mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-04-22 11:19:49 +00:00
fix whois and add /delkit
This commit is contained in:
parent
1ed4cabf53
commit
af47cb46b3
6 changed files with 73 additions and 3 deletions
|
@ -79,6 +79,12 @@ public class Kits implements IConf {
|
|||
config.save();
|
||||
}
|
||||
|
||||
public void deleteKit(String name) {
|
||||
config.removeProperty("kits." + name);
|
||||
kits = _getKits();
|
||||
config.save();
|
||||
}
|
||||
|
||||
public String listKits(final net.ess3.api.IEssentials ess, final User user) throws Exception {
|
||||
try {
|
||||
final ConfigurationSection kits = config.getConfigurationSection("kits");
|
||||
|
|
|
@ -778,7 +778,7 @@ public class User extends UserData implements Comparable<User>, IMessageRecipien
|
|||
|
||||
@Override
|
||||
public boolean isIgnoreExempt() {
|
||||
return this.isAuthorized("essentials.chat.ignoreexempt");
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isRecipeSee() {
|
||||
|
|
|
@ -58,7 +58,7 @@ public class Commandcreatekit extends EssentialsCommand {
|
|||
|
||||
// Command handler will auto fail if this fails.
|
||||
long delay = Long.valueOf(args[1]);
|
||||
String kitname = args[0];
|
||||
String kitname = args[0].toLowerCase();
|
||||
ItemStack[] items = user.getBase().getInventory().getContents();
|
||||
List<String> list = new ArrayList<>();
|
||||
for (ItemStack is : items) {
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
package com.earth2me.essentials.commands;
|
||||
|
||||
import com.earth2me.essentials.CommandSource;
|
||||
import com.earth2me.essentials.User;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Server;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
|
||||
public class Commanddelkit extends EssentialsCommand {
|
||||
|
||||
public Commanddelkit() {
|
||||
super("delkit");
|
||||
}
|
||||
|
||||
// /delkit <name>
|
||||
@Override
|
||||
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception {
|
||||
if (args.length != 1) {
|
||||
throw new NotEnoughArgumentsException();
|
||||
}
|
||||
|
||||
String name = String.join(" ", args).toLowerCase();
|
||||
|
||||
if (ess.getKits().getKits().getKeys(false).contains(name))
|
||||
{
|
||||
ess.getKits().deleteKit(name);
|
||||
user.sendMessage(ChatColor.GOLD + "Deleted kit " + ChatColor.RED + name + ChatColor.GOLD + ".");
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception(tl("kitNotFound"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<String> getTabCompleteOptions(final Server server, final CommandSource sender, final String commandLabel, final String[] args) {
|
||||
if (args.length == 1) {
|
||||
try {
|
||||
return new ArrayList<>(ess.getKits().getKits().getKeys(false));
|
||||
} catch (Exception e) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
} else {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -46,7 +46,7 @@ public class Commandwhois extends EssentialsCommand {
|
|||
if (!ess.getSettings().isEcoDisabled()) {
|
||||
sender.sendMessage(tl("whoisMoney", NumberUtil.displayCurrency(user.getMoney(), ess)));
|
||||
}
|
||||
if (!sender.isPlayer() || getTFMHandler().isAdmin(user)) {
|
||||
if (!sender.isPlayer() || getTFMHandler().isAdmin(sender.getPlayer())) {
|
||||
sender.sendMessage(tl("whoisIPAddress", user.getBase().getAddress().getAddress().toString()));
|
||||
}
|
||||
final String location = user.getGeoLocation();
|
||||
|
|
|
@ -56,6 +56,10 @@ commands:
|
|||
description: Describes your current bearing.
|
||||
usage: /<command>
|
||||
aliases: [ecompass,direction,edirection]
|
||||
createkit:
|
||||
description: Create a kit in game!
|
||||
usage: /<command> <kitname> <delay>
|
||||
aliases: [kitcreate,createk,kc,ck]
|
||||
customtext:
|
||||
description: Allows you to create custom text commands.
|
||||
usage: /<alias> - Define in bukkit.yml
|
||||
|
@ -63,6 +67,10 @@ commands:
|
|||
description: Removes a home.
|
||||
usage: /<command> [player:]<name>
|
||||
aliases: [edelhome,remhome,eremhome,rmhome,ermhome]
|
||||
delkit:
|
||||
description: Delete a kit in game!
|
||||
usage: /<command> <kitname>
|
||||
aliases: [kitdelete,deletek,dc,dk,deletekit]
|
||||
delwarp:
|
||||
description: Deletes the specified warp.
|
||||
usage: /<command> <warp>
|
||||
|
@ -143,6 +151,10 @@ commands:
|
|||
description: Views a list of available commands.
|
||||
usage: /<command> [search term] [page]
|
||||
aliases: [ehelp]
|
||||
ignore:
|
||||
description: Ignore or unignore other players.
|
||||
usage: /<command> <player>
|
||||
aliases: [eignore,unignore,eunignore,delignore,edelignore,remignore,eremignore,rmignore,ermignore]
|
||||
home:
|
||||
description: Teleport to your home.
|
||||
usage: /<command> [player:][name]
|
||||
|
|
Loading…
Reference in a new issue