diff --git a/build.gradle.kts b/build.gradle.kts index ca31752..e8cae4d 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -16,7 +16,7 @@ labyMod { displayName = "GrieferGames" author = "Neocraftr" description = "This add-on adds many useful features for the GrieferGames.net server." - minecraftVersion = "1.8.9<1.12.2" + minecraftVersion = "*" version = "1.0.0" } diff --git a/core/src/main/java/de/neocraftr/griefergames/listener/GGScoreboardListener.java b/core/src/main/java/de/neocraftr/griefergames/listener/GGScoreboardListener.java index 893c51d..cabed9f 100644 --- a/core/src/main/java/de/neocraftr/griefergames/listener/GGScoreboardListener.java +++ b/core/src/main/java/de/neocraftr/griefergames/listener/GGScoreboardListener.java @@ -21,9 +21,11 @@ public void onScoreboardTeams(ScoreboardTeamUpdateEvent event) { String subServerName = griefergames.helper().componentToPlainText(event.team().getPrefix()).toLowerCase(); if(subServerName.isBlank() || subServerName.contains("lade")) return; - griefergames.setSubServer(subServerName); - GGSubServerChangeEvent changeEvent = new GGSubServerChangeEvent(subServerName); - Laby.labyAPI().eventBus().fire(changeEvent); + if(!griefergames.getSubServer().equals(subServerName)) { + griefergames.setSubServer(subServerName); + GGSubServerChangeEvent changeEvent = new GGSubServerChangeEvent(subServerName); + Laby.labyAPI().eventBus().fire(changeEvent); + } } } } diff --git a/game-runner/src/v1_16_5/java/de/neocraftr/griefergames/v1_16_5/VersionedGrieferGamesController.java b/game-runner/src/v1_16_5/java/de/neocraftr/griefergames/v1_16_5/VersionedGrieferGamesController.java new file mode 100644 index 0000000..c69a5c5 --- /dev/null +++ b/game-runner/src/v1_16_5/java/de/neocraftr/griefergames/v1_16_5/VersionedGrieferGamesController.java @@ -0,0 +1,36 @@ +package de.neocraftr.griefergames.v1_16_5; + +import de.neocraftr.griefergames.utils.GrieferGamesController; +import net.labymod.api.models.Implements; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.screens.Screen; +import net.minecraft.client.gui.screens.inventory.ContainerScreen; +import javax.inject.Inject; +import javax.inject.Singleton; + +@Singleton +@Implements(GrieferGamesController.class) +public class VersionedGrieferGamesController extends GrieferGamesController { + + @Inject + public VersionedGrieferGamesController() {} + + @Override + public boolean playerAllowedFlying() { + return Minecraft.getInstance().player.abilities.mayfly; + } + + @Override + public boolean hideBoosterMenu() { + if(Minecraft.getInstance().player == null) return false; + + Screen screen = Minecraft.getInstance().screen; + if(screen instanceof ContainerScreen) { + if(screen.getTitle().getString().equals("§6Booster - Übersicht")) { + Minecraft.getInstance().player.closeContainer(); + return true; + } + } + return false; + } +} \ No newline at end of file diff --git a/game-runner/src/v1_17_1/java/de/neocraftr/griefergames/v1_17_1/VersionedGrieferGamesController.java b/game-runner/src/v1_17_1/java/de/neocraftr/griefergames/v1_17_1/VersionedGrieferGamesController.java new file mode 100644 index 0000000..638f53f --- /dev/null +++ b/game-runner/src/v1_17_1/java/de/neocraftr/griefergames/v1_17_1/VersionedGrieferGamesController.java @@ -0,0 +1,36 @@ +package de.neocraftr.griefergames.v1_17_1; + +import de.neocraftr.griefergames.utils.GrieferGamesController; +import net.labymod.api.models.Implements; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.screens.Screen; +import net.minecraft.client.gui.screens.inventory.ContainerScreen; +import javax.inject.Inject; +import javax.inject.Singleton; + +@Singleton +@Implements(GrieferGamesController.class) +public class VersionedGrieferGamesController extends GrieferGamesController { + + @Inject + public VersionedGrieferGamesController() {} + + @Override + public boolean playerAllowedFlying() { + return Minecraft.getInstance().player.getAbilities().mayfly; + } + + @Override + public boolean hideBoosterMenu() { + if(Minecraft.getInstance().player == null) return false; + + Screen screen = Minecraft.getInstance().screen; + if(screen instanceof ContainerScreen) { + if(screen.getTitle().getString().equals("§6Booster - Übersicht")) { + Minecraft.getInstance().player.closeContainer(); + return true; + } + } + return false; + } +} \ No newline at end of file diff --git a/game-runner/src/v1_18_2/java/de/neocraftr/griefergames/v1_18_2/VersionedGrieferGamesController.java b/game-runner/src/v1_18_2/java/de/neocraftr/griefergames/v1_18_2/VersionedGrieferGamesController.java new file mode 100644 index 0000000..05dd7bf --- /dev/null +++ b/game-runner/src/v1_18_2/java/de/neocraftr/griefergames/v1_18_2/VersionedGrieferGamesController.java @@ -0,0 +1,36 @@ +package de.neocraftr.griefergames.v1_18_2; + +import de.neocraftr.griefergames.utils.GrieferGamesController; +import net.labymod.api.models.Implements; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.screens.Screen; +import net.minecraft.client.gui.screens.inventory.ContainerScreen; +import javax.inject.Inject; +import javax.inject.Singleton; + +@Singleton +@Implements(GrieferGamesController.class) +public class VersionedGrieferGamesController extends GrieferGamesController { + + @Inject + public VersionedGrieferGamesController() {} + + @Override + public boolean playerAllowedFlying() { + return Minecraft.getInstance().player.getAbilities().mayfly; + } + + @Override + public boolean hideBoosterMenu() { + if(Minecraft.getInstance().player == null) return false; + + Screen screen = Minecraft.getInstance().screen; + if(screen instanceof ContainerScreen) { + if(screen.getTitle().getString().equals("§6Booster - Übersicht")) { + Minecraft.getInstance().player.closeContainer(); + return true; + } + } + return false; + } +} \ No newline at end of file diff --git a/game-runner/src/v1_19_2/java/de/neocraftr/griefergames/v1_19_2/VersionedGrieferGamesController.java b/game-runner/src/v1_19_2/java/de/neocraftr/griefergames/v1_19_2/VersionedGrieferGamesController.java new file mode 100644 index 0000000..89d5d38 --- /dev/null +++ b/game-runner/src/v1_19_2/java/de/neocraftr/griefergames/v1_19_2/VersionedGrieferGamesController.java @@ -0,0 +1,36 @@ +package de.neocraftr.griefergames.v1_19_2; + +import de.neocraftr.griefergames.utils.GrieferGamesController; +import net.labymod.api.models.Implements; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.screens.Screen; +import net.minecraft.client.gui.screens.inventory.ContainerScreen; +import javax.inject.Inject; +import javax.inject.Singleton; + +@Singleton +@Implements(GrieferGamesController.class) +public class VersionedGrieferGamesController extends GrieferGamesController { + + @Inject + public VersionedGrieferGamesController() {} + + @Override + public boolean playerAllowedFlying() { + return Minecraft.getInstance().player.getAbilities().mayfly; + } + + @Override + public boolean hideBoosterMenu() { + if(Minecraft.getInstance().player == null) return false; + + Screen screen = Minecraft.getInstance().screen; + if(screen instanceof ContainerScreen) { + if(screen.getTitle().getString().equals("§6Booster - Übersicht")) { + Minecraft.getInstance().player.closeContainer(); + return true; + } + } + return false; + } +} \ No newline at end of file diff --git a/game-runner/src/v1_19_3/java/de/neocraftr/griefergames/v1_19_3/VersionedGrieferGamesController.java b/game-runner/src/v1_19_3/java/de/neocraftr/griefergames/v1_19_3/VersionedGrieferGamesController.java new file mode 100644 index 0000000..979b209 --- /dev/null +++ b/game-runner/src/v1_19_3/java/de/neocraftr/griefergames/v1_19_3/VersionedGrieferGamesController.java @@ -0,0 +1,36 @@ +package de.neocraftr.griefergames.v1_19_3; + +import de.neocraftr.griefergames.utils.GrieferGamesController; +import javax.inject.Inject; +import javax.inject.Singleton; +import net.labymod.api.models.Implements; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.screens.Screen; +import net.minecraft.client.gui.screens.inventory.ContainerScreen; + +@Singleton +@Implements(GrieferGamesController.class) +public class VersionedGrieferGamesController extends GrieferGamesController { + + @Inject + public VersionedGrieferGamesController() {} + + @Override + public boolean playerAllowedFlying() { + return Minecraft.getInstance().player.getAbilities().mayfly; + } + + @Override + public boolean hideBoosterMenu() { + if(Minecraft.getInstance().player == null) return false; + + Screen screen = Minecraft.getInstance().screen; + if(screen instanceof ContainerScreen) { + if(screen.getTitle().getString().equals("§6Booster - Übersicht")) { + Minecraft.getInstance().player.closeContainer(); + return true; + } + } + return false; + } +} \ No newline at end of file diff --git a/game-runner/src/v1_19_4/java/de/neocraftr/griefergames/v1_19_4/VersionedGrieferGamesController.java b/game-runner/src/v1_19_4/java/de/neocraftr/griefergames/v1_19_4/VersionedGrieferGamesController.java new file mode 100644 index 0000000..cc60937 --- /dev/null +++ b/game-runner/src/v1_19_4/java/de/neocraftr/griefergames/v1_19_4/VersionedGrieferGamesController.java @@ -0,0 +1,36 @@ +package de.neocraftr.griefergames.v1_19_4; + +import de.neocraftr.griefergames.utils.GrieferGamesController; +import javax.inject.Inject; +import javax.inject.Singleton; +import net.labymod.api.models.Implements; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.screens.Screen; +import net.minecraft.client.gui.screens.inventory.ContainerScreen; + +@Singleton +@Implements(GrieferGamesController.class) +public class VersionedGrieferGamesController extends GrieferGamesController { + + @Inject + public VersionedGrieferGamesController() {} + + @Override + public boolean playerAllowedFlying() { + return Minecraft.getInstance().player.getAbilities().mayfly; + } + + @Override + public boolean hideBoosterMenu() { + if(Minecraft.getInstance().player == null) return false; + + Screen screen = Minecraft.getInstance().screen; + if(screen instanceof ContainerScreen) { + if(screen.getTitle().getString().equals("§6Booster - Übersicht")) { + Minecraft.getInstance().player.closeContainer(); + return true; + } + } + return false; + } +} \ No newline at end of file diff --git a/game-runner/src/v1_20_1/java/de/neocraftr/griefergames/v1_20_1/VersionedGrieferGamesController.java b/game-runner/src/v1_20_1/java/de/neocraftr/griefergames/v1_20_1/VersionedGrieferGamesController.java new file mode 100644 index 0000000..3edb286 --- /dev/null +++ b/game-runner/src/v1_20_1/java/de/neocraftr/griefergames/v1_20_1/VersionedGrieferGamesController.java @@ -0,0 +1,42 @@ +package de.neocraftr.griefergames.v1_20_1; + +import de.neocraftr.griefergames.utils.GrieferGamesController; +import net.labymod.api.models.Implements; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.screens.Screen; +import net.minecraft.client.gui.screens.inventory.ContainerScreen; +import net.minecraft.world.Container; +import net.minecraft.world.SimpleContainer; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraft.world.inventory.ChestMenu; +import net.minecraft.world.inventory.InventoryMenu; +import net.minecraft.world.level.block.entity.HopperBlockEntity; +import javax.inject.Inject; +import javax.inject.Singleton; + +@Singleton +@Implements(GrieferGamesController.class) +public class VersionedGrieferGamesController extends GrieferGamesController { + + @Inject + public VersionedGrieferGamesController() {} + + @Override + public boolean playerAllowedFlying() { + return Minecraft.getInstance().player.getAbilities().mayfly; + } + + @Override + public boolean hideBoosterMenu() { + if(Minecraft.getInstance().player == null) return false; + + Screen screen = Minecraft.getInstance().screen; + if(screen instanceof ContainerScreen) { + if(screen.getTitle().getString().equals("§6Booster - Übersicht")) { + Minecraft.getInstance().player.closeContainer(); + return true; + } + } + return false; + } +} \ No newline at end of file