mirror of
https://github.com/Maxlego08/zKoth.git
synced 2024-11-22 11:55:12 +01:00
🚧 Update to 1.19
This commit is contained in:
parent
6908e30f0e
commit
84ef8d75c8
@ -1,7 +1,7 @@
|
||||
name: zKoth
|
||||
author: Maxlego08
|
||||
main: fr.maxlego08.zkoth.ZKothPlugin
|
||||
version: 2.1.0.4
|
||||
version: 2.1.0.6
|
||||
softdepend: [PlaceholderAPI, Guilds, Factions, FactionsX, SuperiorSkyblock2, LegacyFactions, FeatherBoard, TAB, TitleManager, UltimateFactions, Multiverse-Core, SternalBoard, SimpleClan]
|
||||
commands:
|
||||
api-version: 1.13
|
@ -13,6 +13,7 @@ import fr.maxlego08.zkoth.save.MessageLoader;
|
||||
import fr.maxlego08.zkoth.scheduler.SchedulerManager;
|
||||
import fr.maxlego08.zkoth.scoreboard.ScoreBoardManager;
|
||||
import fr.maxlego08.zkoth.scoreboard.implementations.FeatherBoardHook;
|
||||
import fr.maxlego08.zkoth.scoreboard.implementations.SimpleBoardHook;
|
||||
import fr.maxlego08.zkoth.scoreboard.implementations.SternalBoardHook;
|
||||
import fr.maxlego08.zkoth.scoreboard.implementations.TabPremiumHook;
|
||||
import fr.maxlego08.zkoth.scoreboard.implementations.TitleManagerHook;
|
||||
@ -84,6 +85,10 @@ public class ZKothPlugin extends ZPlugin {
|
||||
Plugin plugin = this.getServer().getPluginManager().getPlugin("SternalBoard");
|
||||
this.scoreboardManager.setScoreboard(new SternalBoardHook(plugin));
|
||||
}
|
||||
|
||||
if (this.isEnable(Plugins.SIMPLECORE)) {
|
||||
this.scoreboardManager.setScoreboard(new SimpleBoardHook(this));
|
||||
}
|
||||
|
||||
this.scoreboardManager.setDefaultScoreboard();
|
||||
Logger.info("Load " + this.scoreboardManager.getScoreboard().getClass().getName() + " scoreboard manager");
|
||||
|
@ -0,0 +1,34 @@
|
||||
package fr.maxlego08.zkoth.scoreboard.implementations;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import com.r4g3baby.simplescore.SimpleScore;
|
||||
|
||||
import fr.maxlego08.zkoth.api.Scoreboard;
|
||||
|
||||
public class SimpleBoardHook implements Scoreboard {
|
||||
|
||||
private final Plugin plugin;
|
||||
|
||||
/**
|
||||
* @param plugin
|
||||
*/
|
||||
public SimpleBoardHook(Plugin plugin) {
|
||||
super();
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toggle(Player player, Consumer<Player> after) {
|
||||
SimpleScore.Api.getManager().getPlayersData().get(player).show(this.plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hide(Player player, Consumer<Player> after) {
|
||||
SimpleScore.Api.getManager().getPlayersData().get(player).hide(this.plugin);
|
||||
}
|
||||
|
||||
}
|
@ -30,8 +30,9 @@ public class ItemStackUtils {
|
||||
if (paramItemStack == null)
|
||||
return "null";
|
||||
|
||||
if (itemstackSerialized.containsKey(paramItemStack))
|
||||
if (itemstackSerialized.containsKey(paramItemStack)) {
|
||||
return itemstackSerialized.get(paramItemStack);
|
||||
}
|
||||
|
||||
ByteArrayOutputStream localByteArrayOutputStream = null;
|
||||
try {
|
||||
@ -42,20 +43,19 @@ public class ItemStackUtils {
|
||||
.getMethod("asNMSCopy", new Class[] { ItemStack.class })
|
||||
.invoke(null, new Object[] { paramItemStack });
|
||||
|
||||
if (NMS_VERSION == 1.18) {
|
||||
if (NMS_VERSION == 1.18 || NMS_VERSION == 1.19) {
|
||||
EnumReflectionItemStack.ITEMSTACK.getClassz().getMethod("b", new Class[] { localClass })
|
||||
.invoke(localObject2, new Object[] { localObject1 });
|
||||
} else {
|
||||
EnumReflectionItemStack.ITEMSTACK.getClassz().getMethod("save", new Class[] { localClass })
|
||||
.invoke(localObject2, new Object[] { localObject1 });
|
||||
}
|
||||
|
||||
localByteArrayOutputStream = new ByteArrayOutputStream();
|
||||
EnumReflectionItemStack.NBTCOMPRESSEDSTREAMTOOLS.getClassz()
|
||||
.getMethod("a", new Class[] { localClass, OutputStream.class })
|
||||
.invoke(null, new Object[] { localObject1, localByteArrayOutputStream });
|
||||
|
||||
} catch (Exception localException) {
|
||||
// localException.printStackTrace();
|
||||
}
|
||||
String string = Base64.encode(localByteArrayOutputStream.toByteArray());
|
||||
itemstackSerialized.put(paramItemStack, string);
|
||||
@ -73,7 +73,7 @@ public class ItemStackUtils {
|
||||
|
||||
if (paramString.equals("null"))
|
||||
return null;
|
||||
|
||||
|
||||
ByteArrayInputStream localByteArrayInputStream = null;
|
||||
try {
|
||||
localByteArrayInputStream = new ByteArrayInputStream(Base64.decode(paramString));
|
||||
@ -103,7 +103,6 @@ public class ItemStackUtils {
|
||||
localItemStack = (ItemStack) EnumReflectionItemStack.CRAFTITEMSTACK.getClassz()
|
||||
.getMethod("asBukkitCopy", new Class[] { localClass2 }).invoke(null, new Object[] { localObject2 });
|
||||
} catch (Exception localException) {
|
||||
// localException.printStackTrace();
|
||||
}
|
||||
if (localItemStack != null && !itemstackSerialized.containsKey(localItemStack))
|
||||
itemstackSerialized.put(localItemStack, paramString);
|
||||
|
@ -94,30 +94,19 @@ public class NMSUtils {
|
||||
* @return boolean
|
||||
*/
|
||||
public static boolean isNewNMSVersion() {
|
||||
switch (String.valueOf(version)) {
|
||||
case "1.17":
|
||||
case "1.18":
|
||||
case "1.19":
|
||||
case "1.20":
|
||||
case "1.21":
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
final double version = getNMSVersion();
|
||||
return !(version == 1.7 || version == 1.8 || version == 1.9 || version == 1.10 || version == 1.11
|
||||
|| version == 1.12 || version == 1.13 || version == 1.14 || version == 1.15 || version == 1.16);
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows to check if the version has the colors in hex
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public static boolean isHexColor() {
|
||||
switch (String.valueOf(version)) {
|
||||
case "1.21":
|
||||
case "1.20":
|
||||
case "1.19":
|
||||
case "1.18":
|
||||
case "1.17":
|
||||
case "1.16":
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
return !(version == 1.7 || version == 1.8 || version == 1.9 || version == 1.10 || version == 1.11
|
||||
|| version == 1.12 || version == 1.13 || version == 1.14 || version == 1.15);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ public enum Plugins {
|
||||
PLACEHOLDERAPI("PlaceholderAPI"),
|
||||
TITLEMANAGER("TitleManager"),
|
||||
STERNALBOARD("SternalBoard"),
|
||||
SIMPLECORE("SimpleScore"),
|
||||
|
||||
;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user