Permalink
Browse files

v1.7.2_1

一定の文字数以上のユーザーがサイドバーに表示される場合にエラーが起きてしまう問題を修正
  • Loading branch information...
hide92795
hide92795 committed Feb 13, 2014
1 parent 47e6392 commit ac50bc10296117da1bfb42252e9a2a4b1e60b860
Binary file not shown.
@@ -38,7 +38,7 @@
protected IPMap ipmap;
private List<String> countryList;
private HashMap<Integer, Data> warnData;
public HashMap<String, Integer> warnNames;
public HashMap<String, Integer> warnCounts;
public boolean enableProtect;
private boolean enableSideBar;
private SideBarManager sidebar;
@@ -58,7 +58,7 @@ public void onEnable() {
api = new MCBansDetectorAPI(this);
messageFactory = new MessageFactory(this);
warnData = new HashMap<>();
warnNames = new HashMap<>();
warnCounts = new HashMap<>();
sidebar = new SideBarManager(this);
PluginManager pm = this.getServer().getPluginManager();
@@ -377,7 +377,7 @@ private StringBuilder getCurrentLoginPlayersName() {
Player[] players = Bukkit.getOnlinePlayers();
for (Player player : players) {
String name = player.getName();
if (warnNames.containsKey(name)) {
if (warnCounts.containsKey(name)) {
sb.append(", ");
sb.append(ChatColor.YELLOW);
sb.append(name);
@@ -414,11 +414,11 @@ public MCBansDetectorAPI getAPI() {
private void warn(String player, Data data) {
warnData.put(warnData.size() + 1, data);
int count = 0;
if (warnNames.containsKey(player)) {
count = warnNames.get(player);
if (warnCounts.containsKey(player)) {
count = warnCounts.get(player);
}
count++;
warnNames.put(player, count);
warnCounts.put(player, count);
updateSidebar();
}
@@ -43,6 +43,6 @@ public boolean isPlayerWarned(Player player) {
}
public boolean isPlayerWarned(String player) {
return plugin.warnNames.containsKey(player);
return plugin.warnCounts.containsKey(player);
}
}
@@ -41,13 +41,17 @@ private void createSideBarData() {
boolean zero = true;
Set<String> warnplayers = plugin.warnNames.keySet();
Set<String> warnplayers = plugin.warnCounts.keySet();
for (String name : warnplayers) {
if (Bukkit.getPlayerExact(name) != null) {
zero = false;
if (name.length() >= 13) {
name = name.substring(0, 10);
name = name + "...";
}
String disp = String.format(plugin.localize.getString(Type.SIDEBAR_PLAYER_NAME), name);
Score score = objective.getScore(Bukkit.getOfflinePlayer(disp));
score.setScore(plugin.warnNames.get(name));
score.setScore(plugin.warnCounts.get(name));
}
}
if (zero) {
@@ -1,6 +1,6 @@
name: MCBansDetector
main: hide92795.bukkit.plugin.mcbansdetector.MCBansDetector
version: 1.6.4_1
version: 1.7.2_1
description: Check baned player
author: hide92795
depend: [hide92795CoreLib]

0 comments on commit ac50bc1

Please sign in to comment.