Reformatted Code
This commit is contained in:
@@ -29,7 +29,7 @@ public class AutoLeaveProcessTask extends BukkitRunnable {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!readyToGo) {
|
||||
if (! readyToGo) {
|
||||
return;
|
||||
}
|
||||
// this is set so it only does one iteration at a time, no matter how frequently the timer fires
|
||||
@@ -49,18 +49,18 @@ public class AutoLeaveProcessTask extends BukkitRunnable {
|
||||
FPlayer fplayer = iterator.next();
|
||||
|
||||
// Check if they should be exempt from this.
|
||||
if (!fplayer.willAutoLeave()) {
|
||||
SavageFactions.plugin.debug(Level.INFO, fplayer.getName() + " was going to be auto-removed but was set not to.");
|
||||
if (! fplayer.willAutoLeave()) {
|
||||
SavageFactions.plugin.debug(Level.INFO, fplayer.getName() + " was going to be auto-removed but was set not to.");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (fplayer.isOffline() && now - fplayer.getLastLoginTime() > toleranceMillis) {
|
||||
if (Conf.logFactionLeave || Conf.logFactionKick) {
|
||||
SavageFactions.plugin.log("Player " + fplayer.getName() + " was auto-removed due to inactivity.");
|
||||
SavageFactions.plugin.log("Player " + fplayer.getName() + " was auto-removed due to inactivity.");
|
||||
}
|
||||
|
||||
// if player is faction admin, sort out the faction since he's going away
|
||||
if (fplayer.getRole() == Role.LEADER) {
|
||||
if (fplayer.getRole() == Role.LEADER) {
|
||||
Faction faction = fplayer.getFaction();
|
||||
if (faction != null) {
|
||||
fplayer.getFaction().promoteNewLeader();
|
||||
|
||||
@@ -13,16 +13,16 @@ public class AutoLeaveTask implements Runnable {
|
||||
}
|
||||
|
||||
public synchronized void run() {
|
||||
if (task != null && !task.isFinished()) {
|
||||
if (task != null && ! task.isFinished()) {
|
||||
return;
|
||||
}
|
||||
|
||||
task = new AutoLeaveProcessTask();
|
||||
task.runTaskTimer(SavageFactions.plugin, 1, 1);
|
||||
task.runTaskTimer(SavageFactions.plugin, 1, 1);
|
||||
|
||||
// maybe setting has been changed? if so, restart this task at new rate
|
||||
if (this.rate != Conf.autoLeaveRoutineRunsEveryXMinutes) {
|
||||
SavageFactions.plugin.startAutoLeaveTask(true);
|
||||
SavageFactions.plugin.startAutoLeaveTask(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ public class ClipPlaceholderAPIManager extends PlaceholderExpansion implements R
|
||||
// Return the plugin version since this expansion is bundled with the dependency
|
||||
@Override
|
||||
public String getVersion() {
|
||||
return SavageFactions.plugin.getDescription().getVersion();
|
||||
return SavageFactions.plugin.getDescription().getVersion();
|
||||
}
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ public class ClipPlaceholderAPIManager extends PlaceholderExpansion implements R
|
||||
String humanized = DurationFormatUtils.formatDurationWords(System.currentTimeMillis() - fPlayer.getLastLoginTime(), true, true) + TL.COMMAND_STATUS_AGOSUFFIX;
|
||||
return fPlayer.isOnline() ? ChatColor.GREEN + TL.COMMAND_STATUS_ONLINE.toString() : (System.currentTimeMillis() - fPlayer.getLastLoginTime() < 432000000 ? ChatColor.YELLOW + humanized : ChatColor.RED + humanized);
|
||||
case "player_group":
|
||||
return SavageFactions.plugin.getPrimaryGroup(Bukkit.getOfflinePlayer(UUID.fromString(fPlayer.getId())));
|
||||
return SavageFactions.plugin.getPrimaryGroup(Bukkit.getOfflinePlayer(UUID.fromString(fPlayer.getId())));
|
||||
case "player_balance":
|
||||
return Econ.isSetup() ? Econ.getFriendlyBalance(fPlayer) : TL.ECON_OFF.format("balance");
|
||||
case "player_power":
|
||||
@@ -121,7 +121,7 @@ public class ClipPlaceholderAPIManager extends PlaceholderExpansion implements R
|
||||
case "faction_warps":
|
||||
return String.valueOf(faction.getWarps().size());
|
||||
case "faction_raidable":
|
||||
boolean raid = SavageFactions.plugin.getConfig().getBoolean("hcf.raidable", false) && faction.getLandRounded() >= faction.getPowerRounded();
|
||||
boolean raid = SavageFactions.plugin.getConfig().getBoolean("hcf.raidable", false) && faction.getLandRounded() >= faction.getPowerRounded();
|
||||
return raid ? TL.RAIDABLE_TRUE.toString() : TL.RAIDABLE_FALSE.toString();
|
||||
case "faction_home_world":
|
||||
return faction.hasHome() ? faction.getHome().getWorld().getName() : "";
|
||||
|
||||
@@ -37,13 +37,13 @@ public final class EnumTypeAdapter<T extends Enum<T>> extends TypeAdapter<T> {
|
||||
|
||||
public static <TT> TypeAdapterFactory newEnumTypeHierarchyFactory() {
|
||||
return new TypeAdapterFactory() {
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
@SuppressWarnings ({"rawtypes", "unchecked"})
|
||||
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> typeToken) {
|
||||
Class<? super T> rawType = typeToken.getRawType();
|
||||
if (!Enum.class.isAssignableFrom(rawType) || rawType == Enum.class) {
|
||||
if (! Enum.class.isAssignableFrom(rawType) || rawType == Enum.class) {
|
||||
return null;
|
||||
}
|
||||
if (!rawType.isEnum()) {
|
||||
if (! rawType.isEnum()) {
|
||||
rawType = rawType.getSuperclass(); // handle anonymous subclasses
|
||||
}
|
||||
return (TypeAdapter<T>) new EnumTypeAdapter(rawType);
|
||||
|
||||
@@ -17,7 +17,6 @@ public class InventoryTypeAdapter implements JsonSerializer<Inventory>, JsonDese
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Inventory deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext jsonDeserializationContext) {
|
||||
JsonObject object = jsonElement.getAsJsonObject();
|
||||
@@ -25,5 +24,4 @@ public class InventoryTypeAdapter implements JsonSerializer<Inventory>, JsonDese
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -12,90 +12,90 @@ import java.io.Serializable;
|
||||
*/
|
||||
|
||||
public class LazyLocation implements Serializable {
|
||||
private static final long serialVersionUID = - 6049901271320963314L;
|
||||
private transient Location location = null;
|
||||
private String worldName;
|
||||
private double x;
|
||||
private double y;
|
||||
private double z;
|
||||
private float pitch;
|
||||
private float yaw;
|
||||
private static final long serialVersionUID = - 6049901271320963314L;
|
||||
private transient Location location = null;
|
||||
private String worldName;
|
||||
private double x;
|
||||
private double y;
|
||||
private double z;
|
||||
private float pitch;
|
||||
private float yaw;
|
||||
|
||||
public LazyLocation(Location loc) {
|
||||
setLocation(loc);
|
||||
}
|
||||
|
||||
public LazyLocation(final String worldName, final double x, final double y, final double z) {
|
||||
this(worldName, x, y, z, 0, 0);
|
||||
}
|
||||
|
||||
public LazyLocation(final String worldName, final double x, final double y, final double z, final float yaw, final float pitch) {
|
||||
this.worldName = worldName;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
this.yaw = yaw;
|
||||
this.pitch = pitch;
|
||||
}
|
||||
|
||||
// This returns the actual Location
|
||||
public final Location getLocation() {
|
||||
// make sure Location is initialized before returning it
|
||||
initLocation();
|
||||
return location;
|
||||
}
|
||||
|
||||
// change the Location
|
||||
public final void setLocation(Location loc) {
|
||||
this.location = loc;
|
||||
this.worldName = loc.getWorld().getName();
|
||||
this.x = loc.getX();
|
||||
this.y = loc.getY();
|
||||
this.z = loc.getZ();
|
||||
this.yaw = loc.getYaw();
|
||||
this.pitch = loc.getPitch();
|
||||
}
|
||||
|
||||
|
||||
// This initializes the Location
|
||||
private void initLocation() {
|
||||
// if location is already initialized, simply return
|
||||
if (location != null) {
|
||||
return;
|
||||
public LazyLocation(Location loc) {
|
||||
setLocation(loc);
|
||||
}
|
||||
|
||||
// get World; hopefully it's initialized at this point
|
||||
World world = Bukkit.getWorld(worldName);
|
||||
if (world == null) {
|
||||
return;
|
||||
public LazyLocation(final String worldName, final double x, final double y, final double z) {
|
||||
this(worldName, x, y, z, 0, 0);
|
||||
}
|
||||
|
||||
// store the Location for future calls, and pass it on
|
||||
location = new Location(world, x, y, z, yaw, pitch);
|
||||
}
|
||||
public LazyLocation(final String worldName, final double x, final double y, final double z, final float yaw, final float pitch) {
|
||||
this.worldName = worldName;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
this.yaw = yaw;
|
||||
this.pitch = pitch;
|
||||
}
|
||||
|
||||
// This returns the actual Location
|
||||
public final Location getLocation() {
|
||||
// make sure Location is initialized before returning it
|
||||
initLocation();
|
||||
return location;
|
||||
}
|
||||
|
||||
// change the Location
|
||||
public final void setLocation(Location loc) {
|
||||
this.location = loc;
|
||||
this.worldName = loc.getWorld().getName();
|
||||
this.x = loc.getX();
|
||||
this.y = loc.getY();
|
||||
this.z = loc.getZ();
|
||||
this.yaw = loc.getYaw();
|
||||
this.pitch = loc.getPitch();
|
||||
}
|
||||
|
||||
|
||||
public final String getWorldName() {
|
||||
return worldName;
|
||||
}
|
||||
// This initializes the Location
|
||||
private void initLocation() {
|
||||
// if location is already initialized, simply return
|
||||
if (location != null) {
|
||||
return;
|
||||
}
|
||||
|
||||
public final double getX() {
|
||||
return x;
|
||||
}
|
||||
// get World; hopefully it's initialized at this point
|
||||
World world = Bukkit.getWorld(worldName);
|
||||
if (world == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
public final double getY() {
|
||||
return y;
|
||||
}
|
||||
// store the Location for future calls, and pass it on
|
||||
location = new Location(world, x, y, z, yaw, pitch);
|
||||
}
|
||||
|
||||
public final double getZ() {
|
||||
return z;
|
||||
}
|
||||
|
||||
public final double getPitch() {
|
||||
return pitch;
|
||||
}
|
||||
public final String getWorldName() {
|
||||
return worldName;
|
||||
}
|
||||
|
||||
public final double getYaw() {
|
||||
return yaw;
|
||||
}
|
||||
public final double getX() {
|
||||
return x;
|
||||
}
|
||||
|
||||
public final double getY() {
|
||||
return y;
|
||||
}
|
||||
|
||||
public final double getZ() {
|
||||
return z;
|
||||
}
|
||||
|
||||
public final double getPitch() {
|
||||
return pitch;
|
||||
}
|
||||
|
||||
public final double getYaw() {
|
||||
return yaw;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,35 +13,35 @@ public class LocationTypeAdapter implements JsonSerializer<Location>, JsonDeseri
|
||||
@Override
|
||||
public JsonElement serialize(Location location, Type type, JsonSerializationContext jsonSerializationContext) {
|
||||
JsonObject object = new JsonObject();
|
||||
try {
|
||||
object.add("x", new JsonPrimitive(location.getX()));
|
||||
object.add("y", new JsonPrimitive(location.getY()));
|
||||
object.add("z", new JsonPrimitive(location.getZ()));
|
||||
object.add("world", new JsonPrimitive(location.getWorld().toString()));
|
||||
return object;
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
SavageFactions.plugin.log(Level.WARNING, "Error encountered while serializing a Location.");
|
||||
return object;
|
||||
}
|
||||
try {
|
||||
object.add("x", new JsonPrimitive(location.getX()));
|
||||
object.add("y", new JsonPrimitive(location.getY()));
|
||||
object.add("z", new JsonPrimitive(location.getZ()));
|
||||
object.add("world", new JsonPrimitive(location.getWorld().toString()));
|
||||
return object;
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
SavageFactions.plugin.log(Level.WARNING, "Error encountered while serializing a Location.");
|
||||
return object;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Location deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext jsonDeserializationContext) {
|
||||
JsonObject object = jsonElement.getAsJsonObject();
|
||||
try {
|
||||
try {
|
||||
|
||||
return new Location(Bukkit.getWorld(object.get("world").getAsString()),
|
||||
object.get("x").getAsDouble(),
|
||||
object.get("y").getAsDouble(),
|
||||
object.get("z").getAsDouble());
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
SavageFactions.plugin.log(Level.WARNING, "Error encountered while" +
|
||||
" deserializing a Location.");
|
||||
return null;
|
||||
}
|
||||
return new Location(Bukkit.getWorld(object.get("world").getAsString()),
|
||||
object.get("x").getAsDouble(),
|
||||
object.get("y").getAsDouble(),
|
||||
object.get("z").getAsDouble());
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
SavageFactions.plugin.log(Level.WARNING, "Error encountered while" +
|
||||
" deserializing a Location.");
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ public class MapFLocToStringSetTypeAdapter implements JsonDeserializer<Map<FLoca
|
||||
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
SavageFactions.plugin.log(Level.WARNING, "Error encountered while deserializing a Map of FLocations to String Sets.");
|
||||
SavageFactions.plugin.log(Level.WARNING, "Error encountered while deserializing a Map of FLocations to String Sets.");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -86,7 +86,7 @@ public class MapFLocToStringSetTypeAdapter implements JsonDeserializer<Map<FLoca
|
||||
nameArray.add(nameElement);
|
||||
}
|
||||
|
||||
if (!obj.has(locWorld)) {
|
||||
if (! obj.has(locWorld)) {
|
||||
obj.add(locWorld, new JsonObject());
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ public class MapFLocToStringSetTypeAdapter implements JsonDeserializer<Map<FLoca
|
||||
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
SavageFactions.plugin.log(Level.WARNING, "Error encountered while serializing a Map of FLocations to String Sets.");
|
||||
SavageFactions.plugin.log(Level.WARNING, "Error encountered while serializing a Map of FLocations to String Sets.");
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ public class MiscUtil {
|
||||
new HashSet<>(Arrays.asList("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"));
|
||||
|
||||
public static EntityType creatureTypeFromEntity(Entity entity) {
|
||||
if (!(entity instanceof Creature)) {
|
||||
if (! (entity instanceof Creature)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ public class MiscUtil {
|
||||
}
|
||||
|
||||
for (char c : str.toCharArray()) {
|
||||
if (!substanceChars.contains(String.valueOf(c))) {
|
||||
if (! substanceChars.contains(String.valueOf(c))) {
|
||||
errors.add(SavageFactions.plugin.txt.parse(TL.GENERIC_FACTIONTAG_ALPHANUMERIC.toString(), c));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package com.massivecraft.factions.util;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public enum MultiversionMaterials {
|
||||
|
||||
ACACIA_BOAT("BOAT_ACACIA", 0),
|
||||
@@ -858,27 +858,21 @@ public enum MultiversionMaterials {
|
||||
ZOMBIE_VILLAGER_SPAWN_EGG("MONSTER_EGG", 0),
|
||||
ZOMBIE_WALL_HEAD("SKULL", 0),
|
||||
;
|
||||
static int newV = - 1;
|
||||
private static HashMap<String, MultiversionMaterials> cachedSearch = new HashMap<>();
|
||||
String m;
|
||||
int data;
|
||||
|
||||
MultiversionMaterials(String m, int data ){
|
||||
MultiversionMaterials(String m, int data) {
|
||||
this.m = m;
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public ItemStack parseItem(){
|
||||
Material mat = parseMaterial();
|
||||
if(isNewVersion()){
|
||||
return new ItemStack(mat);
|
||||
}
|
||||
return new ItemStack(mat,1,(byte) data);
|
||||
}
|
||||
static int newV = -1;
|
||||
public static boolean isNewVersion(){
|
||||
if(newV == 0) return false;
|
||||
if(newV == 1) return true;
|
||||
public static boolean isNewVersion() {
|
||||
if (newV == 0) return false;
|
||||
if (newV == 1) return true;
|
||||
Material mat = Material.matchMaterial("RED_WOOL");
|
||||
if(mat != null){
|
||||
if (mat != null) {
|
||||
newV = 1;
|
||||
return true;
|
||||
}
|
||||
@@ -886,43 +880,65 @@ public enum MultiversionMaterials {
|
||||
return false;
|
||||
}
|
||||
|
||||
private static HashMap<String, MultiversionMaterials> cachedSearch = new HashMap<>();
|
||||
public static MultiversionMaterials requestXMaterial(String name, byte data){
|
||||
if(cachedSearch.containsKey(name.toUpperCase()+","+data)){
|
||||
return cachedSearch.get(name.toUpperCase()+","+data);
|
||||
public static MultiversionMaterials requestXMaterial(String name, byte data) {
|
||||
if (cachedSearch.containsKey(name.toUpperCase() + "," + data)) {
|
||||
return cachedSearch.get(name.toUpperCase() + "," + data);
|
||||
}
|
||||
for(MultiversionMaterials mat:MultiversionMaterials.values()){
|
||||
if(name.toUpperCase().equals(mat.m) && ((byte)mat.data) == data){
|
||||
cachedSearch.put(mat.m+","+data,mat);
|
||||
for (MultiversionMaterials mat : MultiversionMaterials.values()) {
|
||||
if (name.toUpperCase().equals(mat.m) && ((byte) mat.data) == data) {
|
||||
cachedSearch.put(mat.m + "," + data, mat);
|
||||
return mat;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isSameMaterial(ItemStack comp){
|
||||
if(isNewVersion()){
|
||||
public static MultiversionMaterials fromString(String key) {
|
||||
MultiversionMaterials xmat = null;
|
||||
try {
|
||||
xmat = MultiversionMaterials.valueOf(key);
|
||||
return xmat;
|
||||
} catch (IllegalArgumentException e) {
|
||||
String[] split = key.split(":");
|
||||
if (split.length == 1) {
|
||||
xmat = requestXMaterial(key, (byte) 0);
|
||||
} else {
|
||||
xmat = requestXMaterial(split[0], (byte) Integer.parseInt(split[1]));
|
||||
}
|
||||
return xmat;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public ItemStack parseItem() {
|
||||
Material mat = parseMaterial();
|
||||
if (isNewVersion()) {
|
||||
return new ItemStack(mat);
|
||||
}
|
||||
return new ItemStack(mat, 1, (byte) data);
|
||||
}
|
||||
|
||||
public boolean isSameMaterial(ItemStack comp) {
|
||||
if (isNewVersion()) {
|
||||
return comp.getType() == this.parseMaterial();
|
||||
}
|
||||
if(comp.getType() == this.parseMaterial() &&
|
||||
(int) comp.getData().getData() == (int) this.data){
|
||||
if (comp.getType() == this.parseMaterial() &&
|
||||
(int) comp.getData().getData() == this.data) {
|
||||
return true;
|
||||
}
|
||||
MultiversionMaterials xmat = fromMaterial(comp.getType());
|
||||
if(isDamageable(xmat)){
|
||||
if(this.parseMaterial() == comp.getType()){
|
||||
return true;
|
||||
}
|
||||
if (isDamageable(xmat)) {
|
||||
return this.parseMaterial() == comp.getType();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public MultiversionMaterials fromMaterial(Material mat){
|
||||
try{
|
||||
public MultiversionMaterials fromMaterial(Material mat) {
|
||||
try {
|
||||
return MultiversionMaterials.valueOf(mat.toString());
|
||||
}catch(IllegalArgumentException e){
|
||||
for(MultiversionMaterials xmat:MultiversionMaterials.values()){
|
||||
if(xmat.m.equals(mat.toString())){
|
||||
} catch (IllegalArgumentException e) {
|
||||
for (MultiversionMaterials xmat : MultiversionMaterials.values()) {
|
||||
if (xmat.m.equals(mat.toString())) {
|
||||
return xmat;
|
||||
}
|
||||
}
|
||||
@@ -930,27 +946,10 @@ public enum MultiversionMaterials {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static MultiversionMaterials fromString(String key){
|
||||
MultiversionMaterials xmat = null;
|
||||
try{
|
||||
xmat = MultiversionMaterials.valueOf(key);
|
||||
return xmat;
|
||||
}catch(IllegalArgumentException e){
|
||||
String[] split = key.split(":");
|
||||
if(split.length == 1){
|
||||
xmat = requestXMaterial(key,(byte) 0);
|
||||
}else{
|
||||
xmat = requestXMaterial(split[0],(byte) Integer.parseInt(split[1]));
|
||||
}
|
||||
return xmat;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public boolean isDamageable(MultiversionMaterials type){
|
||||
public boolean isDamageable(MultiversionMaterials type) {
|
||||
String[] split = type.toString().split("_");
|
||||
int length = split.length;
|
||||
switch(split[length-1]){
|
||||
switch (split[length - 1]) {
|
||||
case "HELMET":
|
||||
return true;
|
||||
case "CHESTPLATE":
|
||||
@@ -984,9 +983,9 @@ public enum MultiversionMaterials {
|
||||
}
|
||||
}
|
||||
|
||||
public Material parseMaterial(){
|
||||
public Material parseMaterial() {
|
||||
Material mat = Material.matchMaterial(this.toString());
|
||||
if(mat != null){
|
||||
if (mat != null) {
|
||||
return mat;
|
||||
}
|
||||
return Material.matchMaterial(m);
|
||||
|
||||
@@ -32,7 +32,7 @@ public class MyLocationTypeAdapter implements JsonDeserializer<LazyLocation>, Js
|
||||
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
SavageFactions.plugin.log(Level.WARNING, "Error encountered while deserializing a LazyLocation.");
|
||||
SavageFactions.plugin.log(Level.WARNING, "Error encountered while deserializing a LazyLocation.");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -52,7 +52,7 @@ public class MyLocationTypeAdapter implements JsonDeserializer<LazyLocation>, Js
|
||||
return obj;
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
SavageFactions.plugin.log(Level.WARNING, "Error encountered while serializing a LazyLocation.");
|
||||
SavageFactions.plugin.log(Level.WARNING, "Error encountered while serializing a LazyLocation.");
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ public enum ParticleEffect {
|
||||
* <li>The speed value influences the velocity at which the particle flies off
|
||||
* </ul>
|
||||
*/
|
||||
EXPLOSION_NORMAL("explode", 0, -1, ParticleProperty.DIRECTIONAL),
|
||||
EXPLOSION_NORMAL("explode", 0, - 1, ParticleProperty.DIRECTIONAL),
|
||||
/**
|
||||
* A particle effect which is displayed by exploding ghast fireballs and wither skulls:
|
||||
* <ul>
|
||||
@@ -58,7 +58,7 @@ public enum ParticleEffect {
|
||||
* <li>The speed value slightly influences the size of this particle effect
|
||||
* </ul>
|
||||
*/
|
||||
EXPLOSION_LARGE("largeexplode", 1, -1),
|
||||
EXPLOSION_LARGE("largeexplode", 1, - 1),
|
||||
/**
|
||||
* A particle effect which is displayed by exploding tnt and creepers:
|
||||
* <ul>
|
||||
@@ -66,7 +66,7 @@ public enum ParticleEffect {
|
||||
* <li>The speed value has no influence on this particle effect
|
||||
* </ul>
|
||||
*/
|
||||
EXPLOSION_HUGE("hugeexplosion", 2, -1),
|
||||
EXPLOSION_HUGE("hugeexplosion", 2, - 1),
|
||||
/**
|
||||
* A particle effect which is displayed by launching fireworks:
|
||||
* <ul>
|
||||
@@ -74,7 +74,7 @@ public enum ParticleEffect {
|
||||
* <li>The speed value influences the velocity at which the particle flies off
|
||||
* </ul>
|
||||
*/
|
||||
FIREWORKS_SPARK("fireworksSpark", 3, -1, ParticleProperty.DIRECTIONAL),
|
||||
FIREWORKS_SPARK("fireworksSpark", 3, - 1, ParticleProperty.DIRECTIONAL),
|
||||
/**
|
||||
* A particle effect which is displayed by swimming entities and arrows in water:
|
||||
* <ul>
|
||||
@@ -82,7 +82,7 @@ public enum ParticleEffect {
|
||||
* <li>The speed value influences the velocity at which the particle flies off
|
||||
* </ul>
|
||||
*/
|
||||
WATER_BUBBLE("bubble", 4, -1, ParticleProperty.DIRECTIONAL, ParticleProperty.REQUIRES_WATER),
|
||||
WATER_BUBBLE("bubble", 4, - 1, ParticleProperty.DIRECTIONAL, ParticleProperty.REQUIRES_WATER),
|
||||
/**
|
||||
* A particle effect which is displayed by swimming entities and shaking wolves:
|
||||
* <ul>
|
||||
@@ -90,7 +90,7 @@ public enum ParticleEffect {
|
||||
* <li>The speed value has no influence on this particle effect
|
||||
* </ul>
|
||||
*/
|
||||
WATER_SPLASH("splash", 5, -1, ParticleProperty.DIRECTIONAL),
|
||||
WATER_SPLASH("splash", 5, - 1, ParticleProperty.DIRECTIONAL),
|
||||
/**
|
||||
* A particle effect which is displayed on water when fishing:
|
||||
* <ul>
|
||||
@@ -106,7 +106,7 @@ public enum ParticleEffect {
|
||||
* <li>The speed value has no influence on this particle effect
|
||||
* </ul>
|
||||
*/
|
||||
SUSPENDED("suspended", 7, -1, ParticleProperty.REQUIRES_WATER),
|
||||
SUSPENDED("suspended", 7, - 1, ParticleProperty.REQUIRES_WATER),
|
||||
/**
|
||||
* A particle effect which is displayed by air when close to bedrock and the in the void:
|
||||
* <ul>
|
||||
@@ -114,7 +114,7 @@ public enum ParticleEffect {
|
||||
* <li>The speed value has no influence on this particle effect
|
||||
* </ul>
|
||||
*/
|
||||
SUSPENDED_DEPTH("depthSuspend", 8, -1, ParticleProperty.DIRECTIONAL),
|
||||
SUSPENDED_DEPTH("depthSuspend", 8, - 1, ParticleProperty.DIRECTIONAL),
|
||||
/**
|
||||
* A particle effect which is displayed when landing a critical hit and by arrows:
|
||||
* <ul>
|
||||
@@ -122,7 +122,7 @@ public enum ParticleEffect {
|
||||
* <li>The speed value influences the velocity at which the particle flies off
|
||||
* </ul>
|
||||
*/
|
||||
CRIT("crit", 9, -1, ParticleProperty.DIRECTIONAL),
|
||||
CRIT("crit", 9, - 1, ParticleProperty.DIRECTIONAL),
|
||||
/**
|
||||
* A particle effect which is displayed when landing a hit with an enchanted weapon:
|
||||
* <ul>
|
||||
@@ -130,7 +130,7 @@ public enum ParticleEffect {
|
||||
* <li>The speed value influences the velocity at which the particle flies off
|
||||
* </ul>
|
||||
*/
|
||||
CRIT_MAGIC("magicCrit", 10, -1, ParticleProperty.DIRECTIONAL),
|
||||
CRIT_MAGIC("magicCrit", 10, - 1, ParticleProperty.DIRECTIONAL),
|
||||
/**
|
||||
* A particle effect which is displayed by primed tnt, torches, droppers, dispensers, end portals, brewing stands and monster spawners:
|
||||
* <ul>
|
||||
@@ -138,7 +138,7 @@ public enum ParticleEffect {
|
||||
* <li>The speed value influences the velocity at which the particle flies off
|
||||
* </ul>
|
||||
*/
|
||||
SMOKE_NORMAL("smoke", 11, -1, ParticleProperty.DIRECTIONAL),
|
||||
SMOKE_NORMAL("smoke", 11, - 1, ParticleProperty.DIRECTIONAL),
|
||||
/**
|
||||
* A particle effect which is displayed by fire, minecarts with furnace and blazes:
|
||||
* <ul>
|
||||
@@ -146,7 +146,7 @@ public enum ParticleEffect {
|
||||
* <li>The speed value influences the velocity at which the particle flies off
|
||||
* </ul>
|
||||
*/
|
||||
SMOKE_LARGE("largesmoke", 12, -1, ParticleProperty.DIRECTIONAL),
|
||||
SMOKE_LARGE("largesmoke", 12, - 1, ParticleProperty.DIRECTIONAL),
|
||||
/**
|
||||
* A particle effect which is displayed when splash potions or bottles o' enchanting hit something:
|
||||
* <ul>
|
||||
@@ -155,7 +155,7 @@ public enum ParticleEffect {
|
||||
* <li>Only the motion on the y-axis can be controlled, the motion on the x- and z-axis are multiplied by 0.1 when setting the values to 0
|
||||
* </ul>
|
||||
*/
|
||||
SPELL("spell", 13, -1),
|
||||
SPELL("spell", 13, - 1),
|
||||
/**
|
||||
* A particle effect which is displayed when instant splash potions hit something:
|
||||
* <ul>
|
||||
@@ -164,7 +164,7 @@ public enum ParticleEffect {
|
||||
* <li>Only the motion on the y-axis can be controlled, the motion on the x- and z-axis are multiplied by 0.1 when setting the values to 0
|
||||
* </ul>
|
||||
*/
|
||||
SPELL_INSTANT("instantSpell", 14, -1),
|
||||
SPELL_INSTANT("instantSpell", 14, - 1),
|
||||
/**
|
||||
* A particle effect which is displayed by entities with active potion effects:
|
||||
* <ul>
|
||||
@@ -173,7 +173,7 @@ public enum ParticleEffect {
|
||||
* <li>The particle color gets lighter when increasing the speed and darker when decreasing the speed
|
||||
* </ul>
|
||||
*/
|
||||
SPELL_MOB("mobSpell", 15, -1, ParticleProperty.COLORABLE),
|
||||
SPELL_MOB("mobSpell", 15, - 1, ParticleProperty.COLORABLE),
|
||||
/**
|
||||
* A particle effect which is displayed by entities with active potion effects applied through a beacon:
|
||||
* <ul>
|
||||
@@ -182,7 +182,7 @@ public enum ParticleEffect {
|
||||
* <li>The particle color gets lighter when increasing the speed and darker when decreasing the speed
|
||||
* </ul>
|
||||
*/
|
||||
SPELL_MOB_AMBIENT("mobSpellAmbient", 16, -1, ParticleProperty.COLORABLE),
|
||||
SPELL_MOB_AMBIENT("mobSpellAmbient", 16, - 1, ParticleProperty.COLORABLE),
|
||||
/**
|
||||
* A particle effect which is displayed by witches:
|
||||
* <ul>
|
||||
@@ -191,7 +191,7 @@ public enum ParticleEffect {
|
||||
* <li>Only the motion on the y-axis can be controlled, the motion on the x- and z-axis are multiplied by 0.1 when setting the values to 0
|
||||
* </ul>
|
||||
*/
|
||||
SPELL_WITCH("witchMagic", 17, -1),
|
||||
SPELL_WITCH("witchMagic", 17, - 1),
|
||||
/**
|
||||
* A particle effect which is displayed by blocks beneath a water source:
|
||||
* <ul>
|
||||
@@ -199,7 +199,7 @@ public enum ParticleEffect {
|
||||
* <li>The speed value has no influence on this particle effect
|
||||
* </ul>
|
||||
*/
|
||||
DRIP_WATER("dripWater", 18, -1),
|
||||
DRIP_WATER("dripWater", 18, - 1),
|
||||
/**
|
||||
* A particle effect which is displayed by blocks beneath a lava source:
|
||||
* <ul>
|
||||
@@ -207,7 +207,7 @@ public enum ParticleEffect {
|
||||
* <li>The speed value has no influence on this particle effect
|
||||
* </ul>
|
||||
*/
|
||||
DRIP_LAVA("dripLava", 19, -1),
|
||||
DRIP_LAVA("dripLava", 19, - 1),
|
||||
/**
|
||||
* A particle effect which is displayed when attacking a villager in a village:
|
||||
* <ul>
|
||||
@@ -215,7 +215,7 @@ public enum ParticleEffect {
|
||||
* <li>The speed value has no influence on this particle effect
|
||||
* </ul>
|
||||
*/
|
||||
VILLAGER_ANGRY("angryVillager", 20, -1),
|
||||
VILLAGER_ANGRY("angryVillager", 20, - 1),
|
||||
/**
|
||||
* A particle effect which is displayed when using bone meal and trading with a villager in a village:
|
||||
* <ul>
|
||||
@@ -223,7 +223,7 @@ public enum ParticleEffect {
|
||||
* <li>The speed value has no influence on this particle effect
|
||||
* </ul>
|
||||
*/
|
||||
VILLAGER_HAPPY("happyVillager", 21, -1, ParticleProperty.DIRECTIONAL),
|
||||
VILLAGER_HAPPY("happyVillager", 21, - 1, ParticleProperty.DIRECTIONAL),
|
||||
/**
|
||||
* A particle effect which is displayed by mycelium:
|
||||
* <ul>
|
||||
@@ -231,7 +231,7 @@ public enum ParticleEffect {
|
||||
* <li>The speed value has no influence on this particle effect
|
||||
* </ul>
|
||||
*/
|
||||
TOWN_AURA("townaura", 22, -1, ParticleProperty.DIRECTIONAL),
|
||||
TOWN_AURA("townaura", 22, - 1, ParticleProperty.DIRECTIONAL),
|
||||
/**
|
||||
* A particle effect which is displayed by note blocks:
|
||||
* <ul>
|
||||
@@ -239,7 +239,7 @@ public enum ParticleEffect {
|
||||
* <li>The speed value causes the particle to be colored green when set to 0
|
||||
* </ul>
|
||||
*/
|
||||
NOTE("note", 23, -1, ParticleProperty.COLORABLE),
|
||||
NOTE("note", 23, - 1, ParticleProperty.COLORABLE),
|
||||
/**
|
||||
* A particle effect which is displayed by nether portals, endermen, ender pearls, eyes of ender, ender chests and dragon eggs:
|
||||
* <ul>
|
||||
@@ -247,7 +247,7 @@ public enum ParticleEffect {
|
||||
* <li>The speed value influences the spread of this particle effect
|
||||
* </ul>
|
||||
*/
|
||||
PORTAL("portal", 24, -1, ParticleProperty.DIRECTIONAL),
|
||||
PORTAL("portal", 24, - 1, ParticleProperty.DIRECTIONAL),
|
||||
/**
|
||||
* A particle effect which is displayed by enchantment tables which are nearby bookshelves:
|
||||
* <ul>
|
||||
@@ -255,7 +255,7 @@ public enum ParticleEffect {
|
||||
* <li>The speed value influences the spread of this particle effect
|
||||
* </ul>
|
||||
*/
|
||||
ENCHANTMENT_TABLE("enchantmenttable", 25, -1, ParticleProperty.DIRECTIONAL),
|
||||
ENCHANTMENT_TABLE("enchantmenttable", 25, - 1, ParticleProperty.DIRECTIONAL),
|
||||
/**
|
||||
* A particle effect which is displayed by torches, active furnaces, magma cubes and monster spawners:
|
||||
* <ul>
|
||||
@@ -263,7 +263,7 @@ public enum ParticleEffect {
|
||||
* <li>The speed value influences the velocity at which the particle flies off
|
||||
* </ul>
|
||||
*/
|
||||
FLAME("flame", 26, -1, ParticleProperty.DIRECTIONAL),
|
||||
FLAME("flame", 26, - 1, ParticleProperty.DIRECTIONAL),
|
||||
/**
|
||||
* A particle effect which is displayed by lava:
|
||||
* <ul>
|
||||
@@ -271,7 +271,7 @@ public enum ParticleEffect {
|
||||
* <li>The speed value has no influence on this particle effect
|
||||
* </ul>
|
||||
*/
|
||||
LAVA("lava", 27, -1),
|
||||
LAVA("lava", 27, - 1),
|
||||
/**
|
||||
* A particle effect which is currently unused:
|
||||
* <ul>
|
||||
@@ -279,7 +279,7 @@ public enum ParticleEffect {
|
||||
* <li>The speed value has no influence on this particle effect
|
||||
* </ul>
|
||||
*/
|
||||
FOOTSTEP("footstep", 28, -1),
|
||||
FOOTSTEP("footstep", 28, - 1),
|
||||
/**
|
||||
* A particle effect which is displayed when a mob dies:
|
||||
* <ul>
|
||||
@@ -287,7 +287,7 @@ public enum ParticleEffect {
|
||||
* <li>The speed value influences the velocity at which the particle flies off
|
||||
* </ul>
|
||||
*/
|
||||
CLOUD("cloud", 29, -1, ParticleProperty.DIRECTIONAL),
|
||||
CLOUD("cloud", 29, - 1, ParticleProperty.DIRECTIONAL),
|
||||
/**
|
||||
* A particle effect which is displayed by redstone ore, powered redstone, redstone torches and redstone repeaters:
|
||||
* <ul>
|
||||
@@ -295,7 +295,7 @@ public enum ParticleEffect {
|
||||
* <li>The speed value causes the particle to be colored red when set to 0
|
||||
* </ul>
|
||||
*/
|
||||
REDSTONE("reddust", 30, -1, ParticleProperty.COLORABLE),
|
||||
REDSTONE("reddust", 30, - 1, ParticleProperty.COLORABLE),
|
||||
/**
|
||||
* A particle effect which is displayed when snowballs hit a block:
|
||||
* <ul>
|
||||
@@ -303,7 +303,7 @@ public enum ParticleEffect {
|
||||
* <li>The speed value has no influence on this particle effect
|
||||
* </ul>
|
||||
*/
|
||||
SNOWBALL("snowballpoof", 31, -1),
|
||||
SNOWBALL("snowballpoof", 31, - 1),
|
||||
/**
|
||||
* A particle effect which is currently unused:
|
||||
* <ul>
|
||||
@@ -311,7 +311,7 @@ public enum ParticleEffect {
|
||||
* <li>The speed value influences the velocity at which the particle flies off
|
||||
* </ul>
|
||||
*/
|
||||
SNOW_SHOVEL("snowshovel", 32, -1, ParticleProperty.DIRECTIONAL),
|
||||
SNOW_SHOVEL("snowshovel", 32, - 1, ParticleProperty.DIRECTIONAL),
|
||||
/**
|
||||
* A particle effect which is displayed by slimes:
|
||||
* <ul>
|
||||
@@ -319,7 +319,7 @@ public enum ParticleEffect {
|
||||
* <li>The speed value has no influence on this particle effect
|
||||
* </ul>
|
||||
*/
|
||||
SLIME("slime", 33, -1),
|
||||
SLIME("slime", 33, - 1),
|
||||
/**
|
||||
* A particle effect which is displayed when breeding and taming animals:
|
||||
* <ul>
|
||||
@@ -327,7 +327,7 @@ public enum ParticleEffect {
|
||||
* <li>The speed value has no influence on this particle effect
|
||||
* </ul>
|
||||
*/
|
||||
HEART("heart", 34, -1),
|
||||
HEART("heart", 34, - 1),
|
||||
/**
|
||||
* A particle effect which is displayed by barriers:
|
||||
* <ul>
|
||||
@@ -342,7 +342,7 @@ public enum ParticleEffect {
|
||||
* <li>It looks like a little piece with an item texture
|
||||
* </ul>
|
||||
*/
|
||||
ITEM_CRACK("iconcrack", 36, -1, ParticleProperty.DIRECTIONAL, ParticleProperty.REQUIRES_DATA),
|
||||
ITEM_CRACK("iconcrack", 36, - 1, ParticleProperty.DIRECTIONAL, ParticleProperty.REQUIRES_DATA),
|
||||
/**
|
||||
* A particle effect which is displayed when breaking blocks or sprinting:
|
||||
* <ul>
|
||||
@@ -350,7 +350,7 @@ public enum ParticleEffect {
|
||||
* <li>The speed value has no influence on this particle effect
|
||||
* </ul>
|
||||
*/
|
||||
BLOCK_CRACK("blockcrack", 37, -1, ParticleProperty.REQUIRES_DATA),
|
||||
BLOCK_CRACK("blockcrack", 37, - 1, ParticleProperty.REQUIRES_DATA),
|
||||
/**
|
||||
* A particle effect which is displayed when falling:
|
||||
* <ul>
|
||||
@@ -422,7 +422,7 @@ public enum ParticleEffect {
|
||||
*/
|
||||
public static ParticleEffect fromName(String name) {
|
||||
for (Entry<String, ParticleEffect> entry : NAME_MAP.entrySet()) {
|
||||
if (!entry.getKey().equalsIgnoreCase(name)) {
|
||||
if (! entry.getKey().equalsIgnoreCase(name)) {
|
||||
continue;
|
||||
}
|
||||
return entry.getValue();
|
||||
@@ -467,7 +467,7 @@ public enum ParticleEffect {
|
||||
String world = location.getWorld().getName();
|
||||
for (Player player : players) {
|
||||
Location playerLocation = player.getLocation();
|
||||
if (!world.equals(playerLocation.getWorld().getName()) || playerLocation.distanceSquared(location) < 65536) {
|
||||
if (! world.equals(playerLocation.getWorld().getName()) || playerLocation.distanceSquared(location) < 65536) {
|
||||
continue;
|
||||
}
|
||||
return true;
|
||||
@@ -539,7 +539,7 @@ public enum ParticleEffect {
|
||||
* @return Whether the particle effect is supported or not
|
||||
*/
|
||||
public boolean isSupported() {
|
||||
if (requiredVersion == -1) {
|
||||
if (requiredVersion == - 1) {
|
||||
return true;
|
||||
}
|
||||
return ParticlePacket.getVersion() >= requiredVersion;
|
||||
@@ -562,13 +562,13 @@ public enum ParticleEffect {
|
||||
* @see ParticlePacket#sendTo(Location, double)
|
||||
*/
|
||||
public void display(float offsetX, float offsetY, float offsetZ, float speed, int amount, Location center, double range) throws ParticleVersionException, ParticleDataException, IllegalArgumentException {
|
||||
if (!isSupported()) {
|
||||
if (! isSupported()) {
|
||||
throw new ParticleVersionException("This particle effect is not supported by your server version");
|
||||
}
|
||||
if (hasProperty(ParticleProperty.REQUIRES_DATA)) {
|
||||
throw new ParticleDataException("This particle effect requires additional data");
|
||||
}
|
||||
if (hasProperty(ParticleProperty.REQUIRES_WATER) && !isWater(center)) {
|
||||
if (hasProperty(ParticleProperty.REQUIRES_WATER) && ! isWater(center)) {
|
||||
throw new IllegalArgumentException("There is no water at the center location");
|
||||
}
|
||||
new ParticlePacket(this, offsetX, offsetY, offsetZ, speed, amount, range > 256, null).sendTo(center, range);
|
||||
@@ -591,13 +591,13 @@ public enum ParticleEffect {
|
||||
* @see ParticlePacket#sendTo(Location, List)
|
||||
*/
|
||||
public void display(float offsetX, float offsetY, float offsetZ, float speed, int amount, Location center, List<Player> players) throws ParticleVersionException, ParticleDataException, IllegalArgumentException {
|
||||
if (!isSupported()) {
|
||||
if (! isSupported()) {
|
||||
throw new ParticleVersionException("This particle effect is not supported by your server version");
|
||||
}
|
||||
if (hasProperty(ParticleProperty.REQUIRES_DATA)) {
|
||||
throw new ParticleDataException("This particle effect requires additional data");
|
||||
}
|
||||
if (hasProperty(ParticleProperty.REQUIRES_WATER) && !isWater(center)) {
|
||||
if (hasProperty(ParticleProperty.REQUIRES_WATER) && ! isWater(center)) {
|
||||
throw new IllegalArgumentException("There is no water at the center location");
|
||||
}
|
||||
new ParticlePacket(this, offsetX, offsetY, offsetZ, speed, amount, isLongDistance(center, players), null).sendTo(center, players);
|
||||
@@ -636,16 +636,16 @@ public enum ParticleEffect {
|
||||
* @see ParticlePacket#sendTo(Location, double)
|
||||
*/
|
||||
public void display(Vector direction, float speed, Location center, double range) throws ParticleVersionException, ParticleDataException, IllegalArgumentException {
|
||||
if (!isSupported()) {
|
||||
if (! isSupported()) {
|
||||
throw new ParticleVersionException("This particle effect is not supported by your server version");
|
||||
}
|
||||
if (hasProperty(ParticleProperty.REQUIRES_DATA)) {
|
||||
throw new ParticleDataException("This particle effect requires additional data");
|
||||
}
|
||||
if (!hasProperty(ParticleProperty.DIRECTIONAL)) {
|
||||
if (! hasProperty(ParticleProperty.DIRECTIONAL)) {
|
||||
throw new IllegalArgumentException("This particle effect is not directional");
|
||||
}
|
||||
if (hasProperty(ParticleProperty.REQUIRES_WATER) && !isWater(center)) {
|
||||
if (hasProperty(ParticleProperty.REQUIRES_WATER) && ! isWater(center)) {
|
||||
throw new IllegalArgumentException("There is no water at the center location");
|
||||
}
|
||||
new ParticlePacket(this, direction, speed, range > 256, null).sendTo(center, range);
|
||||
@@ -665,16 +665,16 @@ public enum ParticleEffect {
|
||||
* @see ParticlePacket#sendTo(Location, List)
|
||||
*/
|
||||
public void display(Vector direction, float speed, Location center, List<Player> players) throws ParticleVersionException, ParticleDataException, IllegalArgumentException {
|
||||
if (!isSupported()) {
|
||||
if (! isSupported()) {
|
||||
throw new ParticleVersionException("This particle effect is not supported by your server version");
|
||||
}
|
||||
if (hasProperty(ParticleProperty.REQUIRES_DATA)) {
|
||||
throw new ParticleDataException("This particle effect requires additional data");
|
||||
}
|
||||
if (!hasProperty(ParticleProperty.DIRECTIONAL)) {
|
||||
if (! hasProperty(ParticleProperty.DIRECTIONAL)) {
|
||||
throw new IllegalArgumentException("This particle effect is not directional");
|
||||
}
|
||||
if (hasProperty(ParticleProperty.REQUIRES_WATER) && !isWater(center)) {
|
||||
if (hasProperty(ParticleProperty.REQUIRES_WATER) && ! isWater(center)) {
|
||||
throw new IllegalArgumentException("There is no water at the center location");
|
||||
}
|
||||
new ParticlePacket(this, direction, speed, isLongDistance(center, players), null).sendTo(center, players);
|
||||
@@ -708,13 +708,13 @@ public enum ParticleEffect {
|
||||
* @see ParticlePacket#sendTo(Location, double)
|
||||
*/
|
||||
public void display(ParticleColor color, Location center, double range) throws ParticleVersionException, ParticleColorException {
|
||||
if (!isSupported()) {
|
||||
if (! isSupported()) {
|
||||
throw new ParticleVersionException("This particle effect is not supported by your server version");
|
||||
}
|
||||
if (!hasProperty(ParticleProperty.COLORABLE)) {
|
||||
if (! hasProperty(ParticleProperty.COLORABLE)) {
|
||||
throw new ParticleColorException("This particle effect is not colorable");
|
||||
}
|
||||
if (!isColorCorrect(this, color)) {
|
||||
if (! isColorCorrect(this, color)) {
|
||||
throw new ParticleColorException("The particle color type is incorrect");
|
||||
}
|
||||
new ParticlePacket(this, color, range > 256).sendTo(center, range);
|
||||
@@ -732,13 +732,13 @@ public enum ParticleEffect {
|
||||
* @see ParticlePacket#sendTo(Location, List)
|
||||
*/
|
||||
public void display(ParticleColor color, Location center, List<Player> players) throws ParticleVersionException, ParticleColorException {
|
||||
if (!isSupported()) {
|
||||
if (! isSupported()) {
|
||||
throw new ParticleVersionException("This particle effect is not supported by your server version");
|
||||
}
|
||||
if (!hasProperty(ParticleProperty.COLORABLE)) {
|
||||
if (! hasProperty(ParticleProperty.COLORABLE)) {
|
||||
throw new ParticleColorException("This particle effect is not colorable");
|
||||
}
|
||||
if (!isColorCorrect(this, color)) {
|
||||
if (! isColorCorrect(this, color)) {
|
||||
throw new ParticleColorException("The particle color type is incorrect");
|
||||
}
|
||||
new ParticlePacket(this, color, isLongDistance(center, players)).sendTo(center, players);
|
||||
@@ -775,13 +775,13 @@ public enum ParticleEffect {
|
||||
* @see ParticlePacket#sendTo(Location, double)
|
||||
*/
|
||||
public void display(ParticleData data, float offsetX, float offsetY, float offsetZ, float speed, int amount, Location center, double range) throws ParticleVersionException, ParticleDataException {
|
||||
if (!isSupported()) {
|
||||
if (! isSupported()) {
|
||||
throw new ParticleVersionException("This particle effect is not supported by your server version");
|
||||
}
|
||||
if (!hasProperty(ParticleProperty.REQUIRES_DATA)) {
|
||||
if (! hasProperty(ParticleProperty.REQUIRES_DATA)) {
|
||||
throw new ParticleDataException("This particle effect does not require additional data");
|
||||
}
|
||||
if (!isDataCorrect(this, data)) {
|
||||
if (! isDataCorrect(this, data)) {
|
||||
throw new ParticleDataException("The particle data type is incorrect");
|
||||
}
|
||||
new ParticlePacket(this, offsetX, offsetY, offsetZ, speed, amount, range > 256, data).sendTo(center, range);
|
||||
@@ -804,13 +804,13 @@ public enum ParticleEffect {
|
||||
* @see ParticlePacket#sendTo(Location, List)
|
||||
*/
|
||||
public void display(ParticleData data, float offsetX, float offsetY, float offsetZ, float speed, int amount, Location center, List<Player> players) throws ParticleVersionException, ParticleDataException {
|
||||
if (!isSupported()) {
|
||||
if (! isSupported()) {
|
||||
throw new ParticleVersionException("This particle effect is not supported by your server version");
|
||||
}
|
||||
if (!hasProperty(ParticleProperty.REQUIRES_DATA)) {
|
||||
if (! hasProperty(ParticleProperty.REQUIRES_DATA)) {
|
||||
throw new ParticleDataException("This particle effect does not require additional data");
|
||||
}
|
||||
if (!isDataCorrect(this, data)) {
|
||||
if (! isDataCorrect(this, data)) {
|
||||
throw new ParticleDataException("The particle data type is incorrect");
|
||||
}
|
||||
new ParticlePacket(this, offsetX, offsetY, offsetZ, speed, amount, isLongDistance(center, players), data).sendTo(center, players);
|
||||
@@ -849,13 +849,13 @@ public enum ParticleEffect {
|
||||
* @see ParticlePacket#sendTo(Location, double)
|
||||
*/
|
||||
public void display(ParticleData data, Vector direction, float speed, Location center, double range) throws ParticleVersionException, ParticleDataException {
|
||||
if (!isSupported()) {
|
||||
if (! isSupported()) {
|
||||
throw new ParticleVersionException("This particle effect is not supported by your server version");
|
||||
}
|
||||
if (!hasProperty(ParticleProperty.REQUIRES_DATA)) {
|
||||
if (! hasProperty(ParticleProperty.REQUIRES_DATA)) {
|
||||
throw new ParticleDataException("This particle effect does not require additional data");
|
||||
}
|
||||
if (!isDataCorrect(this, data)) {
|
||||
if (! isDataCorrect(this, data)) {
|
||||
throw new ParticleDataException("The particle data type is incorrect");
|
||||
}
|
||||
new ParticlePacket(this, direction, speed, range > 256, data).sendTo(center, range);
|
||||
@@ -875,13 +875,13 @@ public enum ParticleEffect {
|
||||
* @see ParticlePacket#sendTo(Location, List)
|
||||
*/
|
||||
public void display(ParticleData data, Vector direction, float speed, Location center, List<Player> players) throws ParticleVersionException, ParticleDataException {
|
||||
if (!isSupported()) {
|
||||
if (! isSupported()) {
|
||||
throw new ParticleVersionException("This particle effect is not supported by your server version");
|
||||
}
|
||||
if (!hasProperty(ParticleProperty.REQUIRES_DATA)) {
|
||||
if (! hasProperty(ParticleProperty.REQUIRES_DATA)) {
|
||||
throw new ParticleDataException("This particle effect does not require additional data");
|
||||
}
|
||||
if (!isDataCorrect(this, data)) {
|
||||
if (! isDataCorrect(this, data)) {
|
||||
throw new ParticleDataException("The particle data type is incorrect");
|
||||
}
|
||||
new ParticlePacket(this, direction, speed, isLongDistance(center, players), data).sendTo(center, players);
|
||||
@@ -949,7 +949,7 @@ public enum ParticleEffect {
|
||||
* @param material Material of the item/block
|
||||
* @param data Data value of the item/block
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
@SuppressWarnings ("deprecation")
|
||||
public ParticleData(Material material, byte data) {
|
||||
this.material = material;
|
||||
this.data = data;
|
||||
@@ -1033,7 +1033,7 @@ public enum ParticleEffect {
|
||||
*/
|
||||
public BlockData(Material material, byte data) throws IllegalArgumentException {
|
||||
super(material, data);
|
||||
if (!material.isBlock()) {
|
||||
if (! material.isBlock()) {
|
||||
throw new IllegalArgumentException("The material is not a block");
|
||||
}
|
||||
}
|
||||
@@ -1425,7 +1425,7 @@ public enum ParticleEffect {
|
||||
* @return The version number
|
||||
*/
|
||||
public static int getVersion() {
|
||||
if (!initialized) {
|
||||
if (! initialized) {
|
||||
initialize();
|
||||
}
|
||||
return version;
|
||||
@@ -1530,7 +1530,7 @@ public enum ParticleEffect {
|
||||
String worldName = center.getWorld().getName();
|
||||
double squared = range * range;
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
if (!player.getWorld().getName().equals(worldName) || player.getLocation().distanceSquared(center) > squared) {
|
||||
if (! player.getWorld().getName().equals(worldName) || player.getLocation().distanceSquared(center) > squared) {
|
||||
continue;
|
||||
}
|
||||
sendTo(center, player);
|
||||
|
||||
@@ -44,7 +44,7 @@ public final class ReflectionUtils {
|
||||
public static Constructor<?> getConstructor(Class<?> clazz, Class<?>... parameterTypes) throws NoSuchMethodException {
|
||||
Class<?>[] primitiveTypes = DataType.getPrimitive(parameterTypes);
|
||||
for (Constructor<?> constructor : clazz.getConstructors()) {
|
||||
if (!DataType.compare(DataType.getPrimitive(constructor.getParameterTypes()), primitiveTypes)) {
|
||||
if (! DataType.compare(DataType.getPrimitive(constructor.getParameterTypes()), primitiveTypes)) {
|
||||
continue;
|
||||
}
|
||||
return constructor;
|
||||
@@ -118,7 +118,7 @@ public final class ReflectionUtils {
|
||||
public static Method getMethod(Class<?> clazz, String methodName, Class<?>... parameterTypes) throws NoSuchMethodException {
|
||||
Class<?>[] primitiveTypes = DataType.getPrimitive(parameterTypes);
|
||||
for (Method method : clazz.getMethods()) {
|
||||
if (!method.getName().equals(methodName) || !DataType.compare(DataType.getPrimitive(method.getParameterTypes()), primitiveTypes)) {
|
||||
if (! method.getName().equals(methodName) || ! DataType.compare(DataType.getPrimitive(method.getParameterTypes()), primitiveTypes)) {
|
||||
continue;
|
||||
}
|
||||
return method;
|
||||
|
||||
@@ -62,7 +62,7 @@ public class PermissionsMapTypeAdapter implements JsonDeserializer<Map<Permissab
|
||||
return permissionsMap;
|
||||
|
||||
} catch (Exception ex) {
|
||||
SavageFactions.plugin.log(Level.WARNING, "Error encountered while deserializing a PermissionsMap.");
|
||||
SavageFactions.plugin.log(Level.WARNING, "Error encountered while deserializing a PermissionsMap.");
|
||||
ex.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ public class RelationUtil {
|
||||
return Relation.NEUTRAL; // ERROR
|
||||
}
|
||||
|
||||
if (!fthat.isNormal() || !fme.isNormal()) {
|
||||
if (! fthat.isNormal() || ! fme.isNormal()) {
|
||||
return Relation.NEUTRAL;
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ public class RelationUtil {
|
||||
return Relation.MEMBER;
|
||||
}
|
||||
|
||||
if (!ignorePeaceful && (fme.isPeaceful() || fthat.isPeaceful())) {
|
||||
if (! ignorePeaceful && (fme.isPeaceful() || fthat.isPeaceful())) {
|
||||
return Relation.NEUTRAL;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ public abstract class SpiralTask implements Runnable {
|
||||
// general task-related reference data
|
||||
private transient World world = null;
|
||||
private transient boolean readyToGo = false;
|
||||
private transient int taskID = -1;
|
||||
private transient int taskID = - 1;
|
||||
private transient int limit = 0;
|
||||
|
||||
// values for the spiral pattern routine
|
||||
@@ -35,17 +35,17 @@ public abstract class SpiralTask implements Runnable {
|
||||
private transient int z = 0;
|
||||
private transient boolean isZLeg = false;
|
||||
private transient boolean isNeg = false;
|
||||
private transient int length = -1;
|
||||
private transient int length = - 1;
|
||||
private transient int current = 0;
|
||||
|
||||
@SuppressWarnings("LeakingThisInConstructor")
|
||||
@SuppressWarnings ("LeakingThisInConstructor")
|
||||
public SpiralTask(FLocation fLocation, int radius) {
|
||||
// limit is determined based on spiral leg length for given radius; see insideRadius()
|
||||
this.limit = (radius - 1) * 2;
|
||||
|
||||
this.world = Bukkit.getWorld(fLocation.getWorldName());
|
||||
if (this.world == null) {
|
||||
SavageFactions.plugin.log(Level.WARNING, "[SpiralTask] A valid world must be specified!");
|
||||
SavageFactions.plugin.log(Level.WARNING, "[SpiralTask] A valid world must be specified!");
|
||||
this.stop();
|
||||
return;
|
||||
}
|
||||
@@ -56,7 +56,7 @@ public abstract class SpiralTask implements Runnable {
|
||||
this.readyToGo = true;
|
||||
|
||||
// get this party started
|
||||
this.setTaskID(Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(SavageFactions.plugin, this, 2, 2));
|
||||
this.setTaskID(Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(SavageFactions.plugin, this, 2, 2));
|
||||
}
|
||||
|
||||
private static long now() {
|
||||
@@ -103,14 +103,14 @@ public abstract class SpiralTask implements Runnable {
|
||||
}
|
||||
|
||||
public final void setTaskID(int ID) {
|
||||
if (ID == -1) {
|
||||
if (ID == - 1) {
|
||||
this.stop();
|
||||
}
|
||||
taskID = ID;
|
||||
}
|
||||
|
||||
public final void run() {
|
||||
if (!this.valid() || !readyToGo) {
|
||||
if (! this.valid() || ! readyToGo) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ public abstract class SpiralTask implements Runnable {
|
||||
readyToGo = false;
|
||||
|
||||
// make sure we're still inside the specified radius
|
||||
if (!this.insideRadius()) {
|
||||
if (! this.insideRadius()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -128,13 +128,13 @@ public abstract class SpiralTask implements Runnable {
|
||||
// keep going until the task has been running for 20ms or more, then stop to take a breather
|
||||
while (now() < loopStartTime + 20) {
|
||||
// run the primary task on the current X/Z coordinates
|
||||
if (!this.work()) {
|
||||
if (! this.work()) {
|
||||
this.finish();
|
||||
return;
|
||||
}
|
||||
|
||||
// move on to next chunk in spiral
|
||||
if (!this.moveToNext()) {
|
||||
if (! this.moveToNext()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -145,7 +145,7 @@ public abstract class SpiralTask implements Runnable {
|
||||
|
||||
// step through chunks in spiral pattern from center; returns false if we're done, otherwise returns true
|
||||
public final boolean moveToNext() {
|
||||
if (!this.valid()) {
|
||||
if (! this.valid()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -154,7 +154,7 @@ public abstract class SpiralTask implements Runnable {
|
||||
current++;
|
||||
|
||||
// if we're outside the radius, we're done
|
||||
if (!this.insideRadius()) {
|
||||
if (! this.insideRadius()) {
|
||||
return false;
|
||||
}
|
||||
} else { // one leg/side of the spiral down...
|
||||
@@ -169,9 +169,9 @@ public abstract class SpiralTask implements Runnable {
|
||||
|
||||
// move one chunk further in the appropriate direction
|
||||
if (isZLeg) {
|
||||
z += (isNeg) ? -1 : 1;
|
||||
z += (isNeg) ? - 1 : 1;
|
||||
} else {
|
||||
x += (isNeg) ? -1 : 1;
|
||||
x += (isNeg) ? - 1 : 1;
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -179,7 +179,7 @@ public abstract class SpiralTask implements Runnable {
|
||||
|
||||
public final boolean insideRadius() {
|
||||
boolean inside = current < limit;
|
||||
if (!inside) {
|
||||
if (! inside) {
|
||||
this.finish();
|
||||
}
|
||||
return inside;
|
||||
@@ -193,17 +193,17 @@ public abstract class SpiralTask implements Runnable {
|
||||
|
||||
// we're done, whether finished or cancelled
|
||||
public final void stop() {
|
||||
if (!this.valid()) {
|
||||
if (! this.valid()) {
|
||||
return;
|
||||
}
|
||||
|
||||
readyToGo = false;
|
||||
Bukkit.getServer().getScheduler().cancelTask(taskID);
|
||||
taskID = -1;
|
||||
taskID = - 1;
|
||||
}
|
||||
|
||||
// is this task still valid/workable?
|
||||
public final boolean valid() {
|
||||
return taskID != -1;
|
||||
return taskID != - 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,21 +24,20 @@ public class VisualizeUtil {
|
||||
return ret;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@SuppressWarnings ("deprecation")
|
||||
public static void addLocation(Player player, Location location, Material type, byte data) {
|
||||
getPlayerLocations(player).add(location);
|
||||
player.sendBlockChange(location, type, data);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@SuppressWarnings ("deprecation")
|
||||
public static void addLocation(Player player, Location location, Material material) {
|
||||
getPlayerLocations(player).add(location);
|
||||
player.sendBlockChange(location, material, (byte) 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@SuppressWarnings ("deprecation")
|
||||
public static void addLocations(Player player, Collection<Location> locations, Material material) {
|
||||
Set<Location> ploc = getPlayerLocations(player);
|
||||
for (Location location : locations) {
|
||||
@@ -47,7 +46,7 @@ public class VisualizeUtil {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@SuppressWarnings ("deprecation")
|
||||
public static void addBlocks(Player player, Collection<Block> blocks, Material material) {
|
||||
Set<Location> ploc = getPlayerLocations(player);
|
||||
for (Block block : blocks) {
|
||||
@@ -57,7 +56,7 @@ public class VisualizeUtil {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@SuppressWarnings ("deprecation")
|
||||
public static void clear(Player player) {
|
||||
Set<Location> locations = getPlayerLocations(player);
|
||||
if (locations == null) {
|
||||
|
||||
@@ -21,7 +21,7 @@ public class WarmUpUtil {
|
||||
player.msg(TL.WARMUPS_ALREADY);
|
||||
} else {
|
||||
player.msg(translationKey.format(action, delay));
|
||||
int id = SavageFactions.plugin.getServer().getScheduler().runTaskLater(SavageFactions.plugin, new Runnable() {
|
||||
int id = SavageFactions.plugin.getServer().getScheduler().runTaskLater(SavageFactions.plugin, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
player.stopWarmup();
|
||||
@@ -36,7 +36,7 @@ public class WarmUpUtil {
|
||||
}
|
||||
|
||||
public enum Warmup {
|
||||
HOME, WARP, FLIGHT, BANNER, CHECKPOINT
|
||||
HOME, WARP, FLIGHT, BANNER, CHECKPOINT
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -34,14 +34,14 @@ public class WarpGUI implements InventoryHolder, FactionGUI {
|
||||
|
||||
public WarpGUI(FPlayer fme) {
|
||||
this.fme = fme;
|
||||
this.section = SavageFactions.plugin.getConfig().getConfigurationSection("fwarp-gui");
|
||||
this.section = SavageFactions.plugin.getConfig().getConfigurationSection("fwarp-gui");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void build() {
|
||||
if (section == null) {
|
||||
SavageFactions.plugin.log(Level.WARNING, "Attempted to build f warp GUI but config section not present.");
|
||||
SavageFactions.plugin.log(Level.WARNING, "Copy your config, allow the section to generate, then copy it back to your old config.");
|
||||
SavageFactions.plugin.log(Level.WARNING, "Attempted to build f warp GUI but config section not present.");
|
||||
SavageFactions.plugin.log(Level.WARNING, "Copy your config, allow the section to generate, then copy it back to your old config.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -49,14 +49,14 @@ public class WarpGUI implements InventoryHolder, FactionGUI {
|
||||
guiSize = section.getInt("rows", 3);
|
||||
if (guiSize > 6) {
|
||||
guiSize = 6;
|
||||
SavageFactions.plugin.log(Level.INFO, "Warp GUI size out of bounds, defaulting to 6");
|
||||
SavageFactions.plugin.log(Level.INFO, "Warp GUI size out of bounds, defaulting to 6");
|
||||
}
|
||||
|
||||
guiSize *= 9;
|
||||
String guiName = ChatColor.translateAlternateColorCodes('&', section.getString("name", "FactionPermissions"));
|
||||
warpGUI = Bukkit.createInventory(this, guiSize, guiName);
|
||||
|
||||
maxWarps = SavageFactions.plugin.getConfig().getInt("max-warps", 5);
|
||||
maxWarps = SavageFactions.plugin.getConfig().getInt("max-warps", 5);
|
||||
|
||||
Set<String> factionWarps = fme.getFaction().getWarps().keySet();
|
||||
List<Integer> warpOpenSlots = section.getIntegerList("warp-slots");
|
||||
@@ -64,7 +64,7 @@ public class WarpGUI implements InventoryHolder, FactionGUI {
|
||||
buildDummyItems();
|
||||
|
||||
if (maxWarps != warpOpenSlots.size()) {
|
||||
SavageFactions.plugin.log(Level.SEVERE, "Invalid warp slots for GUI, Please use same value as max warps");
|
||||
SavageFactions.plugin.log(Level.SEVERE, "Invalid warp slots for GUI, Please use same value as max warps");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -95,14 +95,14 @@ public class WarpGUI implements InventoryHolder, FactionGUI {
|
||||
|
||||
// All clear lets TP them or ask for password
|
||||
String warp = warpSlots.get(slot);
|
||||
if (!fme.getFaction().hasWarpPassword(warp)) {
|
||||
if (! fme.getFaction().hasWarpPassword(warp)) {
|
||||
if (transact(fme)) {
|
||||
doWarmup(warp);
|
||||
}
|
||||
} else {
|
||||
fme.setEnteringPassword(true, warp);
|
||||
fme.msg(TL.COMMAND_FWARP_PASSWORD_REQUIRED);
|
||||
Bukkit.getScheduler().runTaskLater(SavageFactions.plugin, new Runnable() {
|
||||
Bukkit.getScheduler().runTaskLater(SavageFactions.plugin, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (fme.isEnteringPassword()) {
|
||||
@@ -110,7 +110,7 @@ public class WarpGUI implements InventoryHolder, FactionGUI {
|
||||
fme.setEnteringPassword(false, "");
|
||||
}
|
||||
}
|
||||
}, SavageFactions.plugin.getConfig().getInt("fwarp-gui.password-timeout", 5) * 20);
|
||||
}, SavageFactions.plugin.getConfig().getInt("fwarp-gui.password-timeout", 5) * 20);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -129,28 +129,28 @@ public class WarpGUI implements InventoryHolder, FactionGUI {
|
||||
}
|
||||
|
||||
private boolean transact(FPlayer player) {
|
||||
if (! SavageFactions.plugin.getConfig().getBoolean("warp-cost.enabled", false) || player.isAdminBypassing()) {
|
||||
if (! SavageFactions.plugin.getConfig().getBoolean("warp-cost.enabled", false) || player.isAdminBypassing()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
double cost = SavageFactions.plugin.getConfig().getDouble("warp-cost.warp", 5);
|
||||
double cost = SavageFactions.plugin.getConfig().getDouble("warp-cost.warp", 5);
|
||||
|
||||
if (!Econ.shouldBeUsed() || this.fme == null || cost == 0.0 || fme.isAdminBypassing()) {
|
||||
if (! Econ.shouldBeUsed() || this.fme == null || cost == 0.0 || fme.isAdminBypassing()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (Conf.bankEnabled && Conf.bankFactionPaysCosts && fme.hasFaction()) {
|
||||
return Econ.modifyMoney(fme.getFaction(), -cost, TL.COMMAND_FWARP_TOWARP.toString(), TL.COMMAND_FWARP_FORWARPING.toString());
|
||||
return Econ.modifyMoney(fme.getFaction(), - cost, TL.COMMAND_FWARP_TOWARP.toString(), TL.COMMAND_FWARP_FORWARPING.toString());
|
||||
} else {
|
||||
return Econ.modifyMoney(fme, -cost, TL.COMMAND_FWARP_TOWARP.toString(), TL.COMMAND_FWARP_FORWARPING.toString());
|
||||
return Econ.modifyMoney(fme, - cost, TL.COMMAND_FWARP_TOWARP.toString(), TL.COMMAND_FWARP_FORWARPING.toString());
|
||||
}
|
||||
}
|
||||
|
||||
private ItemStack buildItem(String warp) {
|
||||
ConfigurationSection warpItemSection = section.getConfigurationSection("warp-item");
|
||||
if (warpItemSection == null) {
|
||||
SavageFactions.plugin.log(Level.WARNING, "Attempted to build f warp GUI but config section not present.");
|
||||
SavageFactions.plugin.log(Level.WARNING, "Copy your config, allow the section to generate, then copy it back to your old config.");
|
||||
SavageFactions.plugin.log(Level.WARNING, "Attempted to build f warp GUI but config section not present.");
|
||||
SavageFactions.plugin.log(Level.WARNING, "Copy your config, allow the section to generate, then copy it back to your old config.");
|
||||
return new ItemStack(Material.AIR);
|
||||
}
|
||||
|
||||
@@ -183,7 +183,7 @@ public class WarpGUI implements InventoryHolder, FactionGUI {
|
||||
string = ChatColor.translateAlternateColorCodes('&', string);
|
||||
string = string.replace("{warp}", warp);
|
||||
string = string.replace("{warp-protected}", faction.hasWarpPassword(warp) ? "Enabled" : "Disabled");
|
||||
string = string.replace("{warp-cost}", ! SavageFactions.plugin.getConfig().getBoolean("warp-cost.enabled", false) ? "Disabled" : Integer.toString(SavageFactions.plugin.getConfig().getInt("warp-cost.warp", 5)));
|
||||
string = string.replace("{warp-cost}", ! SavageFactions.plugin.getConfig().getBoolean("warp-cost.enabled", false) ? "Disabled" : Integer.toString(SavageFactions.plugin.getConfig().getInt("warp-cost.warp", 5)));
|
||||
return string;
|
||||
}
|
||||
|
||||
@@ -193,7 +193,7 @@ public class WarpGUI implements InventoryHolder, FactionGUI {
|
||||
try {
|
||||
dummyId = Integer.parseInt(key);
|
||||
} catch (NumberFormatException exception) {
|
||||
SavageFactions.plugin.log(Level.WARNING, "Invalid dummy item id: " + key.toUpperCase());
|
||||
SavageFactions.plugin.log(Level.WARNING, "Invalid dummy item id: " + key.toUpperCase());
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -205,7 +205,7 @@ public class WarpGUI implements InventoryHolder, FactionGUI {
|
||||
List<Integer> dummyIdSlots = section.getIntegerList("dummy-slots." + key);
|
||||
for (Integer slot : dummyIdSlots) {
|
||||
if (slot + 1 > guiSize || slot < 0) {
|
||||
SavageFactions.plugin.log(Level.WARNING, "Invalid slot: " + slot + " for dummy item: " + key);
|
||||
SavageFactions.plugin.log(Level.WARNING, "Invalid slot: " + slot + " for dummy item: " + key);
|
||||
continue;
|
||||
}
|
||||
dummySlots.add(slot);
|
||||
@@ -218,14 +218,14 @@ public class WarpGUI implements InventoryHolder, FactionGUI {
|
||||
final ConfigurationSection dummySection = section.getConfigurationSection("dummy-items." + id);
|
||||
|
||||
if (dummySection == null) {
|
||||
SavageFactions.plugin.log(Level.WARNING, "Attempted to build f warp GUI but config section not present.");
|
||||
SavageFactions.plugin.log(Level.WARNING, "Copy your config, allow the section to generate, then copy it back to your old config.");
|
||||
SavageFactions.plugin.log(Level.WARNING, "Attempted to build f warp GUI but config section not present.");
|
||||
SavageFactions.plugin.log(Level.WARNING, "Copy your config, allow the section to generate, then copy it back to your old config.");
|
||||
return new ItemStack(Material.AIR);
|
||||
}
|
||||
|
||||
Material material = Material.matchMaterial(dummySection.getString("material", ""));
|
||||
if (material == null) {
|
||||
SavageFactions.plugin.log(Level.WARNING, "Invalid material for dummy item: " + id);
|
||||
SavageFactions.plugin.log(Level.WARNING, "Invalid material for dummy item: " + id);
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -243,7 +243,7 @@ public class WarpGUI implements InventoryHolder, FactionGUI {
|
||||
|
||||
ItemMeta itemMeta = itemStack.getItemMeta();
|
||||
|
||||
if (! SavageFactions.plugin.mc17) {
|
||||
if (! SavageFactions.plugin.mc17) {
|
||||
itemMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS, ItemFlag.HIDE_ATTRIBUTES);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user