F map autoupdate during flying fixed.

This commit is contained in:
ProSavage
2018-07-12 11:11:07 -05:00
parent 2426142664
commit 143daad9e6
74 changed files with 3460 additions and 3659 deletions

View File

@@ -7,49 +7,6 @@ import java.util.ArrayList;
public class AsciiCompass {
public enum Point {
N('N'),
NE('/'),
E('E'),
SE('\\'),
S('S'),
SW('/'),
W('W'),
NW('\\');
public final char asciiChar;
Point(final char asciiChar) {
this.asciiChar = asciiChar;
}
@Override
public String toString() {
return String.valueOf(this.asciiChar);
}
public String getTranslation() {
if (this == N) {
return TL.COMPASS_SHORT_NORTH.toString();
}
if (this == E) {
return TL.COMPASS_SHORT_EAST.toString();
}
if (this == S) {
return TL.COMPASS_SHORT_SOUTH.toString();
}
if (this == W) {
return TL.COMPASS_SHORT_WEST.toString();
}
return toString();
}
public String toString(boolean isActive, ChatColor colorActive, String colorDefault) {
return (isActive ? colorActive : colorDefault) + getTranslation();
}
}
public static Point getCompassPointForDirection(double inDegrees) {
double degrees = (inDegrees - 180) % 360;
if (degrees < 0) {
@@ -107,4 +64,47 @@ public class AsciiCompass {
public static ArrayList<String> getAsciiCompass(double inDegrees, ChatColor colorActive, String colorDefault) {
return getAsciiCompass(getCompassPointForDirection(inDegrees), colorActive, colorDefault);
}
public enum Point {
N('N'),
NE('/'),
E('E'),
SE('\\'),
S('S'),
SW('/'),
W('W'),
NW('\\');
public final char asciiChar;
Point(final char asciiChar) {
this.asciiChar = asciiChar;
}
@Override
public String toString() {
return String.valueOf(this.asciiChar);
}
public String getTranslation() {
if (this == N) {
return TL.COMPASS_SHORT_NORTH.toString();
}
if (this == E) {
return TL.COMPASS_SHORT_EAST.toString();
}
if (this == S) {
return TL.COMPASS_SHORT_SOUTH.toString();
}
if (this == W) {
return TL.COMPASS_SHORT_WEST.toString();
}
return toString();
}
public String toString(boolean isActive, ChatColor colorActive, String colorDefault) {
return (isActive ? colorActive : colorDefault) + getTranslation();
}
}
}

View File

@@ -39,8 +39,6 @@ public class ClipPlaceholderAPIManager extends PlaceholderExpansion implements R
}
// Relational placeholders
@Override
public String onPlaceholderRequest(Player p1, Player p2, String placeholder) {

View File

@@ -15,6 +15,7 @@ import java.util.Map;
public final class EnumTypeAdapter<T extends Enum<T>> extends TypeAdapter<T> {
public static final TypeAdapterFactory ENUM_FACTORY = newEnumTypeHierarchyFactory();
private final Map<String, T> nameToConstant = new HashMap<>();
private final Map<T, String> constantToName = new HashMap<>();
@@ -34,20 +35,6 @@ public final class EnumTypeAdapter<T extends Enum<T>> extends TypeAdapter<T> {
}
}
public T read(JsonReader in) throws IOException {
if (in.peek() == JsonToken.NULL) {
in.nextNull();
return null;
}
return nameToConstant.get(in.nextString());
}
public void write(JsonWriter out, T value) throws IOException {
out.value(value == null ? null : constantToName.get(value));
}
public static final TypeAdapterFactory ENUM_FACTORY = newEnumTypeHierarchyFactory();
public static <TT> TypeAdapterFactory newEnumTypeHierarchyFactory() {
return new TypeAdapterFactory() {
@SuppressWarnings({"rawtypes", "unchecked"})
@@ -64,4 +51,16 @@ public final class EnumTypeAdapter<T extends Enum<T>> extends TypeAdapter<T> {
};
}
public T read(JsonReader in) throws IOException {
if (in.peek() == JsonToken.NULL) {
in.nextNull();
return null;
}
return nameToConstant.get(in.nextString());
}
public void write(JsonWriter out, T value) throws IOException {
out.value(value == null ? null : constantToName.get(value));
}
}

View File

@@ -1,12 +1,6 @@
package com.massivecraft.factions.util;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Item;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.util.io.BukkitObjectInputStream;
import org.bukkit.util.io.BukkitObjectOutputStream;
import org.yaml.snakeyaml.external.biz.base64Coder.Base64Coder;
@@ -14,7 +8,6 @@ import org.yaml.snakeyaml.external.biz.base64Coder.Base64Coder;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.Map;
public class InventoryUtil {
@@ -24,7 +17,7 @@ public class InventoryUtil {
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
BukkitObjectOutputStream dataOutput = new BukkitObjectOutputStream(outputStream);
dataOutput.writeInt(items.length);
for (ItemStack item: items) {
for (ItemStack item : items) {
dataOutput.writeObject(item);
}
dataOutput.close();

View File

@@ -18,6 +18,9 @@ import java.util.logging.Level;
public class MiscUtil {
/// TODO create tag whitelist!!
public static HashSet<String> substanceChars = 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)) {
return null;
@@ -46,9 +49,6 @@ public class MiscUtil {
return values;
}
/// TODO create tag whitelist!!
public static HashSet<String> substanceChars = 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 String getComparisonString(String str) {
StringBuilder ret = new StringBuilder();

View File

@@ -15,8 +15,6 @@ import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.logging.Level;
import static com.massivecraft.factions.zcore.util.TL.ROLE_NORMAL;
public class PermissionsMapTypeAdapter implements JsonDeserializer<Map<Permissable, Map<PermissableAction, Access>>> {
@Override

View File

@@ -59,6 +59,10 @@ public abstract class SpiralTask implements Runnable {
this.setTaskID(Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(P.p, this, 2, 2));
}
private static long now() {
return System.currentTimeMillis();
}
/*
* This is where the necessary work is done; you'll need to override this method with whatever you want
* done at each chunk in the spiral pattern.
@@ -88,16 +92,16 @@ public abstract class SpiralTask implements Runnable {
return x;
}
public final int getZ() {
return z;
}
/*
* Below are the guts of the class, which you normally wouldn't need to mess with.
*/
public final int getZ() {
return z;
}
public final void setTaskID(int ID) {
if (ID == -1) {
this.stop();
@@ -202,8 +206,4 @@ public abstract class SpiralTask implements Runnable {
public final boolean valid() {
return taskID != -1;
}
private static long now() {
return System.currentTimeMillis();
}
}

View File

@@ -24,18 +24,14 @@ import java.util.logging.Level;
public class WarpGUI implements InventoryHolder, FactionGUI {
private final ConfigurationSection section;
int guiSize;
private Inventory warpGUI;
private FPlayer fme;
int guiSize;
private HashMap<Integer, String> warpSlots = new HashMap<>();
private int maxWarps;
private List<Integer> dummySlots = new ArrayList<>();
private final ConfigurationSection section;
public WarpGUI(FPlayer fme) {
this.fme = fme;
this.section = P.p.getConfig().getConfigurationSection("fwarp-gui");
@@ -114,7 +110,7 @@ public class WarpGUI implements InventoryHolder, FactionGUI {
fme.setEnteringPassword(false, "");
}
}
}, P.p.getConfig().getInt("fwarp-gui.password-timeout", 5)*20);
}, P.p.getConfig().getInt("fwarp-gui.password-timeout", 5) * 20);
}
}
}