mirror of
https://github.com/amalthea-mc/ShopChest.git
synced 2024-12-23 01:21:47 +00:00
Removed some unnecessary extra lines
This commit is contained in:
parent
558741e587
commit
5f5fd05e6c
@ -42,54 +42,33 @@ public class Commands extends BukkitCommand {
|
||||
register.invoke(cmdmap, command.getName(),command);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean execute(CommandSender sender, String label, String[] args) {
|
||||
|
||||
if (sender instanceof Player) {
|
||||
|
||||
if (sender instanceof Player) {
|
||||
Player p = (Player) sender;
|
||||
|
||||
if (args.length == 0) {
|
||||
|
||||
sendBasicHelpMessage(p);
|
||||
return true;
|
||||
|
||||
} else {
|
||||
|
||||
if (args[0].equalsIgnoreCase("create")) {
|
||||
|
||||
if (perm.has(p, "shopchest.create")) {
|
||||
|
||||
if (args.length == 4) {
|
||||
|
||||
create(args, ShopType.NORMAL, p);
|
||||
return true;
|
||||
|
||||
|
||||
return true;
|
||||
} else if (args.length == 5) {
|
||||
|
||||
if (args[4].equalsIgnoreCase("infinite")) {
|
||||
|
||||
if (perm.has(p, "shopchest.create.infinite")) {
|
||||
|
||||
create(args, ShopType.INFINITE, p);
|
||||
return true;
|
||||
|
||||
} else {
|
||||
|
||||
p.sendMessage(Config.noPermission_createInfinite());
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
} else if (args[4].equalsIgnoreCase("normal")){
|
||||
|
||||
create(args, ShopType.NORMAL, p);
|
||||
return true;
|
||||
|
||||
} else if (args[4].equalsIgnoreCase("admin")) {
|
||||
|
||||
if (perm.has(p, "shopchest.create.admin")) {
|
||||
create(args, ShopType.ADMIN, p);
|
||||
return true;
|
||||
@ -97,41 +76,25 @@ public class Commands extends BukkitCommand {
|
||||
p.sendMessage(Config.noPermission_createAdmin());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
sendBasicHelpMessage(p);
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
sendBasicHelpMessage(p);
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
p.sendMessage(Config.noPermission_create());
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
} else if (args[0].equalsIgnoreCase("remove")) {
|
||||
|
||||
remove(p);
|
||||
return true;
|
||||
|
||||
} else if (args[0].equalsIgnoreCase("info")) {
|
||||
|
||||
info(p);
|
||||
return true;
|
||||
|
||||
} else if (args[0].equalsIgnoreCase("reload")) {
|
||||
|
||||
if (perm.has(p, "shopchest.reload")) {
|
||||
reload(p);
|
||||
return true;
|
||||
@ -139,9 +102,7 @@ public class Commands extends BukkitCommand {
|
||||
p.sendMessage(Config.noPermission_reload());
|
||||
return true;
|
||||
}
|
||||
|
||||
} else if (args[0].equalsIgnoreCase("update")) {
|
||||
|
||||
if (perm.has(p, "shopchest.update")) {
|
||||
checkUpdates(p);
|
||||
return true;
|
||||
@ -149,37 +110,29 @@ public class Commands extends BukkitCommand {
|
||||
p.sendMessage(Config.noPermission_update());
|
||||
return true;
|
||||
}
|
||||
|
||||
} else if (args[0].equalsIgnoreCase("limits")) {
|
||||
|
||||
if (perm.has(p, "shopchest.limits")) {
|
||||
p.sendMessage(Config.occupied_shop_slots(ShopUtils.getShopLimit(p), ShopUtils.getShopAmount(p)));
|
||||
return true;
|
||||
} else {
|
||||
p.sendMessage(Config.noPermission_limits());
|
||||
}
|
||||
|
||||
} else {
|
||||
sendBasicHelpMessage(p);
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
Bukkit.getConsoleSender().sendMessage(ChatColor.RED + "Only players can execute this command.");
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void checkUpdates(Player player) {
|
||||
|
||||
player.sendMessage(Config.checking_update());
|
||||
|
||||
UpdateChecker uc = new UpdateChecker(ShopChest.getInstance(), ShopChest.getInstance().getDescription().getWebsite());
|
||||
@ -220,9 +173,7 @@ public class Commands extends BukkitCommand {
|
||||
}
|
||||
|
||||
private void reload(Player player) {
|
||||
|
||||
ShopChest.utils.reload(player);
|
||||
|
||||
ShopChest.utils.reload(player);
|
||||
}
|
||||
|
||||
private void create(String[] args, ShopType shopType, Player p) {
|
||||
@ -311,7 +262,6 @@ public class Commands extends BukkitCommand {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ItemStack itemStack = new ItemStack(p.getItemInHand().getType(), amount, p.getItemInHand().getDurability());
|
||||
itemStack.setItemMeta(p.getItemInHand().getItemMeta());
|
||||
@ -339,14 +289,12 @@ public class Commands extends BukkitCommand {
|
||||
}
|
||||
|
||||
private void sendBasicHelpMessage(Player player) {
|
||||
|
||||
player.sendMessage(ChatColor.GREEN + "/" + Config.main_command_name() + " create <amount> <buy-price> <sell-price> [infinite|normal|admin] - " + Config.cmdDesc_create());
|
||||
player.sendMessage(ChatColor.GREEN + "/" + Config.main_command_name() + " remove - " + Config.cmdDesc_remove());
|
||||
player.sendMessage(ChatColor.GREEN + "/" + Config.main_command_name() + " info - " + Config.cmdDesc_info());
|
||||
player.sendMessage(ChatColor.GREEN + "/" + Config.main_command_name() + " reload - " + Config.cmdDesc_reload());
|
||||
player.sendMessage(ChatColor.GREEN + "/" + Config.main_command_name() + " update - " + Config.cmdDesc_update());
|
||||
player.sendMessage(ChatColor.GREEN + "/" + Config.main_command_name() + " limits - " + Config.cmdDesc_limits());
|
||||
|
||||
player.sendMessage(ChatColor.GREEN + "/" + Config.main_command_name() + " limits - " + Config.cmdDesc_limits());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -66,7 +66,6 @@ public class ShopChest extends JavaPlugin{
|
||||
|
||||
|
||||
private boolean setupEconomy() {
|
||||
|
||||
RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class);
|
||||
if (rsp == null) {
|
||||
return false;
|
||||
@ -84,8 +83,7 @@ public class ShopChest extends JavaPlugin{
|
||||
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
|
||||
public void onEnable() {
|
||||
logger = getLogger();
|
||||
|
||||
if (getServer().getPluginManager().getPlugin("Vault") == null) {
|
||||
@ -144,7 +142,6 @@ public class ShopChest extends JavaPlugin{
|
||||
}
|
||||
|
||||
return value;
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
@ -259,19 +256,15 @@ public class ShopChest extends JavaPlugin{
|
||||
getServer().getPluginManager().registerEvents(new ItemCustomNameListener(), this);
|
||||
|
||||
if (getServer().getPluginManager().getPlugin("ClearLag") != null) getServer().getPluginManager().registerEvents(new RegenerateShopItemAfterRemove(), this);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
|
||||
utils.removeShops();
|
||||
|
||||
}
|
||||
|
||||
private void initializeShops() {
|
||||
|
||||
int count = 0;
|
||||
|
||||
for (int id = 1; id < sqlite.getHighestID() + 1; id++) {
|
||||
@ -290,7 +283,6 @@ public class ShopChest extends JavaPlugin{
|
||||
}
|
||||
|
||||
logger.info("Initialized " + String.valueOf(count) + " Shops");
|
||||
|
||||
}
|
||||
|
||||
public static void copy(InputStream in, File file) {
|
||||
@ -298,9 +290,11 @@ public class ShopChest extends JavaPlugin{
|
||||
OutputStream out = new FileOutputStream(file);
|
||||
byte[] buf = new byte[1024];
|
||||
int len;
|
||||
|
||||
while((len=in.read(buf))>0){
|
||||
out.write(buf,0,len);
|
||||
}
|
||||
|
||||
out.close();
|
||||
in.close();
|
||||
} catch (Exception e) {
|
||||
|
Loading…
Reference in New Issue
Block a user