forked from Bukkit/Bukkit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6a53010
commit 110ad8c
Showing
31 changed files
with
410 additions
and
143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package org.bukkit.command; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* Represents a class which can handle command tab completion and commands | ||
*/ | ||
public interface TabCommandExecutor extends CommandExecutor { | ||
public List<String> onTabComplete(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 31 additions & 5 deletions
36
src/main/java/org/bukkit/command/defaults/BanIpCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 20 additions & 8 deletions
28
src/main/java/org/bukkit/command/defaults/BanListCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
src/main/java/org/bukkit/command/defaults/DefaultGameModeCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package org.bukkit.command.defaults; | ||
|
||
import org.bukkit.Bukkit; | ||
import org.bukkit.GameMode; | ||
import org.bukkit.command.CommandSender; | ||
|
||
public class DefaultGameModeCommand extends VanillaCommand { | ||
public DefaultGameModeCommand() { | ||
super("defaultgamemode"); | ||
this.description = "Set the default gamemode"; | ||
this.usageMessage = "/defaultgamemode <mode>"; | ||
this.setPermission("bukkit.command.defaultgamemode"); | ||
} | ||
|
||
@Override | ||
public boolean matches(String input) { | ||
return input.equalsIgnoreCase(this.getName()); | ||
} | ||
|
||
@Override | ||
public boolean execute(CommandSender sender, String commandLabel, String[] args) { | ||
if (args.length == 0) { | ||
sender.sendMessage("Useage: " + usageMessage); | ||
return false; | ||
} | ||
|
||
String modeArg = args[0]; | ||
int value = -1; | ||
|
||
try { | ||
value = Integer.parseInt(modeArg); | ||
} catch (NumberFormatException ex) {} | ||
|
||
GameMode mode = GameMode.getByValue(value); | ||
|
||
if (mode == null) { | ||
if (modeArg.equalsIgnoreCase("creative") || modeArg.equalsIgnoreCase("c")) { | ||
mode = GameMode.CREATIVE; | ||
} else if (modeArg.equalsIgnoreCase("adventure") || modeArg.equalsIgnoreCase("a")) { | ||
mode = GameMode.ADVENTURE; | ||
} else { | ||
mode = GameMode.SURVIVAL; | ||
} | ||
} | ||
|
||
Bukkit.getServer().setDefaultGameMode(mode); | ||
sender.sendMessage("Default game mode set to " + mode.toString().toLowerCase()); | ||
|
||
return true; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.