diff --git a/build.gradle b/build.gradle index 1fc95b088..76b657d56 100644 --- a/build.gradle +++ b/build.gradle @@ -2,11 +2,11 @@ import org.apache.tools.ant.filters.ReplaceTokens buildscript { repositories { - jcenter() + gradlePluginPortal() } dependencies { - classpath 'com.github.jengelman.gradle.plugins:shadow:5.1.0' + classpath 'gradle.plugin.com.github.johnrengelman:shadow:7.1.2' } } @@ -32,11 +32,11 @@ allprojects { } maven { // WorldEdit - url = 'http://maven.sk89q.com/repo/' + url = 'https://maven.enginehub.org/repo/' } maven { // ProtocolLib - url "http://repo.dmulloy2.net/nexus/repository/public/" + url "https://repo.dmulloy2.net/repository/public/" } // PaperLib maven { @@ -52,7 +52,7 @@ allprojects { } processResources { - from(sourceSets.main.resources.srcDirs) { + filesMatching("plugin.yml") { filter ReplaceTokens, tokens: [version: version] } } @@ -69,18 +69,18 @@ dependencies { //shadow 'org.spigotmc:spigot-api:1.17-R0.1-SNAPSHOT' shadow 'org.spigotmc:spigot-api:1.18-R0.1-SNAPSHOT' shadow 'com.github.MilkBowl:VaultAPI:1.7' - shadow 'net.wesjd:anvilgui:1.5.3-SNAPSHOT' - compile name: 'BiomeMapping-1.3' - compile "io.papermc:paperlib:1.0.5" - shadow 'com.comphenix.protocol:ProtocolLib:4.4.0' - compile project('Support-WorldEdit-6') - compile project('Support-WorldEdit-7') + implementation 'net.wesjd:anvilgui:1.5.3-SNAPSHOT' + implementation name: 'BiomeMapping-1.3' + implementation "io.papermc:paperlib:1.0.5" + shadow 'com.comphenix.protocol:ProtocolLib:4.7.0' + implementation project('Support-WorldEdit-6') + implementation project('Support-WorldEdit-7') } shadowJar { classifier = '' - configurations = [project.configurations.compile] relocate 'io.papermc.lib', 'com.gmail.val59000mc.paperlib' + relocate 'net.wesjd.anvilgui', 'com.gmail.val59000mc.anvilgui' } build.dependsOn(shadowJar) \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 558870dad..2e6e5897b 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/main/java/com/gmail/val59000mc/customitems/KitsManager.java b/src/main/java/com/gmail/val59000mc/customitems/KitsManager.java index 08c7e770a..21228d38c 100644 --- a/src/main/java/com/gmail/val59000mc/customitems/KitsManager.java +++ b/src/main/java/com/gmail/val59000mc/customitems/KitsManager.java @@ -106,7 +106,7 @@ public static void loadKits(){ // IllegalArgumentException, Thrown by builder.build() when kit has no items. }catch(ParseException | IllegalArgumentException ex){ Bukkit.getLogger().severe("[UhcCore] Kit "+kitKey+" was disabled because of an error of syntax."); - System.out.println(ex.getMessage()); + Bukkit.getLogger().severe(ex.getMessage()); ex.printStackTrace(); } } diff --git a/src/main/java/com/gmail/val59000mc/game/GameManager.java b/src/main/java/com/gmail/val59000mc/game/GameManager.java index 9a0afd7da..8c2daec44 100644 --- a/src/main/java/com/gmail/val59000mc/game/GameManager.java +++ b/src/main/java/com/gmail/val59000mc/game/GameManager.java @@ -31,7 +31,6 @@ import java.io.File; import java.io.IOException; -import java.lang.reflect.Method; import java.util.ArrayList; import java.util.List; @@ -175,53 +174,6 @@ public void setGameState(GameState gameState){ // Call UhcGameStateChangedEvent Bukkit.getPluginManager().callEvent(new UhcGameStateChangedEvent(oldGameState, gameState)); - - // Update MOTD - switch(gameState){ - case ENDED: - setMotd(Lang.DISPLAY_MOTD_ENDED); - break; - case LOADING: - setMotd(Lang.DISPLAY_MOTD_LOADING); - break; - case DEATHMATCH: - setMotd(Lang.DISPLAY_MOTD_PLAYING); - break; - case PLAYING: - setMotd(Lang.DISPLAY_MOTD_PLAYING); - break; - case STARTING: - setMotd(Lang.DISPLAY_MOTD_STARTING); - break; - case WAITING: - setMotd(Lang.DISPLAY_MOTD_WAITING); - break; - default: - setMotd(Lang.DISPLAY_MOTD_ENDED); - break; - } - } - - private void setMotd(String motd){ - if (config.get(MainConfig.DISABLE_MOTD)){ - return; // No motd support - } - - if (motd == null){ - return; // Failed to load lang.yml so motd is null. - } - - try { - Class craftServerClass = NMSUtils.getNMSClass("CraftServer"); - Object craftServer = craftServerClass.cast(Bukkit.getServer()); - Object dedicatedPlayerList = NMSUtils.getHandle(craftServer); - Object dedicatedServer = NMSUtils.getServer(dedicatedPlayerList); - - Method setMotd = NMSUtils.getMethod(dedicatedServer.getClass(), "setMotd"); - setMotd.invoke(dedicatedServer, motd); - }catch (ReflectiveOperationException | NullPointerException ex){ - ex.printStackTrace(); - } } public void loadNewGame() { diff --git a/src/main/java/com/gmail/val59000mc/scenarios/scenariolisteners/AchievementHunter.java b/src/main/java/com/gmail/val59000mc/scenarios/scenariolisteners/AchievementHunter.java index 5cb14c0f5..ade002e86 100644 --- a/src/main/java/com/gmail/val59000mc/scenarios/scenariolisteners/AchievementHunter.java +++ b/src/main/java/com/gmail/val59000mc/scenarios/scenariolisteners/AchievementHunter.java @@ -62,8 +62,6 @@ public void execute(Listener listener, Event event){ return; } - System.out.println("event!"); - if (type == Type.ACHIEVEMENTS){ addHeart(((PlayerEvent) event).getPlayer()); }else{ @@ -113,7 +111,6 @@ private void addHeart(Player player){ private static boolean isValidAdvancement(PlayerEvent event){ org.bukkit.event.player.PlayerAdvancementDoneEvent advancementEvent = (org.bukkit.event.player.PlayerAdvancementDoneEvent) event; NamespacedKey key = advancementEvent.getAdvancement().getKey(); - System.out.println(key.getKey()); return key.getKey().startsWith("story/"); } diff --git a/src/main/java/com/gmail/val59000mc/scenarios/scenariolisteners/SuperHeroesListener.java b/src/main/java/com/gmail/val59000mc/scenarios/scenariolisteners/SuperHeroesListener.java index a4b947a0e..9fdf8a2dc 100644 --- a/src/main/java/com/gmail/val59000mc/scenarios/scenariolisteners/SuperHeroesListener.java +++ b/src/main/java/com/gmail/val59000mc/scenarios/scenariolisteners/SuperHeroesListener.java @@ -6,6 +6,7 @@ import com.gmail.val59000mc.scenarios.ScenarioListener; import com.gmail.val59000mc.utils.RandomUtils; import com.gmail.val59000mc.utils.VersionUtils; +import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.potion.PotionEffect; @@ -51,7 +52,7 @@ private void addHeroesEffect(UhcPlayer uhcPlayer, int effect){ player.setHealth(maxHealth); break; default: - System.out.println("No effect for: " + effect); + Bukkit.getLogger().info("No effect for: " + effect); break; } } diff --git a/src/main/java/com/gmail/val59000mc/utils/NMSUtils.java b/src/main/java/com/gmail/val59000mc/utils/NMSUtils.java index 4224d7f7f..b65f9fcc8 100644 --- a/src/main/java/com/gmail/val59000mc/utils/NMSUtils.java +++ b/src/main/java/com/gmail/val59000mc/utils/NMSUtils.java @@ -34,15 +34,6 @@ public static Object getHandle(Object craftObject){ } } - @Nullable - public static Object getServer(Object o){ - try{ - return getMethod(o.getClass(), "getServer").invoke(o); - }catch (ReflectiveOperationException | IllegalArgumentException ex){ - return null; - } - } - public static Method getMethod(Class c, String name) throws ReflectiveOperationException{ return getMethod(c, name, -1); } diff --git a/src/main/java/com/gmail/val59000mc/utils/VersionUtils_1_12.java b/src/main/java/com/gmail/val59000mc/utils/VersionUtils_1_12.java index f43118b39..e5c64da13 100644 --- a/src/main/java/com/gmail/val59000mc/utils/VersionUtils_1_12.java +++ b/src/main/java/com/gmail/val59000mc/utils/VersionUtils_1_12.java @@ -201,7 +201,7 @@ public void removeRecipe(ItemStack item, Recipe r){ Recipe recipe = (Recipe) toBukkitRecipe.invoke(value); if (recipe.getResult().isSimilar(item)){ - System.out.println("Found recipe in map! Removing ..."); + Bukkit.getLogger().info("Found recipe in map! Removing ..."); map.remove(value); break; } @@ -227,7 +227,7 @@ public void removeRecipe(ItemStack item, Recipe r){ Recipe recipe = (Recipe) toBukkitRecipe.invoke(mcRecipe); if (recipe.getResult().isSimilar(item)){ - System.out.println("Found recipe in array! Removing ..."); + Bukkit.getLogger().info("Found recipe in array! Removing ..."); array[i] = null; break; } diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index ab4ebd920..c30b2ee58 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,6 +1,6 @@ name: UhcCore main: com.gmail.val59000mc.UhcCore -version: @version@ +version: "@version@" description: Automates UHC games on a dedicated server author: val59000mc, Mezy softdepend: [WorldEdit,Vault,ProtocolLib]