Make a Boolean. If you post the command you want to have restricted we can help you.
|
Declare a boolean either in the Player class or if it's just for that command declare it right above the command locally.
example:
//variable declaration
public boolean commandLock = true;
//now to use this with your commands simple place this code
//if declared in the Player class
//if declared locally in the Command classCode:if(!c.commandLock) { if (playerCommand.equals("ffa")) { c.getPA().startTeleport(3333, 3333, 0, "modern"); } } else { c.sendMessage("This command is currently locked."); }
Code:if(!commandLock) { if (playerCommand.equals("ffa")) { c.getPA().startTeleport(3333, 3333, 0, "modern"); } } else { c.sendMessage("This command is currently locked."); }
Code:public boolean canffa = trueCode:if (playerCommand.equals("ffa")) { if (canffa) { c.getPA().startTeleport(3333, 3333, 0, "modern"); } else { c.sendMessage("This command is currently unavailable"); return; } }Not sure if the toggle will work, it's just as an example.Code:if (playerCommand.equals("toggleffa")) { canffa ? true : false; }
Config.java
Commands.javaCode:public static boolean FFA_DISABLED = true;
Code:if (playerCommand.equals("ffa")) { if(Config.FFA_DISABLED) { c.sendMessage("FFA has been disabled or is currently 'locked'."); return; } c.getPA().startTeleport(3333, 3333, 0, "modern"); } if(playerCommand.equals("freeforall") && c.playerRights > 0) { Config.FFA_DISABLED = FFA_DISABLED ? FFA_DISABLE = false : FFA_DISABLED = true; }
if you don't want people being able to use a command, just make the command only available for yourself or staff members. depending on what you want.
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |