12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- package me.km.plots;
- import me.km.api.Module;
- import java.util.HashMap;
- import java.util.UUID;
- import me.km.KajetansMod;
- import me.km.permissions.PermissionManager;
- import me.km.permissions.Permissions;
- import net.minecraft.entity.player.EntityPlayer;
- import net.minecraft.init.Items;
- import net.minecraft.util.EnumHand;
- import net.minecraft.util.math.BlockPos;
- import net.minecraftforge.event.entity.player.PlayerInteractEvent;
- import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
- public class ProtectionMarkPlot extends Protection
- {
- private final HashMap<UUID, BlockPos> coord1;
- private final HashMap<UUID, BlockPos> coord2;
-
- public ProtectionMarkPlot(Module m)
- {
- super(m);
- coord1 = KajetansMod.plots.getCommand(CommandPlot.class).coord1;
- coord2 = KajetansMod.plots.getCommand(CommandPlot.class).coord2;
- }
-
- @SubscribeEvent
- public void markRegionRightClick(PlayerInteractEvent.RightClickBlock e)
- {
- if(e.getHand() == EnumHand.OFF_HAND)
- {
- return;
- }
- EntityPlayer p = e.getEntityPlayer();
- if(KajetansMod.perms.has(p, Permissions.PLOT_MARK) && p.getHeldItemMainhand().getItem() == Items.WOODEN_SWORD && p.isCreative())
- {
- BlockPos pos = e.getPos();
- coord2.put(p.getUniqueID(), pos);
- this.getModule().send(p, "Punkt 2 wurde ausgewählt (" + pos.getX() + ", " + pos.getY() + ", " + pos.getZ() + ")");
- e.setCanceled(true);
- }
- }
-
- @SubscribeEvent
- public void markRegionLeftClick(PlayerInteractEvent.LeftClickBlock e)
- {
- if(e.getHand() == EnumHand.OFF_HAND)
- {
- return;
- }
- EntityPlayer p = e.getEntityPlayer();
- if(KajetansMod.perms.has(p, Permissions.PLOT_MARK) && p.getHeldItemMainhand().getItem() == Items.WOODEN_SWORD && p.isCreative())
- {
- BlockPos pos = e.getPos();
- coord1.put(p.getUniqueID(), pos);
- this.getModule().send(p, "Punkt 1 wurde ausgewählt (" + pos.getX() + ", " + pos.getY() + ", " + pos.getZ() + ")");
- e.setCanceled(true);
- }
- }
- }
|