Dieser Commit ist enthalten in:
Ursprung
05183a4173
Commit
d83952ae5c
@ -55,7 +55,8 @@ public class LobbySystem extends JavaPlugin {
|
|||||||
new ParticleListener();
|
new ParticleListener();
|
||||||
new InventoryInteraction();
|
new InventoryInteraction();
|
||||||
new WorldInteraction();
|
new WorldInteraction();
|
||||||
new AlphaWall(l -> l.getZ() > 1250, AlphaWall.REFLECT_Z);
|
//new AlphaWall(l -> l.getZ() > 1250, AlphaWall.REFLECT_Z);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,21 +23,27 @@ import de.steamwar.lobby.command.ModifyCommand;
|
|||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
|
import org.bukkit.event.block.Action;
|
||||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||||
import org.bukkit.event.player.PlayerDropItemEvent;
|
import org.bukkit.event.player.PlayerDropItemEvent;
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
import org.bukkit.event.player.PlayerPickupItemEvent;
|
import org.bukkit.event.player.PlayerPickupItemEvent;
|
||||||
import org.bukkit.event.player.PlayerSwapHandItemsEvent;
|
import org.bukkit.event.player.PlayerSwapHandItemsEvent;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
public class InventoryInteraction extends BasicListener {
|
public class InventoryInteraction extends BasicListener {
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOW)
|
@EventHandler(priority = EventPriority.LOW)
|
||||||
public void handlePlayerInteract(PlayerInteractEvent event) {
|
public void handlePlayerInteract(PlayerInteractEvent event) {
|
||||||
if(event.getItem() == null) return;
|
ItemStack item = event.getItem();
|
||||||
if (event.getItem().getType() == Material.FIREWORK_ROCKET) {
|
if(item == null)
|
||||||
event.getItem().setAmount(2);
|
return;
|
||||||
|
|
||||||
|
if ((event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK) && item.getType() == Material.FIREWORK_ROCKET) {
|
||||||
|
item.setAmount(2);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!ModifyCommand.modifying(event.getPlayer()))
|
if(!ModifyCommand.modifying(event.getPlayer()))
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
@ -20,13 +20,18 @@
|
|||||||
package de.steamwar.lobby.listener;
|
package de.steamwar.lobby.listener;
|
||||||
|
|
||||||
import de.steamwar.lobby.command.ModifyCommand;
|
import de.steamwar.lobby.command.ModifyCommand;
|
||||||
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.HumanEntity;
|
import org.bukkit.entity.HumanEntity;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.block.Action;
|
||||||
import org.bukkit.event.block.BlockBreakEvent;
|
import org.bukkit.event.block.BlockBreakEvent;
|
||||||
import org.bukkit.event.block.BlockPlaceEvent;
|
import org.bukkit.event.block.BlockPlaceEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent;
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
import org.bukkit.event.entity.FoodLevelChangeEvent;
|
import org.bukkit.event.entity.FoodLevelChangeEvent;
|
||||||
import org.bukkit.event.hanging.HangingBreakByEntityEvent;
|
import org.bukkit.event.hanging.HangingBreakByEntityEvent;
|
||||||
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
public class WorldInteraction extends BasicListener {
|
public class WorldInteraction extends BasicListener {
|
||||||
|
|
||||||
@ -57,5 +62,14 @@ public class WorldInteraction extends BasicListener {
|
|||||||
if(!ModifyCommand.modifying((HumanEntity) event.getRemover()))
|
if(!ModifyCommand.modifying((HumanEntity) event.getRemover()))
|
||||||
event.setCancelled(true);
|
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)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren