Skip to content

Commit

Permalink
Added 'on player changes sign', removed random debug
Browse files Browse the repository at this point in the history
  • Loading branch information
Morphan1 committed Jul 4, 2013
1 parent 5a02809 commit 81e0f8d
Showing 1 changed file with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.Sign;
import org.bukkit.entity.Entity;
import org.bukkit.entity.ItemFrame;
import org.bukkit.entity.LivingEntity;
Expand All @@ -27,6 +28,7 @@
import org.bukkit.event.block.BlockIgniteEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.block.BlockRedstoneEvent;
import org.bukkit.event.block.SignChangeEvent;
import org.bukkit.event.entity.CreatureSpawnEvent;
import org.bukkit.event.entity.EntityCombustEvent;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
Expand Down Expand Up @@ -216,6 +218,22 @@ public void blockRedstone(BlockRedstoneEvent event) {
event.setNewCurrent(event.getOldCurrent());
}

@EventHandler
public void signChange(SignChangeEvent event) {

Map<String, Object> context = new HashMap<String, Object>();

context.put("location", new dLocation(event.getBlock().getLocation()));
context.put("sign_contents", new dList(Arrays.asList(((Sign) event.getBlock().getState()).getLines())));

String determination = doEvents
(Arrays.asList("player changes sign"),
null, event.getPlayer(), context);

if (determination.toUpperCase().startsWith("CANCELLED"))
event.setCancelled(true);
}


/////////////////////
// CUSTOM EVENTS
Expand Down Expand Up @@ -631,8 +649,6 @@ public void inventoryClickEvent(InventoryClickEvent event) {
events.add(interaction + " in inventory");
events.add(interaction + " in " + type + " inventory");

Bukkit.broadcastMessage("Clicked on item!");

if (item.getItemStack() == null) {
events.add(interaction + " on " +
item.identify().split(":")[0] + " in inventory");
Expand Down

0 comments on commit 81e0f8d

Please sign in to comment.