mirror of
https://github.com/amalthea-mc/ShopChest.git
synced 2024-12-23 01:21:47 +00:00
Code Cleanup
This commit is contained in:
parent
4470300624
commit
3b734ac429
@ -8,18 +8,16 @@ import java.util.List;
|
||||
|
||||
public interface Hologram {
|
||||
|
||||
public Location getLocation();
|
||||
Location getLocation();
|
||||
|
||||
public List<?> getEntities();
|
||||
void showPlayer(OfflinePlayer p);
|
||||
|
||||
public void showPlayer(OfflinePlayer p);
|
||||
void hidePlayer(OfflinePlayer p);
|
||||
|
||||
public void hidePlayer(OfflinePlayer p);
|
||||
boolean isVisible(OfflinePlayer p);
|
||||
|
||||
public boolean isVisible(OfflinePlayer p);
|
||||
boolean exists();
|
||||
|
||||
public boolean exists();
|
||||
|
||||
public void remove();
|
||||
void remove();
|
||||
|
||||
}
|
||||
|
@ -1,27 +1,23 @@
|
||||
package de.epiceric.shopchest.interfaces.hologram;
|
||||
|
||||
import de.epiceric.shopchest.interfaces.Hologram;
|
||||
import net.minecraft.server.v1_10_R1.EntityArmorStand;
|
||||
import net.minecraft.server.v1_10_R1.PacketPlayOutEntityDestroy;
|
||||
import net.minecraft.server.v1_10_R1.PacketPlayOutSpawnEntityLiving;
|
||||
import net.minecraft.server.v1_10_R1.*;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.craftbukkit.v1_10_R1.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_10_R1.entity.CraftPlayer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class Hologram_1_10_R1 implements Hologram {
|
||||
|
||||
private boolean exists = false;
|
||||
private int count;
|
||||
private List<EntityArmorStand> entitylist = new ArrayList<EntityArmorStand>();
|
||||
private List<EntityArmorStand> entityList = new ArrayList<>();
|
||||
private String[] text;
|
||||
private Location location;
|
||||
private double DISTANCE = 0.25D;
|
||||
private HashMap<OfflinePlayer, Boolean> visible = new HashMap<OfflinePlayer, Boolean>();
|
||||
private List<OfflinePlayer> visible = new ArrayList<>();
|
||||
|
||||
public Hologram_1_10_R1(String[] text, Location location) {
|
||||
this.text = text;
|
||||
@ -33,31 +29,26 @@ public class Hologram_1_10_R1 implements Hologram {
|
||||
return location;
|
||||
}
|
||||
|
||||
public List<EntityArmorStand> getEntities() {
|
||||
return entitylist;
|
||||
}
|
||||
|
||||
public void showPlayer(OfflinePlayer p) {
|
||||
for (Object o : entitylist) {
|
||||
for (Object o : entityList) {
|
||||
EntityArmorStand armor = (EntityArmorStand) o;
|
||||
PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving(armor);
|
||||
((CraftPlayer) p).getHandle().playerConnection.sendPacket(packet);
|
||||
}
|
||||
visible.put(p, true);
|
||||
visible.add(p);
|
||||
}
|
||||
|
||||
public void hidePlayer(OfflinePlayer p) {
|
||||
for (Object o : entitylist) {
|
||||
for (Object o : entityList) {
|
||||
EntityArmorStand armor = (EntityArmorStand) o;
|
||||
PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(armor.getId());
|
||||
((CraftPlayer) p).getHandle().playerConnection.sendPacket(packet);
|
||||
}
|
||||
visible.put(p, false);
|
||||
visible.remove(p);
|
||||
}
|
||||
|
||||
public boolean isVisible(OfflinePlayer p) {
|
||||
if (visible.containsKey(p)) return visible.get(p);
|
||||
else return false;
|
||||
return visible.contains(p);
|
||||
}
|
||||
|
||||
private void create() {
|
||||
@ -67,13 +58,13 @@ public class Hologram_1_10_R1 implements Hologram {
|
||||
entity.setCustomNameVisible(true);
|
||||
entity.setInvisible(true);
|
||||
entity.setNoGravity(true);
|
||||
entitylist.add(entity);
|
||||
this.location.subtract(0, this.DISTANCE, 0);
|
||||
entityList.add(entity);
|
||||
this.location.subtract(0, 0.25, 0);
|
||||
count++;
|
||||
}
|
||||
|
||||
for (int i = 0; i < count; i++) {
|
||||
this.location.add(0, this.DISTANCE, 0);
|
||||
this.location.add(0, 0.25, 0);
|
||||
}
|
||||
|
||||
count = 0;
|
||||
@ -85,7 +76,7 @@ public class Hologram_1_10_R1 implements Hologram {
|
||||
}
|
||||
|
||||
public void remove() {
|
||||
for (EntityArmorStand e : entitylist) {
|
||||
for (EntityArmorStand e : entityList) {
|
||||
e.die();
|
||||
}
|
||||
exists = false;
|
||||
|
@ -10,18 +10,16 @@ import org.bukkit.craftbukkit.v1_8_R1.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_8_R1.entity.CraftPlayer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class Hologram_1_8_R1 implements Hologram {
|
||||
|
||||
private boolean exists = false;
|
||||
private int count;
|
||||
private List<EntityArmorStand> entitylist = new ArrayList<EntityArmorStand>();
|
||||
private List<EntityArmorStand> entityList = new ArrayList<>();
|
||||
private String[] text;
|
||||
private Location location;
|
||||
private double DISTANCE = 0.25D;
|
||||
private HashMap<OfflinePlayer, Boolean> visible = new HashMap<OfflinePlayer, Boolean>();
|
||||
private List<OfflinePlayer> visible = new ArrayList<>();
|
||||
|
||||
public Hologram_1_8_R1(String[] text, Location location) {
|
||||
this.text = text;
|
||||
@ -33,31 +31,26 @@ public class Hologram_1_8_R1 implements Hologram {
|
||||
return location;
|
||||
}
|
||||
|
||||
public List<EntityArmorStand> getEntities() {
|
||||
return entitylist;
|
||||
}
|
||||
|
||||
public void showPlayer(OfflinePlayer p) {
|
||||
for (Object o : entitylist) {
|
||||
for (Object o : entityList) {
|
||||
EntityArmorStand armor = (EntityArmorStand) o;
|
||||
PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving(armor);
|
||||
((CraftPlayer) p).getHandle().playerConnection.sendPacket(packet);
|
||||
}
|
||||
visible.put(p, true);
|
||||
visible.add(p);
|
||||
}
|
||||
|
||||
public void hidePlayer(OfflinePlayer p) {
|
||||
for (Object o : entitylist) {
|
||||
for (Object o : entityList) {
|
||||
EntityArmorStand armor = (EntityArmorStand) o;
|
||||
PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(armor.getId());
|
||||
((CraftPlayer) p).getHandle().playerConnection.sendPacket(packet);
|
||||
}
|
||||
visible.put(p, false);
|
||||
visible.remove(p);
|
||||
}
|
||||
|
||||
public boolean isVisible(OfflinePlayer p) {
|
||||
if (visible.containsKey(p)) return visible.get(p);
|
||||
else return false;
|
||||
return visible.contains(p);
|
||||
}
|
||||
|
||||
private void create() {
|
||||
@ -67,13 +60,13 @@ public class Hologram_1_8_R1 implements Hologram {
|
||||
entity.setCustomNameVisible(true);
|
||||
entity.setInvisible(true);
|
||||
entity.setGravity(false);
|
||||
entitylist.add(entity);
|
||||
this.location.subtract(0, this.DISTANCE, 0);
|
||||
entityList.add(entity);
|
||||
this.location.subtract(0, 0.25, 0);
|
||||
count++;
|
||||
}
|
||||
|
||||
for (int i = 0; i < count; i++) {
|
||||
this.location.add(0, this.DISTANCE, 0);
|
||||
this.location.add(0, 0.25, 0);
|
||||
}
|
||||
|
||||
count = 0;
|
||||
@ -85,7 +78,7 @@ public class Hologram_1_8_R1 implements Hologram {
|
||||
}
|
||||
|
||||
public void remove() {
|
||||
for (EntityArmorStand e : entitylist) {
|
||||
for (EntityArmorStand e : entityList) {
|
||||
e.die();
|
||||
}
|
||||
exists = false;
|
||||
|
@ -17,11 +17,10 @@ public class Hologram_1_8_R2 implements Hologram {
|
||||
|
||||
private boolean exists = false;
|
||||
private int count;
|
||||
private List<EntityArmorStand> entitylist = new ArrayList<EntityArmorStand>();
|
||||
private List<EntityArmorStand> entityList = new ArrayList<>();
|
||||
private String[] text;
|
||||
private Location location;
|
||||
private double DISTANCE = 0.25D;
|
||||
private HashMap<OfflinePlayer, Boolean> visible = new HashMap<OfflinePlayer, Boolean>();
|
||||
private List<OfflinePlayer> visible = new ArrayList<>();
|
||||
|
||||
public Hologram_1_8_R2(String[] text, Location location) {
|
||||
this.text = text;
|
||||
@ -33,31 +32,26 @@ public class Hologram_1_8_R2 implements Hologram {
|
||||
return location;
|
||||
}
|
||||
|
||||
public List<EntityArmorStand> getEntities() {
|
||||
return entitylist;
|
||||
}
|
||||
|
||||
public void showPlayer(OfflinePlayer p) {
|
||||
for (Object o : entitylist) {
|
||||
for (Object o : entityList) {
|
||||
EntityArmorStand armor = (EntityArmorStand) o;
|
||||
PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving(armor);
|
||||
((CraftPlayer) p).getHandle().playerConnection.sendPacket(packet);
|
||||
}
|
||||
visible.put(p, true);
|
||||
visible.add(p);
|
||||
}
|
||||
|
||||
public void hidePlayer(OfflinePlayer p) {
|
||||
for (Object o : entitylist) {
|
||||
for (Object o : entityList) {
|
||||
EntityArmorStand armor = (EntityArmorStand) o;
|
||||
PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(armor.getId());
|
||||
((CraftPlayer) p).getHandle().playerConnection.sendPacket(packet);
|
||||
}
|
||||
visible.put(p, false);
|
||||
visible.remove(p);
|
||||
}
|
||||
|
||||
public boolean isVisible(OfflinePlayer p) {
|
||||
if (visible.containsKey(p)) return visible.get(p);
|
||||
else return false;
|
||||
return visible.contains(p);
|
||||
}
|
||||
|
||||
private void create() {
|
||||
@ -67,13 +61,13 @@ public class Hologram_1_8_R2 implements Hologram {
|
||||
entity.setCustomNameVisible(true);
|
||||
entity.setInvisible(true);
|
||||
entity.setGravity(false);
|
||||
entitylist.add(entity);
|
||||
this.location.subtract(0, this.DISTANCE, 0);
|
||||
entityList.add(entity);
|
||||
this.location.subtract(0, 0.25, 0);
|
||||
count++;
|
||||
}
|
||||
|
||||
for (int i = 0; i < count; i++) {
|
||||
this.location.add(0, this.DISTANCE, 0);
|
||||
this.location.add(0, 0.25, 0);
|
||||
}
|
||||
|
||||
count = 0;
|
||||
@ -85,7 +79,7 @@ public class Hologram_1_8_R2 implements Hologram {
|
||||
}
|
||||
|
||||
public void remove() {
|
||||
for (EntityArmorStand e : entitylist) {
|
||||
for (EntityArmorStand e : entityList) {
|
||||
e.die();
|
||||
}
|
||||
exists = false;
|
||||
|
@ -17,11 +17,10 @@ public class Hologram_1_8_R3 implements Hologram {
|
||||
|
||||
private boolean exists = false;
|
||||
private int count;
|
||||
private List<EntityArmorStand> entitylist = new ArrayList<EntityArmorStand>();
|
||||
private List<EntityArmorStand> entityList = new ArrayList<>();
|
||||
private String[] text;
|
||||
private Location location;
|
||||
private double DISTANCE = 0.25D;
|
||||
private HashMap<OfflinePlayer, Boolean> visible = new HashMap<OfflinePlayer, Boolean>();
|
||||
private List<OfflinePlayer> visible = new ArrayList<>();
|
||||
|
||||
public Hologram_1_8_R3(String[] text, Location location) {
|
||||
this.text = text;
|
||||
@ -33,31 +32,26 @@ public class Hologram_1_8_R3 implements Hologram {
|
||||
return location;
|
||||
}
|
||||
|
||||
public List<EntityArmorStand> getEntities() {
|
||||
return entitylist;
|
||||
}
|
||||
|
||||
public void showPlayer(OfflinePlayer p) {
|
||||
for (Object o : entitylist) {
|
||||
for (Object o : entityList) {
|
||||
EntityArmorStand armor = (EntityArmorStand) o;
|
||||
PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving(armor);
|
||||
((CraftPlayer) p).getHandle().playerConnection.sendPacket(packet);
|
||||
}
|
||||
visible.put(p, true);
|
||||
visible.add(p);
|
||||
}
|
||||
|
||||
public void hidePlayer(OfflinePlayer p) {
|
||||
for (Object o : entitylist) {
|
||||
for (Object o : entityList) {
|
||||
EntityArmorStand armor = (EntityArmorStand) o;
|
||||
PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(armor.getId());
|
||||
((CraftPlayer) p).getHandle().playerConnection.sendPacket(packet);
|
||||
}
|
||||
visible.put(p, false);
|
||||
visible.remove(p);
|
||||
}
|
||||
|
||||
public boolean isVisible(OfflinePlayer p) {
|
||||
if (visible.containsKey(p)) return visible.get(p);
|
||||
else return false;
|
||||
return visible.contains(p);
|
||||
}
|
||||
|
||||
private void create() {
|
||||
@ -67,13 +61,13 @@ public class Hologram_1_8_R3 implements Hologram {
|
||||
entity.setCustomNameVisible(true);
|
||||
entity.setInvisible(true);
|
||||
entity.setGravity(false);
|
||||
entitylist.add(entity);
|
||||
this.location.subtract(0, this.DISTANCE, 0);
|
||||
entityList.add(entity);
|
||||
this.location.subtract(0, 0.25, 0);
|
||||
count++;
|
||||
}
|
||||
|
||||
for (int i = 0; i < count; i++) {
|
||||
this.location.add(0, this.DISTANCE, 0);
|
||||
this.location.add(0, 0.25, 0);
|
||||
}
|
||||
|
||||
count = 0;
|
||||
@ -85,7 +79,7 @@ public class Hologram_1_8_R3 implements Hologram {
|
||||
}
|
||||
|
||||
public void remove() {
|
||||
for (EntityArmorStand e : entitylist) {
|
||||
for (EntityArmorStand e : entityList) {
|
||||
e.die();
|
||||
}
|
||||
exists = false;
|
||||
|
@ -17,11 +17,10 @@ public class Hologram_1_9_R1 implements Hologram {
|
||||
|
||||
private boolean exists = false;
|
||||
private int count;
|
||||
private List<EntityArmorStand> entitylist = new ArrayList<EntityArmorStand>();
|
||||
private List<EntityArmorStand> entityList = new ArrayList<>();
|
||||
private String[] text;
|
||||
private Location location;
|
||||
private double DISTANCE = 0.25D;
|
||||
private HashMap<OfflinePlayer, Boolean> visible = new HashMap<OfflinePlayer, Boolean>();
|
||||
private List<OfflinePlayer> visible = new ArrayList<>();
|
||||
|
||||
public Hologram_1_9_R1(String[] text, Location location) {
|
||||
this.text = text;
|
||||
@ -33,31 +32,26 @@ public class Hologram_1_9_R1 implements Hologram {
|
||||
return location;
|
||||
}
|
||||
|
||||
public List<EntityArmorStand> getEntities() {
|
||||
return entitylist;
|
||||
}
|
||||
|
||||
public void showPlayer(OfflinePlayer p) {
|
||||
for (Object o : entitylist) {
|
||||
for (Object o : entityList) {
|
||||
EntityArmorStand armor = (EntityArmorStand) o;
|
||||
PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving(armor);
|
||||
((CraftPlayer) p).getHandle().playerConnection.sendPacket(packet);
|
||||
}
|
||||
visible.put(p, true);
|
||||
visible.add(p);
|
||||
}
|
||||
|
||||
public void hidePlayer(OfflinePlayer p) {
|
||||
for (Object o : entitylist) {
|
||||
for (Object o : entityList) {
|
||||
EntityArmorStand armor = (EntityArmorStand) o;
|
||||
PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(armor.getId());
|
||||
((CraftPlayer) p).getHandle().playerConnection.sendPacket(packet);
|
||||
}
|
||||
visible.put(p, false);
|
||||
visible.remove(p);
|
||||
}
|
||||
|
||||
public boolean isVisible(OfflinePlayer p) {
|
||||
if (visible.containsKey(p)) return visible.get(p);
|
||||
else return false;
|
||||
return visible.contains(p);
|
||||
}
|
||||
|
||||
private void create() {
|
||||
@ -67,13 +61,13 @@ public class Hologram_1_9_R1 implements Hologram {
|
||||
entity.setCustomNameVisible(true);
|
||||
entity.setInvisible(true);
|
||||
entity.setGravity(false);
|
||||
entitylist.add(entity);
|
||||
this.location.subtract(0, this.DISTANCE, 0);
|
||||
entityList.add(entity);
|
||||
this.location.subtract(0, 0.25, 0);
|
||||
count++;
|
||||
}
|
||||
|
||||
for (int i = 0; i < count; i++) {
|
||||
this.location.add(0, this.DISTANCE, 0);
|
||||
this.location.add(0, 0.25, 0);
|
||||
}
|
||||
|
||||
count = 0;
|
||||
@ -85,7 +79,7 @@ public class Hologram_1_9_R1 implements Hologram {
|
||||
}
|
||||
|
||||
public void remove() {
|
||||
for (EntityArmorStand e : entitylist) {
|
||||
for (EntityArmorStand e : entityList) {
|
||||
e.die();
|
||||
}
|
||||
exists = false;
|
||||
|
@ -10,18 +10,16 @@ import org.bukkit.craftbukkit.v1_9_R2.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_9_R2.entity.CraftPlayer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class Hologram_1_9_R2 implements Hologram {
|
||||
|
||||
private boolean exists = false;
|
||||
private int count;
|
||||
private List<EntityArmorStand> entitylist = new ArrayList<EntityArmorStand>();
|
||||
private List<EntityArmorStand> entityList = new ArrayList<>();
|
||||
private String[] text;
|
||||
private Location location;
|
||||
private double DISTANCE = 0.25D;
|
||||
private HashMap<OfflinePlayer, Boolean> visible = new HashMap<OfflinePlayer, Boolean>();
|
||||
private List<OfflinePlayer> visible = new ArrayList<>();
|
||||
|
||||
public Hologram_1_9_R2(String[] text, Location location) {
|
||||
this.text = text;
|
||||
@ -33,31 +31,26 @@ public class Hologram_1_9_R2 implements Hologram {
|
||||
return location;
|
||||
}
|
||||
|
||||
public List<EntityArmorStand> getEntities() {
|
||||
return entitylist;
|
||||
}
|
||||
|
||||
public void showPlayer(OfflinePlayer p) {
|
||||
for (Object o : entitylist) {
|
||||
for (Object o : entityList) {
|
||||
EntityArmorStand armor = (EntityArmorStand) o;
|
||||
PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving(armor);
|
||||
((CraftPlayer) p).getHandle().playerConnection.sendPacket(packet);
|
||||
}
|
||||
visible.put(p, true);
|
||||
visible.add(p);
|
||||
}
|
||||
|
||||
public void hidePlayer(OfflinePlayer p) {
|
||||
for (Object o : entitylist) {
|
||||
for (Object o : entityList) {
|
||||
EntityArmorStand armor = (EntityArmorStand) o;
|
||||
PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(armor.getId());
|
||||
((CraftPlayer) p).getHandle().playerConnection.sendPacket(packet);
|
||||
}
|
||||
visible.put(p, false);
|
||||
visible.remove(p);
|
||||
}
|
||||
|
||||
public boolean isVisible(OfflinePlayer p) {
|
||||
if (visible.containsKey(p)) return visible.get(p);
|
||||
else return false;
|
||||
return visible.contains(p);
|
||||
}
|
||||
|
||||
private void create() {
|
||||
@ -67,13 +60,13 @@ public class Hologram_1_9_R2 implements Hologram {
|
||||
entity.setCustomNameVisible(true);
|
||||
entity.setInvisible(true);
|
||||
entity.setGravity(false);
|
||||
entitylist.add(entity);
|
||||
this.location.subtract(0, this.DISTANCE, 0);
|
||||
entityList.add(entity);
|
||||
this.location.subtract(0, 0.25, 0);
|
||||
count++;
|
||||
}
|
||||
|
||||
for (int i = 0; i < count; i++) {
|
||||
this.location.add(0, this.DISTANCE, 0);
|
||||
this.location.add(0, 0.25, 0);
|
||||
}
|
||||
|
||||
count = 0;
|
||||
@ -85,7 +78,7 @@ public class Hologram_1_9_R2 implements Hologram {
|
||||
}
|
||||
|
||||
public void remove() {
|
||||
for (EntityArmorStand e : entitylist) {
|
||||
for (EntityArmorStand e : entityList) {
|
||||
e.die();
|
||||
}
|
||||
exists = false;
|
||||
|
Loading…
Reference in New Issue
Block a user