mirror of
https://github.com/NEZNAMY/TAB.git
synced 2026-11-26 10:29:49 -05:00
Change section sign encoding to UTF-8; fix typo; gitignore .idea
This commit is contained in:
1 parent
74a474aaf0
commit
bf5f4ce3f5
15 files changed
+73
-71
No files matched your search
@@ -25,3 +25,6 @@ hs_err_pid*
|
||||
.classpath
|
||||
.project
|
||||
/bin/
|
||||
|
||||
# intellij
|
||||
/.idea/
|
||||
@@ -37,7 +37,7 @@ public class Main extends JavaPlugin implements Listener, MainClass{
|
||||
ProtocolVersion.SERVER_VERSION = ProtocolVersion.fromServerString(Bukkit.getBukkitVersion().split("-")[0]);
|
||||
Shared.mainClass = this;
|
||||
Shared.separatorType = "world";
|
||||
Shared.print("§7", "Server version: " + Bukkit.getBukkitVersion().split("-")[0] + " (" + Bukkit.getServer().getClass().getPackage().getName().split("\\.")[3] + ")");
|
||||
Shared.print("§7", "Server version: " + Bukkit.getBukkitVersion().split("-")[0] + " (" + Bukkit.getServer().getClass().getPackage().getName().split("\\.")[3] + ")");
|
||||
if (ProtocolVersion.SERVER_VERSION != ProtocolVersion.UNKNOWN){
|
||||
instance = this;
|
||||
Bukkit.getPluginManager().registerEvents(this, this);
|
||||
@@ -78,9 +78,9 @@ public class Main extends JavaPlugin implements Listener, MainClass{
|
||||
return "1." + ProtocolVersion.SERVER_VERSION.getMinorVersion() + ".x";
|
||||
}
|
||||
}));
|
||||
if (!Shared.disabled) Shared.print("§a", "Enabled in " + (System.currentTimeMillis()-total) + "ms");
|
||||
if (!Shared.disabled) Shared.print("§a", "Enabled in " + (System.currentTimeMillis()-total) + "ms");
|
||||
} else {
|
||||
sendConsoleMessage("§c[TAB] Your server version is not supported. Disabling..");
|
||||
sendConsoleMessage("§c[TAB] Your server version is not supported. Disabling..");
|
||||
Bukkit.getPluginManager().disablePlugin(this);
|
||||
}
|
||||
}
|
||||
@@ -123,16 +123,16 @@ public class Main extends JavaPlugin implements Listener, MainClass{
|
||||
PerWorldPlayerlist.load();
|
||||
ScoreboardManager.load();
|
||||
Shared.startCPUTask();
|
||||
if (Shared.startupWarns > 0) Shared.print("§e", "There were " + Shared.startupWarns + " startup warnings.");
|
||||
if (broadcastTime) Shared.print("§a", "Enabled in " + (System.currentTimeMillis()-time) + "ms");
|
||||
if (Shared.startupWarns > 0) Shared.print("§e", "There were " + Shared.startupWarns + " startup warnings.");
|
||||
if (broadcastTime) Shared.print("§a", "Enabled in " + (System.currentTimeMillis()-time) + "ms");
|
||||
} catch (ParserException | ScannerException e) {
|
||||
Shared.print("§c", "Did not enable due to a broken configuration file.");
|
||||
Shared.print("§c", "Did not enable due to a broken configuration file.");
|
||||
Shared.disabled = true;
|
||||
} catch (Throwable e) {
|
||||
Shared.print("§c", "Failed to enable");
|
||||
sendConsoleMessage("§c" + e.getClass().getName() +": " + e.getMessage());
|
||||
Shared.print("§c", "Failed to enable");
|
||||
sendConsoleMessage("§c" + e.getClass().getName() +": " + e.getMessage());
|
||||
for (StackTraceElement ste : e.getStackTrace()) {
|
||||
sendConsoleMessage("§c at " + ste.toString());
|
||||
sendConsoleMessage("§c at " + ste.toString());
|
||||
}
|
||||
Shared.disabled = true;
|
||||
}
|
||||
@@ -545,7 +545,7 @@ public class Main extends JavaPlugin implements Listener, MainClass{
|
||||
try{
|
||||
TabObjective.type = TabObjectiveType.valueOf(objective.toUpperCase());
|
||||
} catch (Throwable e) {
|
||||
Shared.startupWarn("\"§e" + objective + "§c\" is not a valid type of tablist-objective. Valid options are: §ePING, HEARTS, CUSTOM §cand §eNONE §c(for disabling the feature). §bUsing NONE.");
|
||||
Shared.startupWarn("\"§e" + objective + "§c\" is not a valid type of tablist-objective. Valid options are: §ePING, HEARTS, CUSTOM §cand §eNONE §cfor disabling the feature.");
|
||||
TabObjective.type = TabObjectiveType.NONE;
|
||||
}
|
||||
TabObjective.rawValue = Configs.config.getString("tablist-objective-custom-value", "%ping%");
|
||||
|
||||
@@ -56,7 +56,7 @@ public class Main extends Plugin implements Listener, MainClass{
|
||||
return getPermissionPlugin();
|
||||
}
|
||||
}));
|
||||
if (!Shared.disabled) Shared.print("§a", "Enabled in " + (System.currentTimeMillis()-time) + "ms");
|
||||
if (!Shared.disabled) Shared.print("§a", "Enabled in " + (System.currentTimeMillis()-time) + "ms");
|
||||
}
|
||||
public void onDisable() {
|
||||
if (!Shared.disabled) {
|
||||
@@ -88,16 +88,16 @@ public class Main extends Plugin implements Listener, MainClass{
|
||||
HeaderFooter.load();
|
||||
ScoreboardManager.load();
|
||||
Shared.startCPUTask();
|
||||
if (Shared.startupWarns > 0) Shared.print("§e", "There were " + Shared.startupWarns + " startup warnings.");
|
||||
if (broadcastTime) Shared.print("§a", "Enabled in " + (System.currentTimeMillis()-time) + "ms");
|
||||
if (Shared.startupWarns > 0) Shared.print("§e", "There were " + Shared.startupWarns + " startup warnings.");
|
||||
if (broadcastTime) Shared.print("§a", "Enabled in " + (System.currentTimeMillis()-time) + "ms");
|
||||
} catch (ParserException | ScannerException e) {
|
||||
Shared.print("§c", "Did not enable due to a broken configuration file.");
|
||||
Shared.print("§c", "Did not enable due to a broken configuration file.");
|
||||
Shared.disabled = true;
|
||||
} catch (Throwable e) {
|
||||
Shared.print("§c", "Failed to enable");
|
||||
sendConsoleMessage("§c" + e.getClass().getName() +": " + e.getMessage());
|
||||
Shared.print("§c", "Failed to enable");
|
||||
sendConsoleMessage("§c" + e.getClass().getName() +": " + e.getMessage());
|
||||
for (StackTraceElement ste : e.getStackTrace()) {
|
||||
sendConsoleMessage("§c at " + ste.toString());
|
||||
sendConsoleMessage("§c at " + ste.toString());
|
||||
}
|
||||
Shared.disabled = true;
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ public class Main implements MainClass{
|
||||
}
|
||||
});
|
||||
load(false, true);
|
||||
if (!Shared.disabled) Shared.print("§a", "Enabled in " + (System.currentTimeMillis()-time) + "ms");
|
||||
if (!Shared.disabled) Shared.print("§a", "Enabled in " + (System.currentTimeMillis()-time) + "ms");
|
||||
}
|
||||
public void onDisable() {
|
||||
if (!Shared.disabled) {
|
||||
@@ -92,16 +92,16 @@ public class Main implements MainClass{
|
||||
HeaderFooter.load();
|
||||
ScoreboardManager.load();
|
||||
Shared.startCPUTask();
|
||||
if (Shared.startupWarns > 0) Shared.print("§e", "There were " + Shared.startupWarns + " startup warnings.");
|
||||
if (broadcastTime) Shared.print("§a", "Enabled in " + (System.currentTimeMillis()-time) + "ms");
|
||||
if (Shared.startupWarns > 0) Shared.print("§e", "There were " + Shared.startupWarns + " startup warnings.");
|
||||
if (broadcastTime) Shared.print("§a", "Enabled in " + (System.currentTimeMillis()-time) + "ms");
|
||||
} catch (ParserException | ScannerException e) {
|
||||
Shared.print("§c", "Did not enable due to a broken configuration file.");
|
||||
Shared.print("§c", "Did not enable due to a broken configuration file.");
|
||||
Shared.disabled = true;
|
||||
} catch (Throwable e) {
|
||||
Shared.print("§c", "Failed to enable");
|
||||
sendConsoleMessage("§c" + e.getClass().getName() +": " + e.getMessage());
|
||||
Shared.print("§c", "Failed to enable");
|
||||
sendConsoleMessage("§c" + e.getClass().getName() +": " + e.getMessage());
|
||||
for (StackTraceElement ste : e.getStackTrace()) {
|
||||
sendConsoleMessage("§c at " + ste.toString());
|
||||
sendConsoleMessage("§c at " + ste.toString());
|
||||
}
|
||||
Shared.disabled = true;
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@ import me.neznamy.tab.shared.ConfigurationFile;
|
||||
import me.neznamy.tab.shared.Shared;
|
||||
|
||||
public class Premium {
|
||||
|
||||
public static ConfigurationFile premiumconfig;
|
||||
public static SortingType sortingType;
|
||||
public static String sortingPlaceholder;
|
||||
@@ -27,10 +26,10 @@ public class Premium {
|
||||
public static void loadPremiumConfig() throws Exception {
|
||||
premiumconfig = new ConfigurationFile("premiumconfig.yml", new HashMap<String, List<String>>());
|
||||
String type = premiumconfig.getString("sorting-type", "GROUPS");
|
||||
try{
|
||||
try {
|
||||
sortingType = SortingType.valueOf(type.toUpperCase());
|
||||
} catch (Throwable e) {
|
||||
Shared.startupWarn("\"§e" + type + "§c\" is not a valid type of sorting type. Valid options are: §eGROUPS, GROUP_PERMISSIONS, TABPREFIX_A_TO_Z, PLACEHOLDER_LOW_TO_HIGH, PLACEHOLDER_HIGH_TO_LOW, PLACEHOLDER_A_TO_Z, GROUPS_THEN_PLACEHOLDER_HIGH_TO_LOW and GROUPS_THEN_PLACEHOLDER_LOW_TO_HIGH. §bUsing GROUPS");
|
||||
Shared.startupWarn("\"§e" + type + "§c\" is not a valid type of sorting type. Valid options are: §eGROUPS, GROUP_PERMISSIONS, TABPREFIX_A_TO_Z, PLACEHOLDER_LOW_TO_HIGH, PLACEHOLDER_HIGH_TO_LOW, PLACEHOLDER_A_TO_Z, GROUPS_THEN_PLACEHOLDER_HIGH_TO_LOW and GROUPS_THEN_PLACEHOLDER_LOW_TO_HIGH. §bUsing GROUPS");
|
||||
sortingType = SortingType.GROUPS;
|
||||
}
|
||||
sortingPlaceholder = premiumconfig.getString("sorting-placeholder", "%some_level_maybe?%");
|
||||
@@ -47,10 +46,10 @@ public class Premium {
|
||||
ScoreboardManager.defaultScoreboard = premiumconfig.getString("scoreboard.default-scoreboard", "MyDefaultScoreboard");
|
||||
ScoreboardManager.refresh = premiumconfig.getInt("scoreboard.refresh-interval-ticks", 1);
|
||||
ScoreboardManager.perWorld = (Map<String, String>) premiumconfig.get("scoreboard.per-world");
|
||||
ScoreboardManager.scoreboard_on = premiumconfig.getString("scoreboard-on", "&2Scorebord enabled").replace("&", "§");
|
||||
ScoreboardManager.scoreboard_off = premiumconfig.getString("scoreboard-off", "&7Scoreboard disabled").replace("&", "§");
|
||||
if (premiumconfig.get("scoreboards")!= null)
|
||||
for (String scoreboard : ((Map<String, Object>)premiumconfig.get("scoreboards")).keySet()) {
|
||||
ScoreboardManager.scoreboard_on = premiumconfig.getString("scoreboard-on", "&2Scorebord enabled").replace("&", "§");
|
||||
ScoreboardManager.scoreboard_off = premiumconfig.getString("scoreboard-off", "&7Scoreboard disabled").replace("&", "§");
|
||||
if (premiumconfig.get("scoreboards") != null)
|
||||
for (String scoreboard : ((Map<String, Object>) premiumconfig.get("scoreboards")).keySet()) {
|
||||
boolean permissionRequired = premiumconfig.getBoolean("scoreboards." + scoreboard + ".permission-required");
|
||||
String childBoard = premiumconfig.getString("scoreboards." + scoreboard + ".if-permission-missing");
|
||||
String title = premiumconfig.getString("scoreboards." + scoreboard + ".title");
|
||||
|
||||
@@ -43,7 +43,7 @@ public class Scoreboard {
|
||||
public String getLineName(int i) {
|
||||
String id = i+"";
|
||||
if (id.length() == 1) id = "0" + id;
|
||||
return "§" + id.toCharArray()[0] + "§" + id.toCharArray()[1] + "§r";
|
||||
return "§" + id.toCharArray()[0] + "§" + id.toCharArray()[1] + "§r";
|
||||
}
|
||||
public void register(ITabPlayer p) {
|
||||
if (!players.contains(p)) {
|
||||
@@ -106,9 +106,9 @@ public class Scoreboard {
|
||||
if (replaced.length() > 16) {
|
||||
prefix = replaced.substring(0, 16);
|
||||
suffix = replaced.substring(16, replaced.length());
|
||||
if (prefix.toCharArray()[15] == '§') {
|
||||
if (prefix.toCharArray()[15] == '§') {
|
||||
prefix = prefix.substring(0, 15);
|
||||
suffix = "§" + suffix;
|
||||
suffix = "§" + suffix;
|
||||
}
|
||||
suffix = Placeholders.getLastColors(prefix) + suffix;
|
||||
} else {
|
||||
|
||||
@@ -13,18 +13,18 @@ public class Animation {
|
||||
|
||||
public Animation(String name, List<String> list, int interval){
|
||||
if (interval == 0) {
|
||||
Shared.startupWarn("Animation \"§e" + name + "§c\" has refresh interval of 0 milliseconds! Did you forget to configure it? §bUsing 1000.");
|
||||
Shared.startupWarn("Animation \"§e" + name + "§c\" has refresh interval of 0 milliseconds! Did you forget to configure it? §bUsing 1000.");
|
||||
interval = 1000;
|
||||
}
|
||||
if (interval < 0) {
|
||||
Shared.startupWarn("Animation \"§e" + name + "§c\" has refresh interval of "+interval+". Refresh cannot be negative! §bUsing 1000.");
|
||||
Shared.startupWarn("Animation \"§e" + name + "§c\" has refresh interval of "+interval+". Refresh cannot be negative! §bUsing 1000.");
|
||||
interval = 1000;
|
||||
}
|
||||
if (interval % 50 > 0) {
|
||||
int oldInterval = interval;
|
||||
interval -= interval%50;
|
||||
if (interval == 0) interval = 50;
|
||||
Shared.startupWarn("Animation \"§e" + name + "§c\" has a refresh interval of §e" + oldInterval + "ms§c which is not divisible by 50! Animations can't refresh faster than every tick ( = 50 milliseconds). §bUsing " + interval + ".");
|
||||
Shared.startupWarn("Animation \"§e" + name + "§c\" has a refresh interval of §e" + oldInterval + "ms§c which is not divisible by 50! Animations can't refresh faster than every tick ( = 50 milliseconds). §bUsing " + interval + ".");
|
||||
}
|
||||
this.name = name;
|
||||
this.messages = list.toArray(new String[0]);
|
||||
|
||||
@@ -111,11 +111,11 @@ public class BossBar{
|
||||
this.name = name;
|
||||
this.permissionRequired = permissionRequired;
|
||||
if (refresh == 0) {
|
||||
Shared.startupWarn("Bossbar \"§e" + name + "§c\" has refresh interval of 0 milliseconds! Did you forget to configure it? §bUsing 1000.");
|
||||
Shared.startupWarn("Bossbar \"§e" + name + "§c\" has refresh interval of 0 milliseconds! Did you forget to configure it? §bUsing 1000.");
|
||||
refresh = 1000;
|
||||
}
|
||||
if (refresh < 0) {
|
||||
Shared.startupWarn("Bossbar \"§e" + name + "§c\" has refresh interval of "+refresh+". Refresh cannot be negative! §bUsing 1000.");
|
||||
Shared.startupWarn("Bossbar \"§e" + name + "§c\" has refresh interval of "+refresh+". Refresh cannot be negative! §bUsing 1000.");
|
||||
refresh = 1000;
|
||||
}
|
||||
this.uuid = UUID.randomUUID();
|
||||
|
||||
@@ -64,7 +64,7 @@ public class Configs {
|
||||
public static String reloaded;
|
||||
public static String value_assigned;
|
||||
public static String value_removed;
|
||||
public static String plugin_disabled = "§c[TAB] Plugin is disabled because one of your configuration files is broken. Check console for more info.";
|
||||
public static String plugin_disabled = "§c[TAB] Plugin is disabled because one of your configuration files is broken. Check console for more info.";
|
||||
public static List<Object> help_menu = new ArrayList<Object>();
|
||||
public static String bossbar_off;
|
||||
public static String bossbar_on;
|
||||
@@ -212,7 +212,7 @@ public class Configs {
|
||||
Object progress = bossbar.get("bars." + bar + ".progress");
|
||||
String text = bossbar.getString("bars." + bar + ".text");
|
||||
if (progress == null) {
|
||||
Shared.startupWarn("BossBar \"§e" + bar + "§c\" is missing \"§eprogress§c\" attribute! §bUsing 100");
|
||||
Shared.startupWarn("BossBar \"§e" + bar + "§c\" is missing \"§eprogress§c\" attribute! §bUsing 100");
|
||||
progress = 100;
|
||||
}
|
||||
BossBar.lines.add(new BossBarLine(bar, permissionRequired, refresh, color, style, text, progress+""));
|
||||
@@ -221,7 +221,7 @@ public class Configs {
|
||||
List<String> toRemove = new ArrayList<String>();
|
||||
for (String bar : BossBar.defaultBars) {
|
||||
if (BossBar.getLine(bar) == null) {
|
||||
Shared.startupWarn("BossBar \"§e" + bar + "§c\" is defined as default bar, but does not exist! §bIgnoring.");
|
||||
Shared.startupWarn("BossBar \"§e" + bar + "§c\" is defined as default bar, but does not exist! §bIgnoring.");
|
||||
toRemove.add(bar);
|
||||
}
|
||||
}
|
||||
@@ -229,18 +229,18 @@ public class Configs {
|
||||
}
|
||||
public static void loadTranslation() throws Exception {
|
||||
translation = new ConfigurationFile("translation.yml", new HashMap<String, List<String>>());
|
||||
no_perm = translation.getString("no_permission", "&cI'm sorry, but you do not have permission to perform this command. Please contact the server administrators if you believe that this is in error.").replace("&", "§");
|
||||
unlimited_nametag_mode_not_enabled = translation.getString("unlimited_nametag_mode_not_enabled", "&c[TAB] Warning! To make these work, you need to enable unlimited-nametag-prefix-suffix-mode in config !").replace("&", "§");
|
||||
data_removed = translation.getString("data_removed", "&3[TAB] All data has been successfully removed from %category% §e%value%").replace("&", "§");
|
||||
player_not_found = translation.getString("player_not_found", "&4[TAB] Player not found !").replace("&", "§");
|
||||
reloaded = translation.getString("reloaded", "&3[TAB] Reloaded").replace("&", "§");
|
||||
value_assigned = translation.getString("value_assigned", "&3[TAB] %type% &r'%value%'&r&3 has been successfully assigned to %category% &e%unit%").replace("&", "§");
|
||||
value_removed = translation.getString("value_removed", "&3[TAB] %type% has been successfully removed from %category% &e%unit%").replace("&", "§");
|
||||
no_perm = translation.getString("no_permission", "&cI'm sorry, but you do not have permission to perform this command. Please contact the server administrators if you believe that this is in error.").replace("&", "§");
|
||||
unlimited_nametag_mode_not_enabled = translation.getString("unlimited_nametag_mode_not_enabled", "&c[TAB] Warning! To make these work, you need to enable unlimited-nametag-prefix-suffix-mode in config !").replace("&", "§");
|
||||
data_removed = translation.getString("data_removed", "&3[TAB] All data has been successfully removed from %category% §e%value%").replace("&", "§");
|
||||
player_not_found = translation.getString("player_not_found", "&4[TAB] Player not found !").replace("&", "§");
|
||||
reloaded = translation.getString("reloaded", "&3[TAB] Reloaded").replace("&", "§");
|
||||
value_assigned = translation.getString("value_assigned", "&3[TAB] %type% &r'%value%'&r&3 has been successfully assigned to %category% &e%unit%").replace("&", "§");
|
||||
value_removed = translation.getString("value_removed", "&3[TAB] %type% has been successfully removed from %category% &e%unit%").replace("&", "§");
|
||||
help_menu = translation.getList("help_menu");
|
||||
bossbar_on = translation.getString("bossbar-toggle-on", "&2Bossbar is now visible").replace("&", "§");
|
||||
bossbar_off = translation.getString("bossbar-toggle-off", "&7Bossbar is no longer visible. Magic!").replace("&", "§");
|
||||
preview_on = translation.getString("preview-on", "&7Preview mode &aactivated.").replace("&", "§");
|
||||
preview_off = translation.getString("preview-off", "&7Preview mode &3deactivated.").replace("&", "§");
|
||||
bossbar_on = translation.getString("bossbar-toggle-on", "&2Bossbar is now visible").replace("&", "§");
|
||||
bossbar_off = translation.getString("bossbar-toggle-off", "&7Bossbar is no longer visible. Magic!").replace("&", "§");
|
||||
preview_on = translation.getString("preview-on", "&7Preview mode &aactivated.").replace("&", "§");
|
||||
preview_off = translation.getString("preview-off", "&7Preview mode &3deactivated.").replace("&", "§");
|
||||
}
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <T> T getSecretOption(String path, T defaultValue) {
|
||||
|
||||
@@ -49,7 +49,7 @@ public class ConfigurationFile{
|
||||
} catch (Exception e) {
|
||||
input.close();
|
||||
Shared.startupWarn("File " + destination + " has broken formatting.");
|
||||
Shared.print("§6", "Error message: " + e.getMessage());
|
||||
Shared.print("§6", "Error message: " + e.getMessage());
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ public abstract class ITabPlayer{
|
||||
public String world;
|
||||
private String permissionGroup = "null";
|
||||
public String teamName;
|
||||
private String rank = "§7No Rank";
|
||||
private String rank = "§7No Rank";
|
||||
|
||||
public HashMap<String, Property> properties = new HashMap<String, Property>();
|
||||
private long lastRefreshGroup;
|
||||
@@ -272,12 +272,12 @@ public abstract class ITabPlayer{
|
||||
if (f == null) f = new ArrayList<Object>();
|
||||
int i = 0;
|
||||
for (Object headerLine : h) {
|
||||
if (++i > 1) rawHeader += "\n§r";
|
||||
if (++i > 1) rawHeader += "\n§r";
|
||||
rawHeader += headerLine;
|
||||
}
|
||||
i = 0;
|
||||
for (Object footerLine : f) {
|
||||
if (++i > 1) rawFooter += "\n§r";
|
||||
if (++i > 1) rawFooter += "\n§r";
|
||||
rawFooter += footerLine;
|
||||
}
|
||||
setProperty("header", rawHeader);
|
||||
@@ -325,7 +325,7 @@ public abstract class ITabPlayer{
|
||||
}
|
||||
}
|
||||
if (name == null || name.length() == 0) {
|
||||
name = "§f";
|
||||
name = "§f";
|
||||
} else {
|
||||
name = Placeholders.replaceAllPlaceholders(name, this);
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ public class Playerlist {
|
||||
if (Configs.unlimitedTags && Configs.modifyNPCnames) {
|
||||
if (playerInfoData.name.length() <= 15) {
|
||||
if (playerInfoData.name.length() <= 14) {
|
||||
playerInfoData.name += "§r";
|
||||
playerInfoData.name += "§r";
|
||||
} else {
|
||||
playerInfoData.name += " ";
|
||||
}
|
||||
|
||||
@@ -196,7 +196,7 @@ public class PluginHooks {
|
||||
try {
|
||||
return ProtocolSupportAPI.getProtocolVersion(((TabPlayer)p).player).getId();
|
||||
} catch (Throwable e) {
|
||||
return Shared.error(ProtocolVersion.SERVER_VERSION.getNetworkId(), "An error occured when getting protocol version of " + p.getName() + " using ProtocolSupport", e);
|
||||
return Shared.error(ProtocolVersion.SERVER_VERSION.getNetworkId(), "An error occurred when getting protocol version of " + p.getName() + " using ProtocolSupport", e);
|
||||
}
|
||||
}
|
||||
public static String Vault_getPermissionPlugin() {
|
||||
|
||||
@@ -85,22 +85,22 @@ public class Shared {
|
||||
BufferedWriter buf = new BufferedWriter(new FileWriter(Configs.errorFile, true));
|
||||
if (message != null) {
|
||||
buf.write(ERROR_PREFIX() + "[TAB v" + pluginVersion + "] " + message + newline);
|
||||
if (Configs.SECRET_log_errors_into_console) print("§c", message);
|
||||
if (Configs.SECRET_log_errors_into_console) print("§c", message);
|
||||
}
|
||||
if (t != null) {
|
||||
buf.write(ERROR_PREFIX() + t.getClass().getName() +": " + t.getMessage() + newline);
|
||||
if (Configs.SECRET_log_errors_into_console) printClean("§c" + t.getClass().getName() +": " + t.getMessage());
|
||||
if (Configs.SECRET_log_errors_into_console) printClean("§c" + t.getClass().getName() +": " + t.getMessage());
|
||||
for (StackTraceElement ste : t.getStackTrace()) {
|
||||
buf.write(ERROR_PREFIX() + " at " + ste.toString() + newline);
|
||||
if (Configs.SECRET_log_errors_into_console) printClean("§c at " + ste.toString());
|
||||
if (Configs.SECRET_log_errors_into_console) printClean("§c at " + ste.toString());
|
||||
}
|
||||
}
|
||||
buf.close();
|
||||
}
|
||||
} catch (Throwable ex) {
|
||||
print("§c", "An error occured when generating error message");
|
||||
print("§c", "An error occured when generating error message");
|
||||
ex.printStackTrace();
|
||||
print("§c", "Original error: " + message);
|
||||
print("§c", "Original error: " + message);
|
||||
if (t != null) t.printStackTrace();
|
||||
}
|
||||
return defaultValue;
|
||||
@@ -123,7 +123,7 @@ public class Shared {
|
||||
return new SimpleDateFormat("dd.MM.yyyy - HH:mm:ss - ").format(new Date());
|
||||
}
|
||||
public static void startupWarn(String message) {
|
||||
print("§c", message);
|
||||
print("§c", message);
|
||||
startupWarns++;
|
||||
}
|
||||
public static void print(String color, String message) {
|
||||
@@ -186,7 +186,7 @@ public class Shared {
|
||||
for (Future<?> f : tasks) f.cancel(true);
|
||||
}
|
||||
public static void sendPluginInfo(ITabPlayer to) {
|
||||
IChatBaseComponent message = new IChatBaseComponent("TAB v" + pluginVersion).setColor(EnumChatFormat.DARK_AQUA).onHoverShowText("§aClick to visit plugin's spigot page").onClickOpenUrl("https://www.spigotmc.org/resources/57806/");
|
||||
IChatBaseComponent message = new IChatBaseComponent("TAB v" + pluginVersion).setColor(EnumChatFormat.DARK_AQUA).onHoverShowText("§aClick to visit plugin's spigot page").onClickOpenUrl("https://www.spigotmc.org/resources/57806/");
|
||||
message.addExtra(new IChatBaseComponent(" by _NEZNAMY_ (discord: NEZNAMY#4659)").setColor(EnumChatFormat.BLACK));
|
||||
to.sendCustomPacket(new PacketPlayOutChat(message.toString(), ChatMessageType.CHAT));
|
||||
}
|
||||
@@ -213,7 +213,7 @@ public class Shared {
|
||||
if (PluginHooks.placeholderAPI) PlaceholderAPIExpansion.unregister();
|
||||
}
|
||||
data.clear();
|
||||
print("§a", "Disabled in " + (System.currentTimeMillis()-time) + "ms");
|
||||
print("§a", "Disabled in " + (System.currentTimeMillis()-time) + "ms");
|
||||
} catch (Throwable e) {
|
||||
error(null, "Failed to unload the plugin", e);
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ public class Placeholders {
|
||||
char[] b = textToTranslate.toCharArray();
|
||||
for (int i = 0; i < b.length - 1; i++) {
|
||||
if ((b[i] == '&') && ("0123456789AaBbCcDdEeFfKkLlMmNnOoRr".indexOf(b[(i + 1)]) > -1)){
|
||||
b[i] = '§';
|
||||
b[i] = '§';
|
||||
b[(i + 1)] = Character.toLowerCase(b[(i + 1)]);
|
||||
}
|
||||
}
|
||||
@@ -58,10 +58,10 @@ public class Placeholders {
|
||||
int length = input.length();
|
||||
for (int index = length - 1; index > -1; index--){
|
||||
char section = input.charAt(index);
|
||||
if ((section == '§') && (index < length - 1)){
|
||||
if ((section == '§') && (index < length - 1)){
|
||||
char c = input.charAt(index + 1);
|
||||
if ("0123456789AaBbCcDdEeFfKkLlMmNnOoRr".contains(c+"")) {
|
||||
result = "§" + c + result;
|
||||
result = "§" + c + result;
|
||||
if ("0123456789AaBbCcDdEeFfRr".contains(c+"")) {
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user