mirror of
https://github.com/essentials/Essentials.git
synced 2025-08-17 12:01:20 +02:00
Cleanup and more API work
This commit is contained in:
@@ -9,7 +9,6 @@ import java.net.URL;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.*;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.regex.Pattern;
|
||||
import net.ess3.api.IEssentials;
|
||||
import net.ess3.api.II18n;
|
||||
|
@@ -6,13 +6,11 @@ import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Locale;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import static net.ess3.I18n._;
|
||||
import net.ess3.api.IEssentials;
|
||||
import net.ess3.api.IJails;
|
||||
import net.ess3.api.IUser;
|
||||
import net.ess3.storage.AsyncStorageObjectHolder;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
@@ -106,7 +104,14 @@ public class Jails extends AsyncStorageObjectHolder<net.ess3.settings.Jails> imp
|
||||
@Override
|
||||
public int getCount()
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
try
|
||||
{
|
||||
return getList().size();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@@ -1,7 +1,8 @@
|
||||
package net.ess3;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.regex.Pattern;
|
||||
import static net.ess3.I18n._;
|
||||
|
||||
import net.ess3.api.IEssentials;
|
||||
import net.ess3.api.IUser;
|
||||
import net.ess3.bukkit.Enchantments;
|
||||
@@ -11,8 +12,6 @@ import net.ess3.utils.Util;
|
||||
import net.ess3.utils.textreader.BookInput;
|
||||
import net.ess3.utils.textreader.BookPager;
|
||||
import net.ess3.utils.textreader.IText;
|
||||
import java.util.*;
|
||||
import java.util.regex.Pattern;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.FireworkEffect;
|
||||
|
@@ -5,7 +5,6 @@ import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
import net.ess3.utils.Util;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
|
@@ -7,45 +7,51 @@ import org.bukkit.Location;
|
||||
public interface IJails extends IReload
|
||||
{
|
||||
/**
|
||||
* Used to get the location of a jail with the given name
|
||||
*
|
||||
* @param jailName
|
||||
* @return
|
||||
* @throws Exception
|
||||
* @param jailName the name of the jail to get
|
||||
* @return the location of the jail
|
||||
* @throws Exception if the jail does not exist
|
||||
*/
|
||||
Location getJail(String jailName) throws Exception;
|
||||
|
||||
/**
|
||||
* Used to get a list of jails by name
|
||||
*
|
||||
* @return
|
||||
* @return a list of jails
|
||||
* @throws Exception
|
||||
*/
|
||||
Collection<String> getList() throws Exception;
|
||||
|
||||
/**
|
||||
* Used to get the number of jails set
|
||||
*
|
||||
* @return
|
||||
* @return the number of jails
|
||||
*/
|
||||
int getCount();
|
||||
|
||||
/**
|
||||
* Used to remove a jail
|
||||
*
|
||||
* @param jail
|
||||
* @param jail the name of the jail to remove
|
||||
* @throws Exception
|
||||
*/
|
||||
void removeJail(String jail) throws Exception;
|
||||
|
||||
/**
|
||||
* Used to send a user to jail
|
||||
*
|
||||
* @param user
|
||||
* @param jail
|
||||
* @param user the user to send to jail
|
||||
* @param jail the name of the jail to send them to
|
||||
* @throws Exception
|
||||
*/
|
||||
void sendToJail(IUser user, String jail) throws Exception;
|
||||
|
||||
/**
|
||||
* Used to set a jail
|
||||
*
|
||||
* @param jailName
|
||||
* @param loc
|
||||
* @param jailName the name for the jail
|
||||
* @param loc the location to set the jail at
|
||||
* @throws Exception
|
||||
*/
|
||||
void setJail(String jailName, Location loc) throws Exception;
|
||||
|
@@ -8,47 +8,53 @@ import net.ess3.settings.Kit;
|
||||
public interface IKits extends IReload
|
||||
{
|
||||
/**
|
||||
* Used to get a kit by name
|
||||
*
|
||||
* @param kit
|
||||
* @return
|
||||
* @throws Exception
|
||||
* @param kit the name of the kit to get
|
||||
* @return the kit
|
||||
* @throws Exception if the kit does not exist or is improperly defined (due to broken config formatting)
|
||||
*/
|
||||
Kit getKit(String kit) throws Exception;
|
||||
|
||||
/**
|
||||
* Sends a kit to a user
|
||||
*
|
||||
* @param user
|
||||
* @param kit
|
||||
* @throws Exception
|
||||
* @param user the user to send the kit to
|
||||
* @param kit the kit to send
|
||||
* @throws Exception if the user cannot afford the kit
|
||||
*/
|
||||
void sendKit(IUser user, String kit) throws Exception;
|
||||
|
||||
/**
|
||||
* Sends a kit to a user
|
||||
*
|
||||
* @param user
|
||||
* @param kit
|
||||
* @throws Exception
|
||||
* @param user the user to send the kit to
|
||||
* @param kit the kit to send
|
||||
* @throws Exception if the user cannot afford the kit
|
||||
*/
|
||||
void sendKit(IUser user, Kit kit) throws Exception;
|
||||
|
||||
/**
|
||||
* Used to get a list of kits by name
|
||||
*
|
||||
* @return
|
||||
* @return the list of kits
|
||||
* @throws Exception
|
||||
*/
|
||||
Collection<String> getList() throws Exception;
|
||||
|
||||
/**
|
||||
* Used to check if the list of kits is empty
|
||||
*
|
||||
* @return
|
||||
* @return true if the list is empty, false if not
|
||||
*/
|
||||
boolean isEmpty();
|
||||
|
||||
/**
|
||||
* Used to check kit delay for cooldowns
|
||||
*
|
||||
* @param user
|
||||
* @param kit
|
||||
* @throws NoChargeException
|
||||
* @param user the user to check
|
||||
* @param kit the kit to check
|
||||
* @throws NoChargeException if the kit cannot be used **TODO: use a better exception here**
|
||||
*/
|
||||
void checkTime(final IUser user, Kit kit) throws NoChargeException;
|
||||
}
|
||||
|
@@ -1,8 +1,7 @@
|
||||
package net.ess3.commands;
|
||||
|
||||
import static net.ess3.I18n._;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import static net.ess3.I18n._;
|
||||
import net.ess3.MetaItemStack;
|
||||
import net.ess3.api.ISettings;
|
||||
import net.ess3.api.IUser;
|
||||
|
@@ -2,10 +2,8 @@ package net.ess3.commands;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import static net.ess3.I18n._;
|
||||
import net.ess3.api.*;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.*;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@@ -5,7 +5,6 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.regex.Pattern;
|
||||
import static net.ess3.I18n._;
|
||||
import net.ess3.api.IEssentials;
|
||||
|
@@ -6,7 +6,6 @@ import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.util.logging.Level;
|
||||
import net.ess3.api.IEssentials;
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
|
||||
public abstract class AbstractDelayedYamlFileReader<T extends StorageObject> implements Runnable
|
||||
|
@@ -6,7 +6,6 @@ import java.io.PrintWriter;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
import java.util.logging.Level;
|
||||
import net.ess3.api.IEssentials;
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
|
||||
public abstract class AbstractDelayedYamlFileWriter implements Runnable
|
||||
|
@@ -5,7 +5,6 @@ import java.io.FileNotFoundException;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.logging.Level;
|
||||
import net.ess3.api.IEssentials;
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
|
||||
public abstract class AsyncStorageObjectHolder<T extends StorageObject> implements IStorageObjectHolder<T>
|
||||
|
@@ -407,8 +407,7 @@ public class BukkitConstructor extends Constructor
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new YAMLException(
|
||||
"Cannot create property=" + key + " for JavaBean=" + object + "; " + e.getMessage(), e);
|
||||
throw new YAMLException("Cannot create property=" + key + " for JavaBean=" + object + "; " + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
return object;
|
||||
|
@@ -3,7 +3,6 @@ package net.ess3.utils.textreader;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import static net.ess3.I18n._;
|
||||
import net.ess3.api.IEssentials;
|
||||
import net.ess3.api.ISettings;
|
||||
|
@@ -1,7 +1,5 @@
|
||||
package net.ess3;
|
||||
|
||||
import net.ess3.api.IUser;
|
||||
|
||||
|
||||
public class UserTest extends EssentialsTest
|
||||
{
|
||||
|
Reference in New Issue
Block a user