Code cleanup and stricter visibility of methods/variables
This commit is contained in:
parent
4ea6f59c49
commit
f69d1c41e6
|
@ -25,6 +25,7 @@ import org.bukkit.command.CommandSender;
|
|||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.permissions.Permission;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||
|
@ -364,6 +365,8 @@ public final class AreaShop extends JavaPlugin implements AreaShopInterface {
|
|||
debug = false;
|
||||
ready = false;
|
||||
updater = null;
|
||||
|
||||
HandlerList.unregisterAll(this);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -399,7 +402,7 @@ public final class AreaShop extends JavaPlugin implements AreaShopInterface {
|
|||
languageFolder,
|
||||
getConfig().getString("language"),
|
||||
"EN",
|
||||
getChatPrefix()
|
||||
chatprefix
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -488,14 +491,6 @@ public final class AreaShop extends JavaPlugin implements AreaShopInterface {
|
|||
return null;
|
||||
}
|
||||
return economy.getProvider();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current chatPrefix
|
||||
* @return The current chatPrefix
|
||||
*/
|
||||
public List<String> getChatPrefix() {
|
||||
return chatprefix;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -525,7 +520,7 @@ public final class AreaShop extends JavaPlugin implements AreaShopInterface {
|
|||
/**
|
||||
* Register dynamic permissions controlled by config settings
|
||||
*/
|
||||
public void registerDynamicPermissions() {
|
||||
private void registerDynamicPermissions() {
|
||||
// Register limit groups of amount of regions a player can have
|
||||
ConfigurationSection section = getConfig().getConfigurationSection("limitGroups");
|
||||
if(section == null) {
|
||||
|
|
|
@ -19,10 +19,6 @@ import java.util.List;
|
|||
import java.util.TreeSet;
|
||||
|
||||
public class AddCommand extends CommandAreaShop {
|
||||
|
||||
public AddCommand(AreaShop plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandStart() {
|
||||
|
@ -117,9 +113,8 @@ public class AddCommand extends CommandAreaShop {
|
|||
private TreeSet<GeneralRegion> regionsAlready = new TreeSet<>();
|
||||
private TreeSet<String> namesBlacklisted = new TreeSet<>();
|
||||
private TreeSet<String> namesNoPermission = new TreeSet<>();
|
||||
private TreeSet<String> namesExternal = new TreeSet<>();
|
||||
|
||||
@Override
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
for(int i=0; i<plugin.getConfig().getInt("adding.regionsPerTick"); i++) {
|
||||
if(current < finalRegions.size()) {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package me.wiefferink.areashop.commands;
|
||||
|
||||
import me.wiefferink.areashop.AreaShop;
|
||||
import me.wiefferink.areashop.regions.BuyRegion;
|
||||
import me.wiefferink.areashop.regions.GeneralRegion;
|
||||
import me.wiefferink.areashop.regions.RentRegion;
|
||||
|
@ -14,10 +13,6 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
public class AddfriendCommand extends CommandAreaShop {
|
||||
|
||||
public AddfriendCommand(AreaShop plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandStart() {
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package me.wiefferink.areashop.commands;
|
||||
|
||||
import com.sk89q.worldedit.bukkit.selections.CuboidSelection;
|
||||
import me.wiefferink.areashop.AreaShop;
|
||||
import me.wiefferink.areashop.features.SignsFeature;
|
||||
import me.wiefferink.areashop.regions.GeneralRegion;
|
||||
import me.wiefferink.areashop.tools.Utils;
|
||||
|
@ -17,10 +16,6 @@ import java.util.List;
|
|||
import java.util.Set;
|
||||
|
||||
public class AddsignCommand extends CommandAreaShop {
|
||||
|
||||
public AddsignCommand(AreaShop plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandStart() {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package me.wiefferink.areashop.commands;
|
||||
|
||||
import me.wiefferink.areashop.AreaShop;
|
||||
import me.wiefferink.areashop.regions.BuyRegion;
|
||||
import me.wiefferink.areashop.tools.Utils;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
@ -10,10 +9,6 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
public class BuyCommand extends CommandAreaShop {
|
||||
|
||||
public BuyCommand(AreaShop plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandStart() {
|
||||
|
|
|
@ -11,16 +11,15 @@ import java.util.List;
|
|||
* Abstract class for generalising command classes
|
||||
*/
|
||||
public abstract class CommandAreaShop {
|
||||
AreaShop plugin;
|
||||
|
||||
|
||||
AreaShop plugin = AreaShop.getInstance();
|
||||
|
||||
/**
|
||||
* Save the instance of the main plugin class
|
||||
* @param plugin The main plugin
|
||||
* Check if this Command instance can execute the given command and arguments
|
||||
* @param command The command to check for execution
|
||||
* @param args The arguments to check
|
||||
* @return true if it can execute the command, false otherwise
|
||||
*/
|
||||
public CommandAreaShop(AreaShop plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
public boolean canExecute(Command command, String[] args) {
|
||||
String commandString = command.getName();
|
||||
for(String argument : args) {
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package me.wiefferink.areashop.commands;
|
||||
|
||||
import com.sk89q.worldedit.bukkit.selections.Selection;
|
||||
import me.wiefferink.areashop.AreaShop;
|
||||
import me.wiefferink.areashop.regions.BuyRegion;
|
||||
import me.wiefferink.areashop.regions.GeneralRegion;
|
||||
import me.wiefferink.areashop.regions.RentRegion;
|
||||
|
@ -14,10 +13,6 @@ import java.util.List;
|
|||
import java.util.TreeSet;
|
||||
|
||||
public class DelCommand extends CommandAreaShop {
|
||||
|
||||
public DelCommand(AreaShop plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandStart() {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package me.wiefferink.areashop.commands;
|
||||
|
||||
import me.wiefferink.areashop.AreaShop;
|
||||
import me.wiefferink.areashop.regions.BuyRegion;
|
||||
import me.wiefferink.areashop.regions.GeneralRegion;
|
||||
import me.wiefferink.areashop.regions.RentRegion;
|
||||
|
@ -15,10 +14,6 @@ import java.util.List;
|
|||
|
||||
public class DelfriendCommand extends CommandAreaShop {
|
||||
|
||||
public DelfriendCommand(AreaShop plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandStart() {
|
||||
return "areashop delfriend";
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package me.wiefferink.areashop.commands;
|
||||
|
||||
import me.wiefferink.areashop.AreaShop;
|
||||
import me.wiefferink.areashop.features.SignsFeature;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
|
@ -12,10 +11,6 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
public class DelsignCommand extends CommandAreaShop {
|
||||
|
||||
public DelsignCommand(AreaShop plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandStart() {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package me.wiefferink.areashop.commands;
|
||||
|
||||
import me.wiefferink.areashop.AreaShop;
|
||||
import me.wiefferink.areashop.regions.BuyRegion;
|
||||
import me.wiefferink.areashop.regions.RegionGroup;
|
||||
import me.wiefferink.areashop.regions.RentRegion;
|
||||
|
@ -14,10 +13,6 @@ import java.util.List;
|
|||
import java.util.Random;
|
||||
|
||||
public class FindCommand extends CommandAreaShop {
|
||||
|
||||
public FindCommand(AreaShop plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandStart() {
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package me.wiefferink.areashop.commands;
|
||||
|
||||
import com.sk89q.worldedit.bukkit.selections.Selection;
|
||||
import me.wiefferink.areashop.AreaShop;
|
||||
import me.wiefferink.areashop.regions.GeneralRegion;
|
||||
import me.wiefferink.areashop.regions.RegionGroup;
|
||||
import me.wiefferink.areashop.tools.Utils;
|
||||
|
@ -13,10 +12,6 @@ import java.util.List;
|
|||
import java.util.TreeSet;
|
||||
|
||||
public class GroupaddCommand extends CommandAreaShop {
|
||||
|
||||
public GroupaddCommand(AreaShop plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandStart() {
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package me.wiefferink.areashop.commands;
|
||||
|
||||
import com.sk89q.worldedit.bukkit.selections.Selection;
|
||||
import me.wiefferink.areashop.AreaShop;
|
||||
import me.wiefferink.areashop.regions.GeneralRegion;
|
||||
import me.wiefferink.areashop.regions.RegionGroup;
|
||||
import me.wiefferink.areashop.tools.Utils;
|
||||
|
@ -13,10 +12,6 @@ import java.util.List;
|
|||
import java.util.TreeSet;
|
||||
|
||||
public class GroupdelCommand extends CommandAreaShop {
|
||||
|
||||
public GroupdelCommand(AreaShop plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandStart() {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package me.wiefferink.areashop.commands;
|
||||
|
||||
import me.wiefferink.areashop.AreaShop;
|
||||
import me.wiefferink.areashop.regions.RegionGroup;
|
||||
import me.wiefferink.areashop.tools.Utils;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
@ -10,10 +9,6 @@ import java.util.List;
|
|||
|
||||
public class GroupinfoCommand extends CommandAreaShop {
|
||||
|
||||
public GroupinfoCommand(AreaShop plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandStart() {
|
||||
return "areashop groupinfo";
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package me.wiefferink.areashop.commands;
|
||||
|
||||
import me.wiefferink.areashop.AreaShop;
|
||||
import me.wiefferink.areashop.tools.Utils;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
|
@ -8,10 +7,6 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
public class GrouplistCommand extends CommandAreaShop {
|
||||
|
||||
public GrouplistCommand(AreaShop plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandStart() {
|
||||
|
|
|
@ -1,13 +1,8 @@
|
|||
package me.wiefferink.areashop.commands;
|
||||
|
||||
import me.wiefferink.areashop.AreaShop;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
public class HelpCommand extends CommandAreaShop {
|
||||
|
||||
public HelpCommand(AreaShop plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandStart() {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package me.wiefferink.areashop.commands;
|
||||
|
||||
import me.wiefferink.areashop.AreaShop;
|
||||
import me.wiefferink.areashop.regions.BuyRegion;
|
||||
import me.wiefferink.areashop.regions.GeneralRegion;
|
||||
import me.wiefferink.areashop.regions.RegionGroup;
|
||||
|
@ -15,10 +14,6 @@ import java.util.*;
|
|||
|
||||
public class InfoCommand extends CommandAreaShop {
|
||||
|
||||
public InfoCommand(AreaShop plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandStart() {
|
||||
return "areashop info";
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package me.wiefferink.areashop.commands;
|
||||
|
||||
import me.wiefferink.areashop.AreaShop;
|
||||
import me.wiefferink.interactivemessenger.processing.Message;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -10,10 +9,6 @@ import java.util.List;
|
|||
import java.util.Set;
|
||||
|
||||
public class LinksignsCommand extends CommandAreaShop {
|
||||
|
||||
public LinksignsCommand(AreaShop plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandStart() {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package me.wiefferink.areashop.commands;
|
||||
|
||||
import me.wiefferink.areashop.AreaShop;
|
||||
import me.wiefferink.areashop.regions.BuyRegion;
|
||||
import me.wiefferink.areashop.regions.GeneralRegion;
|
||||
import me.wiefferink.areashop.regions.RentRegion;
|
||||
|
@ -16,10 +15,6 @@ import java.util.List;
|
|||
import java.util.Set;
|
||||
|
||||
public class MeCommand extends CommandAreaShop {
|
||||
|
||||
public MeCommand(AreaShop plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandStart() {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package me.wiefferink.areashop.commands;
|
||||
|
||||
import me.wiefferink.areashop.AreaShop;
|
||||
import me.wiefferink.areashop.tools.Utils;
|
||||
import me.wiefferink.interactivemessenger.processing.Message;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
@ -13,10 +12,6 @@ import java.util.List;
|
|||
|
||||
public class MessageCommand extends CommandAreaShop {
|
||||
|
||||
public MessageCommand(AreaShop plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandStart() {
|
||||
return "areashop message";
|
||||
|
|
|
@ -1,14 +1,9 @@
|
|||
package me.wiefferink.areashop.commands;
|
||||
|
||||
import me.wiefferink.areashop.AreaShop;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
public class ReloadCommand extends CommandAreaShop {
|
||||
|
||||
public ReloadCommand(AreaShop plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandStart() {
|
||||
return "areashop reload";
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package me.wiefferink.areashop.commands;
|
||||
|
||||
import me.wiefferink.areashop.AreaShop;
|
||||
import me.wiefferink.areashop.regions.RentRegion;
|
||||
import me.wiefferink.areashop.tools.Utils;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
@ -10,10 +9,6 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
public class RentCommand extends CommandAreaShop {
|
||||
|
||||
public RentCommand(AreaShop plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandStart() {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package me.wiefferink.areashop.commands;
|
||||
|
||||
import me.wiefferink.areashop.AreaShop;
|
||||
import me.wiefferink.areashop.regions.BuyRegion;
|
||||
import me.wiefferink.areashop.tools.Utils;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
@ -10,10 +9,6 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
public class ResellCommand extends CommandAreaShop {
|
||||
|
||||
public ResellCommand(AreaShop plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandStart() {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package me.wiefferink.areashop.commands;
|
||||
|
||||
import me.wiefferink.areashop.AreaShop;
|
||||
import me.wiefferink.areashop.regions.BuyRegion;
|
||||
import me.wiefferink.areashop.regions.GeneralRegion;
|
||||
import me.wiefferink.areashop.regions.RentRegion;
|
||||
|
@ -13,10 +12,6 @@ import java.util.List;
|
|||
|
||||
public class SchematiceventCommand extends CommandAreaShop {
|
||||
|
||||
public SchematiceventCommand(AreaShop plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandStart() {
|
||||
return "areashop schemevent";
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package me.wiefferink.areashop.commands;
|
||||
|
||||
import me.wiefferink.areashop.AreaShop;
|
||||
import me.wiefferink.areashop.regions.BuyRegion;
|
||||
import me.wiefferink.areashop.regions.GeneralRegion;
|
||||
import me.wiefferink.areashop.tools.Utils;
|
||||
|
@ -12,10 +11,6 @@ import java.util.List;
|
|||
|
||||
public class SellCommand extends CommandAreaShop {
|
||||
|
||||
public SellCommand(AreaShop plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandStart() {
|
||||
return "areashop sell";
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package me.wiefferink.areashop.commands;
|
||||
|
||||
import me.wiefferink.areashop.AreaShop;
|
||||
import me.wiefferink.areashop.regions.RentRegion;
|
||||
import me.wiefferink.areashop.tools.Utils;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
@ -11,10 +10,6 @@ import java.util.List;
|
|||
|
||||
public class SetdurationCommand extends CommandAreaShop {
|
||||
|
||||
public SetdurationCommand(AreaShop plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandStart() {
|
||||
return "areashop setduration";
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package me.wiefferink.areashop.commands;
|
||||
|
||||
import me.wiefferink.areashop.AreaShop;
|
||||
import me.wiefferink.areashop.regions.GeneralRegion;
|
||||
import me.wiefferink.areashop.tools.Utils;
|
||||
import org.bukkit.Bukkit;
|
||||
|
@ -12,10 +11,6 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
public class SetlandlordCommand extends CommandAreaShop {
|
||||
|
||||
public SetlandlordCommand(AreaShop plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandStart() {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package me.wiefferink.areashop.commands;
|
||||
|
||||
import me.wiefferink.areashop.AreaShop;
|
||||
import me.wiefferink.areashop.regions.BuyRegion;
|
||||
import me.wiefferink.areashop.regions.GeneralRegion;
|
||||
import me.wiefferink.areashop.regions.RentRegion;
|
||||
|
@ -16,10 +15,6 @@ import java.util.List;
|
|||
import java.util.UUID;
|
||||
|
||||
public class SetownerCommand extends CommandAreaShop {
|
||||
|
||||
public SetownerCommand(AreaShop plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandStart() {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package me.wiefferink.areashop.commands;
|
||||
|
||||
import me.wiefferink.areashop.AreaShop;
|
||||
import me.wiefferink.areashop.regions.BuyRegion;
|
||||
import me.wiefferink.areashop.regions.GeneralRegion;
|
||||
import me.wiefferink.areashop.regions.RentRegion;
|
||||
|
@ -13,10 +12,6 @@ import java.util.List;
|
|||
|
||||
public class SetpriceCommand extends CommandAreaShop {
|
||||
|
||||
public SetpriceCommand(AreaShop plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandStart() {
|
||||
return "areashop setprice";
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package me.wiefferink.areashop.commands;
|
||||
|
||||
import me.wiefferink.areashop.AreaShop;
|
||||
import me.wiefferink.areashop.regions.GeneralRegion;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
|
@ -8,10 +7,6 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
public class SetrestoreCommand extends CommandAreaShop {
|
||||
|
||||
public SetrestoreCommand(AreaShop plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandStart() {
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package me.wiefferink.areashop.commands;
|
||||
|
||||
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
|
||||
import me.wiefferink.areashop.AreaShop;
|
||||
import me.wiefferink.areashop.regions.BuyRegion;
|
||||
import me.wiefferink.areashop.regions.GeneralRegion;
|
||||
import me.wiefferink.areashop.regions.RentRegion;
|
||||
|
@ -13,10 +12,6 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
public class SetteleportCommand extends CommandAreaShop {
|
||||
|
||||
public SetteleportCommand(AreaShop plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandStart() {
|
||||
|
|
|
@ -21,10 +21,6 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
public class StackCommand extends CommandAreaShop {
|
||||
|
||||
public StackCommand(AreaShop plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandStart() {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package me.wiefferink.areashop.commands;
|
||||
|
||||
import me.wiefferink.areashop.AreaShop;
|
||||
import me.wiefferink.areashop.regions.BuyRegion;
|
||||
import me.wiefferink.areashop.tools.Utils;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
@ -11,10 +10,6 @@ import java.util.List;
|
|||
|
||||
public class StopresellCommand extends CommandAreaShop {
|
||||
|
||||
public StopresellCommand(AreaShop plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandStart() {
|
||||
return "areashop stopresell";
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package me.wiefferink.areashop.commands;
|
||||
|
||||
import me.wiefferink.areashop.AreaShop;
|
||||
import me.wiefferink.areashop.regions.GeneralRegion;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -9,10 +8,6 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
public class TeleportCommand extends CommandAreaShop {
|
||||
|
||||
public TeleportCommand(AreaShop plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandStart() {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package me.wiefferink.areashop.commands;
|
||||
|
||||
import me.wiefferink.areashop.AreaShop;
|
||||
import me.wiefferink.areashop.regions.GeneralRegion;
|
||||
import me.wiefferink.areashop.regions.RentRegion;
|
||||
import me.wiefferink.areashop.tools.Utils;
|
||||
|
@ -11,10 +10,6 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
public class UnrentCommand extends CommandAreaShop {
|
||||
|
||||
public UnrentCommand(AreaShop plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandStart() {
|
||||
|
|
|
@ -10,7 +10,6 @@ import java.util.UUID;
|
|||
*/
|
||||
public class UnrentedRegionEvent extends NotifyRegionEvent<RentRegion> {
|
||||
|
||||
private RentRegion region;
|
||||
private UUID oldRenter;
|
||||
private double refundedMoney;
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ public class SignsFeature extends RegionFeature {
|
|||
ConfigurationSection signSection = region.getConfig().getConfigurationSection("general.signs");
|
||||
if(signSection != null) {
|
||||
for(String signKey : signSection.getKeys(false)) {
|
||||
RegionSign sign = new RegionSign(region, this, signKey);
|
||||
RegionSign sign = new RegionSign(region, signKey);
|
||||
Location location = sign.getLocation();
|
||||
if(location == null) {
|
||||
AreaShop.warn("Sign with key "+signKey+" of region "+region.getName()+" does not have a proper location");
|
||||
|
@ -62,7 +62,7 @@ public class SignsFeature extends RegionFeature {
|
|||
* @param location The location to get the key for
|
||||
* @return A string to use in a map for a location
|
||||
*/
|
||||
public static String locationToString(Location location) {
|
||||
private static String locationToString(Location location) {
|
||||
return location.getWorld().getName()+";"+location.getBlockX()+";"+location.getBlockY()+";"+location.getBlockZ();
|
||||
}
|
||||
|
||||
|
@ -136,7 +136,7 @@ public class SignsFeature extends RegionFeature {
|
|||
region.setSetting(signPath+"profile", profile);
|
||||
}
|
||||
// Add to the map
|
||||
RegionSign sign = new RegionSign(region, this, i+"");
|
||||
RegionSign sign = new RegionSign(region, i + "");
|
||||
signs.put(sign.getStringLocation(), sign);
|
||||
allSigns.put(sign.getStringLocation(), sign);
|
||||
}
|
||||
|
@ -172,12 +172,10 @@ public class SignsFeature extends RegionFeature {
|
|||
public class RegionSign {
|
||||
|
||||
private GeneralRegion region;
|
||||
private SignsFeature signsFeature;
|
||||
private String key;
|
||||
|
||||
public RegionSign(GeneralRegion region, SignsFeature signsFeature, String key) {
|
||||
public RegionSign(GeneralRegion region, String key) {
|
||||
this.region = region;
|
||||
this.signsFeature = signsFeature;
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ public class WorldGuardRegionFlagsFeature extends RegionFeature {
|
|||
* @param region The region to update the flags for
|
||||
* @return true if the flags have been set correctly, otherwise false
|
||||
*/
|
||||
protected boolean updateRegionFlags(GeneralRegion region) {
|
||||
private boolean updateRegionFlags(GeneralRegion region) {
|
||||
boolean result = true;
|
||||
|
||||
// Get section defining the region flag profile
|
||||
|
@ -37,14 +37,12 @@ public class WorldGuardRegionFlagsFeature extends RegionFeature {
|
|||
}
|
||||
|
||||
// Region flags for all states
|
||||
String allPath = "flagProfiles."+region.getStringSetting("general.flagProfile")+".ALL";
|
||||
ConfigurationSection allFlags = flagProfileSection.getConfigurationSection("ALL");
|
||||
if(allFlags != null) {
|
||||
result = result && updateRegionFlags(region, allFlags);
|
||||
}
|
||||
|
||||
// Region flags for the current state
|
||||
String specificPath = "flagProfiles."+region.getStringSetting("general.flagProfile")+"."+region.getState().getValue();
|
||||
ConfigurationSection stateFlags = flagProfileSection.getConfigurationSection(region.getState().getValue());
|
||||
if(stateFlags != null) {
|
||||
result = result && updateRegionFlags(region, stateFlags);
|
||||
|
@ -58,7 +56,7 @@ public class WorldGuardRegionFlagsFeature extends RegionFeature {
|
|||
* @param flags The flags to apply
|
||||
* @return true if the flags have been set correctly, otherwise false
|
||||
*/
|
||||
protected boolean updateRegionFlags(GeneralRegion region, ConfigurationSection flags) {
|
||||
private boolean updateRegionFlags(GeneralRegion region, ConfigurationSection flags) {
|
||||
boolean result = true;
|
||||
|
||||
Set<String> flagNames = flags.getKeys(false);
|
||||
|
@ -188,7 +186,7 @@ public class WorldGuardRegionFlagsFeature extends RegionFeature {
|
|||
* @param message The message where the color codes should be translated (this message has bukkit color codes)
|
||||
* @return The string with the WorldGuard color codes
|
||||
*/
|
||||
public String translateBukkitToWorldGuardColors(String message) {
|
||||
private String translateBukkitToWorldGuardColors(String message) {
|
||||
String result = message;
|
||||
result = result.replace("&c", "&r");
|
||||
result = result.replace("&4", "&R");
|
||||
|
|
|
@ -19,38 +19,38 @@ public class CommandManager extends Manager implements CommandExecutor, TabCompl
|
|||
*/
|
||||
public CommandManager() {
|
||||
commands = new ArrayList<>();
|
||||
commands.add(new HelpCommand(plugin));
|
||||
commands.add(new RentCommand(plugin));
|
||||
commands.add(new UnrentCommand(plugin));
|
||||
commands.add(new BuyCommand(plugin));
|
||||
commands.add(new SellCommand(plugin));
|
||||
commands.add(new MeCommand(plugin));
|
||||
commands.add(new InfoCommand(plugin));
|
||||
commands.add(new TeleportCommand(plugin));
|
||||
commands.add(new SetteleportCommand(plugin));
|
||||
commands.add(new AddfriendCommand(plugin));
|
||||
commands.add(new DelfriendCommand(plugin));
|
||||
commands.add(new FindCommand(plugin));
|
||||
commands.add(new ResellCommand(plugin));
|
||||
commands.add(new StopresellCommand(plugin));
|
||||
commands.add(new SetrestoreCommand(plugin));
|
||||
commands.add(new SetpriceCommand(plugin));
|
||||
commands.add(new SetownerCommand(plugin));
|
||||
commands.add(new SetdurationCommand(plugin));
|
||||
commands.add(new ReloadCommand(plugin));
|
||||
commands.add(new GroupaddCommand(plugin));
|
||||
commands.add(new GroupdelCommand(plugin));
|
||||
commands.add(new GrouplistCommand(plugin));
|
||||
commands.add(new GroupinfoCommand(plugin));
|
||||
commands.add(new SchematiceventCommand(plugin));
|
||||
commands.add(new AddCommand(plugin));
|
||||
commands.add(new DelCommand(plugin));
|
||||
commands.add(new AddsignCommand(plugin));
|
||||
commands.add(new DelsignCommand(plugin));
|
||||
commands.add(new LinksignsCommand(plugin));
|
||||
commands.add(new StackCommand(plugin));
|
||||
commands.add(new SetlandlordCommand(plugin));
|
||||
commands.add(new MessageCommand(plugin));
|
||||
commands.add(new HelpCommand());
|
||||
commands.add(new RentCommand());
|
||||
commands.add(new UnrentCommand());
|
||||
commands.add(new BuyCommand());
|
||||
commands.add(new SellCommand());
|
||||
commands.add(new MeCommand());
|
||||
commands.add(new InfoCommand());
|
||||
commands.add(new TeleportCommand());
|
||||
commands.add(new SetteleportCommand());
|
||||
commands.add(new AddfriendCommand());
|
||||
commands.add(new DelfriendCommand());
|
||||
commands.add(new FindCommand());
|
||||
commands.add(new ResellCommand());
|
||||
commands.add(new StopresellCommand());
|
||||
commands.add(new SetrestoreCommand());
|
||||
commands.add(new SetpriceCommand());
|
||||
commands.add(new SetownerCommand());
|
||||
commands.add(new SetdurationCommand());
|
||||
commands.add(new ReloadCommand());
|
||||
commands.add(new GroupaddCommand());
|
||||
commands.add(new GroupdelCommand());
|
||||
commands.add(new GrouplistCommand());
|
||||
commands.add(new GroupinfoCommand());
|
||||
commands.add(new SchematiceventCommand());
|
||||
commands.add(new AddCommand());
|
||||
commands.add(new DelCommand());
|
||||
commands.add(new AddsignCommand());
|
||||
commands.add(new DelsignCommand());
|
||||
commands.add(new LinksignsCommand());
|
||||
commands.add(new StackCommand());
|
||||
commands.add(new SetlandlordCommand());
|
||||
commands.add(new MessageCommand());
|
||||
|
||||
// Register commands in bukkit
|
||||
plugin.getCommand("AreaShop").setExecutor(this);
|
||||
|
@ -139,9 +139,7 @@ public class CommandManager extends Manager implements CommandExecutor, TabCompl
|
|||
} else {
|
||||
String[] start = new String[args.length];
|
||||
start[0] = command.getName();
|
||||
for(int i=1; i<args.length; i++) {
|
||||
start[i] = args[i-1];
|
||||
}
|
||||
System.arraycopy(args, 0, start, 1, args.length - 1);
|
||||
for(CommandAreaShop c : commands) {
|
||||
if(c.canExecute(command, args)) {
|
||||
result = c.getTabCompleteList(toCompleteNumber, start, sender);
|
||||
|
|
|
@ -27,7 +27,6 @@ import java.util.regex.Matcher;
|
|||
import java.util.regex.Pattern;
|
||||
|
||||
public class FileManager extends Manager {
|
||||
private static FileManager instance = null;
|
||||
|
||||
private HashMap<String, GeneralRegion> regions = null;
|
||||
private String regionsPath = null;
|
||||
|
@ -101,10 +100,6 @@ public class FileManager extends Manager {
|
|||
// GETTERS
|
||||
//////////////////////////////////////////////////////////
|
||||
|
||||
public AreaShop getPlugin() {
|
||||
return plugin;
|
||||
}
|
||||
|
||||
public String getSchematicFolder() {
|
||||
return schemFolder;
|
||||
}
|
||||
|
|
|
@ -636,20 +636,6 @@ public class Utils {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a start of the message with a maximum length
|
||||
* @param message The message
|
||||
* @param maximumLength The maximum length to return
|
||||
* @return The start of the message with at most maximumLength characters
|
||||
*/
|
||||
public static String getMessageStart(Message message, int maximumLength) {
|
||||
String messageStart = "";
|
||||
for(int i = 0; i < message.getRaw().size() && messageStart.length() < maximumLength; i++) {
|
||||
messageStart += message.getRaw().get(i).substring(0, Math.min(maximumLength, message.getRaw().get(i).length()));
|
||||
}
|
||||
return messageStart.substring(0, Math.min(maximumLength, messageStart.length()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse a time setting that could be seconds or a duration string
|
||||
* @param input The string to parse
|
||||
|
|
Loading…
Reference in New Issue