Let's start stepping through the cell creation.

This commit is contained in:
graywolf336 2013-12-09 14:38:22 -06:00
parent d0273828b8
commit d85b2db190

View File

@ -1,54 +1,50 @@
package com.graywolf336.jail.listeners; package com.graywolf336.jail.listeners;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.block.Action; import org.bukkit.event.block.Action;
import org.bukkit.event.player.AsyncPlayerChatEvent; import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerInteractEvent;
import com.graywolf336.jail.JailMain; import com.graywolf336.jail.JailMain;
import com.graywolf336.jail.JailManager; import com.graywolf336.jail.JailManager;
public class PlayerListener implements Listener { public class PlayerListener implements Listener {
private JailMain pl; private JailMain pl;
public PlayerListener(JailMain plugin) { public PlayerListener(JailMain plugin) {
this.pl = plugin; this.pl = plugin;
} }
@EventHandler @EventHandler
public void jailOrCellCreation(PlayerInteractEvent event) { public void jailOrCellCreation(PlayerInteractEvent event) {
if(event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK) { if(event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK) {
Player p = event.getPlayer(); Player p = event.getPlayer();
Location loc = event.getClickedBlock() == null ? p.getLocation() : event.getClickedBlock().getLocation(); Location loc = event.getClickedBlock() == null ? p.getLocation() : event.getClickedBlock().getLocation();
JailManager jm = pl.getJailManager(); JailManager jm = pl.getJailManager();
if(jm.isCreatingSomething(p.getName())) { if(jm.isCreatingSomething(p.getName())) {
if(jm.isCreatingAJail(p.getName())) { if(jm.isCreatingAJail(p.getName())) {
jm.getJailCreationSteps().step(jm, p, jm.getJailCreationPlayer(p.getName()), loc);
jm.getJailCreationSteps().step(jm, p, jm.getJailCreationPlayer(p.getName()), loc); }else if(jm.isCreatingACell(p.getName())) {
jm.getCellCreationSteps().step(jm, p, jm.getCellCreationPlayer(p.getName()), loc);
}else if(jm.isCreatingACell(p.getName())) { }
//One for jail cell creation event.setCancelled(true);
}
} }
}
event.setCancelled(true);
} @EventHandler
} public void chatting(AsyncPlayerChatEvent event) {
} if(pl.getJailManager().isPlayerJailed(event.getPlayer().getName())) {
if(pl.getJailManager().getPrisoner(event.getPlayer().getName()).isMuted()) {
@EventHandler event.setCancelled(true);
public void chatting(AsyncPlayerChatEvent event) { event.getPlayer().sendMessage(ChatColor.RED + "Stop talking, you're currently jailed and muted.");
if(pl.getJailManager().isPlayerJailed(event.getPlayer().getName())) { }
if(pl.getJailManager().getPrisoner(event.getPlayer().getName()).isMuted()) { }
event.setCancelled(true); }
event.getPlayer().sendMessage(ChatColor.RED + "Stop talking, you're currently jailed and muted."); }
}
}
}
}