fixed arena transfer with empty inventory slots and blocked advancements in the arena
This commit is contained in:
1 parent
8b616ba2a2
commit
65c48eae45
4 files changed
+24
-3
No files matched your search
@@ -373,6 +373,7 @@ public class Arena extends Appliance {
|
||||
new FightListener(),
|
||||
new WorldProtectionListener(),
|
||||
new ModeMenuListener(),
|
||||
new NoProgressListener(),
|
||||
new PlayerInteractAtEntityEventListener(villager, event -> this.sendToCraftAttack(event.getPlayer())),
|
||||
new DismissInventoryOpenFromHolder(villager)
|
||||
);
|
||||
|
||||
@@ -39,6 +39,7 @@ final class ArenaWorlds {
|
||||
world.setGameRule(GameRules.SPAWN_WARDENS, false);
|
||||
world.setGameRule(GameRules.RAIDS, false);
|
||||
world.setGameRule(GameRules.SHOW_DEATH_MESSAGES, false);
|
||||
world.setGameRule(GameRules.SHOW_ADVANCEMENT_MESSAGES, false);
|
||||
world.setStorm(false);
|
||||
world.setThundering(false);
|
||||
world.setTime(6000);
|
||||
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package eu.mhsl.craftattack.spawn.arena.appliances.arena;
|
||||
|
||||
import com.destroystokyo.paper.event.player.PlayerAdvancementCriterionGrantEvent;
|
||||
import eu.mhsl.craftattack.spawn.core.appliance.ApplianceListener;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.PlayerRecipeDiscoverEvent;
|
||||
|
||||
/**
|
||||
* Nothing done in the arena counts as progress: no advancements, no recipe unlocks.
|
||||
*/
|
||||
class NoProgressListener extends ApplianceListener<Arena> {
|
||||
@EventHandler
|
||||
public void onCriterion(PlayerAdvancementCriterionGrantEvent event) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onRecipe(PlayerRecipeDiscoverEvent event) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
+1
-3
@@ -20,7 +20,6 @@ import org.bukkit.event.Listener;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Base64;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
@@ -75,8 +74,7 @@ public class ArenaPortal extends Appliance {
|
||||
if(!this.pendingTransfers.add(player.getUniqueId())) return;
|
||||
player.sendActionBar(Component.text("Du wirst zur Arena gebracht...", NamedTextColor.GRAY));
|
||||
|
||||
List<ItemStack> contents = new ArrayList<>(List.of(player.getInventory().getContents()));
|
||||
String items = Base64.getEncoder().encodeToString(ItemStack.serializeItemsAsBytes(contents));
|
||||
String items = Base64.getEncoder().encodeToString(ItemStack.serializeItemsAsBytes(player.getInventory().getContents()));
|
||||
ArenaRepository.InventorySnapshot snapshot = new ArenaRepository.InventorySnapshot(player.getUniqueId(), items);
|
||||
|
||||
Bukkit.getScheduler().runTaskAsynchronously(Main.instance(), () -> {
|
||||
|
||||
Reference in new issue
Block a user