Skip to content

Commit

Permalink
Adjust command usage and description information.
Browse files Browse the repository at this point in the history
  • Loading branch information
nickperkins committed Oct 31, 2013
1 parent b82a286 commit 4125616
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 16 deletions.
4 changes: 2 additions & 2 deletions src/main/java/net/lethargiclion/informaban/InformaBan.java
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ public void onEnable() {
PluginCommand ipban = getCommand("ipban");
if (ipban != null) {
ipban.setExecutor(commandExecutor);
ipban.setDescription(messages.getString("command.ban.description"));
ipban.setUsage(messages.getString("command.ban.usage"));
ipban.setDescription(messages.getString("command.ipban.description"));
ipban.setUsage(messages.getString("command.ipban.usage"));
} else
log.warning(msgFailed.format(new Object[] { "/ban" }));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ private boolean commandRap(CommandSender sender, String[] args) {
if (ipaddress != null) {
List<Event> ipevents = plugin.getDatabase().find(Event.class).where()
.disjunction()
.eq("subject", ipaddress)
.eq("subjectIP", ipaddress)
.findList();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public boolean apply(ResourceBundle messages, String subject,

Player[] players = Bukkit.getOnlinePlayers();
for (Player p: players) {
if (p.getAddress().getHostString().equals(subject)) {
if (p.getAddress().getAddress().getHostAddress().equals(subject)) {
p.kickPlayer(StringUtils.join(message, '\n'));
}
}
Expand Down
19 changes: 12 additions & 7 deletions src/main/java/net/lethargiclion/informaban/events/Unban.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;

import com.google.common.net.InetAddresses;

@Entity()
@DiscriminatorValue("UNBAN")
public class Unban extends Event {

public Unban() {
}


public Unban() {}

public boolean apply(ActiveBan ban,
CommandSender enforcer, String reason) {

Expand All @@ -25,11 +26,15 @@ public boolean apply(ActiveBan ban,
// Record details
super.apply(ban.subject, enforcer, reason);

// Record as unbanned - since banned player must be offline
Bukkit.getOfflinePlayer(ban.subject).setBanned(false);
if (InetAddresses.isInetAddress(ban.subject)) {
Bukkit.unbanIP(ban.subject);
} else {
// Record as unbanned - since banned player must be offline
Bukkit.getOfflinePlayer(ban.subject).setBanned(false);
}
return true;
}

@Override
public String toString() {
return String.format("%s: %s unbanned %s: %s",
Expand Down
14 changes: 8 additions & 6 deletions src/main/resources/Messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ command.ib.usage = Usage: /ib reload
command.kick.description = Kicks a player from the server.
command.kick.usage = Usage: /kick <player> <reason>
command.ban.description = Bans a player from the server.
command.ban.usage = Usage: /ban <player> <time> <reason>
command.unban.description = Unbans a player from the server.
command.unban.usage = Usage: /unban <player> <reason>
command.ban.usage = Usage: /ban <player> <reason>
command.ipban.description = Bans an IP from the server.
command.ipban.usage = Usage: /ipban <player|ip> <reason>
command.unban.description = Unbans a player or IP from the server.
command.unban.usage = Usage: /unban <player|ip> <reason>
command.rap.description = Displays a user's "rap sheet", showing their kick/ban history.
command.rap.usage = Usage: /rap <player>
command.rap.usage = Usage: /rap <player|ip>

command.kick.reasonRequired = You must provide a kick reason.
command.kick.consoleLog = {0} kicked {1} from the server.
Expand All @@ -23,8 +25,8 @@ command.ban.consoleLog = {0} banned {1} from the server.
command.unban.reasonRequired = You must provide an unban reason.
command.unban.consoleLog = {0} unbanned {1} from the server.
command.rap.clean = There is nothing recorded for {0}.
command.rap.ban = Bans for player {0}.
command.rap.ip = Bans matching players IP {0}.
command.rap.ban = Bans for {0}.
command.rap.ip = Bans matching IP {0}.
error.playerNotFound = Could not find that player.
error.playerNotBanned = That player is not currently banned.
error.IPAlreadyBanned = That IP is already banned.
Expand Down

0 comments on commit 4125616

Please sign in to comment.