Skip to content

Commit

Permalink
make resource pack mandatory
Browse files Browse the repository at this point in the history
  • Loading branch information
TehBrian committed Nov 21, 2023
1 parent 0fb8d75 commit c782220
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerResourcePackStatusEvent;
import org.bukkit.inventory.meta.FireworkMeta;
import org.spongepowered.configurate.NodePath;

Expand All @@ -42,6 +43,15 @@ public JoinQuitListener(
this.worldService = worldService;
}

@EventHandler
public void onPack(final PlayerResourcePackStatusEvent event) {
if (event.getStatus() == PlayerResourcePackStatusEvent.Status.DECLINED) {
event.getPlayer().kick(this.langConfig.c(NodePath.path("resource-pack", "decline-kick")));
} else if (event.getStatus() == PlayerResourcePackStatusEvent.Status.FAILED_DOWNLOAD) {
event.getPlayer().kick(this.langConfig.c(NodePath.path("resource-pack", "fail-kick")));
}
}

@EventHandler
public void onJoin(final PlayerJoinEvent event) {
final Player player = event.getPlayer();
Expand Down
8 changes: 8 additions & 0 deletions src/main/resources/lang.conf
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,14 @@ transpose: {

resource-pack: {
sending: "<gradient:blue:aqua>Zooming the epic resource pack your way!"
decline-kick: """You must accept the resource pack.

<gray>Check that you have <#dddd99>server resource packs</#dddd99> set
to <#dddd99>allow</#dddd99> or <#dddd99>prompt</#dddd99> in the server list settings (edit)."""
fail-kick: """The resource pack failed to load.

<gray>If this issue persists, visit our Discord server
at <#BB77FF>thefloating.city/discord</#BB77FF> and ask staff for help."""
}

tag: {
Expand Down

0 comments on commit c782220

Please sign in to comment.