General cleanup
This commit is contained in:
parent
836bd511da
commit
f88d8965b2
|
@ -25,7 +25,7 @@ public interface Hologram {
|
|||
* @param text the content of the line, can be null for an empty line
|
||||
* @return the new TextLine appended
|
||||
*/
|
||||
public TextLine appendTextLine(String text);
|
||||
TextLine appendTextLine(String text);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -34,7 +34,7 @@ public interface Hologram {
|
|||
* @param itemStack the content of the line
|
||||
* @return the new ItemLine appended
|
||||
*/
|
||||
public ItemLine appendItemLine(ItemStack itemStack);
|
||||
ItemLine appendItemLine(ItemStack itemStack);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -46,7 +46,7 @@ public interface Hologram {
|
|||
* @return the new TextLine inserted
|
||||
* @throws IndexOutOfBoundsException if the index is out of range (index < 0 || index >= size())
|
||||
*/
|
||||
public TextLine insertTextLine(int index, String text);
|
||||
TextLine insertTextLine(int index, String text);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -58,7 +58,7 @@ public interface Hologram {
|
|||
* @return the new ItemLine inserted
|
||||
* @throws IndexOutOfBoundsException if the index is out of range (index < 0 || index >= size())
|
||||
*/
|
||||
public ItemLine insertItemLine(int index, ItemStack itemStack);
|
||||
ItemLine insertItemLine(int index, ItemStack itemStack);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -68,7 +68,7 @@ public interface Hologram {
|
|||
* @return the hologram line at the given index, can be an {@link ItemLine} or a {@link TextLine}.
|
||||
* @throws IndexOutOfBoundsException if the index is out of range (index < 0 || index >= size())
|
||||
*/
|
||||
public HologramLine getLine(int index);
|
||||
HologramLine getLine(int index);
|
||||
|
||||
/**
|
||||
* Removes a line at a given index. Since: v2.0.1
|
||||
|
@ -76,13 +76,13 @@ public interface Hologram {
|
|||
* @param index the index of the line, that should be between 0 and size() - 1.
|
||||
* @throws IndexOutOfBoundsException if the index is out of range (index < 0 || index >= size())
|
||||
*/
|
||||
public void removeLine(int index);
|
||||
void removeLine(int index);
|
||||
|
||||
|
||||
/**
|
||||
* Removes all the lines from this hologram.
|
||||
*/
|
||||
public void clearLines();
|
||||
void clearLines();
|
||||
|
||||
|
||||
/**
|
||||
|
@ -90,7 +90,7 @@ public interface Hologram {
|
|||
*
|
||||
* @return the amount of lines
|
||||
*/
|
||||
public int size();
|
||||
int size();
|
||||
|
||||
|
||||
/**
|
||||
|
@ -98,7 +98,7 @@ public interface Hologram {
|
|||
*
|
||||
* @return the height of the hologram, counting all the lines and the gaps between them
|
||||
*/
|
||||
public double getHeight();
|
||||
double getHeight();
|
||||
|
||||
|
||||
/**
|
||||
|
@ -106,7 +106,7 @@ public interface Hologram {
|
|||
*
|
||||
* @param location the new location
|
||||
*/
|
||||
public void teleport(Location location);
|
||||
void teleport(Location location);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -118,21 +118,21 @@ public interface Hologram {
|
|||
* @param y the Y coordinate
|
||||
* @param z the Z coordinate
|
||||
*/
|
||||
public void teleport(World world, double x, double y, double z);
|
||||
void teleport(World world, double x, double y, double z);
|
||||
|
||||
/**
|
||||
* Returns the position of the hologram.
|
||||
*
|
||||
* @return the Location of the hologram
|
||||
*/
|
||||
public Location getLocation();
|
||||
Location getLocation();
|
||||
|
||||
/**
|
||||
* Returns the X coordinate.
|
||||
*
|
||||
* @return the X coordinate of the hologram
|
||||
*/
|
||||
public double getX();
|
||||
double getX();
|
||||
|
||||
|
||||
/**
|
||||
|
@ -140,7 +140,7 @@ public interface Hologram {
|
|||
*
|
||||
* @return the Y coordinate of the hologram
|
||||
*/
|
||||
public double getY();
|
||||
double getY();
|
||||
|
||||
|
||||
/**
|
||||
|
@ -148,7 +148,7 @@ public interface Hologram {
|
|||
*
|
||||
* @return the Z coordinate of the hologram
|
||||
*/
|
||||
public double getZ();
|
||||
double getZ();
|
||||
|
||||
|
||||
/**
|
||||
|
@ -156,7 +156,7 @@ public interface Hologram {
|
|||
*
|
||||
* @return the world of the hologram
|
||||
*/
|
||||
public World getWorld();
|
||||
World getWorld();
|
||||
|
||||
|
||||
/**
|
||||
|
@ -166,7 +166,7 @@ public interface Hologram {
|
|||
*
|
||||
* @return the VisibilityManager of this hologram
|
||||
*/
|
||||
public VisibilityManager getVisibilityManager();
|
||||
VisibilityManager getVisibilityManager();
|
||||
|
||||
|
||||
/**
|
||||
|
@ -174,7 +174,7 @@ public interface Hologram {
|
|||
*
|
||||
* @return the timestamp of when the hologram was created, in milliseconds
|
||||
*/
|
||||
public long getCreationTimestamp();
|
||||
long getCreationTimestamp();
|
||||
|
||||
/**
|
||||
* Checks if the hologram will track and replace placeholders.
|
||||
|
@ -182,7 +182,7 @@ public interface Hologram {
|
|||
*
|
||||
* @return if the hologram allows placeholders
|
||||
*/
|
||||
public boolean isAllowPlaceholders();
|
||||
boolean isAllowPlaceholders();
|
||||
|
||||
/**
|
||||
* Sets if the hologram should track and replace placeholders.
|
||||
|
@ -190,14 +190,14 @@ public interface Hologram {
|
|||
*
|
||||
* @param allowPlaceholders if the hologram should track placeholders
|
||||
*/
|
||||
public void setAllowPlaceholders(boolean allowPlaceholders);
|
||||
void setAllowPlaceholders(boolean allowPlaceholders);
|
||||
|
||||
/**
|
||||
* Deletes this hologram. Editing or teleporting the hologram when deleted
|
||||
* will throw an exception. Lines will be automatically cleared.
|
||||
* You should remove all the references of the hologram after deletion.
|
||||
*/
|
||||
public void delete();
|
||||
void delete();
|
||||
|
||||
|
||||
/**
|
||||
|
@ -205,6 +205,6 @@ public interface Hologram {
|
|||
*
|
||||
* @return true if this hologram was deleted
|
||||
*/
|
||||
public boolean isDeleted();
|
||||
boolean isDeleted();
|
||||
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ public interface VisibilityManager {
|
|||
*
|
||||
* @return if the hologram hologram is visible by default
|
||||
*/
|
||||
public boolean isVisibleByDefault();
|
||||
boolean isVisibleByDefault();
|
||||
|
||||
/**
|
||||
* Sets if the hologram is visible by default. If not changed, this value
|
||||
|
@ -28,7 +28,7 @@ public interface VisibilityManager {
|
|||
*
|
||||
* @param visibleByDefault the new behaviour
|
||||
*/
|
||||
public void setVisibleByDefault(boolean visibleByDefault);
|
||||
void setVisibleByDefault(boolean visibleByDefault);
|
||||
|
||||
/**
|
||||
* Shows the hologram to a player, overriding the value of {@link #isVisibleByDefault()}.
|
||||
|
@ -36,7 +36,7 @@ public interface VisibilityManager {
|
|||
*
|
||||
* @param player the involved player
|
||||
*/
|
||||
public void showTo(Player player);
|
||||
void showTo(Player player);
|
||||
|
||||
/**
|
||||
* Hides the hologram to a player, overriding the value of {@link #isVisibleByDefault()}.
|
||||
|
@ -44,7 +44,7 @@ public interface VisibilityManager {
|
|||
*
|
||||
* @param player the involved player
|
||||
*/
|
||||
public void hideTo(Player player);
|
||||
void hideTo(Player player);
|
||||
|
||||
/**
|
||||
* Checks if a hologram is visible to a player.
|
||||
|
@ -52,7 +52,7 @@ public interface VisibilityManager {
|
|||
* @param player the involved player
|
||||
* @return if the player can see the hologram
|
||||
*/
|
||||
public boolean isVisibleTo(Player player);
|
||||
boolean isVisibleTo(Player player);
|
||||
|
||||
/**
|
||||
* Resets the visibility to the default value. If you previously called {@link #showTo(Player)}
|
||||
|
@ -61,11 +61,11 @@ public interface VisibilityManager {
|
|||
*
|
||||
* @param player the involved player
|
||||
*/
|
||||
public void resetVisibility(Player player);
|
||||
void resetVisibility(Player player);
|
||||
|
||||
/**
|
||||
* Resets the visibility for all the players. See {@link #resetVisibility(Player)} for more details.
|
||||
*/
|
||||
public void resetVisibilityAll();
|
||||
void resetVisibilityAll();
|
||||
|
||||
}
|
||||
|
|
|
@ -16,6 +16,6 @@ public interface PickupHandler {
|
|||
* Called when a player picks up the item.
|
||||
* @param player the player who picked up the item
|
||||
*/
|
||||
public void onPickup(Player player);
|
||||
void onPickup(Player player);
|
||||
|
||||
}
|
||||
|
|
|
@ -16,6 +16,6 @@ public interface TouchHandler {
|
|||
* Called when a player interacts with the hologram (right click).
|
||||
* @param player the player who interacts
|
||||
*/
|
||||
public void onTouch(Player player);
|
||||
void onTouch(Player player);
|
||||
|
||||
}
|
||||
|
|
|
@ -17,13 +17,13 @@ public interface CollectableLine extends HologramLine {
|
|||
*
|
||||
* @param pickupHandler the new PickupHandler, can be null.
|
||||
*/
|
||||
public void setPickupHandler(PickupHandler pickupHandler);
|
||||
void setPickupHandler(PickupHandler pickupHandler);
|
||||
|
||||
/**
|
||||
* Returns the current PickupHandler of this line.
|
||||
*
|
||||
* @return the current PickupHandler, can be null.
|
||||
*/
|
||||
public PickupHandler getPickupHandler();
|
||||
PickupHandler getPickupHandler();
|
||||
|
||||
}
|
||||
|
|
|
@ -17,12 +17,12 @@ public interface HologramLine {
|
|||
*
|
||||
* @return the parent Hologram.
|
||||
*/
|
||||
public Hologram getParent();
|
||||
Hologram getParent();
|
||||
|
||||
/**
|
||||
* Removes this line from the parent Hologram. Since: v2.0.1
|
||||
* Do not call if the Hologram has been deleted, an exception will be thrown.
|
||||
*/
|
||||
public void removeLine();
|
||||
void removeLine();
|
||||
|
||||
}
|
||||
|
|
|
@ -14,13 +14,13 @@ public interface ItemLine extends CollectableLine, TouchableLine {
|
|||
*
|
||||
* @return the ItemStack if this ItemLine.
|
||||
*/
|
||||
public ItemStack getItemStack();
|
||||
ItemStack getItemStack();
|
||||
|
||||
/**
|
||||
* Sets the ItemStack for this ItemLine.
|
||||
*
|
||||
* @param itemStack the new item, should not be null.
|
||||
*/
|
||||
public void setItemStack(ItemStack itemStack);
|
||||
void setItemStack(ItemStack itemStack);
|
||||
|
||||
}
|
||||
|
|
|
@ -12,13 +12,13 @@ public interface TextLine extends TouchableLine {
|
|||
*
|
||||
* @return the current text of this line.
|
||||
*/
|
||||
public String getText();
|
||||
String getText();
|
||||
|
||||
/**
|
||||
* Sets the text of this TextLine.
|
||||
*
|
||||
* @param text the new text of this line.
|
||||
*/
|
||||
public void setText(String text);
|
||||
void setText(String text);
|
||||
|
||||
}
|
||||
|
|
|
@ -17,13 +17,13 @@ public interface TouchableLine extends HologramLine {
|
|||
*
|
||||
* @param touchHandler the new TouchHandler, can be null.
|
||||
*/
|
||||
public void setTouchHandler(TouchHandler touchHandler);
|
||||
void setTouchHandler(TouchHandler touchHandler);
|
||||
|
||||
/**
|
||||
* Returns the current TouchHandler of this line.
|
||||
*
|
||||
* @return the current TouchHandler, can be null.
|
||||
*/
|
||||
public TouchHandler getTouchHandler();
|
||||
TouchHandler getTouchHandler();
|
||||
|
||||
}
|
||||
|
|
|
@ -11,6 +11,6 @@ public interface PlaceholderReplacer {
|
|||
* Called to update a placeholder's replacement.
|
||||
* @return the replacement
|
||||
*/
|
||||
public String update();
|
||||
String update();
|
||||
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ public class ConsoleLogger {
|
|||
}
|
||||
|
||||
public static void handleSpawnFail(HologramLine parentPiece) {
|
||||
logDebug(Level.WARNING, "Coulnd't spawn entity for this hologram: " + parentPiece.getParent().toString());
|
||||
logDebug(Level.WARNING, "Couldn't spawn entity for this hologram: " + parentPiece.getParent().toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -59,11 +59,5 @@ public enum NMSVersion {
|
|||
public static boolean isGreaterEqualThan(NMSVersion other) {
|
||||
return getCurrent().ordinal() >= other.ordinal();
|
||||
}
|
||||
|
||||
|
||||
public static boolean isBetween(NMSVersion from, NMSVersion to) {
|
||||
return from.ordinal() <= getCurrent().ordinal() && getCurrent().ordinal() <= to.ordinal();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -71,9 +71,9 @@ public class Utils {
|
|||
if (objects == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (int i = 0; i < objects.length; i++) {
|
||||
if (objects[i] != null) {
|
||||
|
||||
for (Object object : objects) {
|
||||
if (object != null) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -96,10 +96,7 @@ public class Utils {
|
|||
return str;
|
||||
}
|
||||
|
||||
return new StringBuilder(str.length())
|
||||
.append(Character.toLowerCase(str.charAt(0)))
|
||||
.append(str.substring(1))
|
||||
.toString();
|
||||
return Character.toLowerCase(str.charAt(0)) + str.substring(1);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -76,12 +76,4 @@ public class VersionUtils {
|
|||
return compare(reference, thanWhat) >= 0;
|
||||
}
|
||||
|
||||
public static boolean isVersionLessEqual(String reference, String thanWhat) {
|
||||
return compare(reference, thanWhat) <= 0;
|
||||
}
|
||||
|
||||
public static boolean isVersionBetweenEqual(String reference, String lowest, String highest) {
|
||||
return isVersionGreaterEqual(reference, lowest) && isVersionLessEqual(reference, highest);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -7,7 +7,6 @@ package me.filoghost.example.powerups;
|
|||
|
||||
import me.filoghost.holographicdisplays.api.Hologram;
|
||||
import me.filoghost.holographicdisplays.api.HologramsAPI;
|
||||
import me.filoghost.holographicdisplays.api.handler.PickupHandler;
|
||||
import me.filoghost.holographicdisplays.api.line.ItemLine;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
|
@ -54,21 +53,17 @@ public class PowerUps extends JavaPlugin implements Listener {
|
|||
hologram.appendTextLine(ChatColor.AQUA + "" + ChatColor.BOLD + "Speed PowerUp");
|
||||
ItemLine icon = hologram.appendItemLine(new ItemStack(Material.SUGAR));
|
||||
|
||||
icon.setPickupHandler(new PickupHandler() {
|
||||
icon.setPickupHandler((Player player) -> {
|
||||
|
||||
// Play an effect.
|
||||
player.playEffect(hologram.getLocation(), Effect.MOBSPAWNER_FLAMES, null);
|
||||
|
||||
// 30 seconds of speed II.
|
||||
player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 30 * 20, 1), true);
|
||||
|
||||
// Delete the hologram.
|
||||
hologram.delete();
|
||||
|
||||
@Override
|
||||
public void onPickup(Player player) {
|
||||
|
||||
// Play an effect.
|
||||
player.playEffect(hologram.getLocation(), Effect.MOBSPAWNER_FLAMES, null);
|
||||
|
||||
// 30 seconds of speed II.
|
||||
player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 30 * 20, 1), true);
|
||||
|
||||
// Delete the hologram.
|
||||
hologram.delete();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
|
|
@ -16,59 +16,59 @@ import org.bukkit.inventory.ItemStack;
|
|||
public interface FloatingItem {
|
||||
|
||||
@Deprecated
|
||||
public boolean update();
|
||||
boolean update();
|
||||
|
||||
@Deprecated
|
||||
public void hide();
|
||||
void hide();
|
||||
|
||||
@Deprecated
|
||||
public void setItemStack(ItemStack itemstack);
|
||||
void setItemStack(ItemStack itemstack);
|
||||
|
||||
@Deprecated
|
||||
public ItemStack getItemStack();
|
||||
ItemStack getItemStack();
|
||||
|
||||
@Deprecated
|
||||
public Location getLocation();
|
||||
Location getLocation();
|
||||
|
||||
@Deprecated
|
||||
public double getX();
|
||||
double getX();
|
||||
|
||||
@Deprecated
|
||||
public double getY();
|
||||
double getY();
|
||||
|
||||
@Deprecated
|
||||
public double getZ();
|
||||
double getZ();
|
||||
|
||||
@Deprecated
|
||||
public World getWorld();
|
||||
World getWorld();
|
||||
|
||||
@Deprecated
|
||||
public void teleport(Location location);
|
||||
void teleport(Location location);
|
||||
|
||||
@Deprecated
|
||||
public void setTouchHandler(ItemTouchHandler handler);
|
||||
void setTouchHandler(ItemTouchHandler handler);
|
||||
|
||||
@Deprecated
|
||||
public ItemTouchHandler getTouchHandler();
|
||||
ItemTouchHandler getTouchHandler();
|
||||
|
||||
@Deprecated
|
||||
public boolean hasTouchHandler();
|
||||
boolean hasTouchHandler();
|
||||
|
||||
@Deprecated
|
||||
public void setPickupHandler(PickupHandler handler);
|
||||
void setPickupHandler(PickupHandler handler);
|
||||
|
||||
@Deprecated
|
||||
public PickupHandler getPickupHandler();
|
||||
PickupHandler getPickupHandler();
|
||||
|
||||
@Deprecated
|
||||
public boolean hasPickupHandler();
|
||||
boolean hasPickupHandler();
|
||||
|
||||
@Deprecated
|
||||
public long getCreationTimestamp();
|
||||
long getCreationTimestamp();
|
||||
|
||||
@Deprecated
|
||||
public void delete();
|
||||
void delete();
|
||||
|
||||
@Deprecated
|
||||
public boolean isDeleted();
|
||||
boolean isDeleted();
|
||||
}
|
||||
|
|
|
@ -15,69 +15,69 @@ import org.bukkit.World;
|
|||
public interface Hologram {
|
||||
|
||||
@Deprecated
|
||||
public boolean update();
|
||||
boolean update();
|
||||
|
||||
@Deprecated
|
||||
public void hide();
|
||||
void hide();
|
||||
|
||||
@Deprecated
|
||||
public void addLine(String text);
|
||||
void addLine(String text);
|
||||
|
||||
@Deprecated
|
||||
public void removeLine(int index);
|
||||
void removeLine(int index);
|
||||
|
||||
@Deprecated
|
||||
public void setLine(int index, String text);
|
||||
void setLine(int index, String text);
|
||||
|
||||
@Deprecated
|
||||
public void insertLine(int index, String text);
|
||||
void insertLine(int index, String text);
|
||||
|
||||
@Deprecated
|
||||
public String[] getLines();
|
||||
String[] getLines();
|
||||
|
||||
@Deprecated
|
||||
public int getLinesLength();
|
||||
int getLinesLength();
|
||||
|
||||
@Deprecated
|
||||
public void clearLines();
|
||||
void clearLines();
|
||||
|
||||
@Deprecated
|
||||
public Location getLocation();
|
||||
Location getLocation();
|
||||
|
||||
@Deprecated
|
||||
public double getX();
|
||||
double getX();
|
||||
|
||||
@Deprecated
|
||||
public double getY();
|
||||
double getY();
|
||||
|
||||
@Deprecated
|
||||
public double getZ();
|
||||
double getZ();
|
||||
|
||||
@Deprecated
|
||||
public World getWorld();
|
||||
World getWorld();
|
||||
|
||||
@Deprecated
|
||||
public void setLocation(Location location);
|
||||
void setLocation(Location location);
|
||||
|
||||
@Deprecated
|
||||
public void teleport(Location location);
|
||||
void teleport(Location location);
|
||||
|
||||
@Deprecated
|
||||
public void setTouchHandler(TouchHandler handler);
|
||||
void setTouchHandler(TouchHandler handler);
|
||||
|
||||
@Deprecated
|
||||
public TouchHandler getTouchHandler();
|
||||
TouchHandler getTouchHandler();
|
||||
|
||||
@Deprecated
|
||||
public boolean hasTouchHandler();
|
||||
boolean hasTouchHandler();
|
||||
|
||||
@Deprecated
|
||||
public long getCreationTimestamp();
|
||||
long getCreationTimestamp();
|
||||
|
||||
@Deprecated
|
||||
public void delete();
|
||||
void delete();
|
||||
|
||||
@Deprecated
|
||||
public boolean isDeleted();
|
||||
boolean isDeleted();
|
||||
|
||||
}
|
||||
|
|
|
@ -14,6 +14,6 @@ import org.bukkit.entity.Player;
|
|||
public interface ItemTouchHandler {
|
||||
|
||||
@Deprecated
|
||||
public void onTouch(FloatingItem floatingItem, Player player);
|
||||
void onTouch(FloatingItem floatingItem, Player player);
|
||||
|
||||
}
|
||||
|
|
|
@ -14,6 +14,6 @@ import org.bukkit.entity.Player;
|
|||
public interface PickupHandler {
|
||||
|
||||
@Deprecated
|
||||
public void onPickup(FloatingItem floatingItem, Player player);
|
||||
void onPickup(FloatingItem floatingItem, Player player);
|
||||
|
||||
}
|
||||
|
|
|
@ -14,6 +14,6 @@ import org.bukkit.entity.Player;
|
|||
public interface TouchHandler {
|
||||
|
||||
@Deprecated
|
||||
public void onTouch(Hologram hologram, Player player);
|
||||
void onTouch(Hologram hologram, Player player);
|
||||
|
||||
}
|
||||
|
|
|
@ -19,69 +19,69 @@ import org.bukkit.inventory.ItemStack;
|
|||
public interface Hologram {
|
||||
|
||||
@Deprecated
|
||||
public TextLine appendTextLine(String text);
|
||||
TextLine appendTextLine(String text);
|
||||
|
||||
@Deprecated
|
||||
public ItemLine appendItemLine(ItemStack itemStack);
|
||||
ItemLine appendItemLine(ItemStack itemStack);
|
||||
|
||||
@Deprecated
|
||||
public TextLine insertTextLine(int index, String text);
|
||||
TextLine insertTextLine(int index, String text);
|
||||
|
||||
@Deprecated
|
||||
public ItemLine insertItemLine(int index, ItemStack itemStack);
|
||||
ItemLine insertItemLine(int index, ItemStack itemStack);
|
||||
|
||||
@Deprecated
|
||||
public HologramLine getLine(int index);
|
||||
HologramLine getLine(int index);
|
||||
|
||||
@Deprecated
|
||||
public void removeLine(int index);
|
||||
void removeLine(int index);
|
||||
|
||||
@Deprecated
|
||||
public void clearLines();
|
||||
void clearLines();
|
||||
|
||||
@Deprecated
|
||||
public int size();
|
||||
int size();
|
||||
|
||||
@Deprecated
|
||||
public double getHeight();
|
||||
double getHeight();
|
||||
|
||||
@Deprecated
|
||||
public void teleport(Location location);
|
||||
void teleport(Location location);
|
||||
|
||||
@Deprecated
|
||||
public void teleport(World world, double x, double y, double z);
|
||||
void teleport(World world, double x, double y, double z);
|
||||
|
||||
@Deprecated
|
||||
public Location getLocation();
|
||||
Location getLocation();
|
||||
|
||||
@Deprecated
|
||||
public double getX();
|
||||
double getX();
|
||||
|
||||
@Deprecated
|
||||
public double getY();
|
||||
double getY();
|
||||
|
||||
@Deprecated
|
||||
public double getZ();
|
||||
double getZ();
|
||||
|
||||
@Deprecated
|
||||
public World getWorld();
|
||||
World getWorld();
|
||||
|
||||
@Deprecated
|
||||
public VisibilityManager getVisibilityManager();
|
||||
VisibilityManager getVisibilityManager();
|
||||
|
||||
@Deprecated
|
||||
public long getCreationTimestamp();
|
||||
long getCreationTimestamp();
|
||||
|
||||
@Deprecated
|
||||
public boolean isAllowPlaceholders();
|
||||
boolean isAllowPlaceholders();
|
||||
|
||||
@Deprecated
|
||||
public void setAllowPlaceholders(boolean allowPlaceholders);
|
||||
void setAllowPlaceholders(boolean allowPlaceholders);
|
||||
|
||||
@Deprecated
|
||||
public void delete();
|
||||
void delete();
|
||||
|
||||
@Deprecated
|
||||
public boolean isDeleted();
|
||||
boolean isDeleted();
|
||||
|
||||
}
|
||||
|
|
|
@ -14,24 +14,24 @@ import org.bukkit.entity.Player;
|
|||
public interface VisibilityManager {
|
||||
|
||||
@Deprecated
|
||||
public boolean isVisibleByDefault();
|
||||
boolean isVisibleByDefault();
|
||||
|
||||
@Deprecated
|
||||
public void setVisibleByDefault(boolean visibleByDefault);
|
||||
void setVisibleByDefault(boolean visibleByDefault);
|
||||
|
||||
@Deprecated
|
||||
public void showTo(Player player);
|
||||
void showTo(Player player);
|
||||
|
||||
@Deprecated
|
||||
public void hideTo(Player player);
|
||||
void hideTo(Player player);
|
||||
|
||||
@Deprecated
|
||||
public boolean isVisibleTo(Player player);
|
||||
boolean isVisibleTo(Player player);
|
||||
|
||||
@Deprecated
|
||||
public void resetVisibility(Player player);
|
||||
void resetVisibility(Player player);
|
||||
|
||||
@Deprecated
|
||||
public void resetVisibilityAll();
|
||||
void resetVisibilityAll();
|
||||
|
||||
}
|
||||
|
|
|
@ -14,6 +14,6 @@ import org.bukkit.entity.Player;
|
|||
public interface PickupHandler {
|
||||
|
||||
@Deprecated
|
||||
public void onPickup(Player player);
|
||||
void onPickup(Player player);
|
||||
|
||||
}
|
||||
|
|
|
@ -14,6 +14,6 @@ import org.bukkit.entity.Player;
|
|||
public interface TouchHandler {
|
||||
|
||||
@Deprecated
|
||||
public void onTouch(Player player);
|
||||
void onTouch(Player player);
|
||||
|
||||
}
|
||||
|
|
|
@ -14,9 +14,9 @@ import com.gmail.filoghost.holographicdisplays.api.handler.PickupHandler;
|
|||
public interface CollectableLine extends HologramLine {
|
||||
|
||||
@Deprecated
|
||||
public void setPickupHandler(PickupHandler pickupHandler);
|
||||
void setPickupHandler(PickupHandler pickupHandler);
|
||||
|
||||
@Deprecated
|
||||
public PickupHandler getPickupHandler();
|
||||
PickupHandler getPickupHandler();
|
||||
|
||||
}
|
||||
|
|
|
@ -14,9 +14,9 @@ import com.gmail.filoghost.holographicdisplays.api.Hologram;
|
|||
public interface HologramLine {
|
||||
|
||||
@Deprecated
|
||||
public Hologram getParent();
|
||||
Hologram getParent();
|
||||
|
||||
@Deprecated
|
||||
public void removeLine();
|
||||
void removeLine();
|
||||
|
||||
}
|
||||
|
|
|
@ -14,9 +14,9 @@ import org.bukkit.inventory.ItemStack;
|
|||
public interface ItemLine extends CollectableLine, TouchableLine {
|
||||
|
||||
@Deprecated
|
||||
public ItemStack getItemStack();
|
||||
ItemStack getItemStack();
|
||||
|
||||
@Deprecated
|
||||
public void setItemStack(ItemStack itemStack);
|
||||
void setItemStack(ItemStack itemStack);
|
||||
|
||||
}
|
||||
|
|
|
@ -12,9 +12,9 @@ package com.gmail.filoghost.holographicdisplays.api.line;
|
|||
public interface TextLine extends TouchableLine {
|
||||
|
||||
@Deprecated
|
||||
public String getText();
|
||||
String getText();
|
||||
|
||||
@Deprecated
|
||||
public void setText(String text);
|
||||
void setText(String text);
|
||||
|
||||
}
|
||||
|
|
|
@ -14,9 +14,9 @@ import com.gmail.filoghost.holographicdisplays.api.handler.TouchHandler;
|
|||
public interface TouchableLine extends HologramLine {
|
||||
|
||||
@Deprecated
|
||||
public void setTouchHandler(TouchHandler touchHandler);
|
||||
void setTouchHandler(TouchHandler touchHandler);
|
||||
|
||||
@Deprecated
|
||||
public TouchHandler getTouchHandler();
|
||||
TouchHandler getTouchHandler();
|
||||
|
||||
}
|
||||
|
|
|
@ -12,6 +12,6 @@ package com.gmail.filoghost.holographicdisplays.api.placeholder;
|
|||
public interface PlaceholderReplacer {
|
||||
|
||||
@Deprecated
|
||||
public String update();
|
||||
String update();
|
||||
|
||||
}
|
||||
|
|
|
@ -11,6 +11,6 @@ import org.bukkit.entity.Player;
|
|||
|
||||
public interface ItemPickupManager {
|
||||
|
||||
public void handleItemLinePickup(Player player, PickupHandler pickupHandler, Hologram hologram);
|
||||
void handleItemLinePickup(Player player, PickupHandler pickupHandler, Hologram hologram);
|
||||
|
||||
}
|
||||
|
|
|
@ -11,26 +11,25 @@ import me.filoghost.holographicdisplays.nms.interfaces.entity.NMSArmorStand;
|
|||
import me.filoghost.holographicdisplays.nms.interfaces.entity.NMSEntityBase;
|
||||
import me.filoghost.holographicdisplays.nms.interfaces.entity.NMSItem;
|
||||
import me.filoghost.holographicdisplays.nms.interfaces.entity.NMSSlime;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public interface NMSManager {
|
||||
|
||||
// A method to register all the custom entities of the plugin, it may fail.
|
||||
public void setup() throws Exception;
|
||||
void setup() throws Exception;
|
||||
|
||||
public NMSArmorStand spawnNMSArmorStand(org.bukkit.World world, double x, double y, double z, HologramLine parentPiece, boolean broadcastLocationPacket);
|
||||
NMSArmorStand spawnNMSArmorStand(org.bukkit.World world, double x, double y, double z, HologramLine parentPiece, boolean broadcastLocationPacket);
|
||||
|
||||
public NMSItem spawnNMSItem(org.bukkit.World bukkitWorld, double x, double y, double z, ItemLine parentPiece, ItemStack stack, ItemPickupManager itemPickupManager);
|
||||
NMSItem spawnNMSItem(org.bukkit.World bukkitWorld, double x, double y, double z, ItemLine parentPiece, ItemStack stack, ItemPickupManager itemPickupManager);
|
||||
|
||||
public NMSSlime spawnNMSSlime(org.bukkit.World bukkitWorld, double x, double y, double z, HologramLine parentPiece);
|
||||
NMSSlime spawnNMSSlime(org.bukkit.World bukkitWorld, double x, double y, double z, HologramLine parentPiece);
|
||||
|
||||
public boolean isNMSEntityBase(org.bukkit.entity.Entity bukkitEntity);
|
||||
boolean isNMSEntityBase(org.bukkit.entity.Entity bukkitEntity);
|
||||
|
||||
public NMSEntityBase getNMSEntityBase(org.bukkit.entity.Entity bukkitEntity);
|
||||
NMSEntityBase getNMSEntityBase(org.bukkit.entity.Entity bukkitEntity);
|
||||
|
||||
public NMSEntityBase getNMSEntityBaseFromID(World bukkitWorld, int entityID);
|
||||
NMSEntityBase getNMSEntityBaseFromID(org.bukkit.World bukkitWorld, int entityID);
|
||||
|
||||
public Object replaceCustomNameText(Object customNameObject, String target, String replacement);
|
||||
Object replaceCustomNameText(Object customNameObject, String target, String replacement);
|
||||
|
||||
}
|
||||
|
|
|
@ -8,6 +8,6 @@ package me.filoghost.holographicdisplays.nms.interfaces.entity;
|
|||
public interface NMSArmorStand extends NMSNameable {
|
||||
|
||||
// Sets the location through NMS and optionally broadcast an additional teleport packet containing the location.
|
||||
public void setLocationNMS(double x, double y, double z, boolean broadcastLocationPacket);
|
||||
void setLocationNMS(double x, double y, double z, boolean broadcastLocationPacket);
|
||||
|
||||
}
|
||||
|
|
|
@ -8,6 +8,6 @@ package me.filoghost.holographicdisplays.nms.interfaces.entity;
|
|||
public interface NMSCanMount extends NMSEntityBase {
|
||||
|
||||
// Sets the passenger of this entity through NMS.
|
||||
public void setPassengerOfNMS(NMSEntityBase vehicleBase);
|
||||
void setPassengerOfNMS(NMSEntityBase vehicleBase);
|
||||
|
||||
}
|
||||
|
|
|
@ -13,18 +13,18 @@ import me.filoghost.holographicdisplays.api.line.HologramLine;
|
|||
public interface NMSEntityBase {
|
||||
|
||||
// Returns the linked CraftHologramLine, all the entities are part of a piece. Should never be null.
|
||||
public HologramLine getHologramLine();
|
||||
HologramLine getHologramLine();
|
||||
|
||||
// Returns if the entity is dead through NMS.
|
||||
public boolean isDeadNMS();
|
||||
boolean isDeadNMS();
|
||||
|
||||
// Kills the entity through NMS.
|
||||
public void killEntityNMS();
|
||||
void killEntityNMS();
|
||||
|
||||
// The entity ID.
|
||||
public int getIdNMS();
|
||||
int getIdNMS();
|
||||
|
||||
// Returns the bukkit entity.
|
||||
public org.bukkit.entity.Entity getBukkitEntityNMS();
|
||||
org.bukkit.entity.Entity getBukkitEntityNMS();
|
||||
|
||||
}
|
||||
|
|
|
@ -10,15 +10,12 @@ import org.bukkit.inventory.ItemStack;
|
|||
public interface NMSItem extends NMSEntityBase, NMSCanMount {
|
||||
|
||||
// Sets the location through NMS.
|
||||
public void setLocationNMS(double x, double y, double z);
|
||||
void setLocationNMS(double x, double y, double z);
|
||||
|
||||
// Sets the bukkit ItemStack for this item.
|
||||
public void setItemStackNMS(ItemStack stack);
|
||||
|
||||
// Sets if this item can be picked up by players.
|
||||
public void allowPickup(boolean pickup);
|
||||
|
||||
void setItemStackNMS(ItemStack stack);
|
||||
|
||||
// The raw NMS ItemStack object.
|
||||
public Object getRawItemStack();
|
||||
Object getRawItemStack();
|
||||
|
||||
}
|
||||
|
|
|
@ -8,12 +8,12 @@ package me.filoghost.holographicdisplays.nms.interfaces.entity;
|
|||
public interface NMSNameable extends NMSEntityBase {
|
||||
|
||||
// Sets a custom name as a String.
|
||||
public void setCustomNameNMS(String name);
|
||||
void setCustomNameNMS(String name);
|
||||
|
||||
// Returns the custom name as a String.
|
||||
public String getCustomNameStringNMS();
|
||||
String getCustomNameStringNMS();
|
||||
|
||||
// Returns the custom name as version-dependent NMS object (String for MC 1.12 and below, ChatComponent for MC 1.13+ a ChatComponent).
|
||||
public Object getCustomNameObjectNMS();
|
||||
Object getCustomNameObjectNMS();
|
||||
|
||||
}
|
||||
|
|
|
@ -8,6 +8,6 @@ package me.filoghost.holographicdisplays.nms.interfaces.entity;
|
|||
public interface NMSSlime extends NMSEntityBase, NMSCanMount {
|
||||
|
||||
// Sets the location through NMS.
|
||||
public void setLocationNMS(double x, double y, double z);
|
||||
void setLocationNMS(double x, double y, double z);
|
||||
|
||||
}
|
||||
|
|
|
@ -214,16 +214,7 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
|
|||
public ItemLine getHologramLine() {
|
||||
return parentPiece;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void allowPickup(boolean pickup) {
|
||||
if (pickup) {
|
||||
super.pickupDelay = 0;
|
||||
} else {
|
||||
super.pickupDelay = Integer.MAX_VALUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public org.bukkit.entity.Entity getBukkitEntityNMS() {
|
||||
return getBukkitEntity();
|
||||
|
@ -231,7 +222,7 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
|
|||
|
||||
@Override
|
||||
public void setPassengerOfNMS(NMSEntityBase vehicleBase) {
|
||||
if (vehicleBase == null || !(vehicleBase instanceof Entity)) {
|
||||
if (!(vehicleBase instanceof Entity)) {
|
||||
// It should never dismount
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -210,7 +210,7 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
|
|||
|
||||
@Override
|
||||
public void setPassengerOfNMS(NMSEntityBase vehicleBase) {
|
||||
if (vehicleBase == null || !(vehicleBase instanceof Entity)) {
|
||||
if (!(vehicleBase instanceof Entity)) {
|
||||
// It should never dismount
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ public class NmsManagerImpl implements NMSManager {
|
|||
|
||||
public void registerCustomEntity(Class<?> entityClass, String name, int id) throws Exception {
|
||||
ENTITY_NAMES_BY_CLASS_FIELD.getStatic().put(entityClass, name);
|
||||
ENTITY_IDS_BY_CLASS_FIELD.getStatic().put(entityClass, Integer.valueOf(id));
|
||||
ENTITY_IDS_BY_CLASS_FIELD.getStatic().put(entityClass, id);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -189,16 +189,7 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
|
|||
public ItemLine getHologramLine() {
|
||||
return parentPiece;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void allowPickup(boolean pickup) {
|
||||
if (pickup) {
|
||||
super.pickupDelay = 0;
|
||||
} else {
|
||||
super.pickupDelay = 32767;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public org.bukkit.entity.Entity getBukkitEntityNMS() {
|
||||
return getBukkitEntity();
|
||||
|
@ -206,7 +197,7 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
|
|||
|
||||
@Override
|
||||
public void setPassengerOfNMS(NMSEntityBase vehicleBase) {
|
||||
if (vehicleBase == null || !(vehicleBase instanceof Entity)) {
|
||||
if (!(vehicleBase instanceof Entity)) {
|
||||
// It should never dismount
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -186,7 +186,7 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
|
|||
|
||||
@Override
|
||||
public void setPassengerOfNMS(NMSEntityBase vehicleBase) {
|
||||
if (vehicleBase == null || !(vehicleBase instanceof Entity)) {
|
||||
if (!(vehicleBase instanceof Entity)) {
|
||||
// It should never dismount
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -189,16 +189,7 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
|
|||
public ItemLine getHologramLine() {
|
||||
return parentPiece;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void allowPickup(boolean pickup) {
|
||||
if (pickup) {
|
||||
super.pickupDelay = 0;
|
||||
} else {
|
||||
super.pickupDelay = 32767;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public org.bukkit.entity.Entity getBukkitEntityNMS() {
|
||||
return getBukkitEntity();
|
||||
|
@ -206,7 +197,7 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
|
|||
|
||||
@Override
|
||||
public void setPassengerOfNMS(NMSEntityBase vehicleBase) {
|
||||
if (vehicleBase == null || !(vehicleBase instanceof Entity)) {
|
||||
if (!(vehicleBase instanceof Entity)) {
|
||||
// It should never dismount
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -186,7 +186,7 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
|
|||
|
||||
@Override
|
||||
public void setPassengerOfNMS(NMSEntityBase vehicleBase) {
|
||||
if (vehicleBase == null || !(vehicleBase instanceof Entity)) {
|
||||
if (!(vehicleBase instanceof Entity)) {
|
||||
// It should never dismount
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -189,16 +189,7 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
|
|||
public ItemLine getHologramLine() {
|
||||
return parentPiece;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void allowPickup(boolean pickup) {
|
||||
if (pickup) {
|
||||
super.pickupDelay = 0;
|
||||
} else {
|
||||
super.pickupDelay = 32767;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public org.bukkit.entity.Entity getBukkitEntityNMS() {
|
||||
return getBukkitEntity();
|
||||
|
@ -206,7 +197,7 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
|
|||
|
||||
@Override
|
||||
public void setPassengerOfNMS(NMSEntityBase vehicleBase) {
|
||||
if (vehicleBase == null || !(vehicleBase instanceof Entity)) {
|
||||
if (!(vehicleBase instanceof Entity)) {
|
||||
// It should never dismount
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -187,7 +187,7 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
|
|||
|
||||
@Override
|
||||
public void setPassengerOfNMS(NMSEntityBase vehicleBase) {
|
||||
if (vehicleBase == null || !(vehicleBase instanceof Entity)) {
|
||||
if (!(vehicleBase instanceof Entity)) {
|
||||
// It should never dismount
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -167,7 +167,7 @@ public class NmsManagerImpl implements NMSManager {
|
|||
return CustomNameHelper.replaceCustomNameChatComponent(NMSChatComponentAdapter.INSTANCE, customNameObject, target, replacement);
|
||||
}
|
||||
|
||||
private static enum NMSChatComponentAdapter implements ChatComponentAdapter<IChatBaseComponent> {
|
||||
private enum NMSChatComponentAdapter implements ChatComponentAdapter<IChatBaseComponent> {
|
||||
|
||||
INSTANCE {
|
||||
|
||||
|
|
|
@ -189,16 +189,7 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
|
|||
public ItemLine getHologramLine() {
|
||||
return parentPiece;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void allowPickup(boolean pickup) {
|
||||
if (pickup) {
|
||||
super.pickupDelay = 0;
|
||||
} else {
|
||||
super.pickupDelay = 32767;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public org.bukkit.entity.Entity getBukkitEntityNMS() {
|
||||
return getBukkitEntity();
|
||||
|
@ -206,7 +197,7 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
|
|||
|
||||
@Override
|
||||
public void setPassengerOfNMS(NMSEntityBase vehicleBase) {
|
||||
if (vehicleBase == null || !(vehicleBase instanceof Entity)) {
|
||||
if (!(vehicleBase instanceof Entity)) {
|
||||
// It should never dismount
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -187,7 +187,7 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
|
|||
|
||||
@Override
|
||||
public void setPassengerOfNMS(NMSEntityBase vehicleBase) {
|
||||
if (vehicleBase == null || !(vehicleBase instanceof Entity)) {
|
||||
if (!(vehicleBase instanceof Entity)) {
|
||||
// It should never dismount
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -168,7 +168,7 @@ public class NmsManagerImpl implements NMSManager {
|
|||
return CustomNameHelper.replaceCustomNameChatComponent(NMSChatComponentAdapter.INSTANCE, customNameObject, target, replacement);
|
||||
}
|
||||
|
||||
private static enum NMSChatComponentAdapter implements ChatComponentAdapter<IChatBaseComponent> {
|
||||
private enum NMSChatComponentAdapter implements ChatComponentAdapter<IChatBaseComponent> {
|
||||
|
||||
INSTANCE {
|
||||
|
||||
|
|
|
@ -191,16 +191,7 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
|
|||
public ItemLine getHologramLine() {
|
||||
return parentPiece;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void allowPickup(boolean pickup) {
|
||||
if (pickup) {
|
||||
super.pickupDelay = 0;
|
||||
} else {
|
||||
super.pickupDelay = 32767;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public org.bukkit.entity.Entity getBukkitEntityNMS() {
|
||||
return getBukkitEntity();
|
||||
|
@ -208,7 +199,7 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
|
|||
|
||||
@Override
|
||||
public void setPassengerOfNMS(NMSEntityBase vehicleBase) {
|
||||
if (vehicleBase == null || !(vehicleBase instanceof Entity)) {
|
||||
if (!(vehicleBase instanceof Entity)) {
|
||||
// It should never dismount
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -189,7 +189,7 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
|
|||
|
||||
@Override
|
||||
public void setPassengerOfNMS(NMSEntityBase vehicleBase) {
|
||||
if (vehicleBase == null || !(vehicleBase instanceof Entity)) {
|
||||
if (!(vehicleBase instanceof Entity)) {
|
||||
// It should never dismount
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -151,7 +151,7 @@ public class NmsManagerImpl implements NMSManager {
|
|||
return CustomNameHelper.replaceCustomNameChatComponent(NMSChatComponentAdapter.INSTANCE, customNameObject, target, replacement);
|
||||
}
|
||||
|
||||
private static enum NMSChatComponentAdapter implements ChatComponentAdapter<IChatBaseComponent> {
|
||||
private enum NMSChatComponentAdapter implements ChatComponentAdapter<IChatBaseComponent> {
|
||||
|
||||
INSTANCE {
|
||||
|
||||
|
|
|
@ -192,15 +192,6 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
|
|||
return parentPiece;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void allowPickup(boolean pickup) {
|
||||
if (pickup) {
|
||||
super.pickupDelay = 0;
|
||||
} else {
|
||||
super.pickupDelay = 32767;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public org.bukkit.entity.Entity getBukkitEntityNMS() {
|
||||
return getBukkitEntity();
|
||||
|
@ -208,7 +199,7 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
|
|||
|
||||
@Override
|
||||
public void setPassengerOfNMS(NMSEntityBase vehicleBase) {
|
||||
if (vehicleBase == null || !(vehicleBase instanceof Entity)) {
|
||||
if (!(vehicleBase instanceof Entity)) {
|
||||
// It should never dismount
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -189,7 +189,7 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
|
|||
|
||||
@Override
|
||||
public void setPassengerOfNMS(NMSEntityBase vehicleBase) {
|
||||
if (vehicleBase == null || !(vehicleBase instanceof Entity)) {
|
||||
if (!(vehicleBase instanceof Entity)) {
|
||||
// It should never dismount
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -150,7 +150,7 @@ public class NmsManagerImpl implements NMSManager {
|
|||
return CustomNameHelper.replaceCustomNameChatComponent(NMSChatComponentAdapter.INSTANCE, customNameObject, target, replacement);
|
||||
}
|
||||
|
||||
private static enum NMSChatComponentAdapter implements ChatComponentAdapter<IChatBaseComponent> {
|
||||
private enum NMSChatComponentAdapter implements ChatComponentAdapter<IChatBaseComponent> {
|
||||
|
||||
INSTANCE {
|
||||
|
||||
|
|
|
@ -192,15 +192,6 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
|
|||
return parentPiece;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void allowPickup(boolean pickup) {
|
||||
if (pickup) {
|
||||
super.pickupDelay = 0;
|
||||
} else {
|
||||
super.pickupDelay = 32767;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public org.bukkit.entity.Entity getBukkitEntityNMS() {
|
||||
return getBukkitEntity();
|
||||
|
@ -208,7 +199,7 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
|
|||
|
||||
@Override
|
||||
public void setPassengerOfNMS(NMSEntityBase vehicleBase) {
|
||||
if (vehicleBase == null || !(vehicleBase instanceof Entity)) {
|
||||
if (!(vehicleBase instanceof Entity)) {
|
||||
// It should never dismount
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -189,7 +189,7 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
|
|||
|
||||
@Override
|
||||
public void setPassengerOfNMS(NMSEntityBase vehicleBase) {
|
||||
if (vehicleBase == null || !(vehicleBase instanceof Entity)) {
|
||||
if (!(vehicleBase instanceof Entity)) {
|
||||
// It should never dismount
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -150,7 +150,7 @@ public class NmsManagerImpl implements NMSManager {
|
|||
return CustomNameHelper.replaceCustomNameChatComponent(NMSChatComponentAdapter.INSTANCE, customNameObject, target, replacement);
|
||||
}
|
||||
|
||||
private static enum NMSChatComponentAdapter implements ChatComponentAdapter<IChatBaseComponent> {
|
||||
private enum NMSChatComponentAdapter implements ChatComponentAdapter<IChatBaseComponent> {
|
||||
|
||||
INSTANCE {
|
||||
|
||||
|
|
|
@ -192,15 +192,6 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
|
|||
return parentPiece;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void allowPickup(boolean pickup) {
|
||||
if (pickup) {
|
||||
super.pickupDelay = 0;
|
||||
} else {
|
||||
super.pickupDelay = 32767;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public org.bukkit.entity.Entity getBukkitEntityNMS() {
|
||||
return getBukkitEntity();
|
||||
|
@ -208,7 +199,7 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
|
|||
|
||||
@Override
|
||||
public void setPassengerOfNMS(NMSEntityBase vehicleBase) {
|
||||
if (vehicleBase == null || !(vehicleBase instanceof Entity)) {
|
||||
if (!(vehicleBase instanceof Entity)) {
|
||||
// It should never dismount
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -189,7 +189,7 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
|
|||
|
||||
@Override
|
||||
public void setPassengerOfNMS(NMSEntityBase vehicleBase) {
|
||||
if (vehicleBase == null || !(vehicleBase instanceof Entity)) {
|
||||
if (!(vehicleBase instanceof Entity)) {
|
||||
// It should never dismount
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -141,7 +141,7 @@ public class NmsManagerImpl implements NMSManager {
|
|||
return CustomNameHelper.replaceCustomNameChatComponent(NMSChatComponentAdapter.INSTANCE, customNameObject, target, replacement);
|
||||
}
|
||||
|
||||
private static enum NMSChatComponentAdapter implements ChatComponentAdapter<IChatBaseComponent> {
|
||||
private enum NMSChatComponentAdapter implements ChatComponentAdapter<IChatBaseComponent> {
|
||||
|
||||
INSTANCE {
|
||||
|
||||
|
|
|
@ -192,15 +192,6 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
|
|||
return parentPiece;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void allowPickup(boolean pickup) {
|
||||
if (pickup) {
|
||||
super.pickupDelay = 0;
|
||||
} else {
|
||||
super.pickupDelay = 32767;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public org.bukkit.entity.Entity getBukkitEntityNMS() {
|
||||
return getBukkitEntity();
|
||||
|
@ -208,7 +199,7 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
|
|||
|
||||
@Override
|
||||
public void setPassengerOfNMS(NMSEntityBase vehicleBase) {
|
||||
if (vehicleBase == null || !(vehicleBase instanceof Entity)) {
|
||||
if (!(vehicleBase instanceof Entity)) {
|
||||
// It should never dismount
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -189,7 +189,7 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
|
|||
|
||||
@Override
|
||||
public void setPassengerOfNMS(NMSEntityBase vehicleBase) {
|
||||
if (vehicleBase == null || !(vehicleBase instanceof Entity)) {
|
||||
if (!(vehicleBase instanceof Entity)) {
|
||||
// It should never dismount
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -141,7 +141,7 @@ public class NmsManagerImpl implements NMSManager {
|
|||
return CustomNameHelper.replaceCustomNameChatComponent(NMSChatComponentAdapter.INSTANCE, customNameObject, target, replacement);
|
||||
}
|
||||
|
||||
private static enum NMSChatComponentAdapter implements ChatComponentAdapter<IChatBaseComponent> {
|
||||
private enum NMSChatComponentAdapter implements ChatComponentAdapter<IChatBaseComponent> {
|
||||
|
||||
INSTANCE {
|
||||
|
||||
|
|
|
@ -175,16 +175,7 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
|
|||
public ItemLine getHologramLine() {
|
||||
return parentPiece;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void allowPickup(boolean pickup) {
|
||||
if (pickup) {
|
||||
super.pickupDelay = 0;
|
||||
} else {
|
||||
super.pickupDelay = Integer.MAX_VALUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public org.bukkit.entity.Entity getBukkitEntityNMS() {
|
||||
return getBukkitEntity();
|
||||
|
@ -192,7 +183,7 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
|
|||
|
||||
@Override
|
||||
public void setPassengerOfNMS(NMSEntityBase vehicleBase) {
|
||||
if (vehicleBase == null || !(vehicleBase instanceof Entity)) {
|
||||
if (!(vehicleBase instanceof Entity)) {
|
||||
// It should never dismount
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -174,7 +174,7 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
|
|||
|
||||
@Override
|
||||
public void setPassengerOfNMS(NMSEntityBase vehicleBase) {
|
||||
if (vehicleBase == null || !(vehicleBase instanceof Entity)) {
|
||||
if (!(vehicleBase instanceof Entity)) {
|
||||
// It should never dismount
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ public class NmsManagerImpl implements NMSManager {
|
|||
|
||||
public void registerCustomEntity(Class<?> entityClass, String name, int id) throws Exception {
|
||||
ENTITY_NAMES_BY_CLASS_FIELD.getStatic().put(entityClass, name);
|
||||
ENTITY_IDS_BY_CLASS_FIELD.getStatic().put(entityClass, Integer.valueOf(id));
|
||||
ENTITY_IDS_BY_CLASS_FIELD.getStatic().put(entityClass, id);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -175,16 +175,7 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
|
|||
public ItemLine getHologramLine() {
|
||||
return parentPiece;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void allowPickup(boolean pickup) {
|
||||
if (pickup) {
|
||||
super.pickupDelay = 0;
|
||||
} else {
|
||||
super.pickupDelay = Integer.MAX_VALUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public org.bukkit.entity.Entity getBukkitEntityNMS() {
|
||||
return getBukkitEntity();
|
||||
|
@ -192,7 +183,7 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
|
|||
|
||||
@Override
|
||||
public void setPassengerOfNMS(NMSEntityBase vehicleBase) {
|
||||
if (vehicleBase == null || !(vehicleBase instanceof Entity)) {
|
||||
if (!(vehicleBase instanceof Entity)) {
|
||||
// It should never dismount
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -174,7 +174,7 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
|
|||
|
||||
@Override
|
||||
public void setPassengerOfNMS(NMSEntityBase vehicleBase) {
|
||||
if (vehicleBase == null || !(vehicleBase instanceof Entity)) {
|
||||
if (!(vehicleBase instanceof Entity)) {
|
||||
// It should never dismount
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ public class NmsManagerImpl implements NMSManager {
|
|||
|
||||
public void registerCustomEntity(Class<?> entityClass, String name, int id) throws Exception {
|
||||
ENTITY_NAMES_BY_CLASS_FIELD.getStatic().put(entityClass, name);
|
||||
ENTITY_IDS_BY_CLASS_FIELD.getStatic().put(entityClass, Integer.valueOf(id));
|
||||
ENTITY_IDS_BY_CLASS_FIELD.getStatic().put(entityClass, id);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -213,16 +213,7 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
|
|||
public ItemLine getHologramLine() {
|
||||
return parentPiece;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void allowPickup(boolean pickup) {
|
||||
if (pickup) {
|
||||
super.pickupDelay = 0;
|
||||
} else {
|
||||
super.pickupDelay = Integer.MAX_VALUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public org.bukkit.entity.Entity getBukkitEntityNMS() {
|
||||
return getBukkitEntity();
|
||||
|
@ -230,7 +221,7 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
|
|||
|
||||
@Override
|
||||
public void setPassengerOfNMS(NMSEntityBase vehicleBase) {
|
||||
if (vehicleBase == null || !(vehicleBase instanceof Entity)) {
|
||||
if (!(vehicleBase instanceof Entity)) {
|
||||
// It should never dismount
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -208,7 +208,7 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
|
|||
|
||||
@Override
|
||||
public void setPassengerOfNMS(NMSEntityBase vehicleBase) {
|
||||
if (vehicleBase == null || !(vehicleBase instanceof Entity)) {
|
||||
if (!(vehicleBase instanceof Entity)) {
|
||||
// It should never dismount
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ public class NmsManagerImpl implements NMSManager {
|
|||
|
||||
public void registerCustomEntity(Class<?> entityClass, String name, int id) throws Exception {
|
||||
ENTITY_NAMES_BY_CLASS_FIELD.getStatic().put(entityClass, name);
|
||||
ENTITY_IDS_BY_CLASS_FIELD.getStatic().put(entityClass, Integer.valueOf(id));
|
||||
ENTITY_IDS_BY_CLASS_FIELD.getStatic().put(entityClass, id);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -214,16 +214,7 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
|
|||
public ItemLine getHologramLine() {
|
||||
return parentPiece;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void allowPickup(boolean pickup) {
|
||||
if (pickup) {
|
||||
super.pickupDelay = 0;
|
||||
} else {
|
||||
super.pickupDelay = Integer.MAX_VALUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public org.bukkit.entity.Entity getBukkitEntityNMS() {
|
||||
return getBukkitEntity();
|
||||
|
@ -231,7 +222,7 @@ public class EntityNMSItem extends EntityItem implements NMSItem {
|
|||
|
||||
@Override
|
||||
public void setPassengerOfNMS(NMSEntityBase vehicleBase) {
|
||||
if (vehicleBase == null || !(vehicleBase instanceof Entity)) {
|
||||
if (!(vehicleBase instanceof Entity)) {
|
||||
// It should never dismount
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -209,7 +209,7 @@ public class EntityNMSSlime extends EntitySlime implements NMSSlime {
|
|||
|
||||
@Override
|
||||
public void setPassengerOfNMS(NMSEntityBase vehicleBase) {
|
||||
if (vehicleBase == null || !(vehicleBase instanceof Entity)) {
|
||||
if (!(vehicleBase instanceof Entity)) {
|
||||
// It should never dismount
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ public class NmsManagerImpl implements NMSManager {
|
|||
|
||||
public void registerCustomEntity(Class<?> entityClass, String name, int id) throws Exception {
|
||||
ENTITY_NAMES_BY_CLASS_FIELD.getStatic().put(entityClass, name);
|
||||
ENTITY_IDS_BY_CLASS_FIELD.getStatic().put(entityClass, Integer.valueOf(id));
|
||||
ENTITY_IDS_BY_CLASS_FIELD.getStatic().put(entityClass, id);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -132,7 +132,7 @@ public class HolographicDisplays extends JavaPlugin {
|
|||
ConsoleLogger.log(Level.WARNING, "Failed to load animation files!", ex);
|
||||
}
|
||||
|
||||
// Initalize other static classes.
|
||||
// Initialize other static classes.
|
||||
HologramDatabase.loadYamlFile(this);
|
||||
BungeeServerTracker.startTask(Configuration.bungeeRefreshSeconds);
|
||||
|
||||
|
@ -200,7 +200,7 @@ public class HolographicDisplays extends JavaPlugin {
|
|||
|
||||
try {
|
||||
Thread.sleep(5000);
|
||||
} catch (InterruptedException ex) { }
|
||||
} catch (InterruptedException ignored) {}
|
||||
instance.setEnabled(false);
|
||||
}
|
||||
|
||||
|
|
|
@ -42,10 +42,6 @@ public class BungeeServerTracker {
|
|||
}
|
||||
}
|
||||
|
||||
public static void untrack(String server) {
|
||||
trackedServers.remove(server);
|
||||
}
|
||||
|
||||
protected static BungeeServerInfo getOrCreateServerInfo(String server) {
|
||||
BungeeServerInfo info = trackedServers.get(server);
|
||||
if (info == null) {
|
||||
|
|
|
@ -10,13 +10,12 @@ import java.io.DataInputStream;
|
|||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
class PacketUtils {
|
||||
|
||||
public static final Charset UTF8 = Charset.forName("UTF-8");
|
||||
|
||||
public static void writeString(final DataOutputStream out, final String s, final Charset charset) throws IOException {
|
||||
if (charset == PacketUtils.UTF8) {
|
||||
if (charset == StandardCharsets.UTF_8) {
|
||||
writeVarInt(out, s.length());
|
||||
} else {
|
||||
out.writeShort(s.length());
|
||||
|
@ -52,7 +51,7 @@ class PacketUtils {
|
|||
if (closeable != null) {
|
||||
closeable.close();
|
||||
}
|
||||
} catch (IOException e) {}
|
||||
} catch (IOException ignored) {}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -18,13 +18,6 @@ public class PingResponse
|
|||
private String motd;
|
||||
private int onlinePlayers;
|
||||
private int maxPlayers;
|
||||
|
||||
public PingResponse(boolean isOnline, String motd, int onlinePlayers, int maxPlayers) {
|
||||
this.isOnline = isOnline;
|
||||
this.motd = motd;
|
||||
this.onlinePlayers = onlinePlayers;
|
||||
this.maxPlayers = maxPlayers;
|
||||
}
|
||||
|
||||
public PingResponse(String jsonString, ServerAddress address) {
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ import java.io.IOException;
|
|||
import java.net.Socket;
|
||||
import java.net.SocketTimeoutException;
|
||||
import java.net.UnknownHostException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
public class ServerPinger {
|
||||
|
||||
|
@ -32,7 +33,7 @@ public class ServerPinger {
|
|||
final DataOutputStream handshake = new DataOutputStream(byteOut);
|
||||
handshake.write(0);
|
||||
PacketUtils.writeVarInt(handshake, 4);
|
||||
PacketUtils.writeString(handshake, serverAddress.getAddress(), PacketUtils.UTF8);
|
||||
PacketUtils.writeString(handshake, serverAddress.getAddress(), StandardCharsets.UTF_8);
|
||||
handshake.writeShort(serverAddress.getPort());
|
||||
PacketUtils.writeVarInt(handshake, 1);
|
||||
byte[] bytes = byteOut.toByteArray();
|
||||
|
@ -45,7 +46,7 @@ public class ServerPinger {
|
|||
PacketUtils.readVarInt(dataIn);
|
||||
final byte[] responseData = new byte[PacketUtils.readVarInt(dataIn)];
|
||||
dataIn.readFully(responseData);
|
||||
final String jsonString = new String(responseData, PacketUtils.UTF8);
|
||||
final String jsonString = new String(responseData, StandardCharsets.UTF_8);
|
||||
return new PingResponse(jsonString, serverAddress);
|
||||
}
|
||||
finally {
|
||||
|
|
|
@ -13,14 +13,10 @@ import org.bukkit.plugin.Plugin;
|
|||
|
||||
public interface ProtocolLibHook {
|
||||
|
||||
public boolean hook(Plugin plugin, NMSManager nmsManager);
|
||||
boolean hook(Plugin plugin, NMSManager nmsManager);
|
||||
|
||||
public void sendDestroyEntitiesPacket(Player player, CraftHologram hologram);
|
||||
void sendDestroyEntitiesPacket(Player player, CraftHologram hologram);
|
||||
|
||||
public void sendDestroyEntitiesPacket(Player player, CraftHologramLine line);
|
||||
|
||||
public void sendCreateEntitiesPacket(Player player, CraftHologram hologram);
|
||||
|
||||
public void sendCreateEntitiesPacket(Player player, CraftHologramLine line);
|
||||
void sendCreateEntitiesPacket(Player player, CraftHologram hologram);
|
||||
|
||||
}
|
||||
|
|
|
@ -10,7 +10,6 @@ import com.comphenix.protocol.events.PacketContainer;
|
|||
import com.comphenix.protocol.events.PacketEvent;
|
||||
import com.comphenix.protocol.reflect.EquivalentConverter;
|
||||
import com.comphenix.protocol.reflect.PrettyPrinter;
|
||||
import com.comphenix.protocol.reflect.PrettyPrinter.ObjectPrinter;
|
||||
import com.comphenix.protocol.utility.HexDumper;
|
||||
import com.comphenix.protocol.utility.MinecraftReflection;
|
||||
import com.comphenix.protocol.wrappers.BukkitConverters;
|
||||
|
@ -54,29 +53,26 @@ public class DebugHelper {
|
|||
clazz = clazz.getSuperclass();
|
||||
}
|
||||
|
||||
return PrettyPrinter.printObject(packet, clazz, MinecraftReflection.getPacketClass(), PrettyPrinter.RECURSE_DEPTH, new ObjectPrinter() {
|
||||
@Override
|
||||
public boolean print(StringBuilder output, Object value) {
|
||||
// Special case
|
||||
if (value instanceof byte[]) {
|
||||
byte[] data = (byte[]) value;
|
||||
|
||||
if (data.length > HEX_DUMP_THRESHOLD) {
|
||||
output.append("[");
|
||||
HexDumper.defaultDumper().appendTo(output, data);
|
||||
output.append("]");
|
||||
return true;
|
||||
}
|
||||
} else if (value != null) {
|
||||
EquivalentConverter<Object> converter = findConverter(value.getClass());
|
||||
|
||||
if (converter != null) {
|
||||
output.append(converter.getSpecific(value));
|
||||
return true;
|
||||
}
|
||||
return PrettyPrinter.printObject(packet, clazz, MinecraftReflection.getPacketClass(), PrettyPrinter.RECURSE_DEPTH, (StringBuilder output, Object value) -> {
|
||||
// Special case
|
||||
if (value instanceof byte[]) {
|
||||
byte[] data = (byte[]) value;
|
||||
|
||||
if (data.length > HEX_DUMP_THRESHOLD) {
|
||||
output.append("[");
|
||||
HexDumper.defaultDumper().appendTo(output, data);
|
||||
output.append("]");
|
||||
return true;
|
||||
}
|
||||
} else if (value != null) {
|
||||
EquivalentConverter<Object> converter = findConverter(value.getClass());
|
||||
|
||||
if (converter != null) {
|
||||
output.append(converter.getSpecific(value));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -85,9 +85,7 @@ public class MetadataHelper {
|
|||
|
||||
|
||||
public WrappedWatchableObject getCustomNameWatchableObject(List<WrappedWatchableObject> dataWatcherValues) {
|
||||
for (int i = 0; i < dataWatcherValues.size(); i++) {
|
||||
WrappedWatchableObject watchableObject = dataWatcherValues.get(i);
|
||||
|
||||
for (WrappedWatchableObject watchableObject : dataWatcherValues) {
|
||||
if (watchableObject.getIndex() == customNameIndex) {
|
||||
return watchableObject;
|
||||
}
|
||||
|
@ -115,7 +113,7 @@ public class MetadataHelper {
|
|||
throw new IllegalArgumentException("Expected custom name of type " + String.class);
|
||||
}
|
||||
|
||||
return (String) customNameNMSObject;
|
||||
return customNameNMSObject;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -210,23 +210,6 @@ public class ProtocolLibHookImpl implements ProtocolLibHook {
|
|||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void sendDestroyEntitiesPacket(Player player, CraftHologramLine line) {
|
||||
if (!line.isSpawned()) {
|
||||
return;
|
||||
}
|
||||
|
||||
List<Integer> ids = new ArrayList<>();
|
||||
for (int id : line.getEntitiesIDs()) {
|
||||
ids.add(id);
|
||||
}
|
||||
|
||||
if (!ids.isEmpty()) {
|
||||
packetHelper.sendDestroyEntitiesPacket(player, ids);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void sendCreateEntitiesPacket(Player player, CraftHologram hologram) {
|
||||
for (CraftHologramLine line : hologram.getLinesUnsafe()) {
|
||||
|
@ -235,8 +218,7 @@ public class ProtocolLibHookImpl implements ProtocolLibHook {
|
|||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void sendCreateEntitiesPacket(Player player, CraftHologramLine line) {
|
||||
private void sendCreateEntitiesPacket(Player player, CraftHologramLine line) {
|
||||
if (!line.isSpawned()) {
|
||||
return;
|
||||
}
|
||||
|
@ -246,26 +228,23 @@ public class ProtocolLibHookImpl implements ProtocolLibHook {
|
|||
if (line instanceof CraftTextLine) {
|
||||
CraftTextLine textLine = (CraftTextLine) line;
|
||||
touchableLine = textLine;
|
||||
|
||||
if (textLine.isSpawned()) {
|
||||
packetHelper.sendSpawnArmorStandPacket(player, (NMSArmorStand) textLine.getNmsNameable());
|
||||
}
|
||||
|
||||
|
||||
packetHelper.sendSpawnArmorStandPacket(player, (NMSArmorStand) textLine.getNmsNameable());
|
||||
|
||||
} else if (line instanceof CraftItemLine) {
|
||||
CraftItemLine itemLine = (CraftItemLine) line;
|
||||
touchableLine = itemLine;
|
||||
|
||||
packetHelper.sendSpawnArmorStandPacket(player, (NMSArmorStand) itemLine.getNmsVehicle());
|
||||
packetHelper.sendSpawnItemPacket(player, itemLine.getNmsItem());
|
||||
packetHelper.sendVehicleAttachPacket(player, itemLine.getNmsVehicle(), itemLine.getNmsItem());
|
||||
packetHelper.sendItemMetadataPacket(player, itemLine.getNmsItem());
|
||||
|
||||
if (itemLine.isSpawned()) {
|
||||
packetHelper.sendSpawnArmorStandPacket(player, (NMSArmorStand) itemLine.getNmsVehicle());
|
||||
packetHelper.sendSpawnItemPacket(player, itemLine.getNmsItem());
|
||||
packetHelper.sendVehicleAttachPacket(player, itemLine.getNmsVehicle(), itemLine.getNmsItem());
|
||||
packetHelper.sendItemMetadataPacket(player, itemLine.getNmsItem());
|
||||
}
|
||||
} else {
|
||||
throw new IllegalArgumentException("Unexpected hologram line type: " + line.getClass().getName());
|
||||
}
|
||||
|
||||
if (touchableLine != null && touchableLine.isSpawned() && touchableLine.getTouchSlime() != null) {
|
||||
if (touchableLine.getTouchSlime() != null) {
|
||||
CraftTouchSlimeLine touchSlime = touchableLine.getTouchSlime();
|
||||
|
||||
if (touchSlime.isSpawned()) {
|
||||
|
|
|
@ -71,11 +71,11 @@ public abstract class AbstractPacket {
|
|||
* @param sender - the sender.
|
||||
* @throws RuntimeException If the packet cannot be received.
|
||||
*/
|
||||
public void recievePacket(Player sender) {
|
||||
public void receivePacket(Player sender) {
|
||||
try {
|
||||
ProtocolLibrary.getProtocolManager().recieveClientPacket(sender, getHandle());
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("Cannot recieve packet.", e);
|
||||
throw new RuntimeException("Cannot receive packet.", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,6 @@ package me.filoghost.holographicdisplays.bridge.protocollib.current.packet;
|
|||
|
||||
public interface EntityRelatedPacketWrapper {
|
||||
|
||||
public int getEntityID();
|
||||
int getEntityID();
|
||||
|
||||
}
|
||||
|
|
|
@ -50,15 +50,6 @@ public class CommandValidator {
|
|||
}
|
||||
}
|
||||
|
||||
public static boolean isInteger(String integer) {
|
||||
try {
|
||||
Integer.parseInt(integer);
|
||||
return true;
|
||||
} catch (NumberFormatException ex) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static Player getPlayerSender(CommandSender sender) throws CommandException {
|
||||
if (sender instanceof Player) {
|
||||
return (Player) sender;
|
||||
|
|
|
@ -58,12 +58,12 @@ public class ReadimageCommand extends HologramSubCommand {
|
|||
boolean append = false;
|
||||
|
||||
List<String> newArgs = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < args.length; i++) {
|
||||
if (args[i].equalsIgnoreCase("-a") || args[i].equalsIgnoreCase("-append")) {
|
||||
|
||||
for (String arg : args) {
|
||||
if (arg.equalsIgnoreCase("-a") || arg.equalsIgnoreCase("-append")) {
|
||||
append = true;
|
||||
} else {
|
||||
newArgs.add(args[i]);
|
||||
newArgs.add(arg);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -79,7 +79,7 @@ public class ReadimageCommand extends HologramSubCommand {
|
|||
|
||||
try {
|
||||
String fileName = args[1];
|
||||
BufferedImage image = null;
|
||||
BufferedImage image;
|
||||
|
||||
if (fileName.startsWith("http://") || fileName.startsWith("https://")) {
|
||||
isUrl = true;
|
||||
|
@ -103,9 +103,9 @@ public class ReadimageCommand extends HologramSubCommand {
|
|||
|
||||
ImageMessage imageMessage = new ImageMessage(image, width);
|
||||
String[] newLines = imageMessage.getLines();
|
||||
for (int i = 0; i < newLines.length; i++) {
|
||||
CraftTextLine line = new CraftTextLine(hologram, newLines[i]);
|
||||
line.setSerializedConfigValue(newLines[i]);
|
||||
for (String newLine : newLines) {
|
||||
CraftTextLine line = new CraftTextLine(hologram, newLine);
|
||||
line.setSerializedConfigValue(newLine);
|
||||
hologram.getLinesUnsafe().add(line);
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ public enum ConfigNode {
|
|||
private final String path;
|
||||
private final Object value;
|
||||
|
||||
private ConfigNode(String path, Object defaultValue) {
|
||||
ConfigNode(String path, Object defaultValue) {
|
||||
this.path = path;
|
||||
value = defaultValue;
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ import java.util.TimeZone;
|
|||
import java.util.logging.Level;
|
||||
|
||||
/**
|
||||
* Just a bunch of static varibles to hold the settings.
|
||||
* Just a bunch of static variables to hold the settings.
|
||||
* Useful for fast access.
|
||||
*/
|
||||
public class Configuration {
|
||||
|
|
|
@ -89,10 +89,6 @@ public class HologramDatabase {
|
|||
return config.getKeys(false);
|
||||
}
|
||||
|
||||
public static boolean isExistingHologram(String name) {
|
||||
return config.isConfigurationSection(name);
|
||||
}
|
||||
|
||||
private static ConfigurationSection getOrCreateSection(String name) {
|
||||
if (config.isConfigurationSection(name)) {
|
||||
return config.getConfigurationSection(name);
|
||||
|
|
|
@ -26,7 +26,7 @@ public class HologramLineParser {
|
|||
CraftHologramLine hologramLine;
|
||||
|
||||
if (serializedLine.toLowerCase().startsWith("icon:")) {
|
||||
String serializedIcon = serializedLine.substring("icon:".length(), serializedLine.length());
|
||||
String serializedIcon = serializedLine.substring("icon:".length());
|
||||
ItemStack icon = parseItemStack(serializedIcon, checkMaterialValidity);
|
||||
hologramLine = new CraftItemLine(hologram, icon);
|
||||
|
||||
|
@ -56,7 +56,7 @@ public class HologramLineParser {
|
|||
|
||||
if (nbtStart > 0 && nbtEnd > 0 && nbtEnd > nbtStart) {
|
||||
nbtString = serializedItem.substring(nbtStart, nbtEnd + 1);
|
||||
basicItemData = serializedItem.substring(0, nbtStart) + serializedItem.substring(nbtEnd + 1, serializedItem.length());
|
||||
basicItemData = serializedItem.substring(0, nbtStart) + serializedItem.substring(nbtEnd + 1);
|
||||
} else {
|
||||
basicItemData = serializedItem;
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ public class UnicodeSymbols {
|
|||
|
||||
int indexOf = line.indexOf(':');
|
||||
String placeholder = unquote(line.substring(0, indexOf).trim());
|
||||
String replacement = StringEscapeUtils.unescapeJava(unquote(line.substring(indexOf + 1, line.length()).trim()));
|
||||
String replacement = StringEscapeUtils.unescapeJava(unquote(line.substring(indexOf + 1).trim()));
|
||||
|
||||
if (placeholder.isEmpty() || replacement.isEmpty()) {
|
||||
ConsoleLogger.log(Level.WARNING, "Unable to parse a line(" + line + ") from symbols.yml: the placeholder and the replacement must have both at least 1 character.");
|
||||
|
|
|
@ -7,8 +7,6 @@ package me.filoghost.holographicdisplays.exception;
|
|||
|
||||
public class CommandException extends Exception {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public CommandException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
|
|
@ -7,8 +7,6 @@ package me.filoghost.holographicdisplays.exception;
|
|||
|
||||
public class HologramLineParseException extends Exception {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public HologramLineParseException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
|
|
@ -6,7 +6,5 @@
|
|||
package me.filoghost.holographicdisplays.exception;
|
||||
|
||||
public class HologramNotFoundException extends Exception {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -7,6 +7,4 @@ package me.filoghost.holographicdisplays.exception;
|
|||
|
||||
public class InvalidFormatException extends Exception {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue