diff --git a/varo/src/main/java/de/cliffbreak/varo/Varo.java b/varo/src/main/java/de/cliffbreak/varo/Varo.java index bf528f9..b05c745 100644 --- a/varo/src/main/java/de/cliffbreak/varo/Varo.java +++ b/varo/src/main/java/de/cliffbreak/varo/Varo.java @@ -19,6 +19,7 @@ import de.cliffbreak.varo.listeners.PlayerClientOptionsChangeListener; import de.cliffbreak.varo.listeners.PlayerDeathListener; import de.cliffbreak.varo.listeners.PlayerJoinQuitListener; import de.cliffbreak.varo.listeners.PlayerLoginListener; +import de.cliffbreak.varo.listeners.PlayerResourcePackStatusListener; import de.cliffbreak.varo.managers.NPCManager; import de.cliffbreak.varo.uitls.BanUtils; import de.cliffbreak.varo.uitls.PlayerCache; @@ -57,6 +58,7 @@ public class Varo extends JavaPlugin { this.getServer().getPluginManager().registerEvents(new PlayerLoginListener(this), this); this.getServer().getPluginManager().registerEvents(new PlayerJoinQuitListener(this), this); this.getServer().getPluginManager().registerEvents(new PlayerClientOptionsChangeListener(this), this); + this.getServer().getPluginManager().registerEvents(new PlayerResourcePackStatusListener(), this); this.getServer().getPluginManager().registerEvents(new ChatListener(), this); this.getServer().getPluginManager().registerEvents(new EntityRegainHealthListener(), this); this.getServer().getPluginManager().registerEvents(new PlayerDeathListener(this), this); diff --git a/varo/src/main/java/de/cliffbreak/varo/listeners/PlayerJoinQuitListener.java b/varo/src/main/java/de/cliffbreak/varo/listeners/PlayerJoinQuitListener.java index 93268be..8d55925 100644 --- a/varo/src/main/java/de/cliffbreak/varo/listeners/PlayerJoinQuitListener.java +++ b/varo/src/main/java/de/cliffbreak/varo/listeners/PlayerJoinQuitListener.java @@ -93,6 +93,14 @@ public class PlayerJoinQuitListener implements Listener { }.runTaskTimer(this.plugin, 20, 20); } } + + new BukkitRunnable() { + @Override + public void run() { + e.getPlayer().setResourcePack("https://cdn.cliffbreak.de/vanilla.zip", + "cf29612c4506d02fd1e83ae61d3a660a1f4b9bcd"); + } + }.runTaskLater(plugin, 5); // wait 5 ticks } @EventHandler diff --git a/varo/src/main/java/de/cliffbreak/varo/listeners/PlayerResourcePackStatusListener.java b/varo/src/main/java/de/cliffbreak/varo/listeners/PlayerResourcePackStatusListener.java new file mode 100644 index 0000000..95a8f4b --- /dev/null +++ b/varo/src/main/java/de/cliffbreak/varo/listeners/PlayerResourcePackStatusListener.java @@ -0,0 +1,21 @@ +package de.cliffbreak.varo.listeners; + +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerResourcePackStatusEvent; +import org.bukkit.event.player.PlayerResourcePackStatusEvent.Status; + +public class PlayerResourcePackStatusListener implements Listener { + + @EventHandler + public void onPlayerResourcePackStatus(PlayerResourcePackStatusEvent e) { + if (e.getStatus().equals(Status.DECLINED)) { + e.getPlayer().kickPlayer( + "§4Du wurdest gekickt.\n \n§r§7Aktiviere §f§lRessourcepacks§r§7 in den\n§f§lServer-Einstellungen§r§7, um spielen zu können.\n \nBei Problemen kontaktiere die §f§l@Admins §r§7auf dem Discord-Server."); + } else if (e.getStatus().equals(Status.FAILED_DOWNLOAD)) { + e.getPlayer().kickPlayer( + "§4Du wurdest gekickt.\n \n§r§7Das §f§lServer-Ressourcepack §r§7konnte\n§r§7nicht erfolgreich heruntergeladen werden.\n \nBitte versuche es erneut.\n \nBei Problemen kontaktiere die §f§l@Admins §r§7auf dem Discord-Server."); + } + } + +} \ No newline at end of file