Format source

This commit is contained in:
Shevchik 2014-03-06 21:50:59 +04:00
parent e838c79941
commit 9f9eca6fae
4 changed files with 16 additions and 25 deletions

View File

@ -24,8 +24,7 @@ public class ChairsIgnoreList implements Serializable{
private static final String IGNORE_FILE = "plugins/Chairs/ignores.ser"; private static final String IGNORE_FILE = "plugins/Chairs/ignores.ser";
private Chairs plugin; private Chairs plugin;
public ChairsIgnoreList(Chairs plugin) public ChairsIgnoreList(Chairs plugin) {
{
this.plugin = plugin; this.plugin = plugin;
} }
@ -66,12 +65,10 @@ public class ChairsIgnoreList implements Serializable{
if (ignoreList.contains(s)) { if (ignoreList.contains(s)) {
return; return;
} }
//Chairs.get().logInfo("Adding " + s + " to ignore list.");
ignoreList.add(s); ignoreList.add(s);
} }
public void removePlayer(String s) { public void removePlayer(String s) {
//Chairs.get().logInfo("Removing " + s + " from ignore list.");
ignoreList.remove(s); ignoreList.remove(s);
} }

View File

@ -25,6 +25,7 @@ import com.cnaude.chairs.sitaddons.CommandRestrict;
import com.cnaude.chairs.vehiclearrow.NMSAccess; import com.cnaude.chairs.vehiclearrow.NMSAccess;
public class Chairs extends JavaPlugin { public class Chairs extends JavaPlugin {
public ChairEffects chairEffects; public ChairEffects chairEffects;
public List<ChairBlock> allowedBlocks; public List<ChairBlock> allowedBlocks;
public List<Material> validSigns; public List<Material> validSigns;
@ -45,7 +46,6 @@ public class Chairs extends JavaPlugin {
public String msgSitting, msgStanding, msgOccupied, msgNoPerm, msgReloaded, msgDisabled, msgEnabled, msgCommandRestricted; public String msgSitting, msgStanding, msgOccupied, msgNoPerm, msgReloaded, msgDisabled, msgEnabled, msgCommandRestricted;
private PlayerSitData psitdata; private PlayerSitData psitdata;
public PlayerSitData getPlayerSitData() { public PlayerSitData getPlayerSitData() {
return psitdata; return psitdata;

View File

@ -16,25 +16,19 @@ public class CommandRestrict implements Listener {
} }
@EventHandler(priority=EventPriority.LOWEST) @EventHandler(priority=EventPriority.LOWEST)
public void onPlayerCommand(PlayerCommandPreprocessEvent event) public void onPlayerCommand(PlayerCommandPreprocessEvent event) {
{
Player player = event.getPlayer(); Player player = event.getPlayer();
String playercommand = event.getMessage().toLowerCase(); String playercommand = event.getMessage().toLowerCase();
if (plugin.getPlayerSitData().isSitting(player)) if (plugin.getPlayerSitData().isSitting(player)) {
{ if (plugin.sitDisableAllCommands) {
if (plugin.sitDisableAllCommands)
{
event.setCancelled(true); event.setCancelled(true);
player.sendMessage(plugin.msgCommandRestricted); player.sendMessage(plugin.msgCommandRestricted);
return; return;
} }
for (String disabledCommand : plugin.sitDisabledCommands) for (String disabledCommand : plugin.sitDisabledCommands) {
{ if (disabledCommand.startsWith(playercommand)) {
if (disabledCommand.startsWith(playercommand))
{
String therest = playercommand.replace(disabledCommand, ""); String therest = playercommand.replace(disabledCommand, "");
if (therest.isEmpty() || therest.startsWith(" ")) if (therest.isEmpty() || therest.startsWith(" ")) {
{
event.setCancelled(true); event.setCancelled(true);
player.sendMessage(plugin.msgCommandRestricted); player.sendMessage(plugin.msgCommandRestricted);
return; return;