-
-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
JSONified /alts and possible alts in /bminfo
Clicking player name will execute /bminfo Player names are now colour coded in this command Green = never banned Yellow = Banned previously Gold = Temporarily banned Red = Perm banned Fixed #759
- Loading branch information
Showing
4 changed files
with
110 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
src/main/java/me/confuser/banmanager/util/JSONCommandUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package me.confuser.banmanager.util; | ||
|
||
import me.confuser.banmanager.BanManager; | ||
import me.confuser.banmanager.data.PlayerBanData; | ||
import me.confuser.banmanager.data.PlayerData; | ||
import me.rayzr522.jsonmessage.JSONMessage; | ||
import org.bukkit.ChatColor; | ||
|
||
import java.sql.SQLException; | ||
import java.util.List; | ||
|
||
public class JSONCommandUtils { | ||
private static BanManager plugin = BanManager.getPlugin(); | ||
|
||
public static JSONMessage alts(List<PlayerData> players) { | ||
JSONMessage message = JSONMessage.create(); | ||
int index = 0; | ||
|
||
for (PlayerData player : players) { | ||
ChatColor colour = ChatColor.GREEN; | ||
|
||
if (plugin.getPlayerBanStorage().isBanned(player.getUUID())) { | ||
PlayerBanData ban = plugin.getPlayerBanStorage().getBan(player.getUUID()); | ||
|
||
if (ban.getExpires() == 0) { | ||
colour = ChatColor.RED; | ||
} else { | ||
colour = ChatColor.GOLD; | ||
} | ||
} else { | ||
try { | ||
if (plugin.getPlayerBanRecordStorage().getCount(player) != 0) { | ||
colour = ChatColor.YELLOW; | ||
} | ||
} catch (SQLException e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
||
message.then(player.getName()).color(colour).runCommand("/bminfo " + player.getName()); | ||
|
||
if (index != players.size() - 1) { | ||
message.then(", "); | ||
} | ||
|
||
index++; | ||
} | ||
|
||
return message; | ||
} | ||
} |