feat: require server resourcepack
This commit is contained in:
parent
a8e064d4dc
commit
e1d6c1394e
3 changed files with 31 additions and 0 deletions
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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.");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue