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