This commit is contained in:
GunfighterJ 2013-02-09 16:27:19 -06:00
commit 03b115d4c3
5 changed files with 33 additions and 23 deletions

View file

@ -33,10 +33,20 @@ public class Commandgod extends EssentialsCommand
godOtherPlayers(server, user, args); godOtherPlayers(server, user, args);
return; return;
} }
user.setGodModeEnabled(!user.isGodModeEnabled()); godPlayer(user, !user.isGodModeEnabled());
user.sendMessage(_("godMode", (user.isGodModeEnabled() ? _("enabled") : _("disabled")))); user.sendMessage(_("godMode", (user.isGodModeEnabled() ? _("enabled") : _("disabled"))));
} }
private void godPlayer(User player, boolean enabled)
{
player.setGodModeEnabled(enabled);
if (enabled)
{
player.setHealth(player.getMaxHealth());
player.setFoodLevel(20);
}
}
private void godOtherPlayers(final Server server, final CommandSender sender, final String[] args) private void godOtherPlayers(final Server server, final CommandSender sender, final String[] args)
{ {
for (Player matchPlayer : server.matchPlayer(args[0])) for (Player matchPlayer : server.matchPlayer(args[0]))
@ -47,29 +57,24 @@ public class Commandgod extends EssentialsCommand
continue; continue;
} }
boolean enabled;
if (args.length > 1) if (args.length > 1)
{ {
if (args[1].contains("on") || args[1].contains("ena") || args[1].equalsIgnoreCase("1")) if (args[1].contains("on") || args[1].contains("ena") || args[1].equalsIgnoreCase("1"))
{ {
player.setGodModeEnabled(true); enabled = true;
} }
else else
{ {
player.setGodModeEnabled(false); enabled = false;
} }
} }
else else
{ {
player.setGodModeEnabled(!player.isGodModeEnabled()); enabled = !player.isGodModeEnabled();
}
final boolean enabled = player.isGodModeEnabled();
if (enabled)
{
player.setHealth(player.getMaxHealth());
player.setFoodLevel(20);
} }
godPlayer(player, enabled);
player.sendMessage(_("godMode", (enabled ? _("enabled") : _("disabled")))); player.sendMessage(_("godMode", (enabled ? _("enabled") : _("disabled"))));
sender.sendMessage(_("godMode", _(enabled ? "godEnabledFor" : "godDisabledFor", matchPlayer.getDisplayName()))); sender.sendMessage(_("godMode", _(enabled ? "godEnabledFor" : "godDisabledFor", matchPlayer.getDisplayName())));
} }

View file

@ -206,9 +206,9 @@ player-commands:
# Note: All items MUST be followed by a quantity! # Note: All items MUST be followed by a quantity!
# All kit names should be lower case, and will be treated as lower in permissions/costs. # All kit names should be lower case, and will be treated as lower in permissions/costs.
# Syntax: - itemID[:DataValue/Durability] Amount [Enchantment:Level].. [itemmeta:value]... # Syntax: - itemID[:DataValue/Durability] Amount [Enchantment:Level].. [itemmeta:value]...
# For Item meta information visit http://wiki.ess3.net/wiki/Command_Reference/ICheat#itemmeta # For Item meta information visit http://wiki.ess3.net/wiki/Item_Meta
# 'delay' refers to the cooldown between how often you can use each kit, measured in seconds. # 'delay' refers to the cooldown between how often you can use each kit, measured in seconds.
# For more information, visit http://wiki.ess3.net/wiki/Command_Reference/ICheat#kits # For more information, visit http://wiki.ess3.net/wiki/Kits
kits: kits:
tools: tools:
delay: 10 delay: 10

View file

@ -397,17 +397,12 @@ public class GroupManager extends JavaPlugin {
return true; return true;
} }
if (sender.getClass().getName().equals("org.bukkit.craftbukkit.command.CraftBlockCommandSender")) {
sender.sendMessage(ChatColor.RED + "GM Commands can not be called from CommandBlocks");
return true;
}
// DETERMINING PLAYER INFORMATION // DETERMINING PLAYER INFORMATION
if (sender instanceof Player) { if (sender instanceof Player) {
senderPlayer = (Player) sender; senderPlayer = (Player) sender;
if (!lastError.isEmpty() && !commandLabel.equalsIgnoreCase("manload")) { if (!lastError.isEmpty() && !commandLabel.equalsIgnoreCase("manload")) {
GroupManager.logger.warning(ChatColor.RED + "All commands are locked due to an error. " + ChatColor.BOLD + "" + ChatColor.UNDERLINE + "Check the log" + ChatColor.RESET + "" + ChatColor.RED + " and then try a '/manload'."); sender.sendMessage(ChatColor.RED + "All commands are locked due to an error. " + ChatColor.BOLD + "" + ChatColor.UNDERLINE + "Check the log" + ChatColor.RESET + "" + ChatColor.RED + " and then try a '/manload'.");
return true; return true;
} }
@ -1975,8 +1970,8 @@ public class GroupManager extends JavaPlugin {
sender.sendMessage(ChatColor.YELLOW + "You have selected world '" + dataHolder.getName() + "'."); sender.sendMessage(ChatColor.YELLOW + "You have selected world '" + dataHolder.getName() + "'.");
sender.sendMessage(ChatColor.YELLOW + "This world is using the following data files.."); sender.sendMessage(ChatColor.YELLOW + "This world is using the following data files..");
sender.sendMessage(ChatColor.YELLOW + "Groups: " + dataHolder.getGroupsFile().getAbsolutePath()); sender.sendMessage(ChatColor.YELLOW + "Groups:" + ChatColor.GREEN + " " + dataHolder.getGroupsFile().getAbsolutePath());
sender.sendMessage(ChatColor.YELLOW + "Users: " + dataHolder.getUsersFile().getAbsolutePath()); sender.sendMessage(ChatColor.YELLOW + "Users:" + ChatColor.GREEN + " " + dataHolder.getUsersFile().getAbsolutePath());
return true; return true;

View file

@ -42,6 +42,11 @@ public class GroupsDataHolder {
group.setDataSource(this.dataSource); group.setDataSource(this.dataSource);
} }
} }
public WorldDataHolder getDataSource() {
return this.dataSource;
}
/** /**
* @return the defaultGroup * @return the defaultGroup
@ -123,4 +128,4 @@ public class GroupsDataHolder {
this.timeStampGroups = timeStampGroups; this.timeStampGroups = timeStampGroups;
} }
} }

View file

@ -50,6 +50,11 @@ public class UsersDataHolder {
return users; return users;
} }
public WorldDataHolder getDataSource() {
return this.dataSource;
}
/** /**
* Resets the Users * Resets the Users
@ -106,4 +111,4 @@ public class UsersDataHolder {
this.timeStampUsers = timeStampUsers; this.timeStampUsers = timeStampUsers;
} }
} }