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);
return;
}
user.setGodModeEnabled(!user.isGodModeEnabled());
godPlayer(user, !user.isGodModeEnabled());
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)
{
for (Player matchPlayer : server.matchPlayer(args[0]))
@ -47,29 +57,24 @@ public class Commandgod extends EssentialsCommand
continue;
}
boolean enabled;
if (args.length > 1)
{
if (args[1].contains("on") || args[1].contains("ena") || args[1].equalsIgnoreCase("1"))
{
player.setGodModeEnabled(true);
enabled = true;
}
else
{
player.setGodModeEnabled(false);
enabled = false;
}
}
else
{
player.setGodModeEnabled(!player.isGodModeEnabled());
}
final boolean enabled = player.isGodModeEnabled();
if (enabled)
{
player.setHealth(player.getMaxHealth());
player.setFoodLevel(20);
enabled = !player.isGodModeEnabled();
}
godPlayer(player, enabled);
player.sendMessage(_("godMode", (enabled ? _("enabled") : _("disabled"))));
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!
# 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]...
# 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.
# For more information, visit http://wiki.ess3.net/wiki/Command_Reference/ICheat#kits
# For more information, visit http://wiki.ess3.net/wiki/Kits
kits:
tools:
delay: 10

View File

@ -397,17 +397,12 @@ public class GroupManager extends JavaPlugin {
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
if (sender instanceof Player) {
senderPlayer = (Player) sender;
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;
}
@ -1975,8 +1970,8 @@ public class GroupManager extends JavaPlugin {
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 + "Groups: " + dataHolder.getGroupsFile().getAbsolutePath());
sender.sendMessage(ChatColor.YELLOW + "Users: " + dataHolder.getUsersFile().getAbsolutePath());
sender.sendMessage(ChatColor.YELLOW + "Groups:" + ChatColor.GREEN + " " + dataHolder.getGroupsFile().getAbsolutePath());
sender.sendMessage(ChatColor.YELLOW + "Users:" + ChatColor.GREEN + " " + dataHolder.getUsersFile().getAbsolutePath());
return true;

View File

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

View File

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