Initial commit of TwosideKeeper4 project to handle basic server

management and maintenance from old server.
int
sigonasr2 7 years ago
parent 30b6948d42
commit a27d2145ca
  1. 2
      .classpath
  2. 14
      .externalToolBuilders/New_Builder (6).launch
  3. 10
      .project
  4. BIN
      TwosideKeeper4.jar
  5. 10
      plugin.yml
  6. 8
      projectBuilder.xml
  7. 20
      src/plugin.yml
  8. 42
      src/sig/plugin/TwosideKeeper/TwosideKeeper4/EventListener.java
  9. 49
      src/sig/plugin/TwosideKeeper/TwosideKeeper4/advanced/AdvancedBlock.java
  10. 14
      src/sig/plugin/TwosideKeeper/TwosideKeeper4/advanced/AdvancedLocation.java
  11. 20
      src/sig/plugin/TwosideKeeper/TwosideKeeper4/advanced/AdvancedPlayer.java
  12. 75
      src/sig/plugin/TwosideKeeper/TwosideKeeper4/advanced/block/ItemPedestal.java
  13. 5
      src/sig/plugin/TwosideKeeper/TwosideKeeper4/commands/Command.java
  14. 18
      src/sig/plugin/TwosideKeeper/TwosideKeeper4/commands/CommandHandler.java
  15. 7
      src/sig/plugin/TwosideKeeper/TwosideKeeper4/commands/CommandResult.java
  16. 40
      src/sig/plugin/TwosideKeeper/TwosideKeeper4/commands/ItemPedestalCheckCommand.java
  17. 29
      src/sig/plugin/TwosideKeeper/TwosideKeeper4/commands/ItemPedestalCreateCommand.java
  18. 16
      src/sig/plugin/TwosideKeeper/TwosideKeeper4/commands/ScanCommand.java
  19. 59
      src/sig/plugin/TwosideKeeper/TwosideKeeper4/event/BlockEventHandler.java
  20. 38
      src/sig/plugin/TwosideKeeper/TwosideKeeper4/event/EntityEventHandler.java
  21. 30
      src/sig/plugin/TwosideKeeper/TwosideKeeper4/event/ItemEventHandler.java
  22. 27
      src/sig/plugin/TwosideKeeper/TwosideKeeper4/event/PlayerEventHandler.java
  23. 24
      src/sig/plugin/TwosideKeeper/TwosideKeeper4/filters/EntityRemovalFilters.java
  24. 19
      src/sig/plugin/TwosideKeeper/TwosideKeeper4/main.java

@ -2,6 +2,6 @@
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="lib" path="C:/Users/sigon/Downloads/vogog/spigot-1.9.2-R0.1-SNAPSHOT.jar"/>
<classpathentry kind="lib" path="D:/Downloads/spigot-1.12.2.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.ant.AntBuilderLaunchConfigurationType">
<booleanAttribute key="org.eclipse.ant.ui.ATTR_TARGETS_UPDATED" value="true"/>
<booleanAttribute key="org.eclipse.ant.ui.DEFAULT_VM_INSTALL" value="false"/>
<stringAttribute key="org.eclipse.debug.core.ATTR_REFRESH_SCOPE" value="${resource}"/>
<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/>
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/>
<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="true"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="TwosideKeeper4"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/TwosideKeeper4/projectBuilder.xml}"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="full,incremental,"/>
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${workspace_loc:/TwosideKeeper4}"/>
</launchConfiguration>

@ -10,6 +10,16 @@
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
<triggers>full,incremental,</triggers>
<arguments>
<dictionary>
<key>LaunchConfigHandle</key>
<value>&lt;project&gt;/.externalToolBuilders/New_Builder (6).launch</value>
</dictionary>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>

Binary file not shown.

@ -1,10 +0,0 @@
name: TwosideKeeper4
main: sig.plugin.TwosideKeeper.TwosideKeeper4.main
version: 3.99a
loadbefore: [aPlugin]
commands:
scan:
description: Analyzes the item found above the block you are looking at.
usage: /scan
permission: TwosideKeeper.admin
permission-message: You don't have permission to scan a block.

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xml>
<project name="TwosideKeeper4.makejar" default="makejar" basedir=".">
<target name ="makejar" description="Create a jar for the TwosideKeeper4 project">
<jar jarfile="TwosideKeeper4.jar" includes="**/*.class,**/*.yml" basedir="bin"/>
<jar jarfile="D:\Documents\Test Server\plugins\TwosideKeeper4.jar" includes="**/*.class,**/*.yml" basedir="bin"/>
</target>
</project>

@ -0,0 +1,20 @@
name: TwosideKeeper4
main: sig.plugin.TwosideKeeper.TwosideKeeper4.main
version: 3.99a
loadbefore: [aPlugin]
commands:
scan:
description: Analyzes the item found above the block you are looking at.
usage: /scan
permission: TwosideKeeper.admin
permission-message: You don't have permission to scan a block.
pedestal_check:
description: Checks if the block is a pedestal.
usage: /pedestal_check
permission: TwosideKeeper.admin
permission-message: You don't have permission to check this pedestal.
pedestal_create:
description: Creates a pedestal.
usage: /pedestal_create
permission: TwosideKeeper.admin
permission-message: You don't have permission to create a pedestal.

@ -0,0 +1,42 @@
package sig.plugin.TwosideKeeper.TwosideKeeper4;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockFromToEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.entity.ItemDespawnEvent;
import org.bukkit.event.player.PlayerBucketEmptyEvent;
import sig.plugin.TwosideKeeper.TwosideKeeper4.event.BlockEventHandler;
import sig.plugin.TwosideKeeper.TwosideKeeper4.event.EntityEventHandler;
import sig.plugin.TwosideKeeper.TwosideKeeper4.event.ItemEventHandler;
import sig.plugin.TwosideKeeper.TwosideKeeper4.event.PlayerEventHandler;
public class EventListener implements Listener{
@EventHandler
public void Event_ItemDespawn(ItemDespawnEvent ev) {
ItemEventHandler.HandleEvent(ev);
}
@EventHandler
public void Event_ItemDespawn(EntityExplodeEvent ev) {
EntityEventHandler.HandleEvent(ev);
}
@EventHandler
public void Event_LiquidFlow(BlockFromToEvent ev) {
BlockEventHandler.HandleEvent(ev);
}
@EventHandler
public void Event_BlockPlace(BlockPlaceEvent ev) {
BlockEventHandler.HandleEvent(ev);
}
@EventHandler
public void Event_BlockBreak(BlockBreakEvent ev) {
BlockEventHandler.HandleEvent(ev);
}
@EventHandler
public void Event_EmptyBucket(PlayerBucketEmptyEvent ev) {
PlayerEventHandler.HandleEvent(ev);
}
}

@ -1,21 +1,60 @@
package sig.plugin.TwosideKeeper.TwosideKeeper4.advanced;
import java.util.Collection;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Item;
import org.bukkit.material.MaterialData;
import sig.plugin.TwosideKeeper.TwosideKeeper4.advanced.block.ItemPedestal;
import sig.plugin.TwosideKeeper.TwosideKeeper4.filters.EntityRemovalFilters;
public class AdvancedBlock{
Block b;
protected Block b;
Item holdingitem;
AdvancedLocation al;
public AdvancedBlock(Block b) {
this.b = b;
this.holdingitem = getItemAboveBlock();
this.al = new AdvancedLocation(b);
this.holdingitem = p_getItemAboveBlock();
}
public Block getBlock() {
return b;
}
public AdvancedLocation getLocation() {
return al;
}
private Item getItemAboveBlock() {
Entity[] ents = getNearbyEntities(1);
return null;
private Item p_getItemAboveBlock() {
Collection<Entity> ents = al.getNearbyEntities(0.5,EntityRemovalFilters.allItemDrops());
if (ents.size()>0) {
return (Item)ents.iterator().next();
} else {
return null;
}
}
public Item getItemAboveBlock() {
return holdingitem;
}
public boolean isBlockItemPedestal() {
return ItemPedestal.isItemPedestalMaterial(new MaterialData(b.getType(),b.getData()));
}
public boolean isExplosionProof() {
return b.getType()==Material.BEDROCK ||
b.getType()==Material.CHEST ||
b.getType()==Material.TRAPPED_CHEST ||
b.getType()==Material.WALL_SIGN ||
b.getType()==Material.SIGN ||
b.getType()==Material.SIGN_POST ||
b.getType()==Material.ITEM_FRAME ||
b.getType().name().contains("SHULKER_BOX");
}
}

@ -11,7 +11,7 @@ public class AdvancedLocation {
Location l;
public AdvancedLocation(Block b) {
this(b.getLocation());
this(b.getLocation().add(0.5,1,0.5));
}
public AdvancedLocation(Entity e) {
@ -22,8 +22,18 @@ public class AdvancedLocation {
this.l = l;
}
public Location getLocation() {
return l;
}
public Collection<Entity> getNearbyEntities(double distance) {
return l.getWorld().getNearbyEntities(l, distance, distance, distance).removeIf())
return l.getWorld().getNearbyEntities(l, distance, distance, distance);
}
public Collection<Entity> getNearbyEntities(double distance,Predicate<Entity> remove_filter) {
Collection<Entity> ents = l.getWorld().getNearbyEntities(l, distance, distance, distance);
ents.removeIf(remove_filter);
return ents;
}
}

@ -0,0 +1,20 @@
package sig.plugin.TwosideKeeper.TwosideKeeper4.advanced;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import sig.plugin.TwosideKeeper.TwosideKeeper4.main;
public class AdvancedPlayer {
Player p;
public AdvancedPlayer(Player p) {
this.p=p;
}
public AdvancedBlock getBlockLookingAt() {
Block b = p.getTargetBlock(null, 50);
//main.logger.info(b.toString());
return new AdvancedBlock(b);
}
}

@ -0,0 +1,75 @@
package sig.plugin.TwosideKeeper.TwosideKeeper4.advanced.block;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Item;
import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
import org.bukkit.inventory.ItemStack;
import org.bukkit.material.MaterialData;
import org.bukkit.util.Vector;
import sig.plugin.TwosideKeeper.TwosideKeeper4.advanced.AdvancedBlock;
import sig.plugin.TwosideKeeper.TwosideKeeper4.advanced.AdvancedPlayer;
public class ItemPedestal extends AdvancedBlock{
boolean activePedestal = false;
public ItemPedestal(Block b) {
super(b);
this.activePedestal = p_isActivePedestal();
}
public ItemPedestal(AdvancedBlock b) {
this(b.getBlock());
this.activePedestal = p_isActivePedestal();
}
private boolean p_isActivePedestal() {
Item i = getItemAboveBlock();
if (i!=null && i.getPickupDelay()>=200) {
//Bukkit.getServer().broadcastMessage(Integer.toString(i.getPickupDelay()));
return true;
} else {
return false;
}
}
public void respawnItem() {
Item i = getItemAboveBlock();
if (i!=null && i.getPickupDelay()>=200) {
RespawnPedestalItem(i);
i.remove();
}
}
public static void RespawnPedestalItem(Item i) {
Item new_i = i.getWorld().dropItem(i.getLocation().add(0,0.5,0), i.getItemStack());
new_i.setItemStack(i.getItemStack());
SetItemPedestalProperties(new_i);
//new_i.teleport(new_i.getLocation(), TeleportCause.PLUGIN);
}
private static void SetItemPedestalProperties(Item new_i) {
new_i.setPickupDelay(12000);
new_i.setVelocity(new Vector(0,0,0));
new_i.setInvulnerable(true);
}
public static void SpawnPedestalItem(Location l, ItemStack i) {
Item new_i = l.getWorld().dropItem(l, i);
new_i.setItemStack(i);
SetItemPedestalProperties(new_i);
//new_i.teleport(new_i.getLocation(), TeleportCause.PLUGIN);
}
public boolean isActivePedestal() {
return activePedestal;
}
public static boolean isItemPedestalMaterial(MaterialData mat) {
return mat.getItemType()==Material.SMOOTH_BRICK && mat.getData()==(byte)3;
}
}

@ -0,0 +1,5 @@
package sig.plugin.TwosideKeeper.TwosideKeeper4.commands;
public interface Command {
public CommandResult runCommand();
}

@ -17,6 +17,22 @@ public class CommandHandler {
}
public boolean runCommand() {
CommandResult result = CommandResult.INVALIDCOMMAND;
switch (cmd.getName().toLowerCase()) {
case "scan":{
result = new ScanCommand(sender).runCommand();
}break;
case "pedestal_check":{
result = new ItemPedestalCheckCommand(sender).runCommand();
}break;
case "pedestal_create":{
result = new ItemPedestalCreateCommand(sender).runCommand();
}break;
}
if (result!=CommandResult.OKAY) {
sender.sendMessage(result.getResponse());
return false;
}
return true;
}
}

@ -2,11 +2,16 @@ package sig.plugin.TwosideKeeper.TwosideKeeper4.commands;
public enum CommandResult {
OKAY("Command executed with no issues."),
NOTAPLAYER("This command can only be issued by a player!");
NOTAPLAYER("This command can only be issued by a player!"),
INVALIDCOMMAND("This is not a valid command!");
String response;
CommandResult(String response) {
this.response = response;
}
public String getResponse() {
return response;
}
}

@ -0,0 +1,40 @@
package sig.plugin.TwosideKeeper.TwosideKeeper4.commands;
import org.bukkit.ChatColor;
import org.bukkit.block.Block;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import sig.plugin.TwosideKeeper.TwosideKeeper4.advanced.AdvancedBlock;
import sig.plugin.TwosideKeeper.TwosideKeeper4.advanced.AdvancedPlayer;
import sig.plugin.TwosideKeeper.TwosideKeeper4.advanced.block.ItemPedestal;
public class ItemPedestalCheckCommand implements Command{
CommandSender p;
public ItemPedestalCheckCommand(CommandSender sender) {
this.p = sender;
}
@Override
public CommandResult runCommand() {
if (p instanceof Player) {
AdvancedBlock pedestal = new AdvancedPlayer((Player)p).getBlockLookingAt();
if (pedestal.isBlockItemPedestal()) {
ItemPedestal ped = new ItemPedestal(pedestal);
if (ped.isActivePedestal()) {
p.sendMessage("This is an "+ChatColor.YELLOW+"active"+ChatColor.RESET+" pedestal!");
ped.respawnItem();
} else {
p.sendMessage("This is a pedestal!");
}
} else {
p.sendMessage("This is not a pedestal!");
}
return CommandResult.OKAY;
} else {
return CommandResult.NOTAPLAYER;
}
}
}

@ -0,0 +1,29 @@
package sig.plugin.TwosideKeeper.TwosideKeeper4.commands;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import sig.plugin.TwosideKeeper.TwosideKeeper4.advanced.AdvancedPlayer;
import sig.plugin.TwosideKeeper.TwosideKeeper4.advanced.block.ItemPedestal;
public class ItemPedestalCreateCommand implements Command{
CommandSender p;
public ItemPedestalCreateCommand(CommandSender sender) {
this.p=sender;
}
@Override
public CommandResult runCommand() {
if (p instanceof Player) {
AdvancedPlayer ap = new AdvancedPlayer((Player)p);
if (ap.getBlockLookingAt().isBlockItemPedestal()) {
ItemPedestal pedestal = new ItemPedestal(ap.getBlockLookingAt());
ItemPedestal.SpawnPedestalItem(ap.getBlockLookingAt().getLocation().getLocation(), ((Player) p).getEquipment().getItemInMainHand());
}
return CommandResult.OKAY;
} else {
return CommandResult.NOTAPLAYER;
}
}
}

@ -1,9 +1,16 @@
package sig.plugin.TwosideKeeper.TwosideKeeper4.commands;
import java.util.Set;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Item;
import org.bukkit.entity.Player;
import org.bukkit.scoreboard.Team;
import sig.plugin.TwosideKeeper.TwosideKeeper4.advanced.AdvancedPlayer;
public class ScanCommand {
public class ScanCommand implements Command{
CommandSender p;
public ScanCommand(CommandSender sender) {
@ -13,7 +20,12 @@ public class ScanCommand {
public CommandResult runCommand() {
if (p instanceof Player) {
//Get block looking at and get item.
Item i =
Item i = new AdvancedPlayer((Player)p).getBlockLookingAt().getItemAboveBlock();
if (i!=null) {
p.sendMessage(i.getItemStack().toString());
} else {
p.sendMessage("Invalid block, or no item found!");
}
return CommandResult.OKAY;
} else {
return CommandResult.NOTAPLAYER;

@ -0,0 +1,59 @@
package sig.plugin.TwosideKeeper.TwosideKeeper4.event;
import org.bukkit.Material;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockEvent;
import org.bukkit.event.block.BlockFromToEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.entity.EntityEvent;
import org.bukkit.event.entity.ItemDespawnEvent;
import org.bukkit.event.entity.ItemSpawnEvent;
import sig.plugin.TwosideKeeper.TwosideKeeper4.advanced.AdvancedBlock;
import sig.plugin.TwosideKeeper.TwosideKeeper4.advanced.block.ItemPedestal;
public class BlockEventHandler {
public static void HandleEvent(BlockEvent e) {
if (e instanceof BlockFromToEvent) {
HandleLiquidFlowAttempt((BlockFromToEvent)e);
} else
if (e instanceof BlockPlaceEvent) {
HandleBlockPlaceAttempt((BlockPlaceEvent)e);
} else
if (e instanceof BlockBreakEvent) {
HandleBlockBreakAttempt((BlockBreakEvent)e);
}
}
private static void HandleBlockBreakAttempt(BlockBreakEvent e) {
AdvancedBlock b = new AdvancedBlock(e.getBlock());
if (b.isBlockItemPedestal()) {
ItemPedestal ped = new ItemPedestal(b);
if (ped.isActivePedestal()) {
e.setCancelled(true);
}
}
}
private static void HandleBlockPlaceAttempt(BlockPlaceEvent e) {
AdvancedBlock b = new AdvancedBlock(e.getBlock().getRelative(0, -1, 0));
if (b.isBlockItemPedestal()) {
ItemPedestal ped = new ItemPedestal(b);
if (ped.isActivePedestal()) {
e.setCancelled(true);
}
}
}
private static void HandleLiquidFlowAttempt(BlockFromToEvent e) {
AdvancedBlock b = new AdvancedBlock(e.getToBlock().getRelative(0, -1, 0));
if (b.isBlockItemPedestal()) {
ItemPedestal ped = new ItemPedestal(b);
if (ped.isActivePedestal()) {
e.setCancelled(true);
e.getBlock().breakNaturally();
e.getBlock().setType(Material.AIR, false);
}
}
}
}

@ -0,0 +1,38 @@
package sig.plugin.TwosideKeeper.TwosideKeeper4.event;
import java.util.List;
import org.bukkit.block.Block;
import org.bukkit.event.entity.EntityEvent;
import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.entity.ItemDespawnEvent;
import org.bukkit.event.entity.ItemSpawnEvent;
import sig.plugin.TwosideKeeper.TwosideKeeper4.main;
import sig.plugin.TwosideKeeper.TwosideKeeper4.advanced.AdvancedBlock;
import sig.plugin.TwosideKeeper.TwosideKeeper4.advanced.block.ItemPedestal;
public class EntityEventHandler {
public static void HandleEvent(EntityEvent e) {
if (e instanceof EntityExplodeEvent) {
HandleItemExplosion((EntityExplodeEvent)e);
}
}
private static void HandleItemExplosion(EntityExplodeEvent e) {
List<Block> blocks = e.blockList();
for (int i=0;i<blocks.size();i++) {
AdvancedBlock ab = new AdvancedBlock(blocks.get(i));
if (ab.isBlockItemPedestal()) {
ItemPedestal ped = new ItemPedestal(ab);
if (ped.isActivePedestal()) {
//main.logger.info("Found an active pedestal in the explosion. Removing from list.");
blocks.remove(i--);
}
} else
if (ab.isExplosionProof()) {
blocks.remove(i--);
}
}
}
}

@ -0,0 +1,30 @@
package sig.plugin.TwosideKeeper.TwosideKeeper4.event;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Item;
import org.bukkit.event.entity.EntityEvent;
import org.bukkit.event.entity.ItemDespawnEvent;
import org.bukkit.event.entity.ItemSpawnEvent;
import sig.plugin.TwosideKeeper.TwosideKeeper4.advanced.block.ItemPedestal;
public class ItemEventHandler {
public static void HandleEvent(EntityEvent e) {
if (e instanceof ItemDespawnEvent) {
HandleDespawnItem((ItemDespawnEvent)e);
} else
if (e instanceof ItemSpawnEvent) {
//TODO
}
}
private static void HandleDespawnItem(ItemDespawnEvent e) {
Item i = e.getEntity();
if (i.getPickupDelay()>=200) {
//Consider this a permanently spawned item. Respawn it.
//main.logger.info("Found an item that has a long pickup delay. Spawning a new one... Old Item: "+i.getItemStack());
ItemPedestal.RespawnPedestalItem(i);
//main.logger.info("New Item: "+new_i.getPickupDelay()+" | New Delay: "+new_i.getPickupDelay());
}
}
}

@ -0,0 +1,27 @@
package sig.plugin.TwosideKeeper.TwosideKeeper4.event;
import org.bukkit.event.player.PlayerBucketEmptyEvent;
import org.bukkit.event.player.PlayerEvent;
import sig.plugin.TwosideKeeper.TwosideKeeper4.main;
import sig.plugin.TwosideKeeper.TwosideKeeper4.advanced.AdvancedBlock;
import sig.plugin.TwosideKeeper.TwosideKeeper4.advanced.block.ItemPedestal;
public class PlayerEventHandler {
public static void HandleEvent(PlayerEvent e) {
if (e instanceof PlayerBucketEmptyEvent) {
HandleLiquidPlaceAttempt((PlayerBucketEmptyEvent)e);
}
}
private static void HandleLiquidPlaceAttempt(PlayerBucketEmptyEvent e) {
//main.logger.info(e.getBlockClicked()+"|"+e.getBlockFace()+"|"+e.getBlockClicked().getRelative(e.getBlockFace()));
AdvancedBlock b = new AdvancedBlock(e.getBlockClicked().getRelative(e.getBlockFace()).getRelative(0, -1, 0));
if (b.isBlockItemPedestal()) {
ItemPedestal ped = new ItemPedestal(b);
if (ped.isActivePedestal()) {
e.setCancelled(true);
}
}
}
}

@ -0,0 +1,24 @@
package sig.plugin.TwosideKeeper.TwosideKeeper4.filters;
import java.util.function.Predicate;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Item;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Monster;
import org.bukkit.entity.Player;
public class EntityRemovalFilters {
public static Predicate<Entity> allNonMonsters() {
return e -> e instanceof Monster;
}
public static Predicate<Entity> allNonLivingEntities() {
return e -> e instanceof LivingEntity;
}
public static Predicate<Entity> allItemDrops() {
return e -> !(e instanceof Item);
}
public static Predicate<Entity> allPlayers() {
return e -> !(e instanceof Player);
}
}

@ -1,12 +1,31 @@
package sig.plugin.TwosideKeeper.TwosideKeeper4;
import java.util.Set;
import java.util.logging.Logger;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.ItemDespawnEvent;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scoreboard.Objective;
import org.bukkit.scoreboard.Team;
import sig.plugin.TwosideKeeper.TwosideKeeper4.commands.CommandHandler;
public class main extends JavaPlugin{
public static Logger logger;
public static main plugin;
public static EventListener listener;
public void onEnable() {
logger = Bukkit.getLogger();
plugin = this;
listener = new EventListener();
Bukkit.getPluginManager().registerEvents(listener, this);
}
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {

Loading…
Cancel
Save