mirror of
https://github.com/NEZNAMY/TAB.git
synced 2026-11-26 10:29:49 -05:00
no one reads this anyway
This commit is contained in:
1 parent
b4fde173f9
commit
d24bc7094f
25 files changed
+239
-147
No files matched your search
+1
-1
@@ -1,4 +1,4 @@
|
||||
name: TAB
|
||||
main: me.neznamy.tab.platforms.bungee.Main
|
||||
version: 2.7.0-pre1
|
||||
version: 2.7.0-pre4
|
||||
author: NEZNAMY
|
||||
@@ -17,6 +17,8 @@ import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.yaml.snakeyaml.parser.ParserException;
|
||||
import org.yaml.snakeyaml.scanner.ScannerException;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import de.robingrether.idisguise.api.DisguiseAPI;
|
||||
import me.neznamy.tab.api.TABAPI;
|
||||
import me.neznamy.tab.platforms.bukkit.packets.method.MethodAPI;
|
||||
@@ -547,7 +549,7 @@ public class Main extends JavaPlugin implements Listener, MainClass{
|
||||
return packet.toNMS(protocolVersion);
|
||||
}
|
||||
public void loadConfig() throws Exception {
|
||||
Configs.config = new ConfigurationFile("bukkitconfig.yml", "config.yml", Configs.configComments);
|
||||
Configs.config = new ConfigurationFile("bukkitconfig.yml", "config.yml", null);
|
||||
boolean changeNameTag = Configs.config.getBoolean("change-nametag-prefix-suffix", true);
|
||||
boolean unlimitedTags = Configs.config.getBoolean("unlimited-nametag-prefix-suffix-mode.enabled", false);
|
||||
Configs.modifyNPCnames = Configs.config.getBoolean("unlimited-nametag-prefix-suffix-mode.modify-npc-names", true);
|
||||
@@ -587,7 +589,7 @@ public class Main extends JavaPlugin implements Listener, MainClass{
|
||||
Configs.removeStrings = Configs.config.getStringList("placeholders.remove-strings", Arrays.asList("[] ", "< > "));
|
||||
|
||||
|
||||
Configs.advancedconfig = new ConfigurationFile("advancedconfig.yml", Configs.advancedconfigComments);
|
||||
Configs.advancedconfig = new ConfigurationFile("advancedconfig.yml", Lists.newArrayList("#Detailed explanation of all options available at https://github.com/NEZNAMY/TAB/wiki/advancedconfig.yml", ""));
|
||||
PerWorldPlayerlist.enabled = Configs.advancedconfig.getBoolean("per-world-playerlist", false);
|
||||
PerWorldPlayerlist.allowBypass = Configs.advancedconfig.getBoolean("allow-pwp-bypass-permission", false);
|
||||
PerWorldPlayerlist.ignoredWorlds = Configs.advancedconfig.getList("ignore-pwp-in-worlds", Arrays.asList("ignoredworld", "spawn"));
|
||||
@@ -596,6 +598,7 @@ public class Main extends JavaPlugin implements Listener, MainClass{
|
||||
Configs.usePrimaryGroup = Configs.advancedconfig.getBoolean("use-primary-group", true);
|
||||
Configs.primaryGroupFindingList = Configs.advancedconfig.getStringList("primary-group-finding-list", Arrays.asList("Owner", "Admin", "Helper", "default"));
|
||||
Configs.bukkitBridgeMode = Configs.advancedconfig.getBoolean("bukkit-bridge-mode", false);
|
||||
Configs.groupsByPermissions = Configs.advancedconfig.getBoolean("assign-groups-by-permissions", false);
|
||||
}
|
||||
public void registerUnknownPlaceholder(String identifier) {
|
||||
int server = Configs.getSecretOption("papi-placeholder-cooldowns.server." + identifier, -1);
|
||||
|
||||
@@ -230,7 +230,7 @@ public class Main extends Plugin implements Listener, MainClass{
|
||||
public static void registerPlaceholders() {
|
||||
PluginHooks.premiumVanish = ProxyServer.getInstance().getPluginManager().getPlugin("PremiumVanish") != null;
|
||||
if (PluginHooks.premiumVanish) {
|
||||
TABAPI.registerServerPlaceholder(new ServerPlaceholder("%vanish-fake-online%", 1000) {
|
||||
TABAPI.registerServerPlaceholder(new ServerPlaceholder("%canseeonline%", 1000) {
|
||||
public String get() {
|
||||
return PluginHooks.PremiumVanish_getVisiblePlayerCount()+"";
|
||||
}
|
||||
@@ -247,6 +247,15 @@ public class Main extends Plugin implements Listener, MainClass{
|
||||
return server.getValue().getPlayers().size()+"";
|
||||
}
|
||||
});
|
||||
TABAPI.registerServerPlaceholder(new ServerPlaceholder("%canseeonline_" + server.getKey() + "%", 1000) {
|
||||
public String get() {
|
||||
int count = server.getValue().getPlayers().size();
|
||||
for (ProxiedPlayer p : server.getValue().getPlayers()) {
|
||||
if (PluginHooks._isVanished(Shared.getPlayer(p.getUniqueId()))) count--;
|
||||
}
|
||||
return count+"";
|
||||
}
|
||||
});
|
||||
}
|
||||
Shared.registerUniversalPlaceholders();
|
||||
}
|
||||
@@ -269,7 +278,7 @@ public class Main extends Plugin implements Listener, MainClass{
|
||||
return packet.toBungee(protocolVersion);
|
||||
}
|
||||
public void loadConfig() throws Exception {
|
||||
Configs.config = new ConfigurationFile("bungeeconfig.yml", "config.yml", Configs.configComments);
|
||||
Configs.config = new ConfigurationFile("bungeeconfig.yml", "config.yml", null);
|
||||
TabObjective.rawValue = Configs.config.getString("tablist-objective-value", "%ping%");
|
||||
TabObjective.type = (TabObjective.rawValue.length() == 0) ? TabObjectiveType.NONE : TabObjectiveType.CUSTOM;
|
||||
BelowName.refresh = Configs.config.getInt("belowname.refresh-interval", 200);
|
||||
|
||||
@@ -43,7 +43,7 @@ public class PluginMessenger implements Listener {
|
||||
if (pl != null) {
|
||||
pl.lastValue.put(receiver.getName(), output);
|
||||
pl.lastRefresh.put(receiver.getName(), System.currentTimeMillis());
|
||||
Shared.cpu.addPlaceholderTime(placeholder, cpu);
|
||||
Shared.cpu.addBridgePlaceholderTime(placeholder, cpu);
|
||||
} else {
|
||||
Shared.debug("Received output for unknown placeholder " + placeholder);
|
||||
}
|
||||
|
||||
@@ -331,7 +331,7 @@ public class Main implements MainClass{
|
||||
return packet.toVelocity(protocolVersion);
|
||||
}
|
||||
public void loadConfig() throws Exception {
|
||||
Configs.config = new ConfigurationFile("bungeeconfig.yml", "config.yml", Configs.configComments);
|
||||
Configs.config = new ConfigurationFile("bungeeconfig.yml", "config.yml", null);
|
||||
TabObjective.rawValue = Configs.config.getString("tablist-objective-value", "%ping%");
|
||||
TabObjective.type = (TabObjective.rawValue.length() == 0) ? TabObjectiveType.NONE : TabObjectiveType.CUSTOM;
|
||||
BelowName.refresh = Configs.config.getInt("belowname.refresh-interval", 200);
|
||||
|
||||
@@ -46,7 +46,7 @@ public class PluginMessenger{
|
||||
if (pl != null) {
|
||||
pl.lastValue.put(receiver.getName(), output);
|
||||
pl.lastRefresh.put(receiver.getName(), System.currentTimeMillis());
|
||||
Shared.cpu.addPlaceholderTime(placeholder, cpu);
|
||||
Shared.cpu.addBridgePlaceholderTime(placeholder, cpu);
|
||||
} else {
|
||||
Shared.debug("Received output for unknown placeholder " + placeholder);
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ public class Premium {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static void loadPremiumConfig() throws Exception {
|
||||
premiumconfig = new ConfigurationFile("premiumconfig.yml", new HashMap<String, List<String>>());
|
||||
premiumconfig = new ConfigurationFile("premiumconfig.yml", null);
|
||||
String type = premiumconfig.getString("sorting-type", "GROUPS");
|
||||
try {
|
||||
sortingType = SortingType.valueOf(type.toUpperCase());
|
||||
|
||||
@@ -16,6 +16,9 @@ public class CPUManager {
|
||||
private ConcurrentMap<String, Long> placeholdersLastSecond = new ConcurrentHashMap<String, Long>();
|
||||
private List<ConcurrentMap<String, Long>> placeholdersLastMinute = new ArrayList<ConcurrentMap<String, Long>>();
|
||||
|
||||
private ConcurrentMap<String, Long> bridgePlaceholdersLastSecond = new ConcurrentHashMap<String, Long>();
|
||||
private List<ConcurrentMap<String, Long>> bridgePlaceholdersLastMinute = new ArrayList<ConcurrentMap<String, Long>>();
|
||||
|
||||
private ConcurrentMap<String, Long> featuresLastSecond = new ConcurrentHashMap<String, Long>();
|
||||
private List<ConcurrentMap<String, Long>> featuresLastMinute = new ArrayList<ConcurrentMap<String, Long>>();
|
||||
|
||||
@@ -33,6 +36,10 @@ public class CPUManager {
|
||||
placeholdersLastSecond = new ConcurrentHashMap<String, Long>();
|
||||
if (placeholdersLastMinute.size() > 60) placeholdersLastMinute.remove(0);
|
||||
|
||||
bridgePlaceholdersLastMinute.add(bridgePlaceholdersLastSecond);
|
||||
bridgePlaceholdersLastSecond = new ConcurrentHashMap<String, Long>();
|
||||
if (bridgePlaceholdersLastMinute.size() > 60) bridgePlaceholdersLastMinute.remove(0);
|
||||
|
||||
featuresLastMinute.add(featuresLastSecond);
|
||||
featuresLastSecond = new ConcurrentHashMap<String, Long>();
|
||||
if (featuresLastMinute.size() > 60) featuresLastMinute.remove(0);
|
||||
@@ -91,12 +98,18 @@ public class CPUManager {
|
||||
public Map<String, Float> getPlaceholderCPU(){
|
||||
return getCPU(placeholdersLastMinute);
|
||||
}
|
||||
public Map<String, Float> getBridgePlaceholderCPU(){
|
||||
return getCPU(bridgePlaceholdersLastMinute);
|
||||
}
|
||||
public void addFeatureTime(String feature, long nanoseconds) {
|
||||
addTime(featuresLastSecond, feature, nanoseconds);
|
||||
}
|
||||
public void addPlaceholderTime(String placeholder, long nanoseconds) {
|
||||
addTime(placeholdersLastSecond, placeholder, nanoseconds);
|
||||
}
|
||||
public void addBridgePlaceholderTime(String placeholder, long nanoseconds) {
|
||||
addTime(bridgePlaceholdersLastSecond, placeholder, nanoseconds);
|
||||
}
|
||||
private Map<String, Float> getCPU(List<ConcurrentMap<String, Long>> source){
|
||||
Map<String, Long> nanoMap = new HashMap<String, Long>();
|
||||
String key;
|
||||
|
||||
@@ -23,7 +23,6 @@ import me.neznamy.tab.shared.placeholders.Placeholders;
|
||||
public class Configs {
|
||||
|
||||
public static ConfigurationFile config;
|
||||
public static HashMap<String, List<String>> configComments;
|
||||
public static boolean unlimitedTags;
|
||||
public static boolean modifyNPCnames;
|
||||
public static boolean collision;
|
||||
@@ -55,12 +54,10 @@ public class Configs {
|
||||
|
||||
|
||||
public static ConfigurationFile animation;
|
||||
public static HashMap<String, List<String>> animationComments;
|
||||
public static List<Animation> animations;
|
||||
|
||||
|
||||
public static ConfigurationFile bossbar;
|
||||
public static HashMap<String, List<String>> bossbarComments;
|
||||
|
||||
|
||||
public static ConfigurationFile translation;
|
||||
@@ -78,57 +75,21 @@ public class Configs {
|
||||
public static String preview_on;
|
||||
|
||||
public static ConfigurationFile advancedconfig;
|
||||
public static HashMap<String, List<String>> advancedconfigComments;
|
||||
public static boolean sortByPermissions = false;
|
||||
public static boolean fixPetNames = false;
|
||||
public static boolean usePrimaryGroup = true;
|
||||
public static List<String> primaryGroupFindingList = Arrays.asList("Owner", "Admin", "Helper", "default");
|
||||
public static boolean bukkitBridgeMode;
|
||||
public static boolean groupsByPermissions;
|
||||
|
||||
public static ConfigurationFile playerdata;
|
||||
|
||||
public static File errorFile = new File(ConfigurationFile.dataFolder, "errors.txt");
|
||||
|
||||
static {
|
||||
configComments = new HashMap<String, List<String>>();
|
||||
configComments.put("nametag-refresh-interval-ticks", Arrays.asList("", "#20 ticks = 1 second"));
|
||||
configComments.put("tablist-objective:", Arrays.asList("#the yellow number in tablist", "#options: PING, HEARTS, NONE (to disable it), CUSTOM (any placeholder defined below)"));
|
||||
configComments.put("tablist-objective-value:", Arrays.asList("#the yellow number in tablist", "#set to \"\" to disable"));
|
||||
configComments.put("group-sorting-priority-list", Arrays.asList("#NOT case sensitive"));
|
||||
configComments.put("Groups:", Arrays.asList("#properties: tabprefix, tabsuffix, tagprefix (in name tag), tagsuffix, customtabname (modifying the name itself), header, footer", "#extra ones which need unlimited nametag mode enabled: abovename (line of text above name tag), belowname (below name tag), customtagname"));
|
||||
configComments.put(" _OTHER_:", Arrays.asList(" #any other group not defined above"));
|
||||
configComments.put("Users:", Arrays.asList("", "#personal settings, override group settings"));
|
||||
configComments.put("enable-collision:", Arrays.asList("", "#servers and clients 1.9+"));
|
||||
configComments.put("do-not-move-spectators", Arrays.asList("", "#preventing players in spectator gamemode from appearing at the bottom of tablist with transparent name FOR OTHER PLAYERS"));
|
||||
configComments.put("unlimited-nametag-prefix-suffix-mode:", Arrays.asList("#VERY EXPERIMENTAL !", "#IF YOU EXPERIENCE ANY ISSUES CONTACT ME"));
|
||||
configComments.put(" modify-npc-names:", Arrays.asList(" #modifying names of NPCs to avoid empty names on NPCs of online players", " #this blocks any other attemps to change the name visibility or anything, so you need to disable it if you are using some citizens addon that changes their name", " #needs relog to see the change"));
|
||||
configComments.put("per-world-settings:", Arrays.asList("", "#list of worlds with different settings than default, other worlds will use settings from above"));
|
||||
configComments.put("per-server-settings:", Arrays.asList("", "#list of servers with different settings than default, other servers will use settings from above"));
|
||||
configComments.put("placeholders:", Arrays.asList("#setting output of some placeholders"));
|
||||
configComments.put(" time-offset:", Arrays.asList(" #if time doesn't show correctly, you can change the time it shows", " #setting to -1 will make it show 1 hour less than it does currently, 1 makes it show one hour more than currently, 0 does nothing"));
|
||||
configComments.put(" remove-strings:", Arrays.asList(" #remove these strings from everywhere. Typically an empty output when using some clan/faction related plugin but player isn't in any", " #so players won't have empty brackets before their names"));
|
||||
configComments.put("rank-aliases:", Arrays.asList("", "#better showing of %rank% placeholder"));
|
||||
configComments.put("disable-features", Arrays.asList(""));
|
||||
configComments.put("belowname:", Arrays.asList("", "#the vanilla belowname feature", "#doesn't support player placeholders (faction, prefix), only server placeholders (time, date, animations) and static text"));
|
||||
bossbarComments = new HashMap<String, List<String>>();
|
||||
bossbarComments.put("bossbar-enabled:", Arrays.asList("#styles (SERVER 1.9+)", "#NOTCHED_6, NOTCHED_10, NOTCHED_12, NOTCHED_20, PROGRESS", "", "#colors (SERVER 1.9+)", "#BLUE, GREEN, PINK, PURPLE, RED, WHITE, YELLOW", "", "#IF YOU ARE USING SERVER 1.8.X", "#the entity will be slightly visible when progress is less than ~50% (client-sided bug)", "#only 1 line can be displayed at a time", "", "#you can also announce a message using /tab announce bar <bar name> <duration in seconds> (does not support animations yet)", ""));
|
||||
bossbarComments.put("default-bars:", Arrays.asList("#to have no default bars, set it to ", "#default-bars: []"));
|
||||
bossbarComments.put("remember-toggle-choice:", Arrays.asList("", "#saving toggle decision into playerdata.yml to keep it saved after reloads/restarts"));
|
||||
animationComments = new HashMap<String, List<String>>();
|
||||
animationComments.put("animations:", Arrays.asList("#usage: %animation:NAME% or {animation:NAME}"));
|
||||
advancedconfigComments = new HashMap<String, List<String>>();
|
||||
advancedconfigComments.put("per-world-playerlist:", Arrays.asList("#players will only see in tablist those who are in the same world"));
|
||||
advancedconfigComments.put("allow-pwp-bypass-permission:", Arrays.asList("", "#allow players with tab.bypass permission to see every player in tablist even if the setting above is enabled"));
|
||||
advancedconfigComments.put("ignore-pwp-in-worlds:", Arrays.asList("", "#even if per-world-playerlist is enabled, people in these worlds will see everyone on server in tablist"));
|
||||
advancedconfigComments.put("sort-players-by-permissions:", Arrays.asList("", "#sorting by permissions. Permission node is \"tab.sort.<group>\" and priorities can be set in config"));
|
||||
advancedconfigComments.put("fix-pet-names:", Arrays.asList("", "#an option to remove minecraft vanilla feature since 1.9 making named pets have same prefix as their owner (and being invisible when unlimited nametag mode is enabled)", "#needs relog to see the change"));
|
||||
advancedconfigComments.put("use-primary-group:", Arrays.asList("", "#asking permission plugin for primary group only"));
|
||||
advancedconfigComments.put("primary-group-finding-list:", Arrays.asList("", "#if the option above is disabled, full group list will be asked for and group higher in this list will be used as primary"));
|
||||
}
|
||||
public static void loadFiles() throws Exception {
|
||||
if (errorFile.exists()) {
|
||||
if (errorFile.length() > 10000000) {
|
||||
errorFile.delete();
|
||||
if (errorFile.length() > 10) {
|
||||
Shared.errorManager.startupWarn("File &e" + errorFile.getPath() + "&c exists and is not empty. Please take a look at the errors and try to correct them. You can also join our discord for assistance. After you resolve them, delete the file.");
|
||||
}
|
||||
}
|
||||
Placeholders.clearAll();
|
||||
@@ -271,7 +232,7 @@ public class Configs {
|
||||
disabledBelowname = config.getStringList("disable-features-in-"+Shared.separatorType+"s.belowname", Arrays.asList("disabled" + Shared.separatorType));
|
||||
}
|
||||
public static void loadAnimations() throws Exception {
|
||||
animation = new ConfigurationFile("animations.yml", animationComments);
|
||||
animation = new ConfigurationFile("animations.yml", null);
|
||||
animations = new ArrayList<Animation>();
|
||||
if (animation.getConfigurationSection("animations") != null) {
|
||||
for (String s : animation.getConfigurationSection("animations").keySet())
|
||||
@@ -280,7 +241,7 @@ public class Configs {
|
||||
}
|
||||
@SuppressWarnings("unchecked")
|
||||
public static void loadBossbar() throws Exception {
|
||||
bossbar = new ConfigurationFile("bossbar.yml", bossbarComments);
|
||||
bossbar = new ConfigurationFile("bossbar.yml", null);
|
||||
if (bossbar.get("enabled") != null) {
|
||||
Shared.errorManager.startupWarn("You are using old bossbar config, please make a backup of the file and delete it to get new file.");
|
||||
return;
|
||||
@@ -319,13 +280,13 @@ public class Configs {
|
||||
if (BossBar.remember_toggle_choice) {
|
||||
File file = new File("plugins" + File.separatorChar + "TAB" + File.separatorChar + "playerdata.yml");
|
||||
if (!file.exists()) file.createNewFile();
|
||||
playerdata = new ConfigurationFile("playerdata.yml", new HashMap<String, List<String>>());
|
||||
playerdata = new ConfigurationFile("playerdata.yml", null);
|
||||
BossBar.bossbar_off_players = playerdata.getStringList("bossbar-off");
|
||||
}
|
||||
if (BossBar.bossbar_off_players == null) BossBar.bossbar_off_players = new ArrayList<String>();
|
||||
}
|
||||
public static void loadTranslation() throws Exception {
|
||||
translation = new ConfigurationFile("translation.yml", new HashMap<String, List<String>>());
|
||||
translation = new ConfigurationFile("translation.yml", null);
|
||||
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.");
|
||||
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 !");
|
||||
data_removed = translation.getString("data_removed", "&3[TAB] All data has been successfully removed from %category% &e%value%");
|
||||
|
||||
@@ -22,6 +22,8 @@ import org.yaml.snakeyaml.Yaml;
|
||||
import org.yaml.snakeyaml.parser.ParserException;
|
||||
import org.yaml.snakeyaml.scanner.ScannerException;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import me.neznamy.tab.shared.placeholders.Placeholders;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@@ -31,13 +33,13 @@ public class ConfigurationFile{
|
||||
|
||||
private File file;
|
||||
private Yaml yaml;
|
||||
private HashMap<String, List<String>> comments;
|
||||
private List<String> header;
|
||||
private Map<String, Object> values;
|
||||
|
||||
public ConfigurationFile(String source, String destination, HashMap<String, List<String>> comments) throws Exception{
|
||||
public ConfigurationFile(String source, String destination, List<String> header) throws Exception{
|
||||
FileInputStream input = null;
|
||||
try {
|
||||
this.comments = comments;
|
||||
this.header = header;
|
||||
dataFolder.mkdirs();
|
||||
file = new File(dataFolder, destination);
|
||||
if (!file.exists()) Files.copy(getClass().getClassLoader().getResourceAsStream("resources/" + source), file.toPath());
|
||||
@@ -49,7 +51,7 @@ public class ConfigurationFile{
|
||||
if (values == null) values = new HashMap<String, Object>();
|
||||
input.close();
|
||||
if (Shared.mainClass.convertConfig(values)) save();
|
||||
if (!hasComments()) fixComments();
|
||||
if (!hasHeader()) fixHeader();
|
||||
detectPlaceholders(values);
|
||||
} catch (Exception e) {
|
||||
input.close();
|
||||
@@ -62,8 +64,8 @@ public class ConfigurationFile{
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
public ConfigurationFile(String sourceAndDestination, HashMap<String, List<String>> comments) throws Exception{
|
||||
this(sourceAndDestination, sourceAndDestination, comments);
|
||||
public ConfigurationFile(String sourceAndDestination, List<String> header) throws Exception{
|
||||
this(sourceAndDestination, sourceAndDestination, header);
|
||||
}
|
||||
private void detectPlaceholders(Map<String, Object> map) {
|
||||
for (Entry<String, Object> entry : map.entrySet()) {
|
||||
@@ -257,33 +259,27 @@ public class ConfigurationFile{
|
||||
Writer writer = new OutputStreamWriter(new FileOutputStream(file), StandardCharsets.UTF_8);
|
||||
yaml.dump(values, writer);
|
||||
writer.close();
|
||||
fixComments();
|
||||
fixHeader();
|
||||
} catch (Throwable e) {
|
||||
Shared.errorManager.criticalError("Failed to save yaml file " + file.getPath(), e);
|
||||
}
|
||||
}
|
||||
public boolean hasComments() {
|
||||
public boolean hasHeader() {
|
||||
if (header == null) return true;
|
||||
for (String line : readFile(file)) {
|
||||
if (line.startsWith("#")) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public void fixComments() {
|
||||
public void fixHeader() {
|
||||
if (header == null) return;
|
||||
try {
|
||||
List<String> fileContent = readFile(file);
|
||||
List<String> commented = new ArrayList<String>();
|
||||
for (String line : fileContent) {
|
||||
for (String commentedSetting : comments.keySet()) {
|
||||
if (line.startsWith(commentedSetting)) {
|
||||
commented.addAll(comments.get(commentedSetting));
|
||||
}
|
||||
}
|
||||
commented.add(line);
|
||||
}
|
||||
List<String> content = Lists.newArrayList(header);
|
||||
content.addAll(readFile(file));
|
||||
file.delete();
|
||||
file.createNewFile();
|
||||
BufferedWriter buf = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file, true), "UTF-8"));
|
||||
for (String line : commented) {
|
||||
for (String line : content) {
|
||||
buf.write(line + System.getProperty("line.separator"));
|
||||
}
|
||||
buf.close();
|
||||
|
||||
@@ -240,28 +240,38 @@ public abstract class ITabPlayer {
|
||||
|
||||
public void updateGroupIfNeeded(boolean updateDataIfChanged) {
|
||||
String newGroup = "null";
|
||||
if (Configs.usePrimaryGroup) {
|
||||
newGroup = getGroupFromPermPlugin();
|
||||
if (Configs.groupsByPermissions) {
|
||||
for (Object group : Configs.primaryGroupFindingList) {
|
||||
if (hasPermission("tab.group." + group)) {
|
||||
newGroup = String.valueOf(group);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
String[] playerGroups = getGroupsFromPermPlugin();
|
||||
if (playerGroups != null && playerGroups.length > 0) {
|
||||
loop:
|
||||
for (Object entry : Configs.primaryGroupFindingList) {
|
||||
for (String playerGroup : playerGroups) {
|
||||
if (playerGroup == null) playerGroup = "null"; //ultrapermissions stuff
|
||||
if (playerGroup.equalsIgnoreCase(entry + "")) {
|
||||
newGroup = playerGroup;
|
||||
break loop;
|
||||
if (Configs.usePrimaryGroup) {
|
||||
newGroup = getGroupFromPermPlugin();
|
||||
} else {
|
||||
String[] playerGroups = getGroupsFromPermPlugin();
|
||||
if (playerGroups != null && playerGroups.length > 0) {
|
||||
loop:
|
||||
for (Object entry : Configs.primaryGroupFindingList) {
|
||||
for (String playerGroup : playerGroups) {
|
||||
if (playerGroup == null) playerGroup = "null"; //ultrapermissions stuff
|
||||
if (playerGroup.equalsIgnoreCase(entry + "")) {
|
||||
newGroup = playerGroup;
|
||||
break loop;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (playerGroups[0] != null && newGroup.equals("null")) newGroup = playerGroups[0];
|
||||
if (playerGroups[0] != null && newGroup.equals("null")) newGroup = playerGroups[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!permissionGroup.equals(newGroup)) {
|
||||
if (newGroup == null) {
|
||||
//ultrapermissions
|
||||
Shared.errorManager.printError("New updated group of " + getName() + " is null?");
|
||||
newGroup = "null";
|
||||
return;
|
||||
}
|
||||
permissionGroup = newGroup;
|
||||
@@ -306,7 +316,10 @@ public abstract class ITabPlayer {
|
||||
String value;
|
||||
if ((value = Configs.config.getString("per-" + Shared.separatorType + "-settings." + worldGroup + ".Users." + getName() + "." + property)) != null)
|
||||
return value;
|
||||
if ((value = Configs.config.getString("per-" + Shared.separatorType + "-settings." + worldGroup + ".Users." + getUniqueId().toString() + "." + property)) != null)
|
||||
return value;
|
||||
if ((value = Configs.config.getString("Users." + getName() + "." + property)) != null) return value;
|
||||
if ((value = Configs.config.getString("Users." + getUniqueId().toString() + "." + property)) != null) return value;
|
||||
if ((value = Configs.config.getString("per-" + Shared.separatorType + "-settings." + worldGroup + ".Groups." + permissionGroup + "." + property)) != null)
|
||||
return value;
|
||||
if ((value = Configs.config.getString("per-" + Shared.separatorType + "-settings." + worldGroup + ".Groups._OTHER_." + property)) != null)
|
||||
@@ -325,7 +338,9 @@ public abstract class ITabPlayer {
|
||||
String worldGroup = getWorldGroupOf(getWorldName());
|
||||
StringBuilder rawValue = new StringBuilder();
|
||||
List<Object> lines = Configs.config.getList("per-" + Shared.separatorType + "-settings." + worldGroup + ".Users." + getName() + "." + name);
|
||||
if (lines == null) lines = Configs.config.getList("per-" + Shared.separatorType + "-settings." + worldGroup + ".Users." + getUniqueId().toString() + "." + name);
|
||||
if (lines == null) lines = Configs.config.getList("Users." + getName() + "." + name);
|
||||
if (lines == null) lines = Configs.config.getList("Users." + getUniqueId().toString() + "." + name);
|
||||
if (lines == null) lines = Configs.config.getList("per-" + Shared.separatorType + "-settings." + worldGroup + ".Groups." + permissionGroup + "." + name);
|
||||
if (lines == null) lines = Configs.config.getList("per-" + Shared.separatorType + "-settings." + worldGroup + "." + name);
|
||||
if (lines == null) lines = Configs.config.getList("Groups." + permissionGroup + "." + name);
|
||||
|
||||
@@ -38,7 +38,7 @@ public class PacketAPI{
|
||||
sendScoreboardTeamPacket(to, teamName, prefix, suffix, enumNameTagVisibility, enumTeamPush, null, 2, 69);
|
||||
}
|
||||
private static void sendScoreboardTeamPacket(ITabPlayer to, String team, String prefix, String suffix, boolean enumNameTagVisibility, boolean enumTeamPush, Collection<String> players, int action, int signature) {
|
||||
to.sendCustomPacket(new PacketPlayOutScoreboardTeam(team, prefix, suffix, enumNameTagVisibility?"always":"never", enumTeamPush?"always":"never", players, action, signature, null));
|
||||
to.sendCustomPacket(new PacketPlayOutScoreboardTeam(team, prefix, suffix, enumNameTagVisibility?"always":"never", enumTeamPush?"always":"never", players, action, signature));
|
||||
}
|
||||
|
||||
//scoreboard objective
|
||||
|
||||
@@ -164,7 +164,10 @@ public class PluginHooks {
|
||||
try {
|
||||
try {
|
||||
//LuckPerms API v5
|
||||
return LuckPermsProvider.get().getUserManager().getUser(p.getUniqueId()).getPrimaryGroup();
|
||||
return LuckPermsProvider.get()
|
||||
.getUserManager()
|
||||
.getUser(p.getUniqueId())
|
||||
.getPrimaryGroup();
|
||||
} catch (NoClassDefFoundError e) {
|
||||
//LuckPerms API v4
|
||||
return LuckPerms.getApi().getUser(p.getUniqueId()).getPrimaryGroup();
|
||||
@@ -203,24 +206,24 @@ public class PluginHooks {
|
||||
}
|
||||
return placeholder;
|
||||
}
|
||||
public static String PlaceholderAPI_setRelationalPlaceholders(ITabPlayer one, ITabPlayer two, String placeholder) {
|
||||
public static String PlaceholderAPI_setRelationalPlaceholders(ITabPlayer one, ITabPlayer two, String text) {
|
||||
try {
|
||||
if (placeholderAPI) {
|
||||
long startTime = System.nanoTime();
|
||||
String value = PlaceholderAPI.setRelationalPlaceholders(((TabPlayer)one).player, ((TabPlayer)two).player, placeholder);
|
||||
String value = PlaceholderAPI.setRelationalPlaceholders(((TabPlayer)one).player, ((TabPlayer)two).player, text);
|
||||
Shared.cpu.addPlaceholderTime("PlaceholderAPI-Relational", System.nanoTime()-startTime);
|
||||
return value;
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
Plugin papi = Bukkit.getPluginManager().getPlugin("PlaceholderAPI");
|
||||
if (papi != null) {
|
||||
Shared.errorManager.printError("PlaceholderAPI v" + papi.getDescription().getVersion() + " generated an error when setting relational placeholder " + placeholder + " for players " + one.getName() + " and " + two.getName(), t);
|
||||
Shared.errorManager.printError("PlaceholderAPI v" + papi.getDescription().getVersion() + " generated an error when setting relational text " + text + " for players " + one.getName() + " and " + two.getName(), t);
|
||||
} else {
|
||||
//thats why it failed
|
||||
placeholderAPI = false;
|
||||
}
|
||||
}
|
||||
return placeholder;
|
||||
return text;
|
||||
}
|
||||
public static int PremiumVanish_getVisiblePlayerCount() {
|
||||
return Shared.getPlayers().size() - BungeeVanishAPI.getInvisiblePlayers().size();
|
||||
|
||||
@@ -22,7 +22,7 @@ public class Shared {
|
||||
|
||||
public static final String DECODER_NAME = "TABReader";
|
||||
public static final String CHANNEL_NAME = "tab:placeholders";
|
||||
public static final String pluginVersion = "2.7.0-pre1";
|
||||
public static final String pluginVersion = "2.7.0-pre4";
|
||||
public static final int currentVersionId = 265;
|
||||
public static final DecimalFormat decimal2 = new DecimalFormat("#.##");
|
||||
public static final char COLOR = '\u00a7';
|
||||
|
||||
@@ -26,8 +26,7 @@ public abstract class SubCommand {
|
||||
if (permission == null) return true; //no permission required
|
||||
if (sender == null) return true; //console
|
||||
if (sender.hasPermission("tab.admin")) return true;
|
||||
if (sender.hasPermission(permission)) return true;
|
||||
return false;
|
||||
return sender.hasPermission(permission);
|
||||
}
|
||||
public static void sendMessage(ITabPlayer sender, String message) {
|
||||
if (sender != null) {
|
||||
|
||||
@@ -2,9 +2,7 @@ package me.neznamy.tab.shared.command;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import me.neznamy.tab.shared.Configs;
|
||||
import me.neznamy.tab.shared.ITabPlayer;
|
||||
import me.neznamy.tab.shared.Shared;
|
||||
import me.neznamy.tab.shared.*;
|
||||
import me.neznamy.tab.shared.command.level1.*;
|
||||
|
||||
public class TabCommand extends SubCommand {
|
||||
@@ -18,6 +16,7 @@ public class TabCommand extends SubCommand {
|
||||
subcommands.put("ntpreview", new NTPreviewCommand());
|
||||
subcommands.put("parse", new ParseCommand());
|
||||
subcommands.put("player", new PlayerCommand());
|
||||
subcommands.put("playeruuid", new PlayerUUIDCommand());
|
||||
subcommands.put("reload", new ReloadCommand());
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,11 @@ public class CpuCommand extends SubCommand {
|
||||
Map<String, Float> placeholders = Shared.cpu.getPlaceholderCPU();
|
||||
float placeholdersTotal = 0;
|
||||
for (Float time : placeholders.values()) placeholdersTotal += time;
|
||||
|
||||
Map<String, Float> bridgeplaceholders = Shared.cpu.getBridgePlaceholderCPU();
|
||||
float bridgeplaceholdersTotal = 0;
|
||||
for (Float time : bridgeplaceholders.values()) bridgeplaceholdersTotal += time;
|
||||
|
||||
Map<String, Float> features = Shared.cpu.getFeatureCPU();
|
||||
float featuresTotal = 0;
|
||||
for (Float time : features.values()) featuresTotal += time;
|
||||
@@ -34,14 +39,22 @@ public class CpuCommand extends SubCommand {
|
||||
if (entry.getValue() > 0.1) sendMessage(sender, "&8&l║ &7" + entry.getKey() + " - " + colorizePlaceholder(decimal3.format(entry.getValue())) + "%");
|
||||
}
|
||||
sendMessage(sender, "&8&l║&8&m ");
|
||||
if (Shared.separatorType.equals("server")) {
|
||||
sendMessage(sender, "&8&l║ &6Bukkit bridge placeholders:");
|
||||
for (Entry<String, Float> entry : bridgeplaceholders.entrySet()) {
|
||||
if (entry.getValue() > 0.1) sendMessage(sender, "&8&l║ &7" + entry.getKey() + " - " + colorizePlaceholder(decimal3.format(entry.getValue())) + "%");
|
||||
}
|
||||
sendMessage(sender, "&8&l║&8&m ");
|
||||
}
|
||||
sendMessage(sender, "&8&l║ &6Features:");
|
||||
for (Entry<String, Float> entry : features.entrySet()) {
|
||||
sendMessage(sender, "&8&l║ &7" + entry.getKey() + " - " + colorizeFeature(decimal3.format(entry.getValue())) + "%");
|
||||
}
|
||||
sendMessage(sender, "&8&l║&8&m ");
|
||||
sendMessage(sender, "&8&l║ &6&lPlaceholders Total: &a&l" + colorizeTotalUsage(decimal3.format(placeholdersTotal)) + "%");
|
||||
if (Shared.separatorType.equals("server")) sendMessage(sender, "&8&l║ &6&lBukkit bridge placeholders Total: &a&l" + colorizeTotalUsage(decimal3.format(bridgeplaceholdersTotal)) + "%");
|
||||
sendMessage(sender, "&8&l║ &6&lPlugin internals: &a&l" + colorizeTotalUsage(decimal3.format(featuresTotal-placeholdersTotal)) + "%");
|
||||
sendMessage(sender, "&8&l║ &6&lTotal: &e&l" + colorizeTotalUsage(decimal3.format(featuresTotal)) + "%");
|
||||
sendMessage(sender, "&8&l║ &6&lTotal: &e&l" + colorizeTotalUsage(decimal3.format(featuresTotal + bridgeplaceholdersTotal)) + "%");
|
||||
sendMessage(sender, "&8&l║&8&m &r&8&l[ &bTAB CPU Stats &8&l]&r&8&l&m ");
|
||||
sendMessage(sender, " ");
|
||||
}
|
||||
|
||||
@@ -37,11 +37,14 @@ public class DebugCommand extends SubCommand {
|
||||
sendMessage(sender, "&7&m>-------------------------------<");
|
||||
sendMessage(sender, "&6PlaceholderAPI: &a" + (PluginHooks.placeholderAPI? "Yes" : "No"));
|
||||
sendMessage(sender, "&6Found Permission system: &a" + Shared.mainClass.getPermissionPlugin());
|
||||
if (Configs.usePrimaryGroup) {
|
||||
sendMessage(sender, "&6Permission group choice logic: &aPrimary group&8/&r&8&mChoose from list");
|
||||
if (Configs.groupsByPermissions) {
|
||||
sendMessage(sender, "&6Permission group choice logic: &8&mPrimary group&8 / &r&8&mChoose from list&8 / &aPermissions");
|
||||
} else if (Configs.usePrimaryGroup) {
|
||||
sendMessage(sender, "&6Permission group choice logic: &aPrimary group&8 / &r&8&mChoose from list&8 / &r&8&mPermissions");
|
||||
} else {
|
||||
sendMessage(sender, "&6Permission group choice logic: &8&mPrimary group&r&8/&aChoose from list");
|
||||
sendMessage(sender, "&6Permission group choice logic: &8&mPrimary group&r&8 / &aChoose from list&8 / &r&8&mPermissions");
|
||||
}
|
||||
|
||||
boolean sorting = Configs.unlimitedTags || NameTag16.enable;
|
||||
String sortingType;
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ public class ParseCommand extends SubCommand{
|
||||
String replaced = args[0];
|
||||
List<Placeholder> list = new ArrayList<Placeholder>();
|
||||
list.addAll(Placeholders.myServerPlaceholders.values());
|
||||
list.addAll( Placeholders.myPlayerPlaceholders.values());
|
||||
list.addAll(Placeholders.myPlayerPlaceholders.values());
|
||||
list.addAll(Placeholders.myServerConstants.values());
|
||||
for (Placeholder p : list)
|
||||
if (replaced.contains(p.getIdentifier())) replaced = replaced.replace(p.getIdentifier(), p.getValue(sender));
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
package me.neznamy.tab.shared.command.level1;
|
||||
|
||||
import me.neznamy.tab.shared.Configs;
|
||||
import me.neznamy.tab.shared.ITabPlayer;
|
||||
import me.neznamy.tab.shared.Shared;
|
||||
import me.neznamy.tab.shared.command.SubCommand;
|
||||
|
||||
public class PlayerUUIDCommand extends SubCommand {
|
||||
|
||||
private static final String[] usualProperties = {"tabprefix", "tabsuffix", "tagprefix", "tagsuffix", "customtabname"};
|
||||
private static final String[] extraProperties = {"abovename", "belowname", "customtagname"};
|
||||
|
||||
public PlayerUUIDCommand() {
|
||||
super("playeruuid", null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(ITabPlayer sender, String[] args) {
|
||||
//<uuid> <property> [value...]
|
||||
if (args.length > 1) {
|
||||
String name = args[0];
|
||||
ITabPlayer changed = Shared.getPlayer(name);
|
||||
if (changed == null) {
|
||||
sendMessage(sender, Configs.player_not_found);
|
||||
return;
|
||||
}
|
||||
String type = args[1].toLowerCase();
|
||||
String value = "";
|
||||
for (int i=2; i<args.length; i++){
|
||||
if (i>2) value += " ";
|
||||
value += args[i];
|
||||
}
|
||||
if (type.equals("remove")) {
|
||||
if (hasPermission(sender, "tab.remove")) {
|
||||
Configs.config.set("Users." + changed.getUniqueId().toString(), null);
|
||||
Configs.config.save();
|
||||
changed.updateAll();
|
||||
changed.forceUpdateDisplay();
|
||||
if (Configs.unlimitedTags) changed.restartArmorStands();
|
||||
sendMessage(sender, Configs.data_removed.replace("%category%", "player").replace("%value%", changed.getName() + "(" + changed.getUniqueId().toString() + ")"));
|
||||
}
|
||||
return;
|
||||
}
|
||||
for (String property : usualProperties) {
|
||||
if (type.equals(property)) {
|
||||
if (hasPermission(sender, "tab.change." + property)) {
|
||||
savePlayer(sender, changed, type, value);
|
||||
} else {
|
||||
sendMessage(sender, Configs.no_perm);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
for (String property : extraProperties) {
|
||||
if (type.equals(property)) {
|
||||
if (hasPermission(sender, "tab.change." + property)) {
|
||||
savePlayer(sender, changed, type, value);
|
||||
if (!Configs.unlimitedTags) {
|
||||
sendMessage(sender, Configs.unlimited_nametag_mode_not_enabled);
|
||||
}
|
||||
} else {
|
||||
sendMessage(sender, Configs.no_perm);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
sendMessage(sender, "&cSyntax&8: &3&l/tab &9group&3/&9player &3<name> &9<property> &3<value...>");
|
||||
sendMessage(sender, "&7Valid Properties are:");
|
||||
sendMessage(sender, " - &9tabprefix&3/&9tabsuffix&3/&9tabname");
|
||||
sendMessage(sender, " - &9tagprefix&3/&9tagsuffix&3/&9tagname");
|
||||
sendMessage(sender, " - &9belowname&3/&9abovename");
|
||||
}
|
||||
public static void savePlayer(ITabPlayer sender, ITabPlayer player, String type, String value){
|
||||
if (value.length() == 0) value = null;
|
||||
Configs.config.set("Users." + player.getUniqueId() + "." + type, value);
|
||||
Configs.config.save();
|
||||
player.updateAll();
|
||||
player.forceUpdateDisplay();
|
||||
if (value != null){
|
||||
sendMessage(sender, Configs.value_assigned.replace("%type%", type).replace("%value%", value).replace("%unit%", player.getName() + "(" + player.getUniqueId().toString() + ")").replace("%category%", "UUID"));
|
||||
} else {
|
||||
sendMessage(sender, Configs.value_removed.replace("%type%", type).replace("%unit%", player.getName() + "(" + player.getUniqueId().toString() + ")").replace("%category%", "UUID"));
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public Object complete(ITabPlayer sender, String currentArgument) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package me.neznamy.tab.shared.packets;
|
||||
|
||||
import me.neznamy.tab.platforms.bukkit.packets.method.MethodAPI;
|
||||
import me.neznamy.tab.shared.placeholders.Placeholders;
|
||||
|
||||
public enum EnumChatFormat{
|
||||
|
||||
@@ -27,26 +28,31 @@ public enum EnumChatFormat{
|
||||
ITALIC(20, 'o'),
|
||||
RESET(21, 'r');
|
||||
|
||||
private int bungeeEquivalent;
|
||||
private int networkId;
|
||||
private char character;
|
||||
private Object nmsEquivalent;
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
private EnumChatFormat(int bungeeEquivalent, char character) {
|
||||
this.bungeeEquivalent = bungeeEquivalent;
|
||||
private EnumChatFormat(int networkId, char character) {
|
||||
this.networkId = networkId;
|
||||
this.character = character;
|
||||
if (MethodAPI.getInstance() != null) this.nmsEquivalent = Enum.valueOf((Class<Enum>)MethodAPI.EnumChatFormat, toString());
|
||||
}
|
||||
public static EnumChatFormat getByCharacter(char c) {
|
||||
for (EnumChatFormat e : values()) {
|
||||
if (e.character == c) return e;
|
||||
}
|
||||
return EnumChatFormat.RESET;
|
||||
}
|
||||
public Object toNMS() {
|
||||
return nmsEquivalent;
|
||||
}
|
||||
public int toBungee() {
|
||||
return bungeeEquivalent;
|
||||
public int getNetworkId() {
|
||||
return networkId;
|
||||
}
|
||||
public static EnumChatFormat lastColorsOf(String string) {
|
||||
if (string == null || string.length() == 0) return EnumChatFormat.RESET;
|
||||
String last = Placeholders.getLastColors(string);
|
||||
if (last != null && last.length() > 0) {
|
||||
char c = last.toCharArray()[1];
|
||||
for (EnumChatFormat e : values()) {
|
||||
if (e.character == c) return e;
|
||||
}
|
||||
}
|
||||
return EnumChatFormat.RESET;
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,6 @@ import java.util.Map;
|
||||
|
||||
import me.neznamy.tab.platforms.bukkit.packets.method.MethodAPI;
|
||||
import me.neznamy.tab.shared.ProtocolVersion;
|
||||
import me.neznamy.tab.shared.placeholders.Placeholders;
|
||||
import net.md_5.bungee.protocol.packet.Team;
|
||||
|
||||
public class PacketPlayOutScoreboardTeam extends UniversalPacketPlayOut{
|
||||
@@ -17,13 +16,14 @@ public class PacketPlayOutScoreboardTeam extends UniversalPacketPlayOut{
|
||||
private String suffix;
|
||||
private String visibility;
|
||||
private String teamPush;
|
||||
@SuppressWarnings("unused")
|
||||
private EnumChatFormat chatFormat;
|
||||
private Collection<String> entities;
|
||||
private int action;
|
||||
private int signature;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public PacketPlayOutScoreboardTeam(String team, String prefix, String suffix, String visibility, String teamPush, Collection<String> entities, int action, int signature, EnumChatFormat format) {
|
||||
public PacketPlayOutScoreboardTeam(String team, String prefix, String suffix, String visibility, String teamPush, Collection<String> entities, int action, int signature) {
|
||||
this.team = team;
|
||||
this.prefix = prefix;
|
||||
this.suffix = suffix;
|
||||
@@ -32,7 +32,6 @@ public class PacketPlayOutScoreboardTeam extends UniversalPacketPlayOut{
|
||||
this.entities = (Collection<String>) (entities == null ? Collections.emptyList() : entities);
|
||||
this.action = action;
|
||||
this.signature = signature;
|
||||
this.chatFormat = format == null ? EnumChatFormat.RESET : format;
|
||||
}
|
||||
public Object toNMS(ProtocolVersion clientVersion) throws Exception {
|
||||
if (team == null || team.length() == 0) throw new IllegalArgumentException("Team name cannot be null/empty");
|
||||
@@ -46,15 +45,9 @@ public class PacketPlayOutScoreboardTeam extends UniversalPacketPlayOut{
|
||||
NAME.set(packet, team);
|
||||
if (ProtocolVersion.SERVER_VERSION.getMinorVersion() >= 13) {
|
||||
DISPLAYNAME.set(packet, MethodAPI.getInstance().ICBC_fromString(new IChatBaseComponent(team).toString()));
|
||||
if (prefix != null && prefix.length() > 0) {
|
||||
PREFIX.set(packet, MethodAPI.getInstance().ICBC_fromString(new IChatBaseComponent(prefix).toString()));
|
||||
String last = Placeholders.getLastColors(prefix);
|
||||
if (last != null && last.length() > 0) {
|
||||
chatFormat = EnumChatFormat.getByCharacter(last.toCharArray()[1]);
|
||||
}
|
||||
if (chatFormat != null) CHATFORMAT.set(packet, chatFormat.toNMS());
|
||||
}
|
||||
if (prefix != null && prefix.length() > 0) PREFIX.set(packet, MethodAPI.getInstance().ICBC_fromString(new IChatBaseComponent(prefix).toString()));
|
||||
if (suffix != null && suffix.length() > 0) SUFFIX.set(packet, MethodAPI.getInstance().ICBC_fromString(new IChatBaseComponent(suffix).toString()));
|
||||
CHATFORMAT.set(packet, EnumChatFormat.lastColorsOf(prefix));
|
||||
} else {
|
||||
DISPLAYNAME.set(packet, team);
|
||||
PREFIX.set(packet, prefix);
|
||||
@@ -76,7 +69,7 @@ public class PacketPlayOutScoreboardTeam extends UniversalPacketPlayOut{
|
||||
prefix = new IChatBaseComponent(this.prefix).toString();
|
||||
suffix = new IChatBaseComponent(this.suffix).toString();
|
||||
teamDisplay = new IChatBaseComponent(team).toString();
|
||||
color = chatFormat.toBungee();
|
||||
color = EnumChatFormat.lastColorsOf(prefix).getNetworkId();
|
||||
} else {
|
||||
prefix = cutTo(this.prefix, 16);
|
||||
suffix = cutTo(this.suffix, 16);
|
||||
@@ -92,7 +85,7 @@ public class PacketPlayOutScoreboardTeam extends UniversalPacketPlayOut{
|
||||
prefix = new IChatBaseComponent(this.prefix).toString();
|
||||
suffix = new IChatBaseComponent(this.suffix).toString();
|
||||
teamDisplay = new IChatBaseComponent(team).toString();
|
||||
color = chatFormat.toBungee();
|
||||
color = EnumChatFormat.lastColorsOf(prefix).getNetworkId();
|
||||
} else {
|
||||
prefix = cutTo(this.prefix, 16);
|
||||
suffix = cutTo(this.suffix, 16);
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
name: TAB
|
||||
version: 2.7.0-pre1
|
||||
version: 2.7.0-pre4
|
||||
author: NEZNAMY
|
||||
main: me.neznamy.tab.platforms.bukkit.Main
|
||||
api-version: 1.13
|
||||
|
||||
@@ -1,29 +1,17 @@
|
||||
#players will only see in tablist those who are in the same world
|
||||
#Detailed explanation of all options available at https://github.com/NEZNAMY/TAB/wiki/advancedconfig.yml
|
||||
|
||||
per-world-playerlist: false
|
||||
|
||||
#allow players with tab.bypass permission to see every player in tablist even if the setting above is enabled
|
||||
allow-pwp-bypass-permission: false
|
||||
|
||||
#even if per-world-playerlist is enabled, people in these worlds will see everyone on server in tablist
|
||||
ignore-pwp-in-worlds:
|
||||
- ignoredworld
|
||||
- spawn
|
||||
|
||||
#sorting by permissions. Permission node is "tab.sort.<group>" and priorities can be set in config
|
||||
sort-players-by-permissions: false
|
||||
|
||||
#an option to remove minecraft vanilla feature since 1.9 making named pets have same prefix as their owner (and being invisible when unlimited nametag mode is enabled)
|
||||
#needs relog to see the change
|
||||
fix-pet-names: false
|
||||
|
||||
#asking permission plugin for primary group only
|
||||
use-primary-group: true
|
||||
|
||||
#if the option above is disabled, full group list will be asked for and group higher in this list will be used as primary
|
||||
primary-group-finding-list:
|
||||
- Owner
|
||||
- Admin
|
||||
- Helper
|
||||
- default
|
||||
|
||||
bukkit-bridge-mode: false
|
||||
bukkit-bridge-mode: false
|
||||
assign-groups-by-permissions: false
|
||||
@@ -1 +1 @@
|
||||
{"id":"tab","version":"2.7.0-pre1","description":"Change a player's tablist prefix/suffix, name tag prefix/suffix, header/footer, bossbar and more","authors":["NEZNAMY"],"dependencies":[],"main":"me.neznamy.tab.platforms.velocity.Main"}
|
||||
{"id":"tab","version":"2.7.0-pre4","description":"Change a player's tablist prefix/suffix, name tag prefix/suffix, header/footer, bossbar and more","authors":["NEZNAMY"],"dependencies":[],"main":"me.neznamy.tab.platforms.velocity.Main"}
|
||||
Reference in new issue
Block a user