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.
Add OfflinePlayer support and changed command processing
- Loading branch information
Showing
45 changed files
with
1,050 additions
and
3,166 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
34 changes: 34 additions & 0 deletions
34
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package org.bukkit.command.defaults; | ||
|
||
import org.bukkit.Bukkit; | ||
import org.bukkit.ChatColor; | ||
import org.bukkit.command.Command; | ||
import org.bukkit.command.CommandSender; | ||
|
||
public class BanIpCommand extends VanillaCommand { | ||
public BanIpCommand() { | ||
super("ban-ip"); | ||
this.description = "Prevents the specified IP address from using this server"; | ||
this.usageMessage = "/ban-ip <address>"; | ||
this.setPermission("bukkit.command.ban.ip"); | ||
} | ||
|
||
@Override | ||
public boolean execute(CommandSender sender, String currentAlias, String[] args) { | ||
if (!testPermission(sender)) return true; | ||
if (args.length != 1) { | ||
sender.sendMessage(ChatColor.RED + "Usage: " + usageMessage); | ||
return false; | ||
} | ||
|
||
Bukkit.getServer().banIP(args[0]); | ||
Command.broadcastCommandMessage(sender, "Banning ip " + args[0]); | ||
|
||
return true; | ||
} | ||
|
||
@Override | ||
public boolean matches(String input) { | ||
return input.startsWith("ban-ip ") || input.equalsIgnoreCase("ban-ip"); | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
src/main/java/org/bukkit/command/defaults/DeopCommand.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,42 @@ | ||
package org.bukkit.command.defaults; | ||
|
||
import org.bukkit.Bukkit; | ||
import org.bukkit.ChatColor; | ||
import org.bukkit.OfflinePlayer; | ||
import org.bukkit.command.Command; | ||
import org.bukkit.command.CommandSender; | ||
import org.bukkit.entity.Player; | ||
|
||
public class DeopCommand extends VanillaCommand { | ||
public DeopCommand() { | ||
super("deop"); | ||
this.description = "Takes the specified player's operator status"; | ||
this.usageMessage = "/deop <player>"; | ||
this.setPermission("bukkit.command.op.take"); | ||
} | ||
|
||
@Override | ||
public boolean execute(CommandSender sender, String currentAlias, String[] args) { | ||
if (!testPermission(sender)) return true; | ||
if (args.length != 1) { | ||
sender.sendMessage(ChatColor.RED + "Usage: " + usageMessage); | ||
return false; | ||
} | ||
|
||
Command.broadcastCommandMessage(sender, "De-opping " + args[0]); | ||
|
||
OfflinePlayer player = Bukkit.getServer().getOfflinePlayer(args[0]); | ||
player.setOp(false); | ||
|
||
if (player instanceof Player) { | ||
((Player)player).sendMessage(ChatColor.YELLOW + "You are no longer op!"); | ||
} | ||
|
||
return true; | ||
} | ||
|
||
@Override | ||
public boolean matches(String input) { | ||
return input.startsWith("deop ") || input.equalsIgnoreCase("deop"); | ||
} | ||
} |
Oops, something went wrong.