13
0

Golden pressure plate
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
Lixfel 2022-03-11 16:39:42 +01:00
Ursprung 05183a4173
Commit d83952ae5c
3 geänderte Dateien mit 25 neuen und 4 gelöschten Zeilen

Datei anzeigen

@ -55,7 +55,8 @@ public class LobbySystem extends JavaPlugin {
new ParticleListener();
new InventoryInteraction();
new WorldInteraction();
new AlphaWall(l -> l.getZ() > 1250, AlphaWall.REFLECT_Z);
//new AlphaWall(l -> l.getZ() > 1250, AlphaWall.REFLECT_Z);
}

Datei anzeigen

@ -23,21 +23,27 @@ import de.steamwar.lobby.command.ModifyCommand;
import org.bukkit.Material;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.block.Action;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.event.player.PlayerSwapHandItemsEvent;
import org.bukkit.inventory.ItemStack;
public class InventoryInteraction extends BasicListener {
@EventHandler(priority = EventPriority.LOW)
public void handlePlayerInteract(PlayerInteractEvent event) {
if(event.getItem() == null) return;
if (event.getItem().getType() == Material.FIREWORK_ROCKET) {
event.getItem().setAmount(2);
ItemStack item = event.getItem();
if(item == null)
return;
if ((event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK) && item.getType() == Material.FIREWORK_ROCKET) {
item.setAmount(2);
return;
}
if(!ModifyCommand.modifying(event.getPlayer()))
event.setCancelled(true);
}

Datei anzeigen

@ -20,13 +20,18 @@
package de.steamwar.lobby.listener;
import de.steamwar.lobby.command.ModifyCommand;
import org.bukkit.Material;
import org.bukkit.entity.HumanEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.FoodLevelChangeEvent;
import org.bukkit.event.hanging.HangingBreakByEntityEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.util.Vector;
public class WorldInteraction extends BasicListener {
@ -57,5 +62,14 @@ public class WorldInteraction extends BasicListener {
if(!ModifyCommand.modifying((HumanEntity) event.getRemover()))
event.setCancelled(true);
}
@EventHandler
public void handleGoldenPressurePlate(PlayerInteractEvent event) {
if(!event.hasBlock() || event.getAction() != Action.PHYSICAL || event.getClickedBlock().getType() != Material.LIGHT_WEIGHTED_PRESSURE_PLATE)
return;
Player player = event.getPlayer();
player.setVelocity(player.getLocation().getDirection().multiply(5).add(new Vector(0, 1, 0)));
}
}