diff --git a/src/main/java/xyz/soukup/informator/events/PlayerChangeWorlds.java b/src/main/java/xyz/soukup/informator/events/PlayerChangeWorlds.java new file mode 100644 index 0000000..5e886d0 --- /dev/null +++ b/src/main/java/xyz/soukup/informator/events/PlayerChangeWorlds.java @@ -0,0 +1,13 @@ +package xyz.soukup.informator.events; + +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerChangedWorldEvent; +import xyz.soukup.informator.handlers.TabHandler; + +public class PlayerChangeWorlds implements Listener { + @EventHandler + public void onPlayerChangeWorld(PlayerChangedWorldEvent event){ + TabHandler.chooseTab(event.getPlayer()); + } +} diff --git a/src/main/java/xyz/soukup/informator/handlers/TabHandler.java b/src/main/java/xyz/soukup/informator/handlers/TabHandler.java index d794c7d..e64fa2c 100644 --- a/src/main/java/xyz/soukup/informator/handlers/TabHandler.java +++ b/src/main/java/xyz/soukup/informator/handlers/TabHandler.java @@ -33,6 +33,7 @@ public class TabHandler { String footerString = String.join("\n&r", footer); tabDataList.add(headerString); tabDataList.add(footerString); + Bukkit.getLogger().info((String) tabDataList.get(1)); tabData.put(targetKey + "." + key, tabDataList); @@ -45,21 +46,23 @@ public class TabHandler { public static void chooseTab(Player player){ String choosenTab = "tabs.required.default"; int choosenPriority = tabConfig.getInt("tabs.required.default.priority"); - if (tabData.containsKey("tabs.player.players." + player.getDisplayName())){ - player.sendMessage("ss"+choosenPriority); + if (tabData.containsKey("tabs.world.worlds." + player.getWorld().getName()) && tabConfig.getBoolean("tabs.world.enabled")){ + player.sendMessage(player.getWorld().getName()); + if ((int)tabData.get("tabs.world.worlds." + player.getWorld().getName()).get(0) > choosenPriority){ + choosenTab = "tabs.world.worlds." + player.getWorld().getName(); + choosenPriority = (int)tabData.get("tabs.world.worlds." + player.getWorld().getName()).get(0); + + } + + } + if (tabData.containsKey("tabs.player.players." + player.getDisplayName()) && tabConfig.getBoolean("tabs.player.enabled")){ + if ((int)tabData.get("tabs.player.players." + player.getDisplayName()).get(0) > choosenPriority){ - player.sendMessage("SSSSSSSS"); choosenTab = "tabs.player.players." + player.getDisplayName(); choosenPriority = (int)tabData.get("tabs.player.players." + player.getDisplayName()).get(0); } } - if (tabData.containsKey("tabs.world.worlds." + player.getWorld().getName())){ - if ((int)tabData.get("tabs.world.worlds." + player.getWorld().getName()).get(0) > choosenPriority){ - choosenTab = "tab.world.worlds." + player.getWorld().getName(); - } - - } playerTab.put(player, choosenTab); } diff --git a/src/main/resources/animations.yml b/src/main/resources/animations.yml index ff6d034..c567070 100644 --- a/src/main/resources/animations.yml +++ b/src/main/resources/animations.yml @@ -11,15 +11,15 @@ exampleTitle: #You can use animation creation tool (ACT) built in web configurator! # https://informator.soukup.xyz/configurator/act frames: - - "&b&3I&b&fNFORMATOR" - - "&b&fI&b&3N&b&fFORMATOR" - - "&b&fIN&b&3F&b&fORMATOR" - - "&b&fINF&b&3O&b&fRMATOR" - - "&b&fINFO&b&3R&b&fMATOR" - - "&b&fINFOR&b&3M&b&fATOR" - - "&b&fINFORM&b&3A&b&fTOR" - - "&b&fINFORMA&b&3T&b&fOR" - - "&b&fINFORMAT&b&3O&b&fR" - - "&b&fINFORMATO&b&3R" + - "&6&lI&f&lNFORMATOR" + - "&f&lI&6&lN&f&lFORMATOR" + - "&f&lIN&6&lF&f&lORMATOR" + - "&f&lINF&6&lO&f&lRMATOR" + - "&f&lINFO&6&lR&f&lMATOR" + - "&f&lINFOR&6&lM&f&lATOR" + - "&f&lINFORM&6&lA&f&lTOR" + - "&f&lINFORMA&6&lT&f&lOR" + - "&f&lINFORMAT&6&lO&f&lR" + - "&f&lINFORMATO&6&lR" diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 204c4f6..f99a43c 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -10,10 +10,18 @@ modules-enabled: #Configuration for plugin's web interface -web-interface: - #online configurator enabled. We recommend to disable it after setting up the plugin - enabled: true - #API address of the configurator. - #DO NOT CHANGE THIS IF SOMEONE TOLD YOU TO. - #Api is a powerful tool. It can destroy all configuration if in wrong hands - api-address: https://informator.soukup.xyz/configurator/api/ \ No newline at end of file +#################################################################### +# # +# DANGER ZONE! # +# # +# Settings bellow can strongly influence plugin's functioning # +# They are here mainly for development purposes # +# You should NOT change them if someone told you to # +# You should change them ONLY if you understand them # +# Support will be provided only for default values # +# Please be carefull. # +# # +#################################################################### + +config-version: 0.0.1 +api-url: https://informator.soukup.xyz/configurator/api/ \ No newline at end of file diff --git a/src/main/resources/modules/tab.yml b/src/main/resources/modules/tab.yml index df8e228..e1592af 100644 --- a/src/main/resources/modules/tab.yml +++ b/src/main/resources/modules/tab.yml @@ -24,11 +24,10 @@ tabs: - "Change this in modules/tab.yml" - "" world: - enabled: false - priority: 1 + enabled: true worlds: - exampleWorld: - enabled: true + world_nether: + priority: 6 header: - "World specified tab" - "%%animation:exampleTitle%%" @@ -61,7 +60,7 @@ tabs: - "Change this in modules/tab.yml" - "" player: - enabled: false + enabled: true players: Kuba1428: priority: 3 diff --git a/target/classes/animations.yml b/target/classes/animations.yml index a3f54a3..c567070 100644 --- a/target/classes/animations.yml +++ b/target/classes/animations.yml @@ -6,20 +6,20 @@ exampleTitle: #Speed is in minecraft ticks #20 ticks = 1 second so speed 20 = 1 frame per second - speed: 2 + speed: 4 #Also hate making animations manually? #You can use animation creation tool (ACT) built in web configurator! # https://informator.soukup.xyz/configurator/act frames: - - "&b&3I&b&fNFORMATOR" - - "&b&fI&b&3N&b&fFORMATOR" - - "&b&fIN&b&3F&b&fORMATOR" - - "&b&fINF&b&3O&b&fRMATOR" - - "&b&fINFO&b&3R&b&fMATOR" - - "&b&fINFOR&b&3M&b&fATOR" - - "&b&fINFORM&b&3A&b&fTOR" - - "&b&fINFORMA&b&3T&b&fOR" - - "&b&fINFORMAT&b&3O&b&fR" - - "&b&fINFORMATO&b&3R" - - "&cKONEC" + - "&6&lI&f&lNFORMATOR" + - "&f&lI&6&lN&f&lFORMATOR" + - "&f&lIN&6&lF&f&lORMATOR" + - "&f&lINF&6&lO&f&lRMATOR" + - "&f&lINFO&6&lR&f&lMATOR" + - "&f&lINFOR&6&lM&f&lATOR" + - "&f&lINFORM&6&lA&f&lTOR" + - "&f&lINFORMA&6&lT&f&lOR" + - "&f&lINFORMAT&6&lO&f&lR" + - "&f&lINFORMATO&6&lR" + diff --git a/target/classes/config.yml b/target/classes/config.yml index ccadb33..1a9a5fa 100644 --- a/target/classes/config.yml +++ b/target/classes/config.yml @@ -9,10 +9,11 @@ modules-enabled: bossbar: true #Configuration for plugin's web interface + web-interface: #online configurator enabled. We recommend to disable it after setting up the plugin enabled: true #API address of the configurator. #DO NOT CHANGE THIS IF SOMEONE TOLD YOU TO. - #Api is a powerful tool. It can destroy all configuration if in wrong hands + #API is a powerful tool. It can destroy all configuration if in wrong hands api-address: https://informator.soukup.xyz/configurator/api/ \ No newline at end of file diff --git a/target/classes/modules/tab.yml b/target/classes/modules/tab.yml index df8e228..e1592af 100644 --- a/target/classes/modules/tab.yml +++ b/target/classes/modules/tab.yml @@ -24,11 +24,10 @@ tabs: - "Change this in modules/tab.yml" - "" world: - enabled: false - priority: 1 + enabled: true worlds: - exampleWorld: - enabled: true + world_nether: + priority: 6 header: - "World specified tab" - "%%animation:exampleTitle%%" @@ -61,7 +60,7 @@ tabs: - "Change this in modules/tab.yml" - "" player: - enabled: false + enabled: true players: Kuba1428: priority: 3 diff --git a/target/classes/xyz/soukup/informator/handlers/TabHandler.class b/target/classes/xyz/soukup/informator/handlers/TabHandler.class index 2d1a3b7..633752c 100644 Binary files a/target/classes/xyz/soukup/informator/handlers/TabHandler.class and b/target/classes/xyz/soukup/informator/handlers/TabHandler.class differ