Merge github.com:Mineplex-LLC/Minecraft-PC into clans/beta

This commit is contained in:
Joseph Prezioso Jr 2016-03-08 13:56:05 -05:00
commit 97f5b60404
98 changed files with 11459 additions and 1167 deletions

View File

@ -0,0 +1,21 @@
From 32269ec951791791fe8553f0939c6eaa2b6b472b Mon Sep 17 00:00:00 2001
From: libraryaddict <libraryaddict115@yahoo.co.nz>
Date: Wed, 30 Dec 2015 19:57:10 +1300
Subject: [PATCH] Add Elytra
diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java
index 0fb2605..bc930d1 100644
--- a/src/main/java/org/bukkit/Material.java
+++ b/src/main/java/org/bukkit/Material.java
@@ -443,6 +443,7 @@ public enum Material {
JUNGLE_DOOR_ITEM(429),
ACACIA_DOOR_ITEM(430),
DARK_OAK_DOOR_ITEM(431),
+ ELYTRA(443),
GOLD_RECORD(2256, 1),
GREEN_RECORD(2257, 1),
RECORD_3(2258, 1),
--
1.9.5.msysgit.0

View File

@ -0,0 +1,46 @@
From 24a5d0cfe1d62e2ff6a3a0a279c63b038a134629 Mon Sep 17 00:00:00 2001
From: libraryaddict <libraryaddict115@yahoo.co.nz>
Date: Wed, 30 Dec 2015 21:05:47 +1300
Subject: [PATCH] Levitation potion effect
diff --git a/src/main/java/org/bukkit/potion/PotionEffectType.java b/src/main/java/org/bukkit/potion/PotionEffectType.java
index 4919d59..e75aa18 100644
--- a/src/main/java/org/bukkit/potion/PotionEffectType.java
+++ b/src/main/java/org/bukkit/potion/PotionEffectType.java
@@ -126,6 +126,11 @@ public abstract class PotionEffectType {
*/
public static final PotionEffectType SATURATION = new PotionEffectTypeWrapper(23);
+ /**
+ * Slows the fall rate down
+ */
+ public static final PotionEffectType LEVITATION = new PotionEffectTypeWrapper(25);
+
private final int id;
protected PotionEffectType(int id) {
@@ -202,7 +207,7 @@ public abstract class PotionEffectType {
return "PotionEffectType[" + id + ", " + getName() + "]";
}
- private static final PotionEffectType[] byId = new PotionEffectType[24];
+ private static final PotionEffectType[] byId = new PotionEffectType[26];
private static final Map<String, PotionEffectType> byName = new HashMap<String, PotionEffectType>();
// will break on updates.
private static boolean acceptingNew = true;
diff --git a/src/main/java/org/bukkit/potion/PotionType.java b/src/main/java/org/bukkit/potion/PotionType.java
index 6ad9a91..a3dc228 100644
--- a/src/main/java/org/bukkit/potion/PotionType.java
+++ b/src/main/java/org/bukkit/potion/PotionType.java
@@ -15,6 +15,7 @@ public enum PotionType {
INSTANT_DAMAGE(12, PotionEffectType.HARM, 2),
WATER_BREATHING(13, PotionEffectType.WATER_BREATHING, 1),
INVISIBILITY(14, PotionEffectType.INVISIBILITY, 1),
+ LEVITATION(15, PotionEffectType.LEVITATION, 1),
;
private final int damageValue, maxLevel;
--
1.9.5.msysgit.0

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,82 @@
From d1cf06c308d35a765cf2d11b170a9d0f8fabb418 Mon Sep 17 00:00:00 2001
From: libraryaddict <libraryaddict115@yahoo.co.nz>
Date: Wed, 30 Dec 2015 22:38:30 +1300
Subject: [PATCH] Some debug and crash fixes
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
index b1348b9..147295e 100644
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
@@ -932,12 +932,14 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
protected void a(MobEffect mobeffect, boolean flag) {
super.a(mobeffect, flag);
- this.playerConnection.sendPacket(new PacketPlayOutEntityEffect(this.getId(), mobeffect));
+ if (this.playerConnection.networkManager.getVersion() > 47 || mobeffect.getEffectId() != 25)
+ this.playerConnection.sendPacket(new PacketPlayOutEntityEffect(this.getId(), mobeffect));
}
protected void b(MobEffect mobeffect) {
super.b(mobeffect);
- this.playerConnection.sendPacket(new PacketPlayOutRemoveEntityEffect(this.getId(), mobeffect));
+ if (this.playerConnection.networkManager.getVersion() > 47 || mobeffect.getEffectId() != 25)
+ this.playerConnection.sendPacket(new PacketPlayOutRemoveEntityEffect(this.getId(), mobeffect));
}
public void enderTeleportTo(double d0, double d1, double d2) {
diff --git a/src/main/java/net/minecraft/server/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/EntityTrackerEntry.java
index 39f0b73..e5c947f 100644
--- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java
+++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java
@@ -428,7 +428,8 @@ public class EntityTrackerEntry {
while (iterator.hasNext()) {
MobEffect mobeffect = (MobEffect) iterator.next();
- entityplayer.playerConnection.sendPacket(new PacketPlayOutEntityEffect(this.tracker.getId(), mobeffect));
+ if (entityplayer.playerConnection.networkManager.getVersion() > 47 || mobeffect.getEffectId() != 25)
+ entityplayer.playerConnection.sendPacket(new PacketPlayOutEntityEffect(this.tracker.getId(), mobeffect));
}
}
}
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java
index ef51cd4..54c1ec9 100644
--- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java
+++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java
@@ -14,7 +14,7 @@ public class PacketPlayOutMapChunkBulk implements Packet<PacketListenerPlayOut>
public PacketPlayOutMapChunkBulk() {}
- public PacketPlayOutMapChunkBulk(List<Chunk> list) {Thread.dumpStack();
+ public PacketPlayOutMapChunkBulk(List<Chunk> list) {
int i = list.size();
mapChunks = list;
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index 81e231d..42d9e76 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -168,7 +168,8 @@ public abstract class PlayerList {
while (iterator.hasNext()) {
MobEffect mobeffect = (MobEffect) iterator.next();
- playerconnection.sendPacket(new PacketPlayOutEntityEffect(entityplayer.getId(), mobeffect));
+ if (playerconnection.networkManager.getVersion() > 47 || mobeffect.getEffectId() != 25)
+ playerconnection.sendPacket(new PacketPlayOutEntityEffect(entityplayer.getId(), mobeffect));
}
entityplayer.syncInventory();
@@ -615,7 +616,9 @@ public abstract class PlayerList {
entityplayer.updateAbilities();
for (Object o1 : entityplayer.getEffects()) {
MobEffect mobEffect = (MobEffect) o1;
- entityplayer.playerConnection.sendPacket(new PacketPlayOutEntityEffect(entityplayer.getId(), mobEffect));
+
+ if (entityplayer.playerConnection.networkManager.getVersion() > 47 || mobEffect.getEffectId() != 25)
+ entityplayer.playerConnection.sendPacket(new PacketPlayOutEntityEffect(entityplayer.getId(), mobEffect));
}
// entityplayer1.syncInventory();
// CraftBukkit end
--
1.9.5.msysgit.0

View File

@ -0,0 +1,319 @@
From 0d1bec3dad53441ead8ac0f22e2464a924fb8818 Mon Sep 17 00:00:00 2001
From: git <libraryaddict115@yahoo.co.nz>
Date: Thu, 25 Feb 2016 18:20:02 +1300
Subject: [PATCH] Current patch stuff
diff --git a/src/main/java/net/minecraft/server/EntityEnderman.java b/src/main/java/net/minecraft/server/EntityEnderman.java
index 5c09068..45a9acb 100644
--- a/src/main/java/net/minecraft/server/EntityEnderman.java
+++ b/src/main/java/net/minecraft/server/EntityEnderman.java
@@ -160,6 +160,8 @@ public class EntityEnderman extends EntityMonster {
}
protected boolean k(double d0, double d1, double d2) {
+ if (isVegetated())
+ return false;
double d3 = this.locX;
double d4 = this.locY;
double d5 = this.locZ;
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index d074110..e9a324a 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -550,13 +550,13 @@ public abstract class EntityLiving extends Entity {
protected void B() {
if (this.effects.isEmpty()) {
this.bj();
- this.setInvisible(false);
+ this.setInvisible(isMineplexInvisible());
} else {
int i = PotionBrewer.a(this.effects.values());
this.datawatcher.watch(8, Byte.valueOf((byte) (PotionBrewer.b(this.effects.values()) ? 1 : 0)), META_AMBIENT_POTION, PotionBrewer.b(this.effects.values()));
this.datawatcher.watch(7, Integer.valueOf(i), META_POTION_COLOR, i);
- this.setInvisible(this.hasEffect(MobEffectList.INVISIBILITY.id));
+ this.setInvisible(isMineplexInvisible() || this.hasEffect(MobEffectList.INVISIBILITY.id));
}
}
diff --git a/src/main/java/net/minecraft/server/EnumProtocol.java b/src/main/java/net/minecraft/server/EnumProtocol.java
index f3877e4..0343bf8 100644
--- a/src/main/java/net/minecraft/server/EnumProtocol.java
+++ b/src/main/java/net/minecraft/server/EnumProtocol.java
@@ -219,7 +219,11 @@ public enum EnumProtocol
public Integer a(EnumProtocolDirection enumprotocoldirection, Packet packet, boolean is1_8)
{
Entry entry = (Entry) ((BiMap)j.get(enumprotocoldirection)).inverse().get(packet.getClass());
- if ((Integer) (is1_8 ? entry.getKey() : entry.getValue()) < 0){System.out.print("Trying to send unsupported " + packet.getClass().getSimpleName());Thread.dumpStack();}
+ if ((Integer) (is1_8 ? entry.getKey() : entry.getValue()) < 0)
+ {
+ System.out.print("Trying to send unsupported " + packet.getClass().getSimpleName());
+ Thread.dumpStack();
+ }
return (Integer) (is1_8 ? entry.getKey() : entry.getValue());
}
diff --git a/src/main/java/net/minecraft/server/HandshakeListener.java b/src/main/java/net/minecraft/server/HandshakeListener.java
index 824ec1b..9d27032 100644
--- a/src/main/java/net/minecraft/server/HandshakeListener.java
+++ b/src/main/java/net/minecraft/server/HandshakeListener.java
@@ -25,7 +25,7 @@ public class HandshakeListener implements PacketHandshakingInListener {
int version = packethandshakinginsetprotocol.b();
//System.out.print(version);
- boolean supported = version == 47 || version == 94;
+ boolean supported = version == 47 || version == 104;
if (supported)
{
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntity.java b/src/main/java/net/minecraft/server/PacketPlayOutEntity.java
index 702d33d..c3a067e 100644
--- a/src/main/java/net/minecraft/server/PacketPlayOutEntity.java
+++ b/src/main/java/net/minecraft/server/PacketPlayOutEntity.java
@@ -5,9 +5,9 @@ import java.io.IOException;
public class PacketPlayOutEntity implements Packet<PacketListenerPlayOut> {
public int a;
- public byte b;
- public byte c;
- public byte d;
+ public short b;
+ public short c;
+ public short d;
public byte e;
public byte f;
public boolean g;
@@ -87,9 +87,18 @@ public class PacketPlayOutEntity implements Packet<PacketListenerPlayOut> {
public void b(PacketDataSerializer packetdataserializer) throws IOException {
super.b(packetdataserializer);
- packetdataserializer.writeByte(this.b);
- packetdataserializer.writeByte(this.c);
- packetdataserializer.writeByte(this.d);
+ if (packetdataserializer.version != 47)
+ {
+ packetdataserializer.writeShort(this.b);
+ packetdataserializer.writeShort(this.c);
+ packetdataserializer.writeShort(this.d);
+ }
+ else
+ {
+ packetdataserializer.writeByte(this.b);
+ packetdataserializer.writeByte(this.c);
+ packetdataserializer.writeByte(this.d);
+ }
packetdataserializer.writeBoolean(this.g);
}
}
@@ -123,9 +132,18 @@ public class PacketPlayOutEntity implements Packet<PacketListenerPlayOut> {
public void b(PacketDataSerializer packetdataserializer) throws IOException {
super.b(packetdataserializer);
- packetdataserializer.writeByte(this.b);
- packetdataserializer.writeByte(this.c);
- packetdataserializer.writeByte(this.d);
+ if (packetdataserializer.version != 47)
+ {
+ packetdataserializer.writeShort(this.b);
+ packetdataserializer.writeShort(this.c);
+ packetdataserializer.writeShort(this.d);
+ }
+ else
+ {
+ packetdataserializer.writeByte(this.b);
+ packetdataserializer.writeByte(this.c);
+ packetdataserializer.writeByte(this.d);
+ }
packetdataserializer.writeByte(this.e);
packetdataserializer.writeByte(this.f);
packetdataserializer.writeBoolean(this.g);
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntityTeleport.java b/src/main/java/net/minecraft/server/PacketPlayOutEntityTeleport.java
index 4730b34..3fa9fe4 100644
--- a/src/main/java/net/minecraft/server/PacketPlayOutEntityTeleport.java
+++ b/src/main/java/net/minecraft/server/PacketPlayOutEntityTeleport.java
@@ -44,9 +44,15 @@ public class PacketPlayOutEntityTeleport implements Packet<PacketListenerPlayOut
public void b(PacketDataSerializer packetdataserializer) {
packetdataserializer.b(this.a);
+ if (packetdataserializer.version == 47){
packetdataserializer.writeInt(this.b);
packetdataserializer.writeInt(this.c);
packetdataserializer.writeInt(this.d);
+ } else {
+ packetdataserializer.writeDouble(this.b/32D);
+ packetdataserializer.writeDouble(this.c/32D);
+ packetdataserializer.writeDouble(this.d/32D);
+ }
packetdataserializer.writeByte(this.e);
packetdataserializer.writeByte(this.f);
packetdataserializer.writeBoolean(this.g);
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutNamedEntitySpawn.java b/src/main/java/net/minecraft/server/PacketPlayOutNamedEntitySpawn.java
index 340787a..efc9a08 100644
--- a/src/main/java/net/minecraft/server/PacketPlayOutNamedEntitySpawn.java
+++ b/src/main/java/net/minecraft/server/PacketPlayOutNamedEntitySpawn.java
@@ -48,9 +48,15 @@ public class PacketPlayOutNamedEntitySpawn implements Packet<PacketListenerPlayO
public void b(PacketDataSerializer packetdataserializer) throws IOException {
packetdataserializer.b(this.a);
packetdataserializer.a(this.b);
- packetdataserializer.writeInt(this.c);
- packetdataserializer.writeInt(this.d);
- packetdataserializer.writeInt(this.e);
+ if (packetdataserializer.version != 47){
+ packetdataserializer.writeDouble(this.c/32D);
+ packetdataserializer.writeDouble(this.d/32D);
+ packetdataserializer.writeDouble(this.e/32D);
+ }else {
+ packetdataserializer.writeInt(this.c);
+ packetdataserializer.writeInt(this.d);
+ packetdataserializer.writeInt(this.e);
+ }
packetdataserializer.writeByte(this.f);
packetdataserializer.writeByte(this.g);
if (packetdataserializer.version == 47)
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutNamedSoundEffect.java b/src/main/java/net/minecraft/server/PacketPlayOutNamedSoundEffect.java
index 6c8c8fa..b72b7d7 100644
--- a/src/main/java/net/minecraft/server/PacketPlayOutNamedSoundEffect.java
+++ b/src/main/java/net/minecraft/server/PacketPlayOutNamedSoundEffect.java
@@ -279,6 +279,7 @@ public class PacketPlayOutNamedSoundEffect
toPlay = sounds.get(toPlay);
packetdataserializer.a(toPlay);
+ packetdataserializer.b(0);
packetdataserializer.writeInt(b);
packetdataserializer.writeInt(c);
packetdataserializer.writeInt(d);
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntity.java b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntity.java
index 0c60066..c9de471 100644
--- a/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntity.java
+++ b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntity.java
@@ -93,9 +93,15 @@ public class PacketPlayOutSpawnEntity implements Packet<PacketListenerPlayOut> {
if (packetdataserializer.version != 47)
packetdataserializer.a(this.uuid);
packetdataserializer.writeByte(this.j);
- packetdataserializer.writeInt(this.b);
- packetdataserializer.writeInt(this.c);
- packetdataserializer.writeInt(this.d);
+ if (packetdataserializer.version != 47){
+ packetdataserializer.writeDouble(this.b/32D);
+ packetdataserializer.writeDouble(this.c/32D);
+ packetdataserializer.writeDouble(this.d/32D);
+ }else {
+ packetdataserializer.writeInt(this.b);
+ packetdataserializer.writeInt(this.c);
+ packetdataserializer.writeInt(this.d);
+ }
packetdataserializer.writeByte(this.h);
packetdataserializer.writeByte(this.i);
packetdataserializer.writeInt(this.k);
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityExperienceOrb.java b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityExperienceOrb.java
index 4f2b03e..0a39433 100644
--- a/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityExperienceOrb.java
+++ b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityExperienceOrb.java
@@ -42,9 +42,15 @@ public class PacketPlayOutSpawnEntityExperienceOrb
throws IOException
{
packetdataserializer.b(a);
- packetdataserializer.writeInt(b);
- packetdataserializer.writeInt(c);
- packetdataserializer.writeInt(d);
+ if (packetdataserializer.version != 47){
+ packetdataserializer.writeDouble(this.b/32D);
+ packetdataserializer.writeDouble(this.c/32D);
+ packetdataserializer.writeDouble(this.d/32D);
+ }else {
+ packetdataserializer.writeInt(this.b);
+ packetdataserializer.writeInt(this.c);
+ packetdataserializer.writeInt(this.d);
+ }
packetdataserializer.writeShort(e);
}
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityLiving.java b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityLiving.java
index 9da448e..ea7c98b 100644
--- a/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityLiving.java
+++ b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityLiving.java
@@ -88,9 +88,15 @@ public class PacketPlayOutSpawnEntityLiving implements Packet<PacketListenerPlay
if (packetdataserializer.version != 47)
packetdataserializer.a(this.uuid);
packetdataserializer.writeByte(this.b & 255);
- packetdataserializer.writeInt(this.c);
- packetdataserializer.writeInt(this.d);
- packetdataserializer.writeInt(this.e);
+ if (packetdataserializer.version != 47){
+ packetdataserializer.writeDouble(this.c/32D);
+ packetdataserializer.writeDouble(this.d/32D);
+ packetdataserializer.writeDouble(this.e/32D);
+ }else {
+ packetdataserializer.writeInt(this.c);
+ packetdataserializer.writeInt(this.d);
+ packetdataserializer.writeInt(this.e);
+ }
packetdataserializer.writeByte(this.i);
packetdataserializer.writeByte(this.j);
packetdataserializer.writeByte(this.k);
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityWeather.java b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityWeather.java
index 2ce95fa..51a3a21 100644
--- a/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityWeather.java
+++ b/src/main/java/net/minecraft/server/PacketPlayOutSpawnEntityWeather.java
@@ -44,9 +44,15 @@ public class PacketPlayOutSpawnEntityWeather
{
packetdataserializer.b(a);
packetdataserializer.writeByte(e);
- packetdataserializer.writeInt(b);
- packetdataserializer.writeInt(c);
- packetdataserializer.writeInt(d);
+ if (packetdataserializer.version != 47){
+ packetdataserializer.writeDouble(this.b/32D);
+ packetdataserializer.writeDouble(this.c/32D);
+ packetdataserializer.writeDouble(this.d/32D);
+ }else {
+ packetdataserializer.writeInt(this.b);
+ packetdataserializer.writeInt(this.c);
+ packetdataserializer.writeInt(this.d);
+ }
}
public void a(PacketListenerPlayOut packetlistenerplayout)
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 16f8609..b1400c7 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -1212,6 +1212,17 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList
if (movingobjectposition == null || movingobjectposition.type != MovingObjectPosition.EnumMovingObjectType.BLOCK) {
CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_AIR, this.player.inventory.getItemInHand());
}
+ // Spigot start
+ else if (movingobjectposition.type == MovingObjectPosition.EnumMovingObjectType.BLOCK
+ && (player.playerInteractManager.getGameMode() == WorldSettings.EnumGamemode.ADVENTURE || player.playerInteractManager.getGameMode() == WorldSettings.EnumGamemode.SPECTATOR)) {
+ // RIGHT_CLICK_BLOCK sets this flag
+ if (player.playerInteractManager.firedInteract) {
+ player.playerInteractManager.firedInteract = false;
+ } else {
+ CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_BLOCK, movingobjectposition.a(), movingobjectposition.direction, player.inventory.getItemInHand(), true);
+ }
+ }
+ // Spigot end
// Arm swing animation
PlayerAnimationEvent event = new PlayerAnimationEvent(this.getPlayer());
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftSound.java b/src/main/java/org/bukkit/craftbukkit/CraftSound.java
index 0cc8f9b..dd07600 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftSound.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftSound.java
@@ -14,9 +14,9 @@ public class CraftSound {
set(AMBIENCE_RAIN, "ambient.weather.rain");
set(AMBIENCE_THUNDER, "ambient.weather.thunder");
// Damage
- set(HURT_FLESH, "game.neutral.hurt");
- set(FALL_BIG, "game.neutral.hurt.fall.big");
- set(FALL_SMALL, "game.neutral.hurt.fall.small");
+ set(HURT_FLESH, "game.player.hurt");
+ set(FALL_BIG, "game.player.hurt.fall.big");
+ set(FALL_SMALL, "game.player.hurt.fall.small");
// Dig Sounds
set(DIG_WOOL, "dig.cloth");
set(DIG_GRASS, "dig.grass");
--
1.9.5.msysgit.0

View File

@ -0,0 +1,135 @@
From af6ac4b09da7ad63ebb568333807c7621398f0a6 Mon Sep 17 00:00:00 2001
From: git <libraryaddict115@yahoo.co.nz>
Date: Sun, 28 Feb 2016 00:37:30 +1300
Subject: [PATCH] Changed maven version, fixed entity movement, fixed sound
packet
diff --git a/pom.xml b/pom.xml
index 91627ff..1ea9f81 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<packaging>jar</packaging>
- <version>1.8.8-R0.1-SNAPSHOT</version>
+ <version>1.8.8-1.9-SNAPSHOT</version>
<name>Spigot</name>
<url>http://www.spigotmc.org</url>
diff --git a/src/main/java/net/minecraft/server/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/EntityTrackerEntry.java
index e5c947f..9cd9be6 100644
--- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java
+++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java
@@ -145,6 +145,7 @@ public class EntityTrackerEntry {
int k1 = j - this.yLoc;
int l1 = k - this.zLoc;
Object object = null;
+ Object object2 = null;
boolean flag = Math.abs(j1) >= 4 || Math.abs(k1) >= 4 || Math.abs(l1) >= 4 || this.m % 60 == 0;
boolean flag1 = Math.abs(l - this.yRot) >= 4 || Math.abs(i1 - this.xRot) >= 4;
@@ -163,10 +164,12 @@ public class EntityTrackerEntry {
if (this.m > 0 || this.tracker instanceof EntityArrow) {
if (j1 >= -128 && j1 < 128 && k1 >= -128 && k1 < 128 && l1 >= -128 && l1 < 128 && this.v <= 400 && !this.x && this.y == this.tracker.onGround) {
+ object2 = new PacketPlayOutEntityTeleport(this.tracker.getId(), i, j, k, (byte) l, (byte) i1, this.tracker.onGround);
if ((!flag || !flag1) && !(this.tracker instanceof EntityArrow)) {
if (flag) {
object = new PacketPlayOutEntity.PacketPlayOutRelEntityMove(this.tracker.getId(), (byte) j1, (byte) k1, (byte) l1, this.tracker.onGround);
} else if (flag1) {
+ object2 = null;
object = new PacketPlayOutEntity.PacketPlayOutEntityLook(this.tracker.getId(), (byte) l, (byte) i1, this.tracker.onGround);
}
} else {
@@ -200,7 +203,15 @@ public class EntityTrackerEntry {
}
if (object != null) {
- this.broadcast((Packet) object);
+
+ Iterator iterator = this.trackedPlayers.iterator();
+
+ while (iterator.hasNext()) {
+ EntityPlayer entityplayer = (EntityPlayer) iterator.next();
+ Packet packetToSend = object2 == null || entityplayer.playerConnection.networkManager.getVersion() == 47 ? (Packet) object : (Packet) object2;
+
+ entityplayer.playerConnection.sendPacket(packetToSend);
+ }
}
this.b();
diff --git a/src/main/java/net/minecraft/server/HandshakeListener.java b/src/main/java/net/minecraft/server/HandshakeListener.java
index 9d27032..21dbf3b 100644
--- a/src/main/java/net/minecraft/server/HandshakeListener.java
+++ b/src/main/java/net/minecraft/server/HandshakeListener.java
@@ -25,7 +25,7 @@ public class HandshakeListener implements PacketHandshakingInListener {
int version = packethandshakinginsetprotocol.b();
//System.out.print(version);
- boolean supported = version == 47 || version == 104;
+ boolean supported = version == 47 || version >= 104;
if (supported)
{
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntity.java b/src/main/java/net/minecraft/server/PacketPlayOutEntity.java
index c3a067e..8436897 100644
--- a/src/main/java/net/minecraft/server/PacketPlayOutEntity.java
+++ b/src/main/java/net/minecraft/server/PacketPlayOutEntity.java
@@ -5,9 +5,9 @@ import java.io.IOException;
public class PacketPlayOutEntity implements Packet<PacketListenerPlayOut> {
public int a;
- public short b;
- public short c;
- public short d;
+ public byte b;
+ public byte c;
+ public byte d;
public byte e;
public byte f;
public boolean g;
@@ -89,9 +89,9 @@ public class PacketPlayOutEntity implements Packet<PacketListenerPlayOut> {
super.b(packetdataserializer);
if (packetdataserializer.version != 47)
{
- packetdataserializer.writeShort(this.b);
- packetdataserializer.writeShort(this.c);
- packetdataserializer.writeShort(this.d);
+ packetdataserializer.writeShort((short) this.b);
+ packetdataserializer.writeShort((short) this.c);
+ packetdataserializer.writeShort((short) this.d);
}
else
{
@@ -134,9 +134,9 @@ public class PacketPlayOutEntity implements Packet<PacketListenerPlayOut> {
super.b(packetdataserializer);
if (packetdataserializer.version != 47)
{
- packetdataserializer.writeShort(this.b);
- packetdataserializer.writeShort(this.c);
- packetdataserializer.writeShort(this.d);
+ packetdataserializer.writeShort((short) this.b);
+ packetdataserializer.writeShort((short) this.c);
+ packetdataserializer.writeShort((short) this.d);
}
else
{
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutNamedSoundEffect.java b/src/main/java/net/minecraft/server/PacketPlayOutNamedSoundEffect.java
index b72b7d7..bcfdab9 100644
--- a/src/main/java/net/minecraft/server/PacketPlayOutNamedSoundEffect.java
+++ b/src/main/java/net/minecraft/server/PacketPlayOutNamedSoundEffect.java
@@ -279,7 +279,8 @@ public class PacketPlayOutNamedSoundEffect
toPlay = sounds.get(toPlay);
packetdataserializer.a(toPlay);
- packetdataserializer.b(0);
+ if (packetdataserializer.version > 47)
+ packetdataserializer.b(0);
packetdataserializer.writeInt(b);
packetdataserializer.writeInt(c);
packetdataserializer.writeInt(d);
--
1.9.5.msysgit.0

View File

@ -0,0 +1,60 @@
From 48550b9915d18d2d4a528c4028c8fa35a97a036c Mon Sep 17 00:00:00 2001
From: git <libraryaddict115@yahoo.co.nz>
Date: Tue, 1 Mar 2016 09:29:32 +1300
Subject: [PATCH] Update to 1.9, fix blocking
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 2f52ea2..c2ce92f 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -1745,6 +1745,14 @@ public abstract class Entity implements ICommandListener {
}
public void f(boolean flag) {
+ if (this instanceof EntityPlayer)
+ {
+ EntityPlayer player = (EntityPlayer) this;
+
+ if (player.playerConnection.networkManager.getVersion() != 47 && player.bS() && player.getHeldItem().getItem().e(player.getHeldItem()) == EnumAnimation.BLOCK)
+ return;
+ }
+
this.b(4, flag);
}
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
index 743df69..998ea69 100644
--- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
@@ -124,8 +124,13 @@ public abstract class EntityHuman extends EntityLiving {
}
+ public ItemStack getHeldItem()
+ {
+ return this.g;
+ }
+
public boolean isBlocking() {
- return this.bS() && this.g.getItem().e(this.g) == EnumAnimation.BLOCK;
+ return ((EntityPlayer) this).playerConnection.networkManager.getVersion() == 47 && this.bS() && this.g.getItem().e(this.g) == EnumAnimation.BLOCK;
}
public void t_() {
diff --git a/src/main/java/net/minecraft/server/HandshakeListener.java b/src/main/java/net/minecraft/server/HandshakeListener.java
index 21dbf3b..0d8aff4 100644
--- a/src/main/java/net/minecraft/server/HandshakeListener.java
+++ b/src/main/java/net/minecraft/server/HandshakeListener.java
@@ -25,7 +25,7 @@ public class HandshakeListener implements PacketHandshakingInListener {
int version = packethandshakinginsetprotocol.b();
//System.out.print(version);
- boolean supported = version == 47 || version >= 104;
+ boolean supported = version == 47 || version == 107;
if (supported)
{
--
1.9.5.msysgit.0

View File

@ -30,7 +30,7 @@
</dependency>
<dependency>
<groupId>net.kencochrane.raven</groupId>
<artifactId>raven-log4j2</artifactId>
<artifactId>raven</artifactId>
</dependency>
<dependency>
<groupId>net.md-5</groupId>

View File

@ -7,21 +7,27 @@ import mineplex.bungee.motd.MotdManager;
import mineplex.bungee.playerCount.PlayerCount;
import mineplex.bungee.playerStats.PlayerStats;
import mineplex.bungee.playerTracker.PlayerTracker;
import mineplex.bungee.status.InternetStatus;
import net.kencochrane.raven.RavenFactory;
import net.kencochrane.raven.DefaultRavenFactory;
import net.kencochrane.raven.dsn.Dsn;
import net.kencochrane.raven.jul.SentryHandler;
import net.md_5.bungee.api.plugin.Plugin;
public class Mineplexer extends Plugin
{
{
@Override
public void onEnable()
{
// Sentry setup
Handler sentry = new SentryHandler(RavenFactory.ravenInstance("https://470f12378af3453ba089e0c0a0c9aae6:292516b722594784807aebb06db8ec38@app.getsentry.com/66323"));
sentry.setLevel(Level.WARNING);
getProxy().getLogger().addHandler(sentry);
public void onEnable() {
getProxy().getScheduler().runAsync(this, new Runnable() {
@Override
public void run() {
// Sentry setup
Handler sentry = new SentryHandler(new DefaultRavenFactory().createRavenInstance(
new Dsn("https://470f12378af3453ba089e0c0a0c9aae6:292516b722594784807aebb06db8ec38@app.getsentry.com/66323"
)));
sentry.setLevel(Level.SEVERE);
getProxy().getLogger().addHandler(sentry);
}
});
new MotdManager(this);
new LobbyBalancer(this);
PlayerCount playerCount = new PlayerCount(this);

View File

@ -32,7 +32,7 @@ public class PlayerStatsRepository extends RepositoryBase
public PlayerStatsRepository()
{
super(DBPool.getStats());
super(DBPool.getPlayerStats());
}
@Override

View File

@ -14,7 +14,7 @@ public class PlayerStatsRepository extends RepositoryBase
public PlayerStatsRepository()
{
super(DBPool.getStats());
super(DBPool.getPlayerStats());
}
@Override

View File

@ -39,7 +39,7 @@ public class PlayerCache
catch (Exception exception)
{
System.out.println("Error adding player info in PlayerCache : " + exception.getMessage());
// exception.printStackTrace();
exception.printStackTrace();
}
}
@ -47,7 +47,15 @@ public class PlayerCache
{
try
{
return _repository.getElement(uuid.toString());
PlayerInfo playerInfo = _repository.getElement(uuid.toString());
System.out.println("Got playerInfo: " + playerInfo);
if (playerInfo != null)
{
System.out.println("account id: " + playerInfo.getAccountId());
System.out.println("name: " + playerInfo.getName());
}
return playerInfo;
}
catch (Exception exception)
{

View File

@ -1,46 +0,0 @@
package mineplex.core.common;
import java.io.File;
import java.io.IOException;
import java.util.logging.Level;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.plugin.Plugin;
public class ConfigContainer
{
private final Plugin _plugin;
private File _configFile;
private FileConfiguration _config;
public ConfigContainer(Plugin plugin, String configFile)
{
this._plugin = plugin;
this._configFile = new File(configFile);
}
public FileConfiguration getConfig() {
if (_config == null)
{
if (_configFile.isFile())
{
_config = YamlConfiguration.loadConfiguration(_configFile);
} else {
_config = _plugin.getConfig();
_configFile = new File(_plugin.getDataFolder(), "config.yml");
}
}
return _config;
}
public void saveConfig() {
try
{
getConfig().save(_configFile);
} catch (IOException ex) {
_plugin.getLogger().log(Level.SEVERE, "Could not save config to " + _configFile, ex);
}
}
}

View File

@ -0,0 +1,7 @@
package mineplex.core.common.function;
@FunctionalInterface
public interface Result<T>
{
public void Get(T result);
}

View File

@ -0,0 +1,26 @@
package mineplex.core.common.util;
public class EnclosedObject<T>
{
private T _value;
public EnclosedObject()
{
this(null);
}
public EnclosedObject(T t)
{
_value = t;
}
public T Get()
{
return _value;
}
public T Set(T value)
{
return _value = value;
}
}

View File

@ -1,33 +0,0 @@
package mineplex.core.common.util;
public class NonFinalInteger
{
private int _value;
public NonFinalInteger()
{
this(0);
}
public NonFinalInteger(int value)
{
_value = value;
}
public NonFinalInteger add(int value)
{
_value += value;
return this;
}
public NonFinalInteger subtract(int value)
{
_value -= value;
return this;
}
public int get()
{
return _value;
}
}

View File

@ -0,0 +1,28 @@
package mineplex.core.common.util;
public class NumberFloater
{
private double _min;
private double _max;
private double _modifyPerCall;
private double _cur;
private boolean _up;
public NumberFloater(double min, double max, double modify)
{
_min = min;
_max = max;
_modifyPerCall = modify;
}
public double pulse()
{
if (_up && (_cur = UtilMath.clamp(_cur += _modifyPerCall, _min, _max)) >= _max)
_up = false;
else if ((_cur = UtilMath.clamp(_cur -= _modifyPerCall, _min, _max)) <= _min)
_up = true;
return _cur;
}
}

View File

@ -1,42 +0,0 @@
package mineplex.core.common.util;
public class NumericalPulser
{
private double _min;
private double _max;
private double _modifyPerCall;
private double _cur;
private boolean _up;
public NumericalPulser(double min, double max, double modify)
{
_min = min;
_max = max;
_modifyPerCall = modify;
}
public double pulse()
{
if (_up)
{
_cur = UtilMath.clamp(_cur += _modifyPerCall, _min, _max);
if (_cur >= _max)
{
_up = false;
}
}
else
{
_cur = UtilMath.clamp(_cur -= _modifyPerCall, _min, _max);
if (_cur <= _min)
{
_up = true;
}
}
return _cur;
}
}

View File

@ -171,6 +171,7 @@ public class UtilBlock
blockPassSet.add((byte) Material.STAINED_GLASS_PANE.getId());
blockPassSet.add((byte) Material.IRON_TRAPDOOR.getId());
blockPassSet.add((byte) Material.DAYLIGHT_DETECTOR_INVERTED.getId());
blockPassSet.add((byte) Material.BARRIER.getId());
blockPassSet.add((byte) Material.BIRCH_FENCE_GATE.getId());
blockPassSet.add((byte) Material.JUNGLE_FENCE_GATE.getId());

View File

@ -1,9 +1,9 @@
package mineplex.core.common.util;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
@ -14,7 +14,7 @@ import org.bukkit.ChatColor;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_8_R3.event.CraftEventFactory;
@ -24,6 +24,7 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryView;
import org.bukkit.potion.PotionEffect;
import org.bukkit.util.BlockIterator;
import org.bukkit.util.Vector;
import net.minecraft.server.v1_8_R3.EntityPlayer;
@ -66,6 +67,11 @@ public class UtilPlayer
return true;
}
public static boolean is1_9(Player player)
{
return ((CraftPlayer) player).getHandle().playerConnection.networkManager.getVersion() > 47;
}
private static class Vector3D
{
@ -755,4 +761,32 @@ public class UtilPlayer
looking.multiply(distance);
return player.getEyeLocation().clone().add(looking);
}
public static Block getTarget(LivingEntity entity, HashSet<Byte> ignore, int maxDistance)
{
Iterator<Block> itr = new BlockIterator(entity, maxDistance);
while (itr.hasNext())
{
Block block = itr.next();
int id = block.getTypeId();
if (ignore == null)
{
if (id != 0)
{
return block;
}
}
else
{
if (!ignore.contains((byte)id))
{
return block;
}
}
}
return null;
}
}

View File

@ -1,8 +1,15 @@
package mineplex.core.common.util;
import java.util.HashMap;
import java.util.UUID;
import mineplex.core.common.DummyEntity;
import net.minecraft.server.v1_8_R3.DataWatcher;
import net.minecraft.server.v1_8_R3.Entity;
import net.minecraft.server.v1_8_R3.EntityLiving;
import net.minecraft.server.v1_8_R3.EntityWither;
import net.minecraft.server.v1_8_R3.MathHelper;
import net.minecraft.server.v1_8_R3.PacketPlayOutBossBar;
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy;
import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving;
@ -10,144 +17,220 @@ import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.scheduler.BukkitRunnable;
public class UtilTextTop
public class UtilTextTop
{
//Base Commands
// Base Commands
public static void display(String text, Player... players)
{
displayProgress(text, 1, players);
}
public static void displayProgress(String text, double progress, Player... players)
{
for (Player player : players)
displayTextBar(player, progress, text);
}
//Logic
// Logic
public static final int EntityDragonId = 777777;
public static final int EntityWitherId = 777778;
//Display
public static final UUID BossUUID = UUID.fromString("178f5cde-2fb0-3e73-8296-967ec7e46748");
private static HashMap<String, BukkitRunnable> _lastUpdated = new HashMap<String, BukkitRunnable>();
// Display
public static void displayTextBar(final Player player, double healthPercent, String text)
{
deleteOld(player);
healthPercent = Math.min(1, healthPercent);
//Display Dragon
if (_lastUpdated.containsKey(player.getName()))
{
Location loc = player.getLocation().subtract(0, 200, 0);
UtilPlayer.sendPacket(player, getDragonPacket(text, healthPercent, loc));
_lastUpdated.get(player.getName()).cancel();
}
//Display Wither (as well as Dragon)
Location loc = player.getEyeLocation().add(player.getLocation().getDirection().multiply(24));
UtilPlayer.sendPacket(player, getWitherPacket(text, healthPercent, loc));
//Remove
Bukkit.getServer().getScheduler().runTaskLater(Bukkit.getPluginManager().getPlugins()[0], new Runnable()
healthPercent = Math.max(0, Math.min(1, healthPercent));
// Remove
final BukkitRunnable runnable = new BukkitRunnable()
{
public void run()
{
if (_lastUpdated.containsKey(player.getName()) && _lastUpdated.get(player.getName()) != this)
return;
deleteOld(player);
_lastUpdated.remove(player.getName());
}
}, 20);
};
runnable.runTaskLater(Bukkit.getPluginManager().getPlugins()[0], 20);
if (UtilPlayer.is1_9(player))
{
sendBossBar(player, healthPercent, text);
_lastUpdated.put(player.getName(), runnable);
return;
}
_lastUpdated.put(player.getName(), runnable);
deleteOld(player);
// Display Dragon
{
Location loc = player.getLocation().subtract(0, 200, 0);
UtilPlayer.sendPacket(player, getDragonPacket(text, healthPercent, loc));
}
// Display Wither (as well as Dragon)
Location loc = player.getEyeLocation().add(player.getLocation().getDirection().multiply(24));
UtilPlayer.sendPacket(player, getWitherPacket(text, healthPercent, loc));
}
private static void sendBossBar(Player player, double health, String text)
{
if (_lastUpdated.containsKey(player.getName()))
{
PacketPlayOutBossBar bossBar1 = new PacketPlayOutBossBar();
bossBar1.uuid = BossUUID;
bossBar1.action = 2;
bossBar1.health = (float) health;
PacketPlayOutBossBar bossBar2 = new PacketPlayOutBossBar();
bossBar2.uuid = BossUUID;
bossBar2.action = 3;
bossBar2.title = text;
UtilPlayer.sendPacket(player, bossBar1, bossBar2);
}
else
{
PacketPlayOutBossBar bossBar = new PacketPlayOutBossBar();
bossBar.uuid = BossUUID;
bossBar.title = text;
bossBar.health = (float) health;
bossBar.color = 2;
UtilPlayer.sendPacket(player, bossBar);
}
}
private static void deleteOld(Player player)
{
if (UtilPlayer.is1_9(player))
{
PacketPlayOutBossBar bossBar = new PacketPlayOutBossBar();
bossBar.uuid = BossUUID;
bossBar.action = 1;
UtilPlayer.sendPacket(player, bossBar);
return;
}
// Delete Dragon (All Clients)
PacketPlayOutEntityDestroy destroyDragonPacket = new PacketPlayOutEntityDestroy(new int[]
{
EntityDragonId
EntityDragonId
});
UtilPlayer.sendPacket(player, destroyDragonPacket);
// Delete Wither (1.8+ Only)
PacketPlayOutEntityDestroy destroyWitherPacket = new PacketPlayOutEntityDestroy(new int[]
{
EntityWitherId
EntityWitherId
});
UtilPlayer.sendPacket(player, destroyWitherPacket);
}
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event)
{
if (UtilPlayer.is1_9(event.getPlayer()))
{
deleteOld(event.getPlayer());
}
}
public static PacketPlayOutSpawnEntityLiving getDragonPacket(String text, double healthPercent, Location loc)
{
PacketPlayOutSpawnEntityLiving mobPacket = new PacketPlayOutSpawnEntityLiving();
mobPacket.a = (int) EntityDragonId; //Entity ID
mobPacket.b = (byte) EntityType.ENDER_DRAGON.getTypeId(); //Mob type
mobPacket.c = (int) Math.floor(loc.getBlockX() * 32.0D); //X position
mobPacket.d = (int) MathHelper.floor(loc.getBlockY() * 32.0D); //Y position
mobPacket.e = (int) Math.floor(loc.getBlockZ() * 32.0D); //Z position
mobPacket.f = (byte) 0; //Pitch
mobPacket.g = (byte) 0; //Head Pitch
mobPacket.h = (byte) 0; //Yaw
mobPacket.i = (short) 0; //X velocity
mobPacket.j = (short) 0; //Y velocity
mobPacket.k = (short) 0; //Z velocity
//Health
mobPacket.a = (int) EntityDragonId; // Entity ID
mobPacket.b = (byte) EntityType.ENDER_DRAGON.getTypeId(); // Mob type
mobPacket.c = (int) Math.floor(loc.getBlockX() * 32.0D); // X position
mobPacket.d = (int) MathHelper.floor(loc.getBlockY() * 32.0D); // Y position
mobPacket.e = (int) Math.floor(loc.getBlockZ() * 32.0D); // Z position
mobPacket.f = (byte) 0; // Pitch
mobPacket.g = (byte) 0; // Head Pitch
mobPacket.h = (byte) 0; // Yaw
mobPacket.i = (short) 0; // X velocity
mobPacket.j = (short) 0; // Y velocity
mobPacket.k = (short) 0; // Z velocity
mobPacket.uuid = UUID.randomUUID();
// Health
double health = healthPercent * 199.9 + 0.1;
//if (halfHealth)
// health = healthPercent * 99 + 101;
//Watcher
// if (halfHealth)
// health = healthPercent * 99 + 101;
// Watcher
DataWatcher watcher = getWatcher(text, health, loc.getWorld());
mobPacket.l = watcher;
return mobPacket;
}
public static PacketPlayOutSpawnEntityLiving getWitherPacket(String text, double healthPercent, Location loc)
{
PacketPlayOutSpawnEntityLiving mobPacket = new PacketPlayOutSpawnEntityLiving();
mobPacket.a = (int) EntityWitherId; //Entity ID
mobPacket.b = (byte) EntityType.WITHER.getTypeId(); //Mob type
mobPacket.c = (int) Math.floor(loc.getBlockX() * 32.0D); //X position
mobPacket.d = (int) MathHelper.floor(loc.getBlockY() * 32.0D); //Y position
mobPacket.e = (int) Math.floor(loc.getBlockZ() * 32.0D); //Z position
mobPacket.f = (byte) 0; //Pitch
mobPacket.g = (byte) 0; //Head Pitch
mobPacket.h = (byte) 0; //Yaw
mobPacket.i = (short) 0; //X velocity
mobPacket.j = (short) 0; //Y velocity
mobPacket.k = (short) 0; //Z velocity
//Health
mobPacket.a = (int) EntityWitherId; // Entity ID
mobPacket.b = (byte) EntityType.WITHER.getTypeId(); // Mob type
mobPacket.c = (int) Math.floor(loc.getBlockX() * 32.0D); // X position
mobPacket.d = (int) MathHelper.floor(loc.getBlockY() * 32.0D); // Y position
mobPacket.e = (int) Math.floor(loc.getBlockZ() * 32.0D); // Z position
mobPacket.f = (byte) 0; // Pitch
mobPacket.g = (byte) 0; // Head Pitch
mobPacket.h = (byte) 0; // Yaw
mobPacket.i = (short) 0; // X velocity
mobPacket.j = (short) 0; // Y velocity
mobPacket.k = (short) 0; // Z velocity
mobPacket.uuid = UUID.randomUUID();
// Health
double health = healthPercent * 299.9 + 0.1;
//if (halfHealth)
// health = healthPercent * 149 + 151;
//Watcher
// if (halfHealth)
// health = healthPercent * 149 + 151;
// Watcher
DataWatcher watcher = getWatcher(text, health, loc.getWorld());
mobPacket.l = watcher;
return mobPacket;
}
public static DataWatcher getWatcher(String text, double health, World world)
{
DataWatcher watcher = new DataWatcher(new DummyEntity(((CraftWorld)world).getHandle()));
DataWatcher watcher = new DataWatcher(new DummyEntity(((CraftWorld) world).getHandle()));
watcher.a(0, (Byte) (byte) 0); //Flags, 0x20 = invisible
watcher.a(6, (Float) (float) health);
watcher.a(2, (String) text); //Entity name
watcher.a(3, (Byte) (byte) 0); //Show name, 1 = show, 0 = don't show
watcher.a(16, (Integer) (int) health); //Health
watcher.a(20, (Integer) (int) 881); //Inv
int i1 = watcher.getByte(0);
watcher.watch(0, Byte.valueOf((byte)(i1 | 1 << 5)));
watcher.a(0, (Byte) (byte) (0 | 1 << 5), Entity.META_ENTITYDATA, (byte) (0 | 1 << 5)); // Flags, 0x20 = invisible
watcher.a(6, (Float) (float) health, EntityLiving.META_HEALTH, (float) health);
watcher.a(2, (String) text, Entity.META_CUSTOMNAME, text); // Entity name
watcher.a(3, (Byte) (byte) 0, Entity.META_CUSTOMNAME_VISIBLE, false); // Show name, 1 = show, 0 = don't show
// watcher.a(16, (Integer) (int) health, EntityWither.META); //Health
watcher.a(20, (Integer) (int) 881, EntityWither.META_INVUL_TIME, 881); // Inv
return watcher;
}

View File

@ -19,6 +19,8 @@ import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import net.minecraft.server.v1_8_R3.DataWatcher;
import net.minecraft.server.v1_8_R3.DataWatcher.WatchableObject;
import net.minecraft.server.v1_8_R3.Entity;
import net.minecraft.server.v1_8_R3.EntityArmorStand;
import net.minecraft.server.v1_8_R3.Packet;
import net.minecraft.server.v1_8_R3.PacketPlayInUseEntity;
import net.minecraft.server.v1_8_R3.PacketPlayInUseEntity.EnumEntityUseAction;
@ -519,25 +521,20 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
{
DataWatcher watcher = new DataWatcher(new DummyEntity(((CraftWorld) owner.getWorld()).getHandle()));
watcher.a(0, (byte) (0 | 1 << 5)); // Invisible
watcher.a(1, Short.valueOf((short) 300));
watcher.a(2, finalEntityName);
watcher.a(3, (byte) 1);
watcher.a(4, Byte.valueOf((byte) 0));
watcher.a(7, Integer.valueOf(0));
watcher.a(8, Byte.valueOf((byte) 0));
watcher.a(9, Byte.valueOf((byte) 0));
watcher.a(6, Float.valueOf(1.0F));
watcher.a(10, (byte) (0 | 0x1)); // Small
watcher.a(0, (byte) (0 | 1 << 5), Entity.META_ENTITYDATA, (byte) (0 | 1 << 5)); // Invisible
watcher.a(1, Short.valueOf((short) 300), Entity.META_AIR, 0);
watcher.a(2, finalEntityName, Entity.META_CUSTOMNAME, finalEntityName);
watcher.a(3, (byte) 1, Entity.META_CUSTOMNAME_VISIBLE, true);
watcher.a(10, (byte) (0 | 0x1), EntityArmorStand.META_ARMOR_OPTION, (byte) (0 | 0x1)); // Small
if (newPacket)
{
if (squidId >= 0)
{
watcher.watch(10, (byte) 16);
watcher.watch(10, (byte) 16, EntityArmorStand.META_ARMOR_OPTION, (byte) 16);
DataWatcher squidWatcher = new DataWatcher(new DummyEntity(((CraftWorld) owner.getWorld()).getHandle()));
squidWatcher.a(0, (byte) (0 | 1 << 5));
squidWatcher.a(0, (byte) (0 | 1 << 5), Entity.META_ENTITYDATA, (byte) (0 | 1 << 5));
PacketPlayOutSpawnEntityLiving spawnPacket = new PacketPlayOutSpawnEntityLiving();
spawnPacket.a = squidId;
@ -545,6 +542,7 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
spawnPacket.c = 1000000;
spawnPacket.l = squidWatcher;
spawnPacket.uuid = UUID.randomUUID();
UtilPlayer.sendPacket(owner, spawnPacket);
@ -562,6 +560,7 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
spawnPacket.c = 1000000;
spawnPacket.l = watcher;
spawnPacket.uuid = UUID.randomUUID();
UtilPlayer.sendPacket(owner, spawnPacket);

View File

@ -10,26 +10,27 @@ import java.util.LinkedList;
import java.util.List;
import java.util.UUID;
import mineplex.core.database.MinecraftRepository;
import org.bukkit.Bukkit;
import com.google.gson.reflect.TypeToken;
import org.bukkit.plugin.java.JavaPlugin;
import com.google.gson.reflect.TypeToken;
import mineplex.core.account.ILoginProcessor;
import mineplex.core.account.IQuerylessLoginProcessor;
import mineplex.core.account.repository.token.LoginToken;
import mineplex.core.account.repository.token.RankUpdateToken;
import mineplex.core.common.Rank;
import mineplex.core.common.util.Callback;
import mineplex.core.common.util.EnclosedObject;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.database.MinecraftRepository;
import mineplex.core.server.remotecall.JsonWebCall;
import mineplex.serverdata.database.DBPool;
import mineplex.serverdata.database.DatabaseRunnable;
import mineplex.serverdata.database.RepositoryBase;
import mineplex.serverdata.database.ResultSetCallable;
import mineplex.serverdata.database.column.ColumnBoolean;
import mineplex.serverdata.database.column.ColumnTimestamp;
import mineplex.serverdata.database.column.ColumnVarChar;
import mineplex.core.server.remotecall.JsonWebCall;
public class AccountRepository extends MinecraftRepository
{
@ -189,7 +190,7 @@ public class AccountRepository extends MinecraftRepository
public UUID getClientUUID(String name)
{
final List<UUID> uuids = new ArrayList<UUID>();
EnclosedObject<UUID> uuid = new EnclosedObject<>();
executeQuery(SELECT_ACCOUNT_UUID_BY_NAME, new ResultSetCallable()
{
@ -198,15 +199,12 @@ public class AccountRepository extends MinecraftRepository
{
while (resultSet.next())
{
uuids.add(UUID.fromString(resultSet.getString(1)));
uuid.Set(UUID.fromString(resultSet.getString(1)));
}
}
}, new ColumnVarChar("name", 100, name));
if (uuids.size() > 0)
return uuids.get(0);
else
return null;
return uuid.Get();
}
public void saveRank(final Callback<Rank> callback, final String name, final UUID uuid, final Rank rank, final boolean perm)

View File

@ -11,6 +11,7 @@ import org.bukkit.ChatColor;
import org.bukkit.GameMode;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerMoveEvent;
@ -30,6 +31,7 @@ import mineplex.core.common.Rank;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
@ -202,7 +204,12 @@ public class AntiHack extends MiniPlugin
return true;
}
if (player.isFlying() || player.isInsideVehicle() || player.getGameMode() != GameMode.SURVIVAL || UtilPlayer.isSpectator(player))
if (player.isFlying() || ((CraftPlayer) player).getHandle().isGliding() || player.isInsideVehicle() || player.getGameMode() != GameMode.SURVIVAL || UtilPlayer.isSpectator(player))
{
return true;
}
if (UtilInv.IsItem(player.getInventory().getArmorContents()[2], Material.ELYTRA, (byte) 0))
{
return true;
}

View File

@ -33,7 +33,7 @@ public class AntiHackRepository
{
PreparedStatement preparedStatement = null;
try (Connection connection = DBPool.getStats().getConnection())
try (Connection connection = DBPool.getMineplexStats().getConnection())
{
preparedStatement = connection.prepareStatement(UPDATE_PLAYER_OFFENSES);

View File

@ -72,6 +72,7 @@ import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.plugin.java.JavaPlugin;
import net.minecraft.server.v1_8_R3.DataWatcher;
import net.minecraft.server.v1_8_R3.EntityCreeper;
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityMetadata;
public class BonusManager extends MiniClientPlugin<BonusClientData> implements ILoginProcessor
@ -408,7 +409,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
if (!_enabled)
return;
((CraftEntity)_carlNpc.getEntity()).getHandle().getDataWatcher().watch(16, (byte) -1);
((CraftEntity)_carlNpc.getEntity()).getHandle().getDataWatcher().watch(16, (byte) -1, EntityCreeper.META_FUSE_STATE, -1);
}
public void IncreaseSize(Entity player)
@ -416,7 +417,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
if (!_enabled)
return;
((CraftEntity)_carlNpc.getEntity()).getHandle().getDataWatcher().watch(16, (byte) 1);
((CraftEntity)_carlNpc.getEntity()).getHandle().getDataWatcher().watch(16, (byte) 1, EntityCreeper.META_FUSE_STATE, 1);
}
// DAILY BONUS
@ -939,9 +940,9 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
{
// Charged
DataWatcher watcher = new DataWatcher(null);
watcher.a(0, (byte) 0);
watcher.a(1, (short) 300);
watcher.a(17, (byte) 1);
watcher.a(0, (byte) 0, EntityCreeper.META_ENTITYDATA, (byte) 0);
watcher.a(1, (short) 300, EntityCreeper.META_AIR, 0);
watcher.a(17, (byte) 1, EntityCreeper.META_POWERED, true);
PacketPlayOutEntityMetadata packet = new PacketPlayOutEntityMetadata();
packet.a = _carlNpc.getEntity().getEntityId();
packet.b = watcher.c();
@ -958,7 +959,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
{
// Charged
DataWatcher watcher = new DataWatcher(null);
watcher.a(17, (byte) 0);
watcher.a(17, (byte) 0, EntityCreeper.META_POWERED, false);
PacketPlayOutEntityMetadata packet = new PacketPlayOutEntityMetadata();
packet.a = _carlNpc.getEntity().getEntityId();
packet.b = watcher.c();

View File

@ -401,17 +401,17 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler
disguise(disguise, true, players);
}
public Packet[] getBedChunkLoadPackets(Player player, Location newLoc)
public PacketPlayOutMapChunk[] getBedChunkLoadPackets(Player player, Location newLoc)
{
prepareChunk(newLoc);
Packet[] packets = new Packet[2];
PacketPlayOutMapChunk[] packets = new PacketPlayOutMapChunk[2];
// Make unload
packets[0] = new PacketPlayOutMapChunk(_bedChunk, true, 0);
// Make load
packets[1] = new PacketPlayOutMapChunkBulk(Arrays.asList(_bedChunk));
packets[1] = new PacketPlayOutMapChunk(_bedChunk, true, '\uffff');
return packets;
}
@ -823,7 +823,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler
PacketPlayOutNamedEntitySpawn namePacket = pDisguise.spawnBeforePlayer(player.getLocation());
namePacket.i.watch(0, (byte) 32);
namePacket.i.watch(0, (byte) 32, net.minecraft.server.v1_8_R3.Entity.META_ENTITYDATA, (byte) 32);
handlePacket(namePacket, packetVerifier);

View File

@ -1,5 +1,7 @@
package mineplex.core.disguise.disguises;
import net.minecraft.server.v1_8_R3.EntityAgeable;
import org.bukkit.entity.*;
public abstract class DisguiseAgeable extends DisguiseCreature
@ -8,14 +10,7 @@ public abstract class DisguiseAgeable extends DisguiseCreature
{
super(disguiseType, entity);
DataWatcher.a(12, new Byte((byte)0));
}
public void UpdateDataWatcher()
{
super.UpdateDataWatcher();
DataWatcher.watch(12, DataWatcher.getByte(12));
DataWatcher.a(12, new Byte((byte)0), EntityAgeable.META_BABY, false);
}
public boolean isBaby()
@ -25,6 +20,6 @@ public abstract class DisguiseAgeable extends DisguiseCreature
public void setBaby()
{
DataWatcher.watch(12, new Byte((byte) ( -1 )));
DataWatcher.watch(12, new Byte((byte) ( -1 )), EntityAgeable.META_BABY, true);
}
}

View File

@ -2,6 +2,7 @@ package mineplex.core.disguise.disguises;
import org.bukkit.util.Vector;
import net.minecraft.server.v1_8_R3.EntityArmorStand;
import net.minecraft.server.v1_8_R3.MathHelper;
import net.minecraft.server.v1_8_R3.Packet;
import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving;
@ -13,12 +14,14 @@ public class DisguiseArmorStand extends DisguiseInsentient
{
super(entity);
DataWatcher.a(10, (byte) 0);
DataWatcher.a(10, (byte) 0, EntityArmorStand.META_ARMOR_OPTION, (byte) 0);
for (int i = 11; i < 17; i++)
{
DataWatcher.a(i, new Vector3f(0, 0, 0));
}
DataWatcher.a(11, new Vector3f(0, 0, 0), EntityArmorStand.META_HEAD_POSE, new Vector3f(0, 0, 0));
DataWatcher.a(12, new Vector3f(0, 0, 0), EntityArmorStand.META_BODY_POSE, new Vector3f(0, 0, 0));
DataWatcher.a(13, new Vector3f(0, 0, 0), EntityArmorStand.META_LEFT_ARM_POSE, new Vector3f(0, 0, 0));
DataWatcher.a(14, new Vector3f(0, 0, 0), EntityArmorStand.META_RIGHT_ARM_POSE, new Vector3f(0, 0, 0));
DataWatcher.a(15, new Vector3f(0, 0, 0), EntityArmorStand.META_LEFT_LEG_POSE, new Vector3f(0, 0, 0));
DataWatcher.a(16, new Vector3f(0, 0, 0), EntityArmorStand.META_RIGHT_LEG_POSE, new Vector3f(0, 0, 0));
// Rotations are from -360 to 360
}
@ -55,6 +58,7 @@ public class DisguiseArmorStand extends DisguiseInsentient
packet.i = (byte) ((int) (Entity.yaw * 256.0F / 360.0F));
packet.j = (byte) ((int) (Entity.pitch * 256.0F / 360.0F));
packet.k = (byte) ((int) (Entity.yaw * 256.0F / 360.0F));
packet.uuid = Entity.getUniqueID();
double var2 = 3.9D;
double var4 = 0;
@ -103,51 +107,55 @@ public class DisguiseArmorStand extends DisguiseInsentient
public void setBodyPosition(Vector vector)
{
DataWatcher.watch(12, convert(vector));
DataWatcher.watch(12, convert(vector), EntityArmorStand.META_BODY_POSE, convert(vector));
}
public void setHasArms()
{
DataWatcher.watch(10, (byte) DataWatcher.getByte(10) | 4);
DataWatcher.watch(10, (byte) (DataWatcher.getByte(10) | 4), EntityArmorStand.META_ARMOR_OPTION,
(byte) (DataWatcher.getByte(10) | 4));
}
public void setHeadPosition(Vector vector)
{
DataWatcher.watch(11, convert(vector));
DataWatcher.watch(11, convert(vector), EntityArmorStand.META_HEAD_POSE, convert(vector));
}
public void setLeftArmPosition(Vector vector)
{
DataWatcher.watch(13, convert(vector));
DataWatcher.watch(13, convert(vector), EntityArmorStand.META_LEFT_ARM_POSE, convert(vector));
}
public void setLeftLegPosition(Vector vector)
{
DataWatcher.watch(15, convert(vector));
DataWatcher.watch(15, convert(vector), EntityArmorStand.META_LEFT_LEG_POSE, convert(vector));
}
public void setRemoveBase()
{
DataWatcher.watch(10, (byte) DataWatcher.getByte(10) | 8);
DataWatcher.watch(10, (byte) (DataWatcher.getByte(10) | 8), EntityArmorStand.META_ARMOR_OPTION,
(byte) (DataWatcher.getByte(10) | 8));
}
public void setRightArmPosition(Vector vector)
{
DataWatcher.watch(14, convert(vector));
DataWatcher.watch(14, convert(vector), EntityArmorStand.META_RIGHT_ARM_POSE, convert(vector));
}
public void setRightLegPosition(Vector vector)
{
DataWatcher.watch(16, convert(vector));
DataWatcher.watch(16, convert(vector), EntityArmorStand.META_RIGHT_LEG_POSE, convert(vector));
}
public void setSmall()
{
DataWatcher.watch(10, (byte) DataWatcher.getByte(10) | 1);
DataWatcher.watch(10, (byte) (DataWatcher.getByte(10) | 1), EntityArmorStand.META_ARMOR_OPTION,
(byte) (DataWatcher.getByte(10) | 1));
}
public void setGravityEffected()
{
DataWatcher.watch(10, (byte) DataWatcher.getByte(10) | 2);
DataWatcher.watch(10, (byte) (DataWatcher.getByte(10) | 2), EntityArmorStand.META_ARMOR_OPTION,
(byte) (DataWatcher.getByte(10) | 2));
}
}

View File

@ -31,10 +31,10 @@ public abstract class DisguiseBase
}
DataWatcher = new DataWatcher(new DummyEntity(null));
DataWatcher.a(0, Byte.valueOf((byte)0));
DataWatcher.a(1, Short.valueOf((short)300));
DataWatcher.a(0, Byte.valueOf((byte) 0), Entity.META_ENTITYDATA, (byte) 0);
DataWatcher.a(1, Short.valueOf((short) 300), Entity.META_AIR, 300);
_soundDisguise = this;
}
@ -45,8 +45,8 @@ public abstract class DisguiseBase
public void UpdateDataWatcher()
{
DataWatcher.watch(0, Entity.getDataWatcher().getByte(0));
DataWatcher.watch(1, Entity.getDataWatcher().getShort(1));
DataWatcher.watch(0, Entity.getDataWatcher().getByte(0), Entity.META_ENTITYDATA, Entity.getDataWatcher().getByte(0));
DataWatcher.watch(1, Entity.getDataWatcher().getShort(1), Entity.META_AIR, (int) Entity.getDataWatcher().getShort(1));
}
public abstract Packet GetSpawnPacket();

View File

@ -1,30 +1,32 @@
package mineplex.core.disguise.disguises;
import net.minecraft.server.v1_8_R3.EntityBat;
import org.bukkit.entity.*;
public class DisguiseBat extends DisguiseAnimal
public class DisguiseBat extends DisguiseCreature
{
public DisguiseBat(org.bukkit.entity.Entity entity)
{
super(EntityType.BAT, entity);
DataWatcher.a(16, new Byte((byte)0));
DataWatcher.a(16, new Byte((byte) 0), EntityBat.META_UPSIDEDOWN, (byte) 0);
}
public boolean isSitting()
public boolean isSitting()
{
return (DataWatcher.getByte(16) & 0x1) != 0;
}
public void setSitting(boolean paramBoolean)
public void setSitting(boolean paramBoolean)
{
int i = DataWatcher.getByte(16);
if (paramBoolean)
DataWatcher.watch(16, Byte.valueOf((byte)(i | 0x1)));
DataWatcher.watch(16, Byte.valueOf((byte) (i | 0x1)), EntityBat.META_UPSIDEDOWN, (byte) (i | 0x1));
else
DataWatcher.watch(16, Byte.valueOf((byte)(i & 0xFFFFFFFE)));
DataWatcher.watch(16, Byte.valueOf((byte) (i & 0xFFFFFFFE)), EntityBat.META_UPSIDEDOWN, (byte) (i & 0xFFFFFFFE));
}
public String getHurtSound()
{
return "mob.bat.hurt";

View File

@ -1,5 +1,7 @@
package mineplex.core.disguise.disguises;
import net.minecraft.server.v1_8_R3.EntityBlaze;
import org.bukkit.entity.*;
public class DisguiseBlaze extends DisguiseMonster
@ -7,27 +9,27 @@ public class DisguiseBlaze extends DisguiseMonster
public DisguiseBlaze(org.bukkit.entity.Entity entity)
{
super(EntityType.BLAZE, entity);
DataWatcher.a(16, new Byte((byte)0));
DataWatcher.a(16, new Byte((byte) 0), EntityBlaze.META_FIRE, (byte) 0);
}
public boolean bT()
{
return (DataWatcher.getByte(16) & 0x01) != 0;
}
public void a(boolean flag)
{
byte b0 = DataWatcher.getByte(16);
if (flag)
b0 = (byte)(b0 | 0x1);
b0 = (byte) (b0 | 0x1);
else
b0 = (byte)(b0 | 0xFFFFFFFE);
DataWatcher.watch(16, Byte.valueOf(b0));
b0 = (byte) (b0 | 0xFFFFFFFE);
DataWatcher.watch(16, Byte.valueOf(b0), EntityBlaze.META_FIRE, b0);
}
public String getHurtSound()
{
return "mob.blaze.hit";

View File

@ -9,26 +9,26 @@ import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntity;
public class DisguiseBlock extends DisguiseBase
{
private static Random _random = new Random();
private int _blockId;
private int _blockData;
public DisguiseBlock(org.bukkit.entity.Entity entity, int blockId, int blockData)
{
super(entity);
_blockId = blockId;
_blockData = blockData;
}
public int GetBlockId()
{
return _blockId;
}
public byte GetBlockData()
{
return (byte)_blockData;
return (byte) _blockData;
}
@Override
@ -43,38 +43,45 @@ public class DisguiseBlock extends DisguiseBase
packet.i = MathHelper.d(Entity.yaw * 256.0F / 360.0F);
packet.j = 70;
packet.k = _blockId | _blockData << 12;
packet.uuid = Entity.getUniqueID();
double d1 = Entity.motX;
double d2 = Entity.motY;
double d3 = Entity.motZ;
double d4 = 3.9D;
if (d1 < -d4) d1 = -d4;
if (d2 < -d4) d2 = -d4;
if (d3 < -d4) d3 = -d4;
if (d1 > d4) d1 = d4;
if (d2 > d4) d2 = d4;
if (d3 > d4) d3 = d4;
packet.e = ((int)(d1 * 8000.0D));
packet.f = ((int)(d2 * 8000.0D));
packet.g = ((int)(d3 * 8000.0D));
if (d1 < -d4)
d1 = -d4;
if (d2 < -d4)
d2 = -d4;
if (d3 < -d4)
d3 = -d4;
if (d1 > d4)
d1 = d4;
if (d2 > d4)
d2 = d4;
if (d3 > d4)
d3 = d4;
packet.e = ((int) (d1 * 8000.0D));
packet.f = ((int) (d2 * 8000.0D));
packet.g = ((int) (d3 * 8000.0D));
return packet;
}
protected String getHurtSound()
{
return "damage.hit";
}
protected float getVolume()
{
return 1.0F;
}
protected String getHurtSound()
{
return "damage.hit";
}
protected float getPitch()
{
return (_random.nextFloat() - _random.nextFloat()) * 0.2F + 1.0F;
}
protected float getVolume()
{
return 1.0F;
}
protected float getPitch()
{
return (_random.nextFloat() - _random.nextFloat()) * 0.2F + 1.0F;
}
}

View File

@ -1,5 +1,7 @@
package mineplex.core.disguise.disguises;
import net.minecraft.server.v1_8_R3.EntityOcelot;
import org.bukkit.entity.*;
public class DisguiseCat extends DisguiseTameableAnimal
@ -8,21 +10,21 @@ public class DisguiseCat extends DisguiseTameableAnimal
{
super(EntityType.OCELOT, entity);
DataWatcher.a(18, Byte.valueOf((byte)0));
DataWatcher.a(18, Byte.valueOf((byte) 0), EntityOcelot.META_TYPE, 0);
}
public int getCatType()
{
return DataWatcher.getByte(18);
}
public void setCatType(int i)
public void setCatType(int i)
{
DataWatcher.watch(18, Byte.valueOf((byte)i));
DataWatcher.watch(18, Byte.valueOf((byte) i), EntityOcelot.META_TYPE, i);
}
protected String getHurtSound()
{
return "mob.cat.hitt";
}
protected String getHurtSound()
{
return "mob.cat.hitt";
}
}

View File

@ -2,6 +2,8 @@ package mineplex.core.disguise.disguises;
import org.bukkit.entity.EntityType;
import net.minecraft.server.v1_8_R3.EntitySpider;
public class DisguiseCaveSpider extends DisguiseMonster
{
@ -9,7 +11,7 @@ public class DisguiseCaveSpider extends DisguiseMonster
{
super(EntityType.CAVE_SPIDER, entity);
DataWatcher.a(16, new Byte((byte) 0));
DataWatcher.a(16, new Byte((byte) 0), EntitySpider.META_CLIMBING, (byte) 0);
}
public boolean bT()
@ -26,7 +28,7 @@ public class DisguiseCaveSpider extends DisguiseMonster
else
b0 = (byte) (b0 & 0xFFFFFFFE);
DataWatcher.watch(16, Byte.valueOf(b0));
DataWatcher.watch(16, Byte.valueOf(b0), EntitySpider.META_CLIMBING, b0);
}
protected String getHurtSound()

View File

@ -33,6 +33,7 @@ public abstract class DisguiseCreature extends DisguiseInsentient
packet.i = (byte) ((int) (Entity.yaw * 256.0F / 360.0F));
packet.j = (byte) ((int) (Entity.pitch * 256.0F / 360.0F));
packet.k = (byte) ((int) (Entity.yaw * 256.0F / 360.0F));
packet.uuid = Entity.getUniqueID();
double var2 = 3.9D;
double var4 = 0;

View File

@ -1,5 +1,7 @@
package mineplex.core.disguise.disguises;
import net.minecraft.server.v1_8_R3.EntityCreeper;
import org.bukkit.entity.*;
public class DisguiseCreeper extends DisguiseMonster
@ -7,33 +9,33 @@ public class DisguiseCreeper extends DisguiseMonster
public DisguiseCreeper(org.bukkit.entity.Entity entity)
{
super(EntityType.CREEPER, entity);
DataWatcher.a(16, Byte.valueOf((byte)-1));
DataWatcher.a(17, Byte.valueOf((byte)0));
DataWatcher.a(16, Byte.valueOf((byte) -1), EntityCreeper.META_FUSE_STATE, -1);
DataWatcher.a(17, Byte.valueOf((byte) 0), EntityCreeper.META_POWERED, false);
}
public boolean IsPowered()
{
return DataWatcher.getByte(17) == 1;
}
public void SetPowered(boolean powered)
{
DataWatcher.watch(17, Byte.valueOf((byte)(powered ? 1 : 0)));
DataWatcher.watch(17, Byte.valueOf((byte) (powered ? 1 : 0)), EntityCreeper.META_POWERED, powered);
}
public int bV()
{
return DataWatcher.getByte(16);
}
public void a(int i)
{
DataWatcher.watch(16, Byte.valueOf((byte)i));
DataWatcher.watch(16, Byte.valueOf((byte) i), EntityCreeper.META_FUSE_STATE, i);
}
protected String getHurtSound()
{
return "mob.creeper.say";
}
protected String getHurtSound()
{
return "mob.creeper.say";
}
}

View File

@ -2,50 +2,71 @@ package mineplex.core.disguise.disguises;
import java.util.Arrays;
import net.minecraft.server.v1_8_R3.Block;
import net.minecraft.server.v1_8_R3.Blocks;
import net.minecraft.server.v1_8_R3.EntityEnderman;
import net.minecraft.server.v1_8_R3.EntityLiving;
import net.minecraft.server.v1_8_R3.IBlockData;
import net.minecraft.server.v1_8_R3.MobEffect;
import net.minecraft.server.v1_8_R3.MobEffectList;
import net.minecraft.server.v1_8_R3.PotionBrewer;
import org.bukkit.entity.*;
import com.google.common.base.Optional;
public class DisguiseEnderman extends DisguiseMonster
{
public DisguiseEnderman(org.bukkit.entity.Entity entity)
{
super(EntityType.ENDERMAN, entity);
DataWatcher.a(16, new Short( (short) 0));
DataWatcher.a(17, new Byte( (byte) 0));
DataWatcher.a(18, new Byte( (byte) 0));
int i = PotionBrewer.a(Arrays.asList(new MobEffect(MobEffectList.FIRE_RESISTANCE.id, 777)));
DataWatcher.watch(8, Byte.valueOf((byte)(PotionBrewer.b(Arrays.asList(new MobEffect(MobEffectList.FIRE_RESISTANCE.id, 777))) ? 1 : 0)));
DataWatcher.watch(7, Integer.valueOf(i));
DataWatcher.a(16, new Short((short) 0), EntityEnderman.META_BLOCK, Optional.<IBlockData> absent());
DataWatcher.a(17, new Byte((byte) 0), EntityEnderman.META_BLOCK, Optional.<IBlockData> absent());
DataWatcher.a(18, new Byte((byte) 0), EntityEnderman.META_ANGRY, false);
int i = PotionBrewer.a(Arrays.asList(new MobEffect(MobEffectList.FIRE_RESISTANCE.id, 777)));
DataWatcher.watch(8, Byte.valueOf((byte) (PotionBrewer.b(Arrays.asList(new MobEffect(MobEffectList.FIRE_RESISTANCE.id,
777))) ? 1 : 0)), EntityLiving.META_AMBIENT_POTION, PotionBrewer.b(Arrays.asList(new MobEffect(
MobEffectList.FIRE_RESISTANCE.id, 777))));
DataWatcher.watch(7, Integer.valueOf(i), EntityLiving.META_POTION_COLOR, i);
}
public void UpdateDataWatcher()
{
super.UpdateDataWatcher();
DataWatcher.watch(0, Byte.valueOf((byte)(DataWatcher.getByte(0) & ~(1 << 0))));
DataWatcher.watch(16, DataWatcher.getShort(16));
DataWatcher.watch(0, Byte.valueOf((byte) (DataWatcher.getByte(0) & ~(1 << 0))), Entity.META_ENTITYDATA,
(byte) (DataWatcher.getByte(0) & ~(1 << 0)));
DataWatcher.watch(16, DataWatcher.getShort(16), EntityEnderman.META_BLOCK, getBlock(DataWatcher.getShort(16)));
}
private Optional<IBlockData> getBlock(int i)
{
Block b = Block.getById(i);
if (b != null && b != Blocks.AIR)
{
return Optional.fromNullable(b.getBlockData());
}
return Optional.fromNullable(null);
}
public void SetCarriedId(int i)
{
DataWatcher.watch(16, new Short( (short)(i & 0xFF)) );
DataWatcher.watch(16, new Short((short) (i & 0xFF)), EntityEnderman.META_BLOCK, getBlock(i));
}
public int GetCarriedId()
{
return DataWatcher.getByte(16);
}
public void SetCarriedData(int i)
{
DataWatcher.watch(17, Byte.valueOf((byte)(i & 0xFF)));
DataWatcher.watch(17, Byte.valueOf((byte) (i & 0xFF)), EntityEnderman.META_BLOCK, getBlock(0));
}
public int GetCarriedData()
{
return DataWatcher.getByte(17);
@ -55,14 +76,14 @@ public class DisguiseEnderman extends DisguiseMonster
{
return DataWatcher.getByte(18) > 0;
}
public void a(boolean flag)
{
DataWatcher.watch(18, Byte.valueOf((byte)(flag ? 1 : 0)));
DataWatcher.watch(18, Byte.valueOf((byte) (flag ? 1 : 0)), EntityEnderman.META_ANGRY, flag);
}
protected String getHurtSound()
{
return "mob.endermen.hit";
}
protected String getHurtSound()
{
return "mob.endermen.hit";
}
}

View File

@ -2,23 +2,25 @@ package mineplex.core.disguise.disguises;
import org.bukkit.entity.*;
import net.minecraft.server.v1_8_R3.EntityGuardian;
public class DisguiseGuardian extends DisguiseCreature
{
public DisguiseGuardian(org.bukkit.entity.Entity entity)
{
super(EntityType.GUARDIAN, entity);
DataWatcher.a(16, 0);
DataWatcher.a(17, 0);
DataWatcher.a(16, 0, EntityGuardian.META_ELDER, (byte) 0);
DataWatcher.a(17, 0, EntityGuardian.META_TARGET, 0);
}
public void setTarget(int target)
{
DataWatcher.watch(17, target);
DataWatcher.watch(17, target, EntityGuardian.META_TARGET, target);
}
public void setElder(boolean elder)
{
DataWatcher.watch(16, Integer.valueOf(DataWatcher.getInt(16) | 4));
DataWatcher.watch(16, Integer.valueOf(DataWatcher.getInt(16) | 4), EntityGuardian.META_ELDER, (byte) (DataWatcher.getInt(16) | 4));
}
public boolean isElder()

View File

@ -1,23 +1,29 @@
package mineplex.core.disguise.disguises;
import java.util.UUID;
import net.minecraft.server.v1_8_R3.EntityHorse;
import org.bukkit.entity.*;
import com.google.common.base.Optional;
public class DisguiseHorse extends DisguiseAnimal
{
public DisguiseHorse(org.bukkit.entity.Entity entity)
{
super(EntityType.HORSE, entity);
DataWatcher.a(16, Integer.valueOf(0));
DataWatcher.a(19, Byte.valueOf((byte) 0));
DataWatcher.a(20, Integer.valueOf(0));
DataWatcher.a(21, String.valueOf(""));
DataWatcher.a(22, Integer.valueOf(0));
DataWatcher.a(16, Integer.valueOf(0), EntityHorse.META_HORSE_STATE, (byte) 0);
DataWatcher.a(19, Byte.valueOf((byte) 0), EntityHorse.META_TYPE, 0);
DataWatcher.a(20, Integer.valueOf(0), EntityHorse.META_VARIANT, 0);
DataWatcher.a(21, String.valueOf(""), EntityHorse.META_OWNER, Optional.<UUID> absent());
DataWatcher.a(22, Integer.valueOf(0), EntityHorse.META_ARMOR, 0);
}
public void setType(Horse.Variant horseType)
{
DataWatcher.watch(19, Byte.valueOf((byte) horseType.ordinal()));
DataWatcher.watch(19, Byte.valueOf((byte) horseType.ordinal()), EntityHorse.META_TYPE, horseType.ordinal());
}
public Horse.Variant getType()
@ -27,7 +33,7 @@ public class DisguiseHorse extends DisguiseAnimal
public void setVariant(Horse.Color color)
{
DataWatcher.watch(20, Integer.valueOf(color.ordinal()));
DataWatcher.watch(20, Integer.valueOf(color.ordinal()), EntityHorse.META_VARIANT, color.ordinal());
}
public Horse.Color getVariant()
@ -35,49 +41,35 @@ public class DisguiseHorse extends DisguiseAnimal
return Horse.Color.values()[DataWatcher.getInt(20)];
}
private boolean w(int i)
{
return (DataWatcher.getInt(16) & i) != 0;
}
public void kick()
{
b(32, false);
b(64, true);
b(32, false);
b(64, true);
}
public void stopKick()
{
b(64, false);
b(64, false);
}
private void b(int i, boolean flag)
{
int j = DataWatcher.getInt(16);
if (flag)
DataWatcher.watch(16, Integer.valueOf(j | i));
DataWatcher.watch(16, Integer.valueOf(j | i), EntityHorse.META_HORSE_STATE, (byte) (j | i));
else
DataWatcher.watch(16, Integer.valueOf(j & (i ^ 0xFFFFFFFF)));
DataWatcher.watch(16, Integer.valueOf(j & (i ^ 0xFFFFFFFF)), EntityHorse.META_HORSE_STATE,
(byte) (j & (i ^ 0xFFFFFFFF)));
}
public String getOwnerName()
{
return DataWatcher.getString(21);
}
public void setOwnerName(String s)
{
DataWatcher.watch(21, s);
}
public int cf()
public int getArmor()
{
return DataWatcher.getInt(22);
}
public void r(int i)
public void setArmor(int i)
{
DataWatcher.watch(22, Integer.valueOf(i));
DataWatcher.watch(22, Integer.valueOf(i), EntityHorse.META_ARMOR, i);
}
}

View File

@ -1,14 +1,16 @@
package mineplex.core.disguise.disguises;
import net.minecraft.server.v1_8_R3.EntityHuman;
public abstract class DisguiseHuman extends DisguiseLiving
{
public DisguiseHuman(org.bukkit.entity.Entity entity)
{
super(entity);
DataWatcher.a(10, (byte) 0); // todo
DataWatcher.a(16, (byte) 0);
DataWatcher.a(17, Float.valueOf(0.0F));
DataWatcher.a(18, Integer.valueOf(0));
DataWatcher.a(10, (byte) 0, EntityHuman.META_SKIN, (byte) 0); // todo
DataWatcher.a(16, (byte) 1, EntityHuman.META_CAPE, (byte) 1);
DataWatcher.a(17, Float.valueOf(0.0F), EntityHuman.META_SCALED_HEALTH, 0f);
DataWatcher.a(18, Integer.valueOf(0), EntityHuman.META_SCORE, 0);
}
}

View File

@ -1,25 +1,27 @@
package mineplex.core.disguise.disguises;
import mineplex.core.common.*;
import net.minecraft.server.v1_8_R3.EntityInsentient;
import org.bukkit.*;
public abstract class DisguiseInsentient extends DisguiseLiving
{
private boolean _showArmor;
private boolean _showArmor;
public DisguiseInsentient(org.bukkit.entity.Entity entity)
{
super(entity);
DataWatcher.a(3, Byte.valueOf((byte) 0));
DataWatcher.a(2, "");
DataWatcher.a(3, Byte.valueOf((byte) 0), EntityInsentient.META_CUSTOMNAME_VISIBLE, false);
DataWatcher.a(2, "", EntityInsentient.META_CUSTOMNAME, "");
}
public void setName(String name)
{
setName(name, null);
}
public void setName(String name, Rank rank)
{
if (rank != null)
@ -30,35 +32,34 @@ public abstract class DisguiseInsentient extends DisguiseLiving
}
}
DataWatcher.watch(2, name);
DataWatcher.watch(2, name, EntityInsentient.META_CUSTOMNAME, name);
}
public boolean hasCustomName()
{
return DataWatcher.getString(2).length() > 0;
}
public void setCustomNameVisible(boolean visible)
{
DataWatcher.watch(3, Byte.valueOf((byte)(visible ? 1 : 0)));
DataWatcher.watch(3, Byte.valueOf((byte) (visible ? 1 : 0)), EntityInsentient.META_CUSTOMNAME_VISIBLE, visible);
}
public boolean getCustomNameVisible()
{
return DataWatcher.getByte(11) == 1;
}
public boolean armorVisible()
{
return _showArmor;
}
public void showArmor()
{
_showArmor = true;
}
public void hideArmor()
{
_showArmor = false;

View File

@ -1,5 +1,7 @@
package mineplex.core.disguise.disguises;
import net.minecraft.server.v1_8_R3.EntityIronGolem;
import org.bukkit.entity.*;
public class DisguiseIronGolem extends DisguiseGolem
@ -8,26 +10,27 @@ public class DisguiseIronGolem extends DisguiseGolem
{
super(EntityType.IRON_GOLEM, entity);
DataWatcher.a(16, Byte.valueOf((byte)0));
}
public boolean bW()
{
return (DataWatcher.getByte(16) & 0x1) != 0;
DataWatcher.a(16, Byte.valueOf((byte) 0), EntityIronGolem.META_PLAYER_CREATED, (byte) 0);
}
public void setPlayerCreated(boolean flag)
public boolean bW()
{
return (DataWatcher.getByte(16) & 0x1) != 0;
}
public void setPlayerCreated(boolean flag)
{
byte b0 = DataWatcher.getByte(16);
if (flag)
DataWatcher.watch(16, Byte.valueOf((byte)(b0 | 0x1)));
DataWatcher.watch(16, Byte.valueOf((byte) (b0 | 0x1)), EntityIronGolem.META_PLAYER_CREATED, (byte) (b0 | 0x1));
else
DataWatcher.watch(16, Byte.valueOf((byte)(b0 & 0xFFFFFFFE)));
DataWatcher.watch(16, Byte.valueOf((byte) (b0 & 0xFFFFFFFE)), EntityIronGolem.META_PLAYER_CREATED,
(byte) (b0 & 0xFFFFFFFE));
}
protected String getHurtSound()
{
return "mob.irongolem.hit";
}
protected String getHurtSound()
{
return "mob.irongolem.hit";
}
}

View File

@ -21,10 +21,10 @@ public abstract class DisguiseLiving extends DisguiseBase
{
super(entity);
DataWatcher.a(6, Float.valueOf(1.0F));
DataWatcher.a(7, Integer.valueOf(0));
DataWatcher.a(8, Byte.valueOf((byte) 0));
DataWatcher.a(9, Byte.valueOf((byte) 0));
DataWatcher.a(6, Float.valueOf(1.0F), EntityLiving.META_HEALTH, 1F);
DataWatcher.a(7, Integer.valueOf(0), EntityLiving.META_POTION_COLOR, 0);
DataWatcher.a(8, Byte.valueOf((byte) 0), EntityLiving.META_AMBIENT_POTION, false);
DataWatcher.a(9, Byte.valueOf((byte) 0), EntityLiving.META_ARROWS, 0);
}
public ItemStack[] getEquipment()
@ -106,16 +106,20 @@ public abstract class DisguiseLiving extends DisguiseBase
byte b0 = DataWatcher.getByte(0);
if (_invisible)
DataWatcher.watch(0, Byte.valueOf((byte) (b0 | 1 << 5)));
DataWatcher.watch(0, Byte.valueOf((byte) (b0 | 1 << 5)), EntityLiving.META_ENTITYDATA, (byte) (b0 | 1 << 5));
else
DataWatcher.watch(0, Byte.valueOf((byte) (b0 & ~(1 << 5))));
DataWatcher.watch(0, Byte.valueOf((byte) (b0 & ~(1 << 5))), EntityLiving.META_ENTITYDATA, (byte) (b0 & ~(1 << 5)));
if (Entity instanceof EntityLiving)
{
DataWatcher.watch(6, Entity.getDataWatcher().getFloat(6));
DataWatcher.watch(7, Entity.getDataWatcher().getInt(7));
DataWatcher.watch(8, Entity.getDataWatcher().getByte(8));
DataWatcher.watch(9, Entity.getDataWatcher().getByte(9));
DataWatcher.watch(6, Entity.getDataWatcher().getFloat(6), EntityLiving.META_HEALTH,
Entity.getDataWatcher().getFloat(6));
DataWatcher.watch(7, Entity.getDataWatcher().getInt(7), EntityLiving.META_POTION_COLOR, Entity.getDataWatcher()
.getInt(7));
DataWatcher.watch(8, Entity.getDataWatcher().getByte(8), EntityLiving.META_AMBIENT_POTION, Entity.getDataWatcher()
.getByte(8) == 1);
DataWatcher.watch(9, Entity.getDataWatcher().getByte(9), EntityLiving.META_ARROWS, (int) Entity.getDataWatcher()
.getByte(9));
}
}
@ -146,7 +150,7 @@ public abstract class DisguiseLiving extends DisguiseBase
public void setHealth(float health)
{
DataWatcher.watch(6, Float.valueOf(health));
DataWatcher.watch(6, Float.valueOf(health), EntityLiving.META_HEALTH, health);
}
public float getHealth()

View File

@ -1,5 +1,6 @@
package mineplex.core.disguise.disguises;
import net.minecraft.server.v1_8_R3.EntitySlime;
import net.minecraft.server.v1_8_R3.MathHelper;
import net.minecraft.server.v1_8_R3.Packet;
import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving;
@ -10,14 +11,14 @@ public class DisguiseMagmaCube extends DisguiseInsentient
{
super(entity);
DataWatcher.a(16, new Byte((byte)1));
DataWatcher.a(16, new Byte((byte) 1), EntitySlime.META_SIZE, 1);
}
public void SetSize(int i)
{
DataWatcher.watch(16, new Byte((byte)i));
DataWatcher.watch(16, new Byte((byte) i), EntitySlime.META_SIZE, i);
}
public int GetSize()
{
return DataWatcher.getByte(16);
@ -28,65 +29,66 @@ public class DisguiseMagmaCube extends DisguiseInsentient
PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving();
packet.a = Entity.getId();
packet.b = (byte) 62;
packet.c = (int)MathHelper.floor(Entity.locX * 32D);
packet.d = (int)MathHelper.floor(Entity.locY * 32.0D);
packet.e = (int)MathHelper.floor(Entity.locZ * 32D);
packet.c = (int) MathHelper.floor(Entity.locX * 32D);
packet.d = (int) MathHelper.floor(Entity.locY * 32.0D);
packet.e = (int) MathHelper.floor(Entity.locZ * 32D);
packet.i = (byte) ((int) (Entity.yaw * 256.0F / 360.0F));
packet.j = (byte) ((int) (Entity.pitch * 256.0F / 360.0F));
packet.k = (byte) ((int) (Entity.yaw * 256.0F / 360.0F));
packet.uuid = Entity.getUniqueID();
double var2 = 3.9D;
double var4 = 0;
double var6 = 0;
double var8 = 0;
double var2 = 3.9D;
double var4 = 0;
double var6 = 0;
double var8 = 0;
if (var4 < -var2)
{
var4 = -var2;
}
if (var4 < -var2)
{
var4 = -var2;
}
if (var6 < -var2)
{
var6 = -var2;
}
if (var6 < -var2)
{
var6 = -var2;
}
if (var8 < -var2)
{
var8 = -var2;
}
if (var8 < -var2)
{
var8 = -var2;
}
if (var4 > var2)
{
var4 = var2;
}
if (var4 > var2)
{
var4 = var2;
}
if (var6 > var2)
{
var6 = var2;
}
if (var6 > var2)
{
var6 = var2;
}
if (var8 > var2)
{
var8 = var2;
}
if (var8 > var2)
{
var8 = var2;
}
packet.f = (int) (var4 * 8000.0D);
packet.g = (int) (var6 * 8000.0D);
packet.h = (int) (var8 * 8000.0D);
packet.l = DataWatcher;
packet.m = DataWatcher.b();
packet.f = (int)(var4 * 8000.0D);
packet.g = (int)(var6 * 8000.0D);
packet.h = (int)(var8 * 8000.0D);
packet.l = DataWatcher;
packet.m = DataWatcher.b();
return packet;
}
protected String getHurtSound()
{
return "mob.slime." + (GetSize() > 1 ? "big" : "small");
}
protected float getVolume()
{
return 0.4F * (float)GetSize();
}
protected String getHurtSound()
{
return "mob.slime." + (GetSize() > 1 ? "big" : "small");
}
protected float getVolume()
{
return 0.4F * (float) GetSize();
}
}

View File

@ -8,6 +8,7 @@ import org.bukkit.block.BlockFace;
import com.mojang.authlib.GameProfile;
import mineplex.core.common.skin.SkinData;
import net.minecraft.server.v1_8_R3.EntityHuman;
import net.minecraft.server.v1_8_R3.MathHelper;
import net.minecraft.server.v1_8_R3.Packet;
import net.minecraft.server.v1_8_R3.PacketPlayOutNamedEntitySpawn;
@ -17,31 +18,31 @@ import net.minecraft.server.v1_8_R3.WorldSettings;
public class DisguisePlayer extends DisguiseHuman
{
private GameProfile _profile;
private boolean _sneaking;
private BlockFace _sleeping;
private GameProfile _profile;
private boolean _sneaking;
private BlockFace _sleeping;
private boolean _sendSkinToSelf;
public DisguisePlayer(org.bukkit.entity.Entity entity)
{
super(entity);
}
public DisguisePlayer(org.bukkit.entity.Entity entity)
{
super(entity);
}
public DisguisePlayer(org.bukkit.entity.Entity entity, GameProfile profile)
{
this(entity);
public DisguisePlayer(org.bukkit.entity.Entity entity, GameProfile profile)
{
this(entity);
setProfile(profile);
}
setProfile(profile);
}
public void setProfile(GameProfile profile)
{
GameProfile newProfile = new GameProfile(UUID.randomUUID(), profile.getName());
public void setProfile(GameProfile profile)
{
GameProfile newProfile = new GameProfile(UUID.randomUUID(), profile.getName());
newProfile.getProperties().putAll(profile.getProperties());
newProfile.getProperties().putAll(profile.getProperties());
_profile = newProfile;
}
_profile = newProfile;
}
public GameProfile getProfile()
{
@ -66,28 +67,28 @@ public class DisguisePlayer extends DisguiseHuman
return _sendSkinToSelf;
}
public BlockFace getSleepingDirection()
{
return _sleeping;
}
public BlockFace getSleepingDirection()
{
return _sleeping;
}
/**
* Don't use this if the disguise is already on as it will not work the way
* you want it to. Contact libraryaddict if you need that added.
*/
public void setSleeping(BlockFace sleeping)
{
_sleeping = sleeping;
}
/**
* Don't use this if the disguise is already on as it will not work the way you want it to. Contact libraryaddict if you need
* that added.
*/
public void setSleeping(BlockFace sleeping)
{
_sleeping = sleeping;
}
public void setSneaking(boolean sneaking)
{
_sneaking = sneaking;
}
public boolean getSneaking()
{
return _sneaking;
public void setSneaking(boolean sneaking)
{
_sneaking = sneaking;
}
public boolean getSneaking()
{
return _sneaking;
}
public Packet getNewInfoPacket(boolean add)
@ -103,56 +104,55 @@ public class DisguisePlayer extends DisguiseHuman
return newDisguiseInfo;
}
@Override
public void UpdateDataWatcher()
{
super.UpdateDataWatcher();
@Override
public void UpdateDataWatcher()
{
super.UpdateDataWatcher();
byte b0 = DataWatcher.getByte(0);
DataWatcher.watch(10, (Object)(byte)0x40);
if(_sneaking)
DataWatcher.watch(0, Byte.valueOf((byte) (b0 | 1 << 1)));
else
DataWatcher.watch(0, Byte.valueOf((byte) (b0 & ~(1 << 1))));
}
byte b0 = DataWatcher.getByte(0);
public PacketPlayOutNamedEntitySpawn spawnBeforePlayer(Location spawnLocation)
{
Location loc = spawnLocation.add(spawnLocation.getDirection().normalize().multiply(30));
loc.setY(Math.max(loc.getY(), 0));
if (_sneaking)
DataWatcher.watch(0, Byte.valueOf((byte) (b0 | 1 << 1)), EntityHuman.META_ENTITYDATA, (byte) (b0 | 1 << 1));
else
DataWatcher.watch(0, Byte.valueOf((byte) (b0 & ~(1 << 1))), EntityHuman.META_ENTITYDATA, (byte) (b0 & ~(1 << 1)));
}
PacketPlayOutNamedEntitySpawn packet = new PacketPlayOutNamedEntitySpawn();
packet.a = Entity.getId();
packet.b = _profile.getId();
packet.c = MathHelper.floor(loc.getX() * 32.0D);
packet.d = MathHelper.floor(loc.getY() * 32.0D);
packet.e = MathHelper.floor(loc.getZ() * 32.0D);
packet.f = (byte) ((int) (loc.getYaw() * 256.0F / 360.0F));
packet.g = (byte) ((int) (loc.getPitch() * 256.0F / 360.0F));
packet.i = DataWatcher;
public PacketPlayOutNamedEntitySpawn spawnBeforePlayer(Location spawnLocation)
{
Location loc = spawnLocation.add(spawnLocation.getDirection().normalize().multiply(30));
loc.setY(Math.max(loc.getY(), 0));
return packet;
}
PacketPlayOutNamedEntitySpawn packet = new PacketPlayOutNamedEntitySpawn();
packet.a = Entity.getId();
packet.b = _profile.getId();
packet.c = MathHelper.floor(loc.getX() * 32.0D);
packet.d = MathHelper.floor(loc.getY() * 32.0D);
packet.e = MathHelper.floor(loc.getZ() * 32.0D);
packet.f = (byte) ((int) (loc.getYaw() * 256.0F / 360.0F));
packet.g = (byte) ((int) (loc.getPitch() * 256.0F / 360.0F));
packet.i = DataWatcher;
@Override
public PacketPlayOutNamedEntitySpawn GetSpawnPacket()
{
PacketPlayOutNamedEntitySpawn packet = new PacketPlayOutNamedEntitySpawn();
packet.a = Entity.getId();
packet.b = _profile.getId();
packet.c = MathHelper.floor(Entity.locX * 32.0D);
packet.d = MathHelper.floor(Entity.locY * 32.0D);
packet.e = MathHelper.floor(Entity.locZ * 32.0D);
packet.f = (byte) ((int) (Entity.yaw * 256.0F / 360.0F));
packet.g = (byte) ((int) (Entity.pitch * 256.0F / 360.0F));
packet.i = DataWatcher;
return packet;
}
return packet;
}
@Override
public PacketPlayOutNamedEntitySpawn GetSpawnPacket()
{
PacketPlayOutNamedEntitySpawn packet = new PacketPlayOutNamedEntitySpawn();
packet.a = Entity.getId();
packet.b = _profile.getId();
packet.c = MathHelper.floor(Entity.locX * 32.0D);
packet.d = MathHelper.floor(Entity.locY * 32.0D);
packet.e = MathHelper.floor(Entity.locZ * 32.0D);
packet.f = (byte) ((int) (Entity.yaw * 256.0F / 360.0F));
packet.g = (byte) ((int) (Entity.pitch * 256.0F / 360.0F));
packet.i = DataWatcher;
public String getName()
{
return _profile.getName();
}
return packet;
}
public String getName()
{
return _profile.getName();
}
}

View File

@ -1,21 +1,20 @@
package mineplex.core.disguise.disguises;
import org.bukkit.entity.EntityType;
import net.minecraft.server.v1_8_R3.EntityRabbit;
import net.minecraft.server.v1_8_R3.MathHelper;
import net.minecraft.server.v1_8_R3.Packet;
import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving;
public class DisguiseRabbit extends DisguiseInsentient
public class DisguiseRabbit extends DisguiseAnimal
{
public DisguiseRabbit(org.bukkit.entity.Entity entity)
{
super(entity);
super(EntityType.RABBIT, entity);
DataWatcher.a(4, Byte.valueOf((byte) 0));
DataWatcher.a(12, (byte) 0);
DataWatcher.a(15, Byte.valueOf((byte) 0));
DataWatcher.a(18, Byte.valueOf((byte) 0));
DataWatcher.a(18, Byte.valueOf((byte) 0), EntityRabbit.META_TYPE, 0);
}
@Override
@ -30,6 +29,7 @@ public class DisguiseRabbit extends DisguiseInsentient
packet.i = (byte) ((int) (Entity.yaw * 256.0F / 360.0F));
packet.j = (byte) ((int) (Entity.pitch * 256.0F / 360.0F));
packet.k = (byte) ((int) (Entity.yaw * 256.0F / 360.0F));
packet.uuid = Entity.getUniqueID();
double var2 = 3.9D;
double var4 = 0;

View File

@ -1,5 +1,7 @@
package mineplex.core.disguise.disguises;
import net.minecraft.server.v1_8_R3.EntitySheep;
import org.bukkit.DyeColor;
import org.bukkit.entity.*;
@ -9,34 +11,35 @@ public class DisguiseSheep extends DisguiseAnimal
{
super(EntityType.SHEEP, entity);
DataWatcher.a(16, new Byte((byte)0));
DataWatcher.a(16, new Byte((byte) 0), EntitySheep.META_WOOL_STATE, (byte) 0);
}
public boolean isSheared()
{
return (DataWatcher.getByte(16) & 16) != 0;
}
public void setSheared(boolean sheared)
{
byte b0 = DataWatcher.getByte(16);
byte b0 = DataWatcher.getByte(16);
if (sheared)
DataWatcher.watch(16, Byte.valueOf((byte)(b0 | 16)));
else
DataWatcher.watch(16, Byte.valueOf((byte)(b0 & -17)));
if (sheared)
DataWatcher.watch(16, Byte.valueOf((byte) (b0 | 16)), EntitySheep.META_WOOL_STATE, (byte) (b0 | 16));
else
DataWatcher.watch(16, Byte.valueOf((byte) (b0 & -17)), EntitySheep.META_WOOL_STATE, (byte) (b0 & -17));
}
public int getColor()
public int getColor()
{
return DataWatcher.getByte(16) & 15;
return DataWatcher.getByte(16) & 15;
}
@SuppressWarnings("deprecation")
public void setColor(DyeColor color)
public void setColor(DyeColor color)
{
byte b0 = DataWatcher.getByte(16);
byte b0 = DataWatcher.getByte(16);
DataWatcher.watch(16, Byte.valueOf((byte)(b0 & 240 | color.getWoolData() & 15)));
DataWatcher.watch(16, Byte.valueOf((byte) (b0 & 240 | color.getWoolData() & 15)), EntitySheep.META_WOOL_STATE,
(byte) (b0 & 240 | color.getWoolData() & 15));
}
}

View File

@ -1,5 +1,7 @@
package mineplex.core.disguise.disguises;
import net.minecraft.server.v1_8_R3.EntitySkeleton;
import org.bukkit.entity.*;
import org.bukkit.entity.Skeleton.SkeletonType;
@ -8,22 +10,22 @@ public class DisguiseSkeleton extends DisguiseMonster
public DisguiseSkeleton(org.bukkit.entity.Entity entity)
{
super(EntityType.SKELETON, entity);
DataWatcher.a(13, Byte.valueOf((byte)0));
DataWatcher.a(13, Byte.valueOf((byte) 0), EntitySkeleton.META_TYPE, 0);
}
public void SetSkeletonType(SkeletonType skeletonType)
{
DataWatcher.watch(13, Byte.valueOf((byte)skeletonType.getId()));
DataWatcher.watch(13, Byte.valueOf((byte) skeletonType.getId()), EntitySkeleton.META_TYPE, skeletonType.getId());
}
public int GetSkeletonType()
{
return DataWatcher.getByte(13);
}
protected String getHurtSound()
{
return "mob.skeleton.hurt";
}
protected String getHurtSound()
{
return "mob.skeleton.hurt";
}
}

View File

@ -1,5 +1,6 @@
package mineplex.core.disguise.disguises;
import net.minecraft.server.v1_8_R3.EntitySlime;
import net.minecraft.server.v1_8_R3.MathHelper;
import net.minecraft.server.v1_8_R3.Packet;
import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving;
@ -10,14 +11,14 @@ public class DisguiseSlime extends DisguiseInsentient
{
super(entity);
DataWatcher.a(16, new Byte((byte)1));
DataWatcher.a(16, new Byte((byte) 1), EntitySlime.META_SIZE, 1);
}
public void SetSize(int i)
{
DataWatcher.watch(16, new Byte((byte)i));
DataWatcher.watch(16, new Byte((byte) i), EntitySlime.META_SIZE, i);
}
public int GetSize()
{
return DataWatcher.getByte(16);
@ -29,63 +30,64 @@ public class DisguiseSlime extends DisguiseInsentient
packet.a = Entity.getId();
packet.b = (byte) 55;
packet.c = (int) MathHelper.floor(Entity.locX * 32D);
packet.d = (int)MathHelper.floor(Entity.locY * 32.0D);
packet.e = (int)MathHelper.floor(Entity.locZ * 32D);
packet.d = (int) MathHelper.floor(Entity.locY * 32.0D);
packet.e = (int) MathHelper.floor(Entity.locZ * 32D);
packet.i = (byte) ((int) (Entity.yaw * 256.0F / 360.0F));
packet.j = (byte) ((int) (Entity.pitch * 256.0F / 360.0F));
packet.k = (byte) ((int) (Entity.yaw * 256.0F / 360.0F));
packet.uuid = Entity.getUniqueID();
double var2 = 3.9D;
double var4 = 0;
double var6 = 0;
double var8 = 0;
double var2 = 3.9D;
double var4 = 0;
double var6 = 0;
double var8 = 0;
if (var4 < -var2)
{
var4 = -var2;
}
if (var4 < -var2)
{
var4 = -var2;
}
if (var6 < -var2)
{
var6 = -var2;
}
if (var6 < -var2)
{
var6 = -var2;
}
if (var8 < -var2)
{
var8 = -var2;
}
if (var8 < -var2)
{
var8 = -var2;
}
if (var4 > var2)
{
var4 = var2;
}
if (var4 > var2)
{
var4 = var2;
}
if (var6 > var2)
{
var6 = var2;
}
if (var6 > var2)
{
var6 = var2;
}
if (var8 > var2)
{
var8 = var2;
}
if (var8 > var2)
{
var8 = var2;
}
packet.f = (int)(var4 * 8000.0D);
packet.g = (int)(var6 * 8000.0D);
packet.h = (int)(var8 * 8000.0D);
packet.f = (int) (var4 * 8000.0D);
packet.g = (int) (var6 * 8000.0D);
packet.h = (int) (var8 * 8000.0D);
packet.l = DataWatcher;
packet.m = DataWatcher.b();
return packet;
}
protected String getHurtSound()
{
return "mob.slime." + (GetSize() > 1 ? "big" : "small");
}
protected float getVolume()
{
return 0.4F * (float)GetSize();
}
protected String getHurtSound()
{
return "mob.slime." + (GetSize() > 1 ? "big" : "small");
}
protected float getVolume()
{
return 0.4F * (float) GetSize();
}
}

View File

@ -1,5 +1,7 @@
package mineplex.core.disguise.disguises;
import net.minecraft.server.v1_8_R3.EntitySpider;
import org.bukkit.entity.*;
public class DisguiseSpider extends DisguiseMonster
@ -8,7 +10,7 @@ public class DisguiseSpider extends DisguiseMonster
{
super(EntityType.SPIDER, entity);
DataWatcher.a(16, new Byte((byte) 0));
DataWatcher.a(16, new Byte((byte) 0), EntitySpider.META_CLIMBING, (byte) 0);
}
public boolean bT()
@ -20,12 +22,12 @@ public class DisguiseSpider extends DisguiseMonster
{
byte b0 = DataWatcher.getByte(16);
if(flag)
if (flag)
b0 = (byte) (b0 | 0x1);
else
b0 = (byte) (b0 & 0xFFFFFFFE);
DataWatcher.watch(16, Byte.valueOf(b0));
DataWatcher.watch(16, Byte.valueOf(b0), EntitySpider.META_CLIMBING, b0);
}
protected String getHurtSound()

View File

@ -7,34 +7,15 @@ public class DisguiseSquid extends DisguiseMonster
public DisguiseSquid(org.bukkit.entity.Entity entity)
{
super(EntityType.SQUID, entity);
DataWatcher.a(16, new Byte((byte)0));
}
public boolean bT()
{
return (DataWatcher.getByte(16) & 0x01) != 0;
}
public void a(boolean flag)
protected String getHurtSound()
{
byte b0 = DataWatcher.getByte(16);
if (flag)
b0 = (byte)(b0 | 0x1);
else
b0 = (byte)(b0 & 0xFFFFFFFE);
DataWatcher.watch(16, Byte.valueOf(b0));
return "damage.hit";
}
protected float getVolume()
{
return 0.4F;
}
protected String getHurtSound()
{
return "damage.hit";
}
protected float getVolume()
{
return 0.4F;
}
}

View File

@ -1,54 +1,53 @@
package mineplex.core.disguise.disguises;
import java.util.UUID;
import net.minecraft.server.v1_8_R3.EntityTameableAnimal;
import org.bukkit.entity.*;
import com.google.common.base.Optional;
public abstract class DisguiseTameableAnimal extends DisguiseAnimal
{
public DisguiseTameableAnimal(EntityType disguiseType, org.bukkit.entity.Entity entity)
{
super(disguiseType, entity);
DataWatcher.a(16, Byte.valueOf((byte)0));
DataWatcher.a(17, "");
DataWatcher.a(16, Byte.valueOf((byte) 0), EntityTameableAnimal.META_SITTING_TAMED, (byte) 0);
DataWatcher.a(17, "", EntityTameableAnimal.META_OWNER, Optional.<UUID> absent());
}
public boolean isTamed()
{
return (DataWatcher.getByte(16) & 0x4) != 0;
}
public void setTamed(boolean tamed)
{
int i = DataWatcher.getByte(16);
if (tamed)
DataWatcher.watch(16, Byte.valueOf((byte)(i | 0x4)));
DataWatcher.watch(16, Byte.valueOf((byte) (i | 0x4)), EntityTameableAnimal.META_SITTING_TAMED, (byte) (i | 0x4));
else
DataWatcher.watch(16, Byte.valueOf((byte)(i | 0xFFFFFFFB)));
DataWatcher.watch(16, Byte.valueOf((byte) (i | 0xFFFFFFFB)), EntityTameableAnimal.META_SITTING_TAMED,
(byte) (i | 0xFFFFFFFB));
}
public boolean isSitting()
{
return (DataWatcher.getByte(16) & 0x1) != 0;
}
public void setSitting(boolean sitting)
{
int i = DataWatcher.getByte(16);
if (sitting)
DataWatcher.watch(16, Byte.valueOf((byte)(i | 0x1)));
DataWatcher.watch(16, Byte.valueOf((byte) (i | 0x1)), EntityTameableAnimal.META_SITTING_TAMED, (byte) (i | 0x1));
else
DataWatcher.watch(16, Byte.valueOf((byte)(i | 0xFFFFFFFE)));
}
public void setOwnerName(String name)
{
DataWatcher.watch(17, name);
}
public String getOwnerName()
{
return DataWatcher.getString(17);
DataWatcher.watch(16, Byte.valueOf((byte) (i | 0xFFFFFFFE)), EntityTameableAnimal.META_SITTING_TAMED,
(byte) (i | 0xFFFFFFFE));
}
}

View File

@ -1,5 +1,7 @@
package mineplex.core.disguise.disguises;
import net.minecraft.server.v1_8_R3.EntityWitch;
import org.bukkit.entity.*;
public class DisguiseWitch extends DisguiseMonster
@ -8,21 +10,21 @@ public class DisguiseWitch extends DisguiseMonster
{
super(EntityType.WITCH, entity);
DataWatcher.a(21, Byte.valueOf((byte)0));
}
public String getHurtSound()
{
return "mob.witch.hurt";
DataWatcher.a(21, Byte.valueOf((byte) 0), EntityWitch.META_AGGRESSIVE, false);
}
public void a(boolean flag)
public String getHurtSound()
{
DataWatcher.watch(21, Byte.valueOf((byte)(flag ? 1 : 0)));
return "mob.witch.hurt";
}
public boolean bT()
public void a(boolean flag)
{
return DataWatcher.getByte(21) == 1;
DataWatcher.watch(21, Byte.valueOf((byte) (flag ? 1 : 0)), EntityWitch.META_AGGRESSIVE, flag);
}
public boolean bT()
{
return DataWatcher.getByte(21) == 1;
}
}

View File

@ -1,5 +1,7 @@
package mineplex.core.disguise.disguises;
import net.minecraft.server.v1_8_R3.EntityWither;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
@ -8,30 +10,25 @@ public class DisguiseWither extends DisguiseMonster
public DisguiseWither(org.bukkit.entity.Entity entity)
{
super(EntityType.WITHER, entity);
DataWatcher.a(17, new Integer(0));
DataWatcher.a(18, new Integer(0));
DataWatcher.a(19, new Integer(0));
DataWatcher.a(20, new Integer(0));
DataWatcher.a(17, new Integer(0), EntityWither.META_INVUL_TIME, 0);
DataWatcher.a(18, new Integer(0), EntityWither.META_TARGET_1, 0);
DataWatcher.a(19, new Integer(0), EntityWither.META_TARGET_2, 0);
DataWatcher.a(20, new Integer(0), EntityWither.META_TARGET_3, 0);
}
public int getInvulTime()
{
return DataWatcher.getInt(20);
}
public void setInvulTime(int i)
{
DataWatcher.watch(20, Integer.valueOf(i));
}
public int t(int i)
{
return DataWatcher.getInt(17 + i);
}
public int getInvulTime()
{
return DataWatcher.getInt(20);
}
public void b(int i, int j)
{
DataWatcher.watch(17 + i, Integer.valueOf(j));
}
public void setInvulTime(int i)
{
DataWatcher.watch(20, Integer.valueOf(i), EntityWither.META_INVUL_TIME, i);
}
public int t(int i)
{
return DataWatcher.getInt(17 + i);
}
}

View File

@ -1,5 +1,7 @@
package mineplex.core.disguise.disguises;
import net.minecraft.server.v1_8_R3.EntityWolf;
import org.bukkit.entity.*;
public class DisguiseWolf extends DisguiseTameableAnimal
@ -8,51 +10,52 @@ public class DisguiseWolf extends DisguiseTameableAnimal
{
super(EntityType.WOLF, entity);
DataWatcher.a(18, new Float(20F));
DataWatcher.a(19, new Byte((byte)0));
DataWatcher.a(20, new Byte((byte)14));
DataWatcher.a(18, new Float(20F), EntityWolf.META_WOLF_HEALTH, 20F);
DataWatcher.a(19, new Byte((byte) 0), EntityWolf.META_BEGGING, false);
DataWatcher.a(20, new Byte((byte) 14), EntityWolf.META_COLLAR, 14);
}
public boolean isAngry()
public boolean isAngry()
{
return (DataWatcher.getByte(16) & 0x2) != 0;
}
public void setAngry(boolean angry)
{
byte b0 = DataWatcher.getByte(16);
byte b0 = DataWatcher.getByte(16);
if (angry)
DataWatcher.watch(16, Byte.valueOf((byte)(b0 | 0x2)));
else
DataWatcher.watch(16, Byte.valueOf((byte)(b0 & 0xFFFFFFFD)));
if (angry)
DataWatcher.watch(16, Byte.valueOf((byte) (b0 | 0x2)), EntityWolf.META_SITTING_TAMED, (byte) (b0 | 0x2));
else
DataWatcher
.watch(16, Byte.valueOf((byte) (b0 & 0xFFFFFFFD)), EntityWolf.META_SITTING_TAMED, (byte) (b0 & 0xFFFFFFFD));
}
public int getCollarColor()
public int getCollarColor()
{
return DataWatcher.getByte(20) & 0xF;
return DataWatcher.getByte(20) & 0xF;
}
public void setCollarColor(int i)
public void setCollarColor(int i)
{
DataWatcher.watch(20, Byte.valueOf((byte)(i & 0xF)));
DataWatcher.watch(20, Byte.valueOf((byte) (i & 0xF)), EntityWolf.META_COLLAR, (i & 0xF));
}
public void m(boolean flag)
{
if (flag)
DataWatcher.watch(19, Byte.valueOf((byte)1));
else
DataWatcher.watch(19, Byte.valueOf((byte)0));
if (flag)
DataWatcher.watch(19, Byte.valueOf((byte) 1), EntityWolf.META_BEGGING, flag);
else
DataWatcher.watch(19, Byte.valueOf((byte) 0), EntityWolf.META_BEGGING, flag);
}
public boolean ce()
{
return DataWatcher.getByte(19) == 1;
}
protected String getHurtSound()
{
return "mob.wolf.hurt";
}
protected String getHurtSound()
{
return "mob.wolf.hurt";
}
}

View File

@ -1,5 +1,7 @@
package mineplex.core.disguise.disguises;
import net.minecraft.server.v1_8_R3.EntityZombie;
import org.bukkit.entity.*;
public class DisguiseZombie extends DisguiseMonster
@ -12,34 +14,34 @@ public class DisguiseZombie extends DisguiseMonster
public DisguiseZombie(EntityType disguiseType, Entity entity)
{
super(disguiseType, entity);
DataWatcher.a(12, Byte.valueOf((byte)0));
DataWatcher.a(13, Byte.valueOf((byte)0));
DataWatcher.a(14, Byte.valueOf((byte)0));
DataWatcher.a(12, Byte.valueOf((byte) 0), EntityZombie.META_CHILD, false);
DataWatcher.a(13, Byte.valueOf((byte) 0), EntityZombie.META_VILLAGER, false);
DataWatcher.a(14, Byte.valueOf((byte) 0), EntityZombie.META_CONVERTING, false);
}
public boolean IsBaby()
{
return DataWatcher.getByte(12) == 1;
}
public void SetBaby(boolean baby)
{
DataWatcher.watch(12, Byte.valueOf((byte)(baby ? 1 : 0)));
DataWatcher.watch(12, Byte.valueOf((byte) (baby ? 1 : 0)), EntityZombie.META_CHILD, baby);
}
public boolean IsVillager()
{
return DataWatcher.getByte(13) == 1;
}
public void SetVillager(boolean villager)
{
DataWatcher.watch(13, Byte.valueOf((byte)(villager ? 1 : 0)));
DataWatcher.watch(13, Byte.valueOf((byte) (villager ? 1 : 0)), EntityZombie.META_VILLAGER, villager);
}
protected String getHurtSound()
{
return "mob.zombie.hurt";
}
protected String getHurtSound()
{
return "mob.zombie.hurt";
}
}

View File

@ -13,6 +13,7 @@ import mineplex.core.disguise.disguises.DisguiseChicken;
import mineplex.core.gadget.event.GadgetBlockEvent;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.recharge.Recharge;
import net.minecraft.server.v1_8_R3.Entity;
import org.bukkit.Bukkit;
import org.bukkit.Effect;
@ -30,25 +31,25 @@ public class BlockForm
{
private MorphBlock _host;
private Player _player;
private Material _mat;
private Block _block;
private Location _loc;
public BlockForm(MorphBlock host, Player player, Material mat)
public BlockForm(MorphBlock host, Player player, Material mat)
{
_host = host;
_player = player;
_mat = mat;
_loc = player.getLocation();
Apply();
}
public void Apply()
public void Apply()
{
//Remove Old
// Remove Old
if (_player.getPassenger() != null)
{
Recharge.Instance.useForce(_player, "PassengerChange", 100);
@ -57,36 +58,42 @@ public class BlockForm
_player.eject();
}
((CraftEntity)_player).getHandle().getDataWatcher().watch(0, Byte.valueOf((byte) 32));
((CraftEntity) _player).getHandle().getDataWatcher().watch(0, Byte.valueOf((byte) 32), Entity.META_ENTITYDATA, (byte) 32);
//Player > Chicken
// Player > Chicken
DisguiseChicken disguise = new DisguiseChicken(_player);
disguise.setBaby();
disguise.setBaby();
disguise.setSoundDisguise(new DisguiseCat(_player));
disguise.setInvisible(true);
_host.Manager.getDisguiseManager().disguise(disguise);
//Apply Falling Block
// Apply Falling Block
FallingBlockCheck();
//Inform
String blockName = F.elem(ItemStackFactory.Instance.GetName(_mat, (byte)0, false));
// Inform
String blockName = F.elem(ItemStackFactory.Instance.GetName(_mat, (byte) 0, false));
if (!blockName.contains("Block"))
UtilPlayer.message(_player, F.main("Morph", "You are now a " + F.elem(ItemStackFactory.Instance.GetName(_mat, (byte)0, false) + " Block") + "!"));
UtilPlayer
.message(
_player,
F.main("Morph",
"You are now a "
+ F.elem(ItemStackFactory.Instance.GetName(_mat, (byte) 0, false) + " Block") + "!"));
else
UtilPlayer.message(_player, F.main("Morph", "You are now a " + F.elem(ItemStackFactory.Instance.GetName(_mat, (byte)0, false)) + "!"));
UtilPlayer.message(_player,
F.main("Morph", "You are now a " + F.elem(ItemStackFactory.Instance.GetName(_mat, (byte) 0, false)) + "!"));
//Sound
// Sound
_player.playSound(_player.getLocation(), Sound.ZOMBIE_UNFECT, 2f, 2f);
}
public void Remove()
public void Remove()
{
SolidifyRemove();
_host.Manager.getDisguiseManager().undisguise(_player);
//Remove FB
// Remove FB
if (_player.getPassenger() != null)
{
Recharge.Instance.useForce(_player, "PassengerChange", 100);
@ -95,97 +102,99 @@ public class BlockForm
_player.eject();
}
((CraftEntity)_player).getHandle().getDataWatcher().watch(0, Byte.valueOf((byte) 0));
((CraftEntity) _player).getHandle().getDataWatcher().watch(0, Byte.valueOf((byte) 0), Entity.META_ENTITYDATA, (byte) 0);
}
public void SolidifyUpdate()
{
if (!_player.isSprinting())
((CraftEntity)_player).getHandle().getDataWatcher().watch(0, Byte.valueOf((byte) 32));
//Not a Block
((CraftEntity) _player).getHandle().getDataWatcher()
.watch(0, Byte.valueOf((byte) 32), Entity.META_ENTITYDATA, (byte) 32);
// Not a Block
if (_block == null)
{
//Moved
// Moved
if (!_loc.getBlock().equals(_player.getLocation().getBlock()))
{
_player.setExp(0);
_loc = _player.getLocation();
}
//Unmoved
// Unmoved
else
{
double hideBoost = 0.025;
_player.setExp((float) Math.min(0.999f, _player.getExp() + hideBoost));
//Set Block
// Set Block
if (_player.getExp() >= 0.999f)
{
Block block = _player.getLocation().getBlock();
List<Block> blockList = new ArrayList<Block>();
blockList.add(block);
GadgetBlockEvent event = new GadgetBlockEvent(_host, blockList);
Bukkit.getServer().getPluginManager().callEvent(event);
//Not Able
if (block.getType() != Material.AIR || !UtilBlock.solid(block.getRelative(BlockFace.DOWN)) || event.getBlocks().isEmpty() || event.isCancelled())
// Not Able
if (block.getType() != Material.AIR || !UtilBlock.solid(block.getRelative(BlockFace.DOWN))
|| event.getBlocks().isEmpty() || event.isCancelled())
{
UtilPlayer.message(_player, F.main("Morph", "You cannot become a Solid Block here."));
_player.setExp(0f);
return;
}
//Set Block
// Set Block
_block = block;
//Effect
// Effect
_player.playEffect(_player.getLocation(), Effect.STEP_SOUND, _mat);
//block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, _mat);
// block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, _mat);
//Display
// Display
SolidifyVisual();
//Invisible
//Host.Manager.GetCondition().Factory().Cloak("Disguised as Block", Player, Player, 60000, false, false);
// Invisible
// Host.Manager.GetCondition().Factory().Cloak("Disguised as Block", Player, Player, 60000, false, false);
//Sound
// Sound
_player.playSound(_player.getLocation(), Sound.NOTE_PLING, 1f, 2f);
}
}
}
//Is a Block
// Is a Block
else
{
//Moved
// Moved
if (!_loc.getBlock().equals(_player.getLocation().getBlock()))
{
SolidifyRemove();
}
//Send Packets
// Send Packets
else
{
SolidifyVisual();
}
}
}
}
public void SolidifyRemove()
{
if (_block != null)
{
MapUtil.QuickChangeBlockAt(_block.getLocation(), 0, (byte)0);
MapUtil.QuickChangeBlockAt(_block.getLocation(), 0, (byte) 0);
_block = null;
}
_player.setExp(0f);
//Host.Manager.GetCondition().EndCondition(Player, null, "Disguised as Block");
// Host.Manager.GetCondition().EndCondition(Player, null, "Disguised as Block");
//Inform
// Inform
_player.playSound(_player.getLocation(), Sound.NOTE_PLING, 1f, 0.5f);
FallingBlockCheck();
@ -197,7 +206,7 @@ public class BlockForm
if (_block == null)
return;
//Remove Old
// Remove Old
if (_player.getPassenger() != null)
{
Recharge.Instance.useForce(_player, "PassengerChange", 100);
@ -206,49 +215,49 @@ public class BlockForm
_player.eject();
}
//Others
// Others
for (Player other : UtilServer.getPlayers())
other.sendBlockChange(_player.getLocation(), _mat, (byte)0);
other.sendBlockChange(_player.getLocation(), _mat, (byte) 0);
//Self
_player.sendBlockChange(_player.getLocation(), 36, (byte)0);
// Self
_player.sendBlockChange(_player.getLocation(), 36, (byte) 0);
FallingBlockCheck();
}
public void FallingBlockCheck()
public void FallingBlockCheck()
{
//Block Form (Hide Falling)
// Block Form (Hide Falling)
if (_block != null)
return;
//Recreate Falling
// Recreate Falling
if (_player.getPassenger() == null || !_player.getPassenger().isValid())
{
if (!Recharge.Instance.use(_player, "PassengerChange", 100, false, false))
return;
//Falling Block
FallingBlock block = _player.getWorld().spawnFallingBlock(_player.getEyeLocation(), _mat, (byte)0);
//No Arrow Collision
((CraftFallingSand)block).getHandle().spectating = true;
// Falling Block
FallingBlock block = _player.getWorld().spawnFallingBlock(_player.getEyeLocation(), _mat, (byte) 0);
// No Arrow Collision
((CraftFallingSand) block).getHandle().spectating = true;
_player.setPassenger(block);
_host.fallingBlockRegister(block);
}
//Ensure Falling doesnt Despawn
// Ensure Falling doesnt Despawn
else
{
((CraftFallingSand)_player.getPassenger()).getHandle().ticksLived = 1;
((CraftFallingSand) _player.getPassenger()).getHandle().ticksLived = 1;
_player.getPassenger().setTicksLived(1);
}
}
public Block GetBlock()
public Block GetBlock()
{
return _block;
}

View File

@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Iterator;
import java.util.UUID;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
@ -13,6 +14,7 @@ import org.bukkit.util.Vector;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilPlayer;
import net.minecraft.server.v1_8_R3.DataWatcher;
import net.minecraft.server.v1_8_R3.EntityArmorStand;
import net.minecraft.server.v1_8_R3.Packet;
import net.minecraft.server.v1_8_R3.PacketPlayOutEntity;
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy;
@ -291,15 +293,16 @@ public class Hologram
packet.d = (int) ((getLocation().getY() + (_hideBoundingBox ? 0 : -2.1) + ((double) textRow * 0.285)) * 32);
packet.e = (int) (getLocation().getZ() * 32);
packet.l = watcher;
packet.uuid = UUID.randomUUID();
// Setup datawatcher for armor stand
watcher.a(0, (byte) 32);
watcher.a(2, lineOfText);
watcher.a(3, (byte) 1);
watcher.a(0, (byte) 32, EntityArmorStand.META_ENTITYDATA, (byte) 32);
watcher.a(2, lineOfText, EntityArmorStand.META_CUSTOMNAME, lineOfText);
watcher.a(3, (byte) 1, EntityArmorStand.META_CUSTOMNAME_VISIBLE, true);
if (_hideBoundingBox)
{
watcher.a(10, (byte) 16); // TODO Uncomment after we can enforce 1.8.3
watcher.a(10, (byte) 16, EntityArmorStand.META_ARMOR_OPTION, (byte) 16); // TODO Uncomment after we can enforce 1.8.3
}
// Also correct hologram positioning
@ -527,9 +530,9 @@ public class Hologram
DataWatcher watcher1_8 = new DataWatcher(null);
watcher1_8.a(0, (byte) 32);
watcher1_8.a(2, newText[i]);
watcher1_8.a(3, (byte) 1);
watcher1_8.a(0, (byte) 32, EntityArmorStand.META_ENTITYDATA, (byte) 32);
watcher1_8.a(2, newText[i], EntityArmorStand.META_CUSTOMNAME, newText[i]);
watcher1_8.a(3, (byte) 1, EntityArmorStand.META_CUSTOMNAME_VISIBLE, true);
// watcher1_8.a(10, (byte) 16);// TODO Uncomment after we can enforce 1.8.3
// Also correct hologram positioning
metadata1_8.b = watcher1_8.c();

View File

@ -172,7 +172,7 @@ public class Recharge extends MiniPlugin
//Recharging
if (Get(player).containsKey(ability))
{
if (inform)
if (inform && !Get(player).get(ability).DisplayForce && !Get(player).get(ability).AttachItem)
{
UtilPlayer.message(player, F.main("Recharge", "You cannot use " + F.skill(abilityFull) + " for " +
F.time(UtilTime.convertString((Get(player).get(ability).GetRemaining()), 1, TimeUnit.FIT)) + "."));
@ -217,7 +217,7 @@ public class Recharge extends MiniPlugin
}
else
{
if (inform)
if (inform && !Get(player).get(ability).DisplayForce && !Get(player).get(ability).AttachItem)
UtilPlayer.message(player, F.main("Recharge", "You cannot use " + F.skill(ability) + " for " +
F.time(UtilTime.convertString((Get(player).get(ability).GetRemaining()), 1, TimeUnit.FIT)) + "."));

View File

@ -0,0 +1,77 @@
package mineplex.core.vanish;
import java.sql.ResultSet;
import java.sql.SQLException;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.MiniClientPlugin;
import mineplex.core.account.CoreClientManager;
import mineplex.core.account.event.ClientWebResponseEvent;
import mineplex.core.common.util.UtilServer;
import mineplex.core.vanish.commands.VanishCommand;
import mineplex.core.vanish.events.PreVanishEvent;
import mineplex.core.vanish.repository.VanishClient;
import mineplex.core.vanish.repository.VanishRepository;
public class Vanish extends MiniClientPlugin<VanishClient>
{
private CoreClientManager _clientManager;
private VanishRepository _repository;
public Vanish(JavaPlugin plugin, CoreClientManager clientManager)
{
super("Vanish", plugin);
_repository = new VanishRepository(this);
_clientManager = clientManager;
}
public void addCommands()
{
addCommand(new VanishCommand(this));
}
public boolean toggle(Player caller)
{
boolean enabled = !Get(caller).State;
PreVanishEvent event = new PreVanishEvent(caller, enabled);//UtilServer.callEvent(new PreVanishEvent(caller, true));
UtilServer.getServer().getPluginManager().callEvent(event);
if (event.isCancelled())
{
return;
}
Get(caller).State = enabled;
return enabled;
}
@EventHandler
public void ClientLoad(ClientWebResponseEvent event)
{
Get(event.get
}
public String getQuery(int accountId, String uuid, String name)
{
return "CREATE TABLE IF NOT EXISTS incognitoStaff (accountId INT NOT NULL, enabled TINYINT(1) NOT NULL, enabledTime BIGINT)";
}
public void processLoginResultSet(String playerName, int accountId, ResultSet resultSet) throws SQLException
{
int accountId = resultSet.getInt("accountId");
boolean enabled = resultSet.getBoolean("enabled");
}
protected VanishClient AddPlayer(String player)
{
return new VanishClient();
}
}

View File

@ -0,0 +1,21 @@
package mineplex.core.vanish.commands;
import org.bukkit.entity.Player;
import mineplex.core.command.CommandBase;
import mineplex.core.common.Rank;
import mineplex.core.vanish.Vanish;
public class VanishCommand extends CommandBase<Vanish>
{
public VanishCommand(Vanish plugin)
{
super(plugin, Rank.HELPER, "incognito", "vanish");
}
@Override
public void Execute(Player caller, String[] args)
{
Plugin.toggle(caller);
}
}

View File

@ -0,0 +1,52 @@
package mineplex.core.vanish.events;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
public class PreVanishEvent extends Event
{
private static final HandlerList handlers = new HandlerList();
private Player _player;
private boolean _newState;
private boolean _cancelled;
public PreVanishEvent(Player player, boolean newState)
{
_player = player;
_newState = newState;
}
public boolean getNewState()
{
return _newState;
}
public Player getPlayer()
{
return _player;
}
public void setCancelled(boolean cancelled)
{
_cancelled = cancelled;
}
public boolean isCancelled()
{
return _cancelled;
}
public HandlerList getHandlers()
{
return handlers;
}
public static HandlerList getHandlerList()
{
return handlers;
}
}

View File

@ -0,0 +1,6 @@
package mineplex.core.vanish.repository;
public class VanishClient
{
public boolean State;
}

View File

@ -0,0 +1,53 @@
package mineplex.core.vanish.repository;
import mineplex.core.common.util.EnclosedObject;
import mineplex.core.database.MinecraftRepository;
import mineplex.core.vanish.Vanish;
import mineplex.serverdata.database.DBPool;
import mineplex.serverdata.database.column.ColumnBoolean;
import mineplex.serverdata.database.column.ColumnInt;
public class VanishRepository extends MinecraftRepository
{
private static final String CREATE_TABLE = "CREATE TABLE IF NOT EXISTS incognitoStaff (accountId INT NOT NULL, status TINYINT(1) DEFAULT '0');";
private static final String GET_STATUS = "SELECT * FROM incognitoStaff WHERE accountId = ?;";
private static final String SET_STATUS = "INSERT INTO incognitoStaff (accountId, status) VALUES (?, ?);";
private Vanish _vanish;
public VanishRepository(Vanish vanish)
{
super(vanish.getPlugin(), DBPool.getAccount());
_vanish = vanish;
}
public void setStatus(int accountId, boolean status)
{
executeUpdate(SET_STATUS, new ColumnInt("accountId", accountId), new ColumnBoolean("status", status));
}
public boolean getStatus(int accountId)
{
EnclosedObject<Boolean> status = new EnclosedObject<>();
executeQuery(GET_STATUS, result -> {
if (result.next())
status.Set(Boolean.valueOf(result.getBoolean("accountId")));
else
status.Set(Boolean.FALSE);
}, new ColumnInt("accountId", accountId));
return status.GetDispose().booleanValue();
}
protected void initialize()
{
executeUpdate(CREATE_TABLE);
}
protected void update()
{
}
}

View File

@ -13,7 +13,6 @@ import mineplex.core.aprilfools.AprilFoolsManager;
import mineplex.core.blockrestore.BlockRestore;
import mineplex.core.chat.Chat;
import mineplex.core.command.CommandCenter;
import mineplex.core.common.ConfigContainer;
import mineplex.core.common.events.ServerShutdownEvent;
import mineplex.core.creature.Creature;
import mineplex.core.customdata.CustomDataManager;
@ -69,22 +68,10 @@ import mineplex.minecraft.game.core.IRelation;
import mineplex.minecraft.game.core.combat.CombatManager;
import mineplex.minecraft.game.core.damage.DamageManager;
import mineplex.minecraft.game.core.fire.Fire;
import org.bukkit.configuration.file.FileConfiguration;
public class Hub extends JavaPlugin implements IRelation
{
private String WEB_CONFIG = "webServer";
private final ConfigContainer _config = new ConfigContainer(this, "mineplex.yml");
@Override
public FileConfiguration getConfig() {
return _config.getConfig();
}
@Override
public void saveConfig() {
_config.saveConfig();
}
@Override
public void onEnable()

View File

@ -40,6 +40,7 @@ public class ServerGameMenu extends ShopPageBase<ServerManager, QuickShop>
@Override
protected void buildPage()
{
/*
addButton(2, new ItemBuilder(Material.RED_ROSE).setTitle(C.cYellowB + "Valentines Vendetta " + C.cGray + "Save Valentines!").addLore(new String[]
{
(_extraValue ? C.cAquaB : C.cWhiteB) + "LIMITED TIME GAME",
@ -50,8 +51,9 @@ public class ServerGameMenu extends ShopPageBase<ServerManager, QuickShop>
C.Reset + "",
C.Reset + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("VV") + C.Reset + " other players!",
}).setHideInfo(true).build(), new SelectVVButton(this));
*/
addButton(4, new ItemBuilder(Material.QUARTZ_BLOCK).setTitle(C.cYellowB + "Speed Builders " + C.cGray + "Competitive Building").addLore(new String[]
addButton(2, new ItemBuilder(Material.QUARTZ_BLOCK).setTitle(C.cYellowB + "Speed Builders " + C.cGray + "Competitive Building").addLore(new String[]
{
(_extraValue ? C.cAquaB : C.cWhiteB) + "NEW GAME",
C.Reset + "",
@ -62,6 +64,28 @@ public class ServerGameMenu extends ShopPageBase<ServerManager, QuickShop>
C.Reset + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("SB") + C.Reset + " other players!",
}).setHideInfo(true).build(), new SelectSBButton(this));
addButton(4, new ItemBuilder(Material.BOOK_AND_QUILL).setTitle(C.cYellowB + "Draw My Thing " + C.cGray + "Pictionary").addLore(new String[]
{
(_extraValue ? C.cAquaB : C.cWhiteB) + "NEW UPDATE",
C.Reset + "",
C.Reset + "Players take turns at drawing a random",
C.Reset + "word. Whoever guesses it within the time",
C.Reset + "limit gets some points!",
C.Reset + "",
C.Reset + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("DMT") + C.Reset + " other players!",
}).setHideInfo(true).build(), new SelectDMTButton(this));
addButton(6, new ItemBuilder(Material.TNT).setTitle(C.cYellowB + "Dragon Escape " + C.cGray + "Fast Paced Parkour").addLore(new String[]
{
(_extraValue ? C.cAquaB : C.cWhiteB) + "FEATURED ARCADE GAME",
C.Reset + "",
C.Reset + "Douglas the Dragon is angry",
C.Reset + "You better RUNNNNN!",
C.Reset + "Last player alive wins",
C.Reset + "",
C.Reset + "Join " + C.cGreen + getPlugin().getGroupTagPlayerCount("DE") + C.Reset + " other players!"
}).setHideInfo(true).build(), new SelectFEATButton(this, "Dragon Escape"));
/*
addButton(6, new ItemBuilder(Material.IRON_SWORD).setTitle(C.cYellowB + "Gladiators" + C.cGray + " Bracketted Deathmatch").addLore(new String[]
{
@ -88,6 +112,7 @@ public class ServerGameMenu extends ShopPageBase<ServerManager, QuickShop>
}).setHideInfo(true).build(), new SelectFEATButton(this, "Micro Battle"));
*/
/*
addButton(6, new ItemBuilder(Material.TNT).setTitle(C.cYellowB + "Bomb Lobbers " + C.cGray + "TNT Mayhem").addLore(new String[]
{
(_extraValue ? C.cAquaB : C.cWhiteB) + "FEATURED ARCADE GAME",
@ -97,6 +122,7 @@ public class ServerGameMenu extends ShopPageBase<ServerManager, QuickShop>
C.Reset + "",
C.Reset + "Join " + C.cGreen + getPlugin().getGroupTagPlayerCount("BL") + C.Reset + " other players!"
}).setHideInfo(true).build(), new SelectFEATButton(this, "Bomb Lobbers"));
*/
addButton(9, new ItemBuilder(Material.IRON_PICKAXE).setTitle(C.cYellowB + "The Bridges " + C.cGray + "4 Team Survival").addLore(new String[]
{
@ -201,7 +227,7 @@ public class ServerGameMenu extends ShopPageBase<ServerManager, QuickShop>
C.Reset + "Join " + C.cGreen + getPlugin().getGroupTagPlayerCount("BH") + C.Reset + " other players!",
}).setHideInfo(true).build(), new SelectBHButton(this));
addButton(27, new ItemBuilder(Material.TNT).setTitle(C.cYellowB + "MineStrike " + C.cGray + "Team Survival").addLore(new String[]
addButton(28, new ItemBuilder(Material.TNT).setTitle(C.cYellowB + "MineStrike " + C.cGray + "Team Survival").addLore(new String[]
{
C.Reset + "",
C.Reset + "One team must defend two bomb sites from",
@ -211,21 +237,11 @@ public class ServerGameMenu extends ShopPageBase<ServerManager, QuickShop>
C.Reset + "Join " + C.cGreen + getPlugin().getGroupTagPlayerCount("MS") + C.Reset + " other players!",
}).setHideInfo(true).build(), new SelectMSButton(this));
addButton(29, new ItemBuilder(Material.BOOK_AND_QUILL).setTitle(C.cYellowB + "Draw My Thing " + C.cGray + "Pictionary").addLore(new String[]
{
C.Reset + "",
C.Reset + "Players take turns at drawing a random",
C.Reset + "word. Whoever guesses it within the time",
C.Reset + "limit gets some points!",
C.Reset + "",
C.Reset + "Join " + ChatColor.GREEN + getPlugin().getGroupTagPlayerCount("DMT") + C.Reset + " other players!",
}).setHideInfo(true).build(), new SelectDMTButton(this));
addButton(30, _superSmashCycle.get(_ssmIndex), new SelectSSMButton(this));
addButton(31, _superSmashCycle.get(_ssmIndex), new SelectSSMButton(this));
addButton(32, _minigameCycle.get(_minigameIndex), new SelectMINButton(this));
addButton(33, _minigameCycle.get(_minigameIndex), new SelectMINButton(this));
addButton(35, new ItemBuilder(Material.WOOD).setTitle(C.cYellowB + "Master Builders " + C.cGray + "Creative Build").setLore(new String[]
addButton(34, new ItemBuilder(Material.WOOD).setTitle(C.cYellowB + "Master Builders " + C.cGray + "Creative Build").setLore(new String[]
{
C.Reset + "",
C.Reset + "Players are given a Build Theme and ",

View File

@ -22,26 +22,7 @@ import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilWorld;
import mineplex.mapparser.command.AdminCommand;
import mineplex.mapparser.command.AuthorCommand;
import mineplex.mapparser.command.BaseCommand;
import mineplex.mapparser.command.CopyCommand;
import mineplex.mapparser.command.CopySchematicsCommand;
import mineplex.mapparser.command.CreateCommand;
import mineplex.mapparser.command.DeleteCommand;
import mineplex.mapparser.command.GameTypeCommand;
import mineplex.mapparser.command.HubCommand;
import mineplex.mapparser.command.ListCommand;
import mineplex.mapparser.command.MapCommand;
import mineplex.mapparser.command.NameCommand;
import mineplex.mapparser.command.ParseCommand200;
import mineplex.mapparser.command.ParseCommand400;
import mineplex.mapparser.command.ParseCommand600;
import mineplex.mapparser.command.RenameCommand;
import mineplex.mapparser.command.SaveCommand;
import mineplex.mapparser.command.SetSpawnCommand;
import mineplex.mapparser.command.SpawnCommand;
import mineplex.mapparser.command.WorldsCommand;
import mineplex.mapparser.command.*;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
@ -120,6 +101,9 @@ public class MapParser extends JavaPlugin implements Listener
_commands.add(new CopyCommand(this));
_commands.add(new SpawnCommand(this));
_commands.add(new SetSpawnCommand(this));
_commands.add(new ItemNameCommand(this));
_commands.add(new AddLoreCommand(this));
_commands.add(new ClearLoreCommand(this));
}
@Override

View File

@ -0,0 +1,58 @@
package mineplex.mapparser.command;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import mineplex.core.common.util.F;
import mineplex.mapparser.MapParser;
public class AddLoreCommand extends BaseCommand
{
public AddLoreCommand(MapParser plugin)
{
super(plugin, "addlore", "al");
}
@Override
public boolean execute(Player player, String alias, String[] args)
{
if (args == null || args.length < 1)
{
message(player, "Invalid Usage: " + F.elem("/" + alias + " <text>"));
return true;
}
ItemStack is = player.getItemInHand();
if (is == null || is.getType() == Material.AIR)
{
message(player, "You must be holding an item in your hand.");
return true;
}
ItemMeta im = is.getItemMeta();
String line = "";
for (int i = 0; i < args.length; i++)
{
line += args[i] + " ";
}
line = line.replaceAll("&", "§").trim();
List<String> lore = (im.getLore() != null ? new ArrayList<>(im.getLore()) : new ArrayList<>());
lore.add(line);
im.setLore(lore);
is.setItemMeta(im);
player.setItemInHand(is);
player.updateInventory();
message(player, "Added lore: " + line);
return true;
}
}

View File

@ -0,0 +1,40 @@
package mineplex.mapparser.command;
import java.util.ArrayList;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import mineplex.mapparser.MapParser;
public class ClearLoreCommand extends BaseCommand
{
public ClearLoreCommand(MapParser plugin)
{
super(plugin, "clearlore", "cl");
}
@Override
public boolean execute(Player player, String alias, String[] args)
{
ItemStack is = player.getItemInHand();
if (is == null || is.getType() == Material.AIR)
{
message(player, "You must be holding an item in your hand.");
return true;
}
ItemMeta im = is.getItemMeta();
im.setLore(new ArrayList<>());
is.setItemMeta(im);
player.setItemInHand(is);
player.updateInventory();
message(player, "Cleared lore on item!");
return true;
}
}

View File

@ -0,0 +1,52 @@
package mineplex.mapparser.command;
import mineplex.core.common.util.F;
import mineplex.mapparser.MapParser;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
public class ItemNameCommand extends BaseCommand
{
public ItemNameCommand(MapParser plugin)
{
super(plugin, "itemname", "in");
}
@Override
public boolean execute(Player player, String alias, String[] args)
{
if (args == null || args.length < 1)
{
message(player, "Invalid Usage: " + F.elem("/" + alias + " <name>"));
return true;
}
ItemStack is = player.getItemInHand();
if (is == null || is.getType() == Material.AIR)
{
message(player, "You must be holding an item in your hand.");
return true;
}
ItemMeta im = is.getItemMeta();
String name = "";
for (int i = 0; i < args.length; i++)
{
name += args[i] + " ";
}
name = name.replaceAll("&", "§").trim();
im.setDisplayName(name);
is.setItemMeta(im);
player.setItemInHand(is);
player.updateInventory();
message(player, "Set name: " + name);
return true;
}
}

View File

@ -2,6 +2,7 @@ package mineplex.minecraft.game.core.boss.ironwizard.abilities;
import mineplex.core.common.util.UtilEnt;
import net.minecraft.server.v1_8_R3.DataWatcher;
import net.minecraft.server.v1_8_R3.Entity;
import net.minecraft.server.v1_8_R3.Packet;
import net.minecraft.server.v1_8_R3.PacketPlayOutAttachEntity;
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy;
@ -52,8 +53,8 @@ public class BlockHailBlock
PacketPlayOutSpawnEntityLiving packet1 = new PacketPlayOutSpawnEntityLiving();
DataWatcher watcher = new DataWatcher(null);
watcher.a(0, (byte) 32);
watcher.a(1, 0);
watcher.a(0, (byte) 32, Entity.META_ENTITYDATA, (byte) 0);
watcher.a(1, 0, Entity.META_AIR, 0);
packet1.a = _silverfish;
packet1.b = EntityType.SILVERFISH.getTypeId();

View File

@ -172,8 +172,8 @@ public class GolemExplodingAura extends BossAbility<GolemCreature, IronGolem>
PacketPlayOutSpawnEntityLiving packet1 = new PacketPlayOutSpawnEntityLiving();
DataWatcher watcher = new DataWatcher(null);
watcher.a(0, (byte) 32);
watcher.a(1, 0);
watcher.a(0, (byte) 32, net.minecraft.server.v1_8_R3.Entity.META_ENTITYDATA, (byte) 0);
watcher.a(1, 0, net.minecraft.server.v1_8_R3.Entity.META_AIR, 0);
packet1.a = key;
packet1.b = EntityType.SILVERFISH.getTypeId();

View File

@ -395,8 +395,8 @@ public class GolemExplosiveBlock extends BossAbility<GolemCreature, IronGolem>
PacketPlayOutSpawnEntityLiving packet1 = new PacketPlayOutSpawnEntityLiving();
DataWatcher watcher = new DataWatcher(null);
watcher.a(0, (byte) 32);
watcher.a(1, 0);
watcher.a(0, (byte) 32, net.minecraft.server.v1_8_R3.Entity.META_ENTITYDATA, (byte) 0);
watcher.a(1, 0, net.minecraft.server.v1_8_R3.Entity.META_AIR, 0);
packet1.a = id;
packet1.b = EntityType.SILVERFISH.getTypeId();

View File

@ -1,5 +1,7 @@
package mineplex.minecraft.game.core.boss.snake;
import java.util.UUID;
import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack;
import org.bukkit.entity.EntityType;
import org.bukkit.inventory.ItemStack;
@ -8,12 +10,14 @@ import org.bukkit.util.Vector;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilEnt;
import net.minecraft.server.v1_8_R3.DataWatcher;
import net.minecraft.server.v1_8_R3.EntityArmorStand;
import net.minecraft.server.v1_8_R3.Packet;
import net.minecraft.server.v1_8_R3.PacketPlayOutEntity;
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityEquipment;
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityMetadata;
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityTeleport;
import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving;
import net.minecraft.server.v1_8_R3.Vector3f;
public class SnakeSegment
{
@ -92,16 +96,16 @@ public class SnakeSegment
_prevDir = vec;
DataWatcher watcher = new DataWatcher(null);
watcher.a(0, (byte) 32);
watcher.a(1, 0);
watcher.a(10, (byte) 0);
watcher.a(11, vec);
for (int i = 12; i < 17; i++)
{
watcher.a(i, new Vector(0, 0, 0));
}
watcher.a(0, (byte) 32, net.minecraft.server.v1_8_R3.Entity.META_ENTITYDATA, (byte) 0);
watcher.a(1, 0, net.minecraft.server.v1_8_R3.Entity.META_AIR, 0);
watcher.a(10, (byte) 0, EntityArmorStand.META_ARMOR_OPTION, (byte) 0);
watcher.a(11, new Vector3f(0, 0, 0), EntityArmorStand.META_HEAD_POSE,
new Vector3f((float) vec.getX(), (float) vec.getY(), (float) vec.getZ()));
watcher.a(12, new Vector3f(0, 0, 0), EntityArmorStand.META_BODY_POSE, new Vector3f(0, 0, 0));
watcher.a(13, new Vector3f(0, 0, 0), EntityArmorStand.META_LEFT_ARM_POSE, new Vector3f(0, 0, 0));
watcher.a(14, new Vector3f(0, 0, 0), EntityArmorStand.META_RIGHT_ARM_POSE, new Vector3f(0, 0, 0));
watcher.a(15, new Vector3f(0, 0, 0), EntityArmorStand.META_LEFT_LEG_POSE, new Vector3f(0, 0, 0));
watcher.a(16, new Vector3f(0, 0, 0), EntityArmorStand.META_RIGHT_LEG_POSE, new Vector3f(0, 0, 0));
PacketPlayOutEntityMetadata meta = new PacketPlayOutEntityMetadata();
@ -129,23 +133,25 @@ public class SnakeSegment
PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving();
DataWatcher watcher = new DataWatcher(null);
watcher.a(1, 0);
watcher.a(1, 0, net.minecraft.server.v1_8_R3.Entity.META_AIR, 0);
packet.a = getId();
packet.c = (int) Math.floor(_entityLocation.getX() * 32);
packet.d = (int) Math.floor(_entityLocation.getY() * 32);
packet.e = (int) Math.floor(_entityLocation.getZ() * 32);
packet.l = watcher;
packet.uuid = UUID.randomUUID();
if (_item != null)
{
watcher.a(0, (byte) 32);
watcher.a(10, (byte) 0);
for (int i = 11; i < 17; i++)
{
watcher.a(i, new Vector(0, 0, 0));
}
watcher.a(0, (byte) 32, net.minecraft.server.v1_8_R3.Entity.META_ENTITYDATA, (byte) 32);
watcher.a(10, (byte) 0, EntityArmorStand.META_ARMOR_OPTION, (byte) 0);
watcher.a(11, new Vector3f(0, 0, 0), EntityArmorStand.META_HEAD_POSE, new Vector3f(0, 0, 0));
watcher.a(12, new Vector3f(0, 0, 0), EntityArmorStand.META_BODY_POSE, new Vector3f(0, 0, 0));
watcher.a(13, new Vector3f(0, 0, 0), EntityArmorStand.META_LEFT_ARM_POSE, new Vector3f(0, 0, 0));
watcher.a(14, new Vector3f(0, 0, 0), EntityArmorStand.META_RIGHT_ARM_POSE, new Vector3f(0, 0, 0));
watcher.a(15, new Vector3f(0, 0, 0), EntityArmorStand.META_LEFT_LEG_POSE, new Vector3f(0, 0, 0));
watcher.a(16, new Vector3f(0, 0, 0), EntityArmorStand.META_RIGHT_LEG_POSE, new Vector3f(0, 0, 0));
packet.b = 30;
@ -162,7 +168,7 @@ public class SnakeSegment
}
else
{
watcher.a(0, (byte) 0);
watcher.a(0, (byte) 0, net.minecraft.server.v1_8_R3.Entity.META_ENTITYDATA, (byte) 0);
packet.b = EntityType.MAGMA_CUBE.getTypeId();
return new Packet[]

View File

@ -17,13 +17,16 @@
<artifactId>gson</artifactId>
</dependency>
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-dbcp2</artifactId>
<version>2.0.1</version>
</dependency>
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -15,7 +15,9 @@ public final class DBPool
private static DataSource ACCOUNT;
private static DataSource QUEUE;
private static DataSource MINEPLEX;
private static DataSource STATS_MINEPLEX;
private static DataSource MINEPLEX_STATS;
private static DataSource PLAYER_STATS;
private static DataSource SERVER_STATS;
private static DataSource openDataSource(String url, String username, String password)
{
@ -59,12 +61,28 @@ public final class DBPool
return MINEPLEX;
}
public static DataSource getStats()
public static DataSource getMineplexStats()
{
if (STATS_MINEPLEX == null)
if (MINEPLEX_STATS == null)
loadDataSources();
return STATS_MINEPLEX;
return MINEPLEX_STATS;
}
public static DataSource getPlayerStats()
{
if (PLAYER_STATS == null)
loadDataSources();
return PLAYER_STATS;
}
public static DataSource getServerStats()
{
if (SERVER_STATS == null)
loadDataSources();
return SERVER_STATS;
}
private static void loadDataSources()
@ -113,8 +131,12 @@ public final class DBPool
QUEUE = openDataSource("jdbc:mysql://" + dbHost, userName, password);
else if (dbSource.toUpperCase().equalsIgnoreCase("MINEPLEX"))
MINEPLEX = openDataSource("jdbc:mysql://" + dbHost, userName, password);
else if (dbSource.toUpperCase().equalsIgnoreCase("STATS"))
STATS_MINEPLEX = openDataSource("jdbc:mysql://" + dbHost, userName, password);
else if (dbSource.toUpperCase().equalsIgnoreCase("MINEPLEX_STATS"))
MINEPLEX_STATS = openDataSource("jdbc:mysql://" + dbHost, userName, password);
else if (dbSource.toUpperCase().equalsIgnoreCase("PLAYER_STATS"))
PLAYER_STATS = openDataSource("jdbc:mysql://" + dbHost, userName, password);
else if (dbSource.toUpperCase().equalsIgnoreCase("SERVER_STATS"))
SERVER_STATS = openDataSource("jdbc:mysql://" + dbHost, userName, password);
}
}
}

View File

@ -12,6 +12,17 @@ import mineplex.serverdata.database.column.Column;
public abstract class RepositoryBase
{
static
{
try
{
Class.forName("com.mysql.jdbc.Driver");
} catch (ClassNotFoundException e)
{
e.printStackTrace();
}
}
private DataSource _dataSource; // Connection pool
/**

View File

@ -34,7 +34,7 @@ public class StatusHistoryRepository extends RepositoryBase
public StatusHistoryRepository()
{
super(DBPool.getStats());
super(DBPool.getServerStats());
PreparedStatement preparedStatement = null;

View File

@ -16,7 +16,6 @@ import mineplex.core.blockrestore.BlockRestore;
import mineplex.core.blood.Blood;
import mineplex.core.chat.Chat;
import mineplex.core.command.CommandCenter;
import mineplex.core.common.ConfigContainer;
import mineplex.core.common.events.ServerShutdownEvent;
import mineplex.core.common.util.FileUtil;
import mineplex.core.common.util.UtilServer;
@ -61,7 +60,6 @@ import mineplex.minecraft.game.core.damage.DamageManager;
import nautilus.game.arcade.game.GameServerConfig;
import net.minecraft.server.v1_8_R3.BiomeBase;
import net.minecraft.server.v1_8_R3.MinecraftServer;
import org.bukkit.configuration.file.FileConfiguration;
public class Arcade extends JavaPlugin
{
@ -75,17 +73,6 @@ public class Arcade extends JavaPlugin
private ArcadeManager _gameManager;
private ServerConfiguration _serverConfiguration;
private final ConfigContainer _config = new ConfigContainer(this, "mineplex.yml");
@Override
public FileConfiguration getConfig() {
return _config.getConfig();
}
@Override
public void saveConfig() {
_config.saveConfig();
}
@Override
public void onEnable()

View File

@ -133,7 +133,8 @@ import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.server.ServerListPingEvent;
import org.bukkit.potion.PotionEffect;
import org.bukkit.util.Vector;
import net.minecraft.server.v1_8_R3.EntityLiving;
public class ArcadeManager extends MiniPlugin implements IRelation
{
// Modules
@ -870,7 +871,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
UtilInv.Clear(player);
((CraftEntity) player).getHandle().getDataWatcher().watch(0, Byte.valueOf((byte) 0));
((CraftEntity) player).getHandle().getDataWatcher().watch(0, Byte.valueOf((byte) 0), EntityLiving.META_ENTITYDATA, (byte) 0);
player.setCustomName("");
player.setCustomNameVisible(false);

View File

@ -88,7 +88,7 @@ public enum GameType
DragonRiders(DragonRiders.class, GameDisplay.DragonRiders),
Dragons(Dragons.class, GameDisplay.Dragons),
DragonsTeams(DragonsTeams.class, GameDisplay.DragonsTeams),
Draw(Draw.class, GameDisplay.Draw),
Draw(Draw.class, GameDisplay.Draw, "http://chivebox.com/mineplex/ResDrawMyThing.zip", true),
Evolution(Evolution.class, GameDisplay.Evolution),
Gravity(Gravity.class, GameDisplay.Gravity),
Halloween(Halloween.class, GameDisplay.Halloween, "http://file.mineplex.com/ResHalloween.zip", true),

View File

@ -1,6 +1,7 @@
package nautilus.game.arcade.game.games.christmas;
import java.util.HashSet;
import java.util.UUID;
import org.bukkit.Location;
import org.bukkit.Material;
@ -18,6 +19,8 @@ import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilPlayer;
import net.minecraft.server.v1_8_R3.DataWatcher;
import net.minecraft.server.v1_8_R3.Entity;
import net.minecraft.server.v1_8_R3.EntityArmorStand;
import net.minecraft.server.v1_8_R3.EntityPlayer;
import net.minecraft.server.v1_8_R3.EntityTrackerEntry;
import net.minecraft.server.v1_8_R3.Packet;
@ -162,11 +165,13 @@ public class SleighHorse
packet.d = (int) (loc.getY() * 32);
packet.e = (int) (loc.getZ() * 32) + this._previousDir[(i * 2) + 1];
packet.f = ((byte) (int) (loc.getYaw() * 256.0F / 360.0F));
packet.uuid = UUID.randomUUID();
// Setup datawatcher for armor stand
DataWatcher watcher = new DataWatcher(null);
watcher.a(0, (byte) 32);
watcher.a(10, (byte) 4);
watcher.a(11, new Vector3f(0, i * 180, (i == 0 ? -1 : 1) * 60f));
watcher.a(0, (byte) 32, Entity.META_ENTITYDATA, (byte) 32);
watcher.a(10, (byte) 4, EntityArmorStand.META_ARMOR_OPTION, (byte) 4);
watcher.a(11, new Vector3f(0, i * 180, (i == 0 ? -1 : 1) * 60f), EntityArmorStand.META_HEAD_POSE, new Vector3f(0, i * 180, (i == 0 ? -1 : 1) * 60f));
packet.l = watcher;
PacketPlayOutEntityEquipment enquipPacket = new PacketPlayOutEntityEquipment();
enquipPacket.a = id;

View File

@ -0,0 +1,25 @@
package nautilus.game.arcade.game.games.draw;
import org.bukkit.Material;
public class BlockInfo
{
private Material _type;
private byte _data;
public BlockInfo(Material type, byte data)
{
_type = type;
_data = data;
}
public Material getType()
{
return _type;
}
public byte getData()
{
return _data;
}
}

View File

@ -10,6 +10,7 @@ import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
@ -18,6 +19,7 @@ import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityShootBowEvent;
import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerInteractEvent;
@ -66,6 +68,7 @@ public class Draw extends SoloGame
//Brush
private byte _brushColor = 15;
private Material _brushMaterial = Material.WOOL;
private Location _brushPrevious = null;
private boolean _lockDrawer = true;
@ -88,22 +91,23 @@ public class Draw extends SoloGame
private String[] _holidayWords;
private boolean _useHolidayWords = false;
private HashSet<String> _usedWords = new HashSet<String>();
public Draw(ArcadeManager manager)
{
super(manager, GameType.Draw,
new Kit[]
{
new KitSlowAndSteady(manager),
new KitSelector(manager),
new KitTools(manager),
//new KitSlowAndSteady(manager),
//new KitSelector(manager),
// new KitTools(manager),
new KitArtist(manager)
},
new String[]
{
"Take turns to draw something",
"Right-Click with Swords to draw",
"Right-Click with items to draw",
"Hints are given at top of screen",
});
@ -111,11 +115,73 @@ public class Draw extends SoloGame
this.Damage = false;
this.HungerSet = 20;
this.WorldTimeSet = 8000;
_words = new String[]
{
"Bird", "Volcano", "Sloth", "Love", "Dance", "Hair", "Glasses", "Domino", "Dice", "Computer", "Top Hat", "Beard", "Wind", "Rain", "Minecraft", "Push", "Fighting", "Juggle", "Clown", "Miner", "Creeper", "Ghast", "Spider", "Punch", "Roll", "River", "Desert", "Cold", "Pregnant", "Photo", "Quick", "Mario", "Luigi", "Bridge", "Turtle", "Door Knob", "Mineplex", "Binoculars", "Telescope", "Planet", "Mountain Bike", "Moon", "Comet", "Flower", "Squirrel", "Horse Riding", "Chef", "Elephant", "Yoshi", "Shotgun", "Pistol", "James Bond", "Money", "Salt and Pepper", "Truck", "Helicopter", "Hot Air Balloon", "Sprout", "Yelling", "Muscles", "Skinny", "Zombie", "Lava", "Snake", "Motorbike", "Whale", "Boat", "Letterbox", "Window", "Lollipop", "Handcuffs", "Police", "Uppercut", "Windmill", "Eyepatch", "Campfire", "Rainbow", "Storm", "Pikachu", "Charmander", "Tornado", "Crying", "King", "Hobo", "Worm", "Snail", "XBox", "Playstation", "Nintendo", "Duck", "Pull", "Dinosaur", "Alligator", "Ankle", "Angel", "Acorn", "Bread", "Booty", "Bacon", "Crown", "Donut", "Drill", "Leash", "Magic", "Wizard", "Igloo", "Plant", "Screw", "Rifle", "Puppy", "Stool", "Stamp", "Letter", "Witch", "Zebra", "Wagon", "Compass", "Watch", "Clock", "Time", "Cyclops", "Coconut", "Hang", "Penguin", "Confused", "Bucket", "Lion", "Rubbish", "Spaceship", "Bowl", "Shark", "Pizza", "Pyramid", "Dress", "Pants", "Shorts", "Boots", "Boy", "Girl", "Math", "Sunglasses", "Frog", "Chair", "Cake", "Grapes", "Kiss", "Snorlax", "Earth", "Spaghetti", "Couch", "Family", "Milk", "Blood", "Pig", "Giraffe", "Mouse", "Couch", "Fat", "Chocolate", "Camel", "Cheese", "Beans", "Water", "Chicken", "Cannibal", "Zipper", "Book", "Swimming", "Horse", "Paper", "Toaster", "Television", "Hammer", "Piano", "Sleeping", "Yawn", "Sheep", "Night", "Chest", "Lamp", "Redstone", "Grass", "Plane", "Ocean", "Lake", "Melon", "Pumpkin", "Gift", "Fishing", "Pirate", "Lightning", "Stomach", "Belly Button", "Fishing Rod", "Iron Ore", "Diamonds", "Emeralds", "Nether Portal", "Ender Dragon", "Rabbit", "Harry Potter", "Torch", "Light", "Battery", "Zombie Pigman", "Telephone", "Tent", "Hand", "Traffic Lights", "Anvil", "Tail", "Umbrella", "Piston", "Skeleton", "Spikes", "Bridge", "Bomb", "Spoon", "Rainbow", "Staircase", "Poop", "Dragon", "Fire", "Apple", "Shoe", "Squid", "Cookie", "Tooth", "Camera", "Sock", "Monkey", "Unicorn", "Smile", "Pool", "Rabbit", "Cupcake", "Pancake", "Princess", "Castle", "Flag", "Planet", "Stars", "Camp Fire", "Rose", "Spray", "Pencil", "Ice Cream", "Toilet", "Moose", "Bear", "Beer", "Batman", "Eggs", "Teapot", "Golf Club", "Tennis Racket", "Shield", "Crab", "Pot of Gold", "Cactus", "Television", "Pumpkin Pie", "Chimney", "Stable", "Nether", "Wither", "Beach", "Stop Sign", "Chestplate", "Pokeball", "Christmas Tree", "Present", "Snowflake", "Laptop", "Superman", "Football", "Basketball", "Creeper", "Tetris", "Jump", "Ninja", "Baby", "Troll Face", "Grim Reaper", "Temple", "Explosion", "Vomit", "Ants", "Barn", "Burn", "Baggage", "Frisbee", "Iceberg", "Sleeping", "Dream", "Snorlax", "Balloons", "Elevator", "Alligator", "Bikini", "Butterfly", "Bumblebee", "Pizza", "Jellyfish", "Sideburns", "Speedboat", "Treehouse", "Water Gun", "Drink", "Hook", "Dance", "Fall", "Summer", "Autumn", "Spring", "Winter", "Night Time", "Galaxy", "Sunrise", "Sunset", "Picnic", "Snowflake", "Holding Hands", "America", "Laptop", "Anvil", "Bagel", "Bench", "Cigar", "Darts", "Muffin", "Queen", "Wheat", "Dolphin", "Scarf", "Swing", "Thumb", "Tomato", "Alcohol", "Armor", "Alien", "Beans", "Cheek", "Phone", "Keyboard", "Orange", "Calculator", "Paper", "Desk", "Disco", "Elbow", "Drool", "Giant", "Golem", "Grave", "Llama", "Moose", "Party", "Panda", "Plumber", "Salsa", "Salad", "Skunk", "Skull", "Stump", "Sugar", "Ruler", "Bookcase", "Hamster", "Soup", "Teapot", "Towel", "Waist", "Archer", "Anchor", "Bamboo", "Branch", "Booger", "Carrot", "Cereal", "Coffee", "Wolf", "Crayon", "Finger", "Forest", "Hotdog", "Burger", "Obsidian", "Pillow", "Swing", "YouTube", "Farm", "Rain", "Cloud", "Frozen", "Garbage", "Music", "Twitter", "Facebook", "Santa Hat", "Rope", "Neck", "Sponge", "Sushi", "Noodles", "Soup", "Tower", "Berry", "Capture", "Prison", "Robot", "Trash", "School", "Skype", "Snowman", "Crowd", "Bank", "Mudkip", "Joker", "Lizard", "Tiger", "Royal", "Erupt", "Wizard", "Stain", "Cinema", "Notebook", "Blanket", "Paint", "Guard", "Astronaut" , "Slime" , "Mansion" , "Radar" , "Thorn" , "Tears" , "Tiny" , "Candy" , "Pepsi" , "Flint" , "Draw My Thing" , "Rice" , "Shout" , "Prize" , "Skirt" , "Thief" , "Syrup" , "Kirby" , "Brush" , "Violin", "Car", "Sun", "Eye", "Bow", "Axe", "Face", "Mushroom", "Guitar", "Book",
};
{
"Bird", "Volcano", "Sloth", "Love", "Dance", "Hair", "Glasses", "Domino", "Dice", "Computer", "Top Hat",
"Beard", "Wind", "Rain", "Minecraft", "Push", "Fighting", "Juggle", "Clown", "Miner", "Creeper",
"Ghast", "Spider", "Punch", "Roll", "River", "Desert", "Cold", "Pregnant", "Photo", "Quick", "Mario",
"Luigi", "Bridge", "Turtle", "Door Knob", "Mineplex", "Binoculars", "Telescope", "Planet",
"Mountain Bike", "Moon", "Comet", "Flower", "Squirrel", "Horse Riding", "Chef", "Elephant", "Yoshi",
"Shotgun", "Pistol", "James Bond", "Money", "Salt and Pepper", "Truck", "Helicopter", "Hot Air Balloon",
"Sprout", "Yelling", "Muscles", "Skinny", "Zombie", "Lava", "Snake", "Motorbike", "Whale", "Boat",
"Letterbox", "Window", "Lollipop", "Handcuffs", "Police", "Uppercut", "Windmill", "Eyepatch", "Campfire",
"Rainbow", "Storm", "Pikachu", "Charmander", "Tornado", "Crying", "King", "Hobo", "Worm", "Snail",
"XBox", "Playstation", "Nintendo", "Duck", "Pull", "Dinosaur", "Alligator", "Ankle", "Angel", "Acorn",
"Bread", "Booty", "Bacon", "Crown", "Donut", "Drill", "Leash", "Magic", "Wizard", "Igloo", "Plant",
"Screw", "Rifle", "Puppy", "Stool", "Stamp", "Letter", "Witch", "Zebra", "Wagon", "Compass", "Watch",
"Clock", "Time", "Cyclops", "Coconut", "Hang", "Penguin", "Confused", "Bucket", "Lion", "Rubbish",
"Spaceship", "Bowl", "Shark", "Pizza", "Pyramid", "Dress", "Pants", "Shorts", "Boots", "Boy", "Girl",
"Math", "Sunglasses", "Frog", "Chair", "Cake", "Grapes", "Kiss", "Snorlax", "Earth", "Spaghetti",
"Couch", "Family", "Milk", "Blood", "Pig", "Giraffe", "Mouse", "Couch", "Fat", "Chocolate", "Camel",
"Cheese", "Beans", "Water", "Chicken", "Zipper", "Book", "Swimming", "Horse", "Paper", "Toaster",
"Television", "Hammer", "Piano", "Sleeping", "Yawn", "Sheep", "Night", "Chest", "Lamp", "Redstone",
"Grass", "Plane", "Ocean", "Lake", "Melon", "Pumpkin", "Gift", "Fishing", "Pirate",
"Lightning", "Stomach", "Belly Button", "Fishing Rod", "Iron Ore", "Diamonds", "Emeralds",
"Nether Portal", "Ender Dragon", "Rabbit", "Harry Potter", "Torch", "Light", "Battery", "Zombie Pigman",
"Telephone", "Tent", "Hand", "Traffic Lights", "Anvil", "Tail", "Umbrella", "Piston", "Skeleton",
"Spikes", "Bridge", "Bomb", "Spoon", "Rainbow", "Staircase", "Poop", "Dragon", "Fire", "Apple", "Shoe",
"Squid", "Cookie", "Tooth", "Camera", "Sock", "Monkey", "Unicorn", "Smile", "Pool", "Rabbit",
"Cupcake", "Pancake", "Princess", "Castle", "Flag", "Planet", "Stars", "Camp Fire", "Rose", "Spray",
"Pencil", "Ice Cream", "Toilet", "Moose", "Bear", "Beer", "Batman", "Eggs", "Teapot", "Golf Club",
"Tennis Racket", "Shield", "Crab", "Pot of Gold", "Cactus", "Television", "Pumpkin Pie", "Chimney",
"Stable", "Nether", "Wither", "Beach", "Stop Sign", "Chestplate", "Pokeball", "Christmas Tree",
"Present", "Snowflake", "Laptop", "Superman", "Football", "Basketball", "Creeper", "Tetris", "Jump",
"Ninja", "Baby", "Troll Face", "Grim Reaper", "Temple", "Explosion", "Vomit", "Ants", "Barn", "Burn",
"Baggage", "Frisbee", "Iceberg", "Sleeping", "Dream", "Snorlax", "Balloons", "Elevator", "Alligator",
"Bikini", "Butterfly", "Bumblebee", "Pizza", "Jellyfish", "Sideburns", "Speedboat", "Treehouse",
"Water Gun", "Drink", "Hook", "Dance", "Fall", "Summer", "Autumn", "Spring", "Winter", "Night Time",
"Galaxy", "Sunrise", "Sunset", "Picnic", "Snowflake", "Holding Hands", "America", "Laptop", "Anvil",
"Bagel", "Bench", "Cigar", "Darts", "Muffin", "Queen", "Wheat", "Dolphin", "Scarf", "Swing", "Thumb",
"Tomato", "Armor", "Alien", "Beans", "Cheek", "Phone", "Keyboard", "Orange", "Calculator",
"Paper", "Desk", "Disco", "Elbow", "Drool", "Giant", "Golem", "Grave", "Llama", "Moose", "Party",
"Panda", "Plumber", "Salsa", "Salad", "Skunk", "Skull", "Stump", "Sugar", "Ruler", "Bookcase",
"Hamster", "Soup", "Teapot", "Towel", "Waist", "Archer", "Anchor", "Bamboo", "Branch", "Booger",
"Carrot", "Cereal", "Coffee", "Wolf", "Crayon", "Finger", "Forest", "Hotdog", "Burger", "Obsidian",
"Pillow", "Swing", "YouTube", "Farm", "Rain", "Cloud", "Frozen", "Garbage", "Music", "Twitter",
"Facebook", "Santa Hat", "Rope", "Neck", "Sponge", "Sushi", "Noodles", "Soup", "Tower", "Berry",
"Capture", "Prison", "Robot", "Trash", "School", "Skype", "Snowman", "Crowd", "Bank", "Mudkip",
"Joker", "Lizard", "Tiger", "Royal", "Erupt", "Wizard", "Stain", "Cinema", "Notebook", "Blanket",
"Paint", "Guard", "Astronaut" , "Slime" , "Mansion" , "Radar" , "Thorn" , "Tears" , "Tiny" , "Candy" ,
"Pepsi" , "Flint" , "Draw My Thing" , "Rice" , "Shout" , "Prize" , "Skirt" , "Thief" , "Syrup" ,
"Kirby" , "Brush" , "Violin", "Car", "Sun", "Eye", "Bow", "Axe", "Face", "Mushroom", "Guitar",
"Pickle", "Banana", "Crab", "Sugar", "Soda", "Cookie", "Burger", "Fries", "Speaker",
"Pillow", "Rug", "Purse", "Monitor", "Bow", "Pen", "Cat", "Kitten", "Puppy", "Bed", "Button",
"Computer", "Key", "Spoon", "Lamp", "Bottle", "Card", "Newspaper", "Glasses", "Mountain", "Minecraft",
"Shirt", "Truck", "Car", "Phone", "Cork", "iPod", "Paper", "Bag", "USB", "CD", "Wallet", "Cow", "Pig",
"Sheep", "Tomato", "Painting", "Chair", "Keyboard", "Chocolate", "Duck", "Clock", "Balloon", "Remote",
"Bread", "Ring", "Necklace", "Hippo", "Flag", "Window", "Door", "Radio", "Television", "Boat",
"Fridge", "House", "Piano", "Guitar", "Trumpet", "Drums", "Speaker", "Helmet", "Tree", "Slippers",
"Table", "Doll", "Headphones", "Box", "Flower", "Book", "Carrot", "Egg", "Sun", "Hill", "Candle",
"Food", "Mouse", "Money", "Emerald", "Magnet", "Camera", "Movie", "Video Game", "Teddy", "Lake",
"Violin", "Cheese", "Burger", "Peasant", "King", "Queen", "Prince", "Princess", "Mother", "Father", "Taco",
"Racecar", "Car", "Truck", "Tree", "Elephant", "Lion", "Pig", "Cow", "Chicken", "Dog", "Cat", "Moon", "Stars",
"Sun", "Diamond", "Gold", "Redstone", "Skateboard", "Bike", "Swimming Pool", "Cookie", "Computer", "Laptop",
"Piano", "Guitar", "Trumpet", "Drums", "Flute", "Helicopter", "Plane", "Football", "Tennis", "Hockey",
"Water", "Ocean", "Microsoft", "Twitter", "Godzilla", "Building", "House", "Rainbow", "Barbie", "Girl", "Boy",
"Children", "Bomb", "Explosion", "Gun", "Tank", "Penguin", "Eagle", "America", "Kangaroo", "Sea", "Raspberry",
"Strawberry", "Jam", "Sandwich", "Owl", "Watermelon", "Australia", "Canada", "United States", "Diary"
};
_holidayWords = new String[]
{
@ -150,13 +216,50 @@ public class Draw extends SoloGame
@Override
public void ParseData()
{
for (Location loc : WorldData.GetCustomLocs("159"))
_canvas.add(loc.getBlock());
int count = 0;
for (Block b : UtilBlock.getInBoundingBox(WorldData.GetDataLocs("PINK").get(0), WorldData.GetDataLocs("PINK").get(1), false))
{
if (b.getType() != Material.AIR)
{
_canvas.add(b);
count++;
}
}
System.out.println("===");
System.out.println("Draw loc: " + WorldData.GetDataLocs("RED").size());
System.out.println("Canvas Count: " + count);
System.out.println("===");
_drawerLocation = WorldData.GetDataLocs("RED").get(0);
_textLocation = WorldData.GetDataLocs("YELLOW").get(0);
}
@EventHandler
public void clearBoardStart(GameStateChangeEvent e)
{
if (e.GetState() != GameState.Live)
return;
Reset();
for (Player player : GetPlayers(true))
player.setGameMode(GameMode.ADVENTURE);
}
@EventHandler
public void playerFallCloudy(PlayerMoveEvent e)
{
if (!GetPlayers(true).contains(e.getPlayer()))
return;
if (!WorldData.MapName.equalsIgnoreCase("Cloudy"))
return;
if (e.getTo().getBlockY() <= 130)
{
GetTeam(e.getPlayer()).SpawnTeleport(e.getPlayer());
}
}
@Override
@ -281,21 +384,20 @@ public class Draw extends SoloGame
drawer.setAllowFlight(true);
drawer.setFlying(true);
drawer.setFlySpeed(0.4f);
drawer.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.WOOD_SWORD, (byte)0, 1, "Thin Paint Brush"));
drawer.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte)0, 1, "Thick Paint Brush"));
if (GetKit(drawer) instanceof KitTools)
{
drawer.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.STONE_SWORD, (byte)0, 1, "Line Tool"));
drawer.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.GOLD_SWORD, (byte)0, 1, "Square Tool"));
drawer.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.DIAMOND_SWORD, (byte)0, 1, "Circle Tool"));
}
drawer.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.WOOD_SWORD, (byte) 0, 1, "Pencil"));
drawer.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte) 0, 1, "Paint Brush"));
drawer.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.STONE_SWORD, (byte) 0, 1, "Line Tool"));
drawer.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.GOLD_SWORD, (byte)0, 1, "Square Tool"));
drawer.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.DIAMOND_SWORD, (byte)0, 1, "Circle Tool"));
drawer.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW, (byte)0, 1, "Spray Can"));
drawer.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BUCKET, (byte)0, 1, "Paint Bucket"));
drawer.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.TNT, (byte)0, 1, "Clear Canvas"));
drawer.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_HOE, (byte)0, 1, "Paint Bucket"));
drawer.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.GOLD_HOE, (byte)0, 1, "Clear Canvas"));
Announce(C.cGold + C.Bold + "Round " + (_roundCount+1) + ": " + C.cYellow + C.Bold + drawer.getName() + " is drawing!");
drawer.getInventory().setItem(10, ItemStackFactory.Instance.CreateStack(Material.ARROW, (byte)0, 1, "Paint"));
Announce(C.cGold + C.Bold + "Round " + (_roundCount + 1) + ": " + C.cYellow + C.Bold + drawer.getName() + " is drawing!");
}
}
@ -477,7 +579,66 @@ public class Draw extends SoloGame
for (Tool tool : _tools)
tool.update();
}
@EventHandler
public void sprayCan(UpdateEvent e)
{
if (e.getType() != UpdateType.TICK)
return;
if (!IsLive())
return;
for (Player p : _drawers.GetPlayers(true))
{
if (!UtilGear.isMat(p.getItemInHand(), Material.BOW))
continue;
if (!UtilPlayer.isChargingBow(p))
{
_brushPrevious = null;
continue;
}
Block block = UtilPlayer.getTarget(p, UtilBlock.blockPassSet, 400);
if (block == null || !_canvas.contains(block))
continue;
// Spray
block.setType(_brushMaterial);
block.setData(_brushColor);
for (Block surround : UtilBlock.getSurrounding(block, true))
{
if (!_canvas.contains(surround))
continue;
if (Math.random() > 0.5)
{
surround.setType(_brushMaterial);
surround.setData(_brushColor);
}
}
for (Player other : UtilServer.getPlayers())
other.playSound(other.getLocation(), Sound.FIZZ, 0.2f, 2f);
_lockDrawer = false;
_brushPrevious = block.getLocation().add(0.5, 0.5, 0.5);
}
}
@EventHandler
public void sprayCanArrowCancel(EntityShootBowEvent e)
{
if (e.getEntity() instanceof Player)
{
e.setCancelled(true);
((Player)e.getEntity()).updateInventory();
}
}
@EventHandler
public void Paint(UpdateEvent event)
{
@ -491,23 +652,24 @@ public class Draw extends SoloGame
{
if (!UtilGear.isMat(player.getItemInHand(), Material.WOOD_SWORD) && !UtilGear.isMat(player.getItemInHand(), Material.IRON_SWORD))
continue;
if (!player.isBlocking())
{
_brushPrevious = null;
continue;
}
Block block = player.getTargetBlock((HashSet<Byte>) null, 200);
if (block == null || !_canvas.contains(block))
Block block = UtilPlayer.getTarget(player, UtilBlock.blockPassSet, 400);
if (block == null || !_canvas.contains(block))
continue;
if (block.getData() == _brushColor)
if (block.getData() == _brushColor && block.getType() == _brushMaterial)
continue;
//Color
block.setType(_brushMaterial);
block.setData(_brushColor);
//Thick Brush
if (UtilGear.isMat(player.getItemInHand(), Material.IRON_SWORD))
{
@ -515,25 +677,27 @@ public class Draw extends SoloGame
{
if (!_canvas.contains(other))
continue;
block.setType(_brushMaterial);
other.setData(_brushColor);
}
}
//Join Dots
if (_brushPrevious != null)
{
{
while (UtilMath.offset(_brushPrevious, block.getLocation().add(0.5, 0.5, 0.5)) > 0.5)
{
{
_brushPrevious.add(UtilAlg.getTrajectory(_brushPrevious, block.getLocation().add(0.5, 0.5, 0.5)).multiply(0.5));
Block fixBlock = _brushPrevious.getBlock();
if (!_canvas.contains(fixBlock))
continue;
fixBlock.setType(_brushMaterial);
fixBlock.setData(_brushColor);
//Thick Brush
if (UtilGear.isMat(player.getItemInHand(), Material.IRON_SWORD))
{
@ -541,18 +705,19 @@ public class Draw extends SoloGame
{
if (!_canvas.contains(other))
continue;
other.setType(_brushMaterial);
other.setData(_brushColor);
}
}
}
}
for (Player other : UtilServer.getPlayers())
other.playSound(other.getLocation(), Sound.FIZZ, 0.2f, 2f);
_lockDrawer = false;
_brushPrevious = block.getLocation().add(0.5, 0.5, 0.5);
}
}
@ -565,7 +730,7 @@ public class Draw extends SoloGame
Player player = event.getPlayer();
if (!UtilGear.isMat(player.getItemInHand(), Material.TNT))
if (!UtilGear.isMat(player.getItemInHand(), Material.GOLD_HOE))
return;
if (!_drawers.HasPlayer(player))
@ -580,6 +745,7 @@ public class Draw extends SoloGame
//Restore
_brushColor = color;
_brushMaterial = Material.WOOL;
_lockDrawer = false;
for (Player other : UtilServer.getPlayers())
@ -587,48 +753,60 @@ public class Draw extends SoloGame
}
@EventHandler
public void PaintBucket(PlayerInteractEvent event)
{
public void paintFill(PlayerInteractEvent e)
{
if (!IsLive())
return;
Player player = event.getPlayer();
if (!UtilGear.isMat(player.getItemInHand(), Material.BUCKET))
Player p = e.getPlayer();
if (!UtilGear.isMat(p.getItemInHand(), Material.IRON_HOE))
{
// Not the correct tool (iron hoe = paint fill).
return;
}
if (!_drawers.HasPlayer(p))
{
// Not drawing.
return;
}
// Get the target block that the player clicks on.
Block target = UtilPlayer.getTarget(p, UtilBlock.blockPassSet, 400);
if (target == null || !_canvas.contains(target))
{
// Target block is non-existent or not in the canvas.
return;
}
Material material = target.getType();
byte data = target.getData();
if (data == _brushColor && material == _brushMaterial)
return;
if (!_drawers.HasPlayer(player))
return;
Block block = player.getTargetBlock((HashSet<Byte>) null, 200);
if (block == null || !_canvas.contains(block))
return;
//Fill
byte color = block.getData();
if (color == _brushColor)
return;
FillRecurse(block, color);
fillRecursive(target, material, data);
for (Player other : UtilServer.getPlayers())
other.playSound(other.getLocation(), Sound.SPLASH, 0.4f, 1.5f);
}
public void FillRecurse(Block block, byte color)
private void fillRecursive(Block block, final Material fillMaterial, final byte fillData)
{
if (block.getData() != color)
return;
if (!_canvas.contains(block))
return;
block.setData(_brushColor);
for (Block other : UtilBlock.getSurrounding(block, false))
if (!_canvas.contains(block) || block.getType() != fillMaterial || block.getData() != fillData)
{
FillRecurse(other, color);
return;
}
block.setTypeIdAndData(_brushMaterial.getId(), _brushColor, false);
List<Block> around = UtilBlock.getSurrounding(block, false);
for (Block next : around)
{
fillRecursive(next, fillMaterial, fillData);
}
}
@ -643,11 +821,40 @@ public class Draw extends SoloGame
if (!_drawers.HasPlayer(player))
return;
Block block = player.getTargetBlock((HashSet<Byte>) null, 200);
if (block == null || block.getType() != Material.WOOL || _canvas.contains(block))
Block target = UtilPlayer.getTarget(player, UtilBlock.blockPassSet, 400);
if (target == null)
return;
Location loc = target.getLocation();
List<Block> possibleBlocks = UtilBlock.getInBoundingBox(WorldData.GetDataLocs("GREEN").get(0),
WorldData.GetDataLocs("GREEN").get(1));
Block block = player.getWorld().getBlockAt(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
if (block == null)
{
return;
}
for (Block other : possibleBlocks)
{
if (
other.getX() == block.getX()
&& other.getY() == block.getY()
&& other.getZ() == block.getZ()
)
{
block = other;
}
}
if (block == null || !possibleBlocks.contains(block))
return;
_brushColor = block.getData();
_brushMaterial = block.getType();
player.playSound(player.getLocation(), Sound.ORB_PICKUP, 2f, 1f);
}
@ -656,11 +863,13 @@ public class Draw extends SoloGame
{
for (Block block : _canvas)
{
if (block.getTypeId() != 35 || block.getData() != 0)
block.setTypeIdAndData(35, (byte)0, false);
// if (block.getTypeId() != 35 || block.getData() != 0)
// block.setTypeIdAndData(35, (byte)0, false);
block.setTypeIdAndData(35, (byte) 0, false);
}
_brushColor = 15;
_brushMaterial = Material.WOOL;
if (_textBlocks != null)
{
@ -843,6 +1052,11 @@ public class Draw extends SoloGame
return _brushColor;
}
public Material getBrushMaterial()
{
return _brushMaterial;
}
public void setLock(boolean b)
{
_lockDrawer = b;

View File

@ -0,0 +1,38 @@
package nautilus.game.arcade.game.games.draw.kits;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
/**
* Created by William (WilliamTiger).
* 23/12/15
*/
public class KitArtist extends Kit
{
public KitArtist(ArcadeManager manager)
{
super(manager, "Artist", KitAvailability.Free,
new String[]
{
"The world is but a canvas to your imagination."
},
new Perk[]
{
},
EntityType.ZOMBIE, new ItemStack(Material.IRON_SWORD));
}
@Override
public void GiveItems(Player player)
{
}
}

View File

@ -1,13 +1,17 @@
package nautilus.game.arcade.game.games.draw.tools;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilEvent.ActionType;
import nautilus.game.arcade.game.games.draw.BlockInfo;
import nautilus.game.arcade.game.games.draw.Draw;
import org.bukkit.Material;
@ -25,8 +29,8 @@ public abstract class Tool
protected Material _material;
protected HashMap<Block, Byte> _past = new HashMap<Block, Byte>();
protected HashMap<Block, Byte> _new = new HashMap<Block, Byte>();
protected HashMap<Block, BlockInfo> _past = new HashMap<Block, BlockInfo>();
protected HashMap<Block, BlockInfo> _new = new HashMap<Block, BlockInfo>();
public Tool(Draw host, Material mat)
{
@ -36,9 +40,13 @@ public abstract class Tool
public void start(PlayerInteractEvent event)
{
if (_start != null)
return;
if (!UtilEvent.isAction(event, ActionType.R))
return;
Block block = event.getPlayer().getTargetBlock((HashSet<Byte>) null, 60);
Block block = UtilPlayer.getTarget(event.getPlayer(), UtilBlock.blockPassSet, 400);
if (block == null)
return;
@ -68,10 +76,10 @@ public abstract class Tool
return;
}
_new = new HashMap<Block, Byte>();
_new = new HashMap<Block, BlockInfo>();
//Calculate New
Block end = _drawer.getTargetBlock((HashSet<Byte>) null, 64);
Block end = UtilPlayer.getTarget(_drawer, UtilBlock.blockPassSet, 400);
if (end != null && Host.getCanvas().contains(end))
{
customDraw(end);
@ -81,7 +89,10 @@ public abstract class Tool
for (Block block : _past.keySet())
{
if (!_new.containsKey(block))
block.setData(_past.get(block));
{
block.setType(_past.get(block).getType());
block.setData(_past.get(block).getData());
}
}
_past = _new;

View File

@ -3,6 +3,7 @@ package nautilus.game.arcade.game.games.draw.tools;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import nautilus.game.arcade.game.games.draw.BlockInfo;
import nautilus.game.arcade.game.games.draw.Draw;
import org.bukkit.Location;
@ -48,10 +49,15 @@ public class ToolCircle extends Tool
return;
byte color = block.getData();
Material type = block.getType();
if (_past.containsKey(block))
color = _past.get(block);
{
type = _past.get(block).getType();
color = _past.get(block).getData();
}
_new.put(block, color);
_new.put(block, new BlockInfo(type, color));
block.setType(Host.getBrushMaterial());
block.setData(Host.getColor());
}
}

View File

@ -2,6 +2,7 @@ package nautilus.game.arcade.game.games.draw.tools;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilMath;
import nautilus.game.arcade.game.games.draw.BlockInfo;
import nautilus.game.arcade.game.games.draw.Draw;
import org.bukkit.Location;
@ -32,10 +33,15 @@ public class ToolLine extends Tool
continue;
byte color = lineBlock.getData();
Material type = lineBlock.getType();
if (_past.containsKey(lineBlock))
color = _past.get(lineBlock);
{
type = _past.get(lineBlock).getType();
color = _past.get(lineBlock).getData();
}
_new.put(lineBlock, color);
_new.put(lineBlock, new BlockInfo(type, color));
lineBlock.setType(Host.getBrushMaterial());
lineBlock.setData(Host.getColor());
}
}

View File

@ -1,5 +1,6 @@
package nautilus.game.arcade.game.games.draw.tools;
import nautilus.game.arcade.game.games.draw.BlockInfo;
import nautilus.game.arcade.game.games.draw.Draw;
import org.bukkit.Location;
@ -71,12 +72,17 @@ public class ToolSquare extends Tool
if (!Host.getCanvas().contains(block))
return;
Material type = block.getType();
byte color = block.getData();
if (_past.containsKey(block))
color = _past.get(block);
{
type = _past.get(block).getType();
color = _past.get(block).getData();
}
_new.put(block, color);
_new.put(block, new BlockInfo(type, color));
block.setType(Host.getBrushMaterial());
block.setData(Host.getColor());
}
}

View File

@ -259,7 +259,7 @@ public class HideSeek extends TeamGame
.sendPacket(
player,
blockForm
.getBlockPackets());
.getBlockPackets(UtilPlayer.is1_9(player)));
}
});
break;

View File

@ -1,5 +1,7 @@
package nautilus.game.arcade.game.games.hideseek.forms;
import java.util.UUID;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.MapUtil;
@ -15,10 +17,12 @@ import mineplex.core.recharge.Recharge;
import nautilus.game.arcade.game.games.hideseek.HideSeek;
import nautilus.game.arcade.game.games.hideseek.kits.KitHiderQuick;
import net.minecraft.server.v1_8_R3.DataWatcher;
import net.minecraft.server.v1_8_R3.Entity;
import net.minecraft.server.v1_8_R3.EntityPlayer;
import net.minecraft.server.v1_8_R3.EntityTrackerEntry;
import net.minecraft.server.v1_8_R3.Packet;
import net.minecraft.server.v1_8_R3.PacketPlayOutAttachEntity;
import net.minecraft.server.v1_8_R3.PacketPlayOutNewAttachEntity;
import net.minecraft.server.v1_8_R3.PacketPlayOutEntity.PacketPlayOutRelEntityMove;
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy;
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityTeleport;
@ -68,23 +72,23 @@ public class BlockForm extends Form
}
@Override
public void Apply()
{
// Remove Old
if (Player.getPassenger() != null)
{
Player.getPassenger().remove();
Player.eject();
}
public void Apply()
{
// Remove Old
if (Player.getPassenger() != null)
{
Player.getPassenger().remove();
Player.eject();
}
EntityPlayer player = ((CraftPlayer) Player).getHandle();
player.getDataWatcher().watch(0, Byte.valueOf((byte) 32));
EntityPlayer player = ((CraftPlayer) Player).getHandle();
player.getDataWatcher().watch(0, Byte.valueOf((byte) 32), Entity.META_ENTITYDATA, (byte) 32);
// Player > Chicken
DisguiseChicken disguise = new DisguiseChicken(Player);
disguise.setBaby();
disguise.setInvisible(true);
// Player > Chicken
DisguiseChicken disguise = new DisguiseChicken(Player);
disguise.setBaby();
disguise.setInvisible(true);
disguise.setSoundDisguise(new DisguiseCat(Player));
Host.Manager.GetDisguise().disguise(disguise);
@ -102,65 +106,94 @@ public class BlockForm extends Form
packet1.d = (int) Math.floor(_lastSaw.getY() * 32);
packet1.e = (int) Math.floor(_lastSaw.getZ() * 32);
DataWatcher watcher = new DataWatcher(null);
watcher.a(0, (byte) 32);
watcher.a(1, 0);
watcher.a(0, (byte) 32, Entity.META_ENTITYDATA, (byte) 32);
watcher.a(1, 0, Entity.META_AIR, 0);
packet1.l = watcher;
packet1.uuid = UUID.randomUUID();
packets[0] = packet1;
PacketPlayOutAttachEntity packet3 = new PacketPlayOutAttachEntity();
if (UtilPlayer.is1_9(Player))
{
packets[2] = new PacketPlayOutNewAttachEntity(_selfEntityId1, new int[]
{
_selfEntityId2
});
packet3.b = _selfEntityId2;
packet3.c = _selfEntityId1;
packets[2] = packet3;
}
else
{
PacketPlayOutAttachEntity packet3 = new PacketPlayOutAttachEntity();
PacketPlayOutSpawnEntity packet2 = new PacketPlayOutSpawnEntity(player,
70, _mat.getId());
packet3.b = _selfEntityId2;
packet3.c = _selfEntityId1;
packets[2] = packet3;
}
PacketPlayOutSpawnEntity packet2 = new PacketPlayOutSpawnEntity(player, 70, _mat.getId());
packet2.a = _selfEntityId2;
packet2.uuid = UUID.randomUUID();
packets[1] = packet2;
UtilPlayer.sendPacket(Player, packets);
// Inform
String blockName = F.elem(ItemStackFactory.Instance.GetName(_mat, (byte) 0, false));
if (!blockName.contains("Block"))
UtilPlayer.message(
Player,
F.main("Game",
C.cWhite + "You are now a "
+ F.elem(ItemStackFactory.Instance.GetName(_mat, (byte) 0, false) + " Block") + "!"));
else
UtilPlayer.message(
Player,
F.main("Game", C.cWhite + "You are now a " + F.elem(ItemStackFactory.Instance.GetName(_mat, (byte) 0, false))
+ "!"));
if (!blockName.contains("Block"))
UtilPlayer.message(
Player,
F.main("Game",
C.cWhite + "You are now a "
+ F.elem(ItemStackFactory.Instance.GetName(_mat, (byte) 0, false) + " Block") + "!"));
else
UtilPlayer.message(
Player,
F.main("Game", C.cWhite + "You are now a " + F.elem(ItemStackFactory.Instance.GetName(_mat, (byte) 0, false))
+ "!"));
// Give Item
Player.getInventory().setItem(8, new ItemStack(Host.GetItemEquivilent(_mat)));
UtilInv.Update(Player);
// Give Item
Player.getInventory().setItem(8, new ItemStack(Host.GetItemEquivilent(_mat)));
UtilInv.Update(Player);
// Sound
Player.playSound(Player.getLocation(), Sound.ZOMBIE_UNFECT, 2f, 2f);
}
public Packet[] getBlockPackets()
{
PacketPlayOutSpawnEntity packet2 = new PacketPlayOutSpawnEntity(((CraftPlayer) Player).getHandle(),
70, _mat.getId());
packet2.a = _blockId;
PacketPlayOutAttachEntity packet3 = new PacketPlayOutAttachEntity();
packet3.b = _blockId;
packet3.c = Player.getEntityId();
return new Packet[] {packet2, packet3};
// Sound
Player.playSound(Player.getLocation(), Sound.ZOMBIE_UNFECT, 2f, 2f);
}
public Packet[] getBlockPackets(boolean is19)
{
Packet[] packets = new Packet[2];
PacketPlayOutSpawnEntity packet2 = new PacketPlayOutSpawnEntity(((CraftPlayer) Player).getHandle(), 70, _mat.getId());
packet2.a = _blockId;
packet2.uuid = UUID.randomUUID();
packets[0] = packet2;
if (is19)
{
packets[2] = new PacketPlayOutNewAttachEntity(_blockId, new int[]
{
Player.getEntityId()
});
}
else
{
PacketPlayOutAttachEntity packet3 = new PacketPlayOutAttachEntity();
packet3.b = _blockId;
packet3.c = Player.getEntityId();
packets[1] = packet3;
}
return packets;
}
public int getBlockId()
{
return _blockId;
}
@Override
public void Remove()
{
@ -169,19 +202,20 @@ public class BlockForm extends Form
Host.Manager.GetDisguise().undisguise(Player);
UtilPlayer.sendPacket(Player, new PacketPlayOutEntityDestroy(new int[]
{
_selfEntityId1, _selfEntityId2, _blockId
}));
{
_selfEntityId1,
_selfEntityId2,
_blockId
}));
((CraftEntity) Player).getHandle().getDataWatcher()
.watch(0, Byte.valueOf((byte) 0));
((CraftEntity) Player).getHandle().getDataWatcher().watch(0, (byte) 0, Entity.META_ENTITYDATA, (byte) 0);
}
public void SolidifyUpdate()
{
if (!Player.isSprinting())
((CraftEntity) Player).getHandle().getDataWatcher()
.watch(0, Byte.valueOf((byte) 32));
.watch(0, Byte.valueOf((byte) 32), Entity.META_ENTITYDATA, (byte) 32);
// Not a Block
if (_block == null)
@ -199,8 +233,7 @@ public class BlockForm extends Form
if (Host.GetKit(Player) instanceof KitHiderQuick)
hideBoost = 0.1;
Player.setExp((float) Math.min(0.999f, Player.getExp()
+ hideBoost));
Player.setExp((float) Math.min(0.999f, Player.getExp() + hideBoost));
// Set Block
if (Player.getExp() >= 0.999f)
@ -208,25 +241,20 @@ public class BlockForm extends Form
Block block = Player.getLocation().getBlock();
// Not Able
if (block.getType() != Material.AIR
|| !UtilBlock.solid(block
.getRelative(BlockFace.DOWN)))
if (block.getType() != Material.AIR || !UtilBlock.solid(block.getRelative(BlockFace.DOWN)))
{
UtilPlayer.message(Player, F.main("Game",
"You cannot become a Solid Block here."));
UtilPlayer.message(Player, F.main("Game", "You cannot become a Solid Block here."));
Player.setExp(0f);
return;
}
Bukkit.getPluginManager().callEvent(
new HideSeek.PlayerSolidifyEvent(Player));
Bukkit.getPluginManager().callEvent(new HideSeek.PlayerSolidifyEvent(Player));
// Set Block
_block = block;
// Effect
Player.playEffect(Player.getLocation(), Effect.STEP_SOUND,
_mat);
Player.playEffect(Player.getLocation(), Effect.STEP_SOUND, _mat);
// block.getWorld().playEffect(block.getLocation(),
// Effect.STEP_SOUND, _mat);
@ -238,19 +266,16 @@ public class BlockForm extends Form
// Player, Player, 60000, false, false);
// Sound
Player.playSound(Player.getLocation(), Sound.NOTE_PLING,
1f, 2f);
Player.playSound(Player.getLocation(), Sound.NOTE_PLING, 1f, 2f);
// Teleport falling block to the position.
Vector blockLoc = _block.getLocation()
.add(0.5, -.21875, 0.5).toVector();
Vector blockLoc = _block.getLocation().add(0.5, -.21875, 0.5).toVector();
_sawDiff.add(blockLoc.clone().subtract(_lastSaw));
Packet packet = this.getPacket(_sawDiff, blockLoc);
_lastSaw = Player.getLocation().toVector()
.subtract(new Vector(0, 0.15625, 0));
_lastSaw = Player.getLocation().toVector().subtract(new Vector(0, 0.15625, 0));
_sawDiff = _lastSaw.clone().subtract(blockLoc);
if (packet != null)
@ -260,17 +285,15 @@ public class BlockForm extends Form
_sawDiff = new Vector();
}
((CraftPlayer) Player).getHandle().playerConnection
.sendPacket(packet);
((CraftPlayer) Player).getHandle().playerConnection.sendPacket(packet);
}
for (Player player : UtilServer.getPlayers())
{
UtilPlayer.sendPacket(player,
new PacketPlayOutEntityDestroy(new int[]
{
getBlockId()
}));
UtilPlayer.sendPacket(player, new PacketPlayOutEntityDestroy(new int[]
{
getBlockId()
}));
}
}
}
@ -298,16 +321,14 @@ public class BlockForm extends Form
MapUtil.QuickChangeBlockAt(_block.getLocation(), 0, (byte) 0);
_block = null;
EntityTrackerEntry tracker = (EntityTrackerEntry) ((WorldServer) ((CraftEntity) Player)
.getHandle().world).tracker.trackedEntities.get(Player
.getEntityId());
EntityTrackerEntry tracker = (EntityTrackerEntry) ((WorldServer) ((CraftEntity) Player).getHandle().world).tracker.trackedEntities
.get(Player.getEntityId());
if (tracker != null)
{
for (EntityPlayer entity : tracker.trackedPlayers)
{
UtilPlayer.sendPacket(entity.getBukkitEntity(),
getBlockPackets());
UtilPlayer.sendPacket(entity.getBukkitEntity(), getBlockPackets(UtilPlayer.is1_9(entity.getBukkitEntity())));
}
}
}
@ -348,13 +369,10 @@ public class BlockForm extends Form
if (_lastSaw != null)
{
this._sawDiff.add(Player.getLocation()
.subtract(0, 0.15625, 0).toVector()
.subtract(_lastSaw));
this._sawDiff.add(Player.getLocation().subtract(0, 0.15625, 0).toVector().subtract(_lastSaw));
}
_lastSaw = Player.getLocation().subtract(0, 0.15625, 0)
.toVector();
_lastSaw = Player.getLocation().subtract(0, 0.15625, 0).toVector();
Packet packet = this.getPacket(_sawDiff, _lastSaw);
@ -363,8 +381,7 @@ public class BlockForm extends Form
if (packet instanceof PacketPlayOutRelEntityMove)
{
PacketPlayOutRelEntityMove relPacket = (PacketPlayOutRelEntityMove) packet;
_sawDiff.subtract(new Vector(relPacket.b / 32D,
relPacket.c / 32D, relPacket.d / 32D));
_sawDiff.subtract(new Vector(relPacket.b / 32D, relPacket.c / 32D, relPacket.d / 32D));
}
else
{
@ -384,8 +401,7 @@ public class BlockForm extends Form
if (x != 0 || y != 0 || z != 0)
{
if (x >= -128 && x <= 127 && y >= -128 && y <= 127 && z >= -128
&& z <= 127)
if (x >= -128 && x <= 127 && y >= -128 && y <= 127 && z >= -128 && z <= 127)
{
PacketPlayOutRelEntityMove relMove = new PacketPlayOutRelEntityMove();
relMove.a = this._selfEntityId1;

View File

@ -7,6 +7,7 @@ import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.disguise.disguises.*;
import nautilus.game.arcade.game.games.hideseek.HideSeek;
import net.minecraft.server.v1_8_R3.Entity;
import org.bukkit.Material;
import org.bukkit.Sound;
@ -43,7 +44,7 @@ public class CreatureForm extends Form
_disguise.setSoundDisguise(new DisguiseCat(Player));
Host.Manager.GetDisguise().disguise(_disguise);
((CraftEntity)Player).getHandle().getDataWatcher().watch(0, Byte.valueOf((byte) 0));
((CraftEntity)Player).getHandle().getDataWatcher().watch(0, Byte.valueOf((byte) 0), Entity.META_ENTITYDATA, (byte) 0);
//Inform
UtilPlayer.message(Player, F.main("Game", C.cWhite + "You are now a " + F.elem(UtilEnt.getName(_type)) + "!"));
@ -61,6 +62,6 @@ public class CreatureForm extends Form
{
Host.Manager.GetDisguise().undisguise(Player);
((CraftEntity)Player).getHandle().getDataWatcher().watch(0, Byte.valueOf((byte) 0));
((CraftEntity)Player).getHandle().getDataWatcher().watch(0, Byte.valueOf((byte) 0), Entity.META_ENTITYDATA, (byte) 0);
}
}

View File

@ -11,11 +11,13 @@ import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import net.minecraft.server.v1_8_R3.DataWatcher;
import net.minecraft.server.v1_8_R3.Entity;
import net.minecraft.server.v1_8_R3.Packet;
import net.minecraft.server.v1_8_R3.PacketPlayOutAttachEntity;
import net.minecraft.server.v1_8_R3.PacketPlayOutEntity;
import net.minecraft.server.v1_8_R3.PacketPlayOutEntity.PacketPlayOutRelEntityMove;
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy;
import net.minecraft.server.v1_8_R3.PacketPlayOutNewAttachEntity;
import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntity;
import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving;
@ -176,9 +178,10 @@ public class Wall
packet1.d = (int) Math.floor((entry.getKey().getY() - 0.15625) * 32);
packet1.e = (int) Math.floor(entry.getKey().getZ() * 32);
DataWatcher watcher = new DataWatcher(null);
watcher.a(0, (byte) 32);
watcher.a(1, 0);
watcher.a(0, (byte) 32, Entity.META_ENTITYDATA, (byte) 32);
watcher.a(1, 0, Entity.META_AIR, 0);
packet1.l = watcher;
packet1.uuid = UUID.randomUUID();
PacketPlayOutSpawnEntity packet2 = new PacketPlayOutSpawnEntity(((CraftPlayer) player).getHandle(), 70,
Material.STAINED_GLASS.getId() | ids.data << 16);
@ -186,11 +189,26 @@ public class Wall
packet2.b = (int) Math.floor(entry.getKey().getX() * 32);
packet2.c = (int) Math.floor(entry.getKey().getY() * 32);
packet2.d = (int) Math.floor(entry.getKey().getZ() * 32);
packet2.uuid = UUID.randomUUID();
PacketPlayOutAttachEntity packet3 = new PacketPlayOutAttachEntity();
Packet packet3;
packet3.b = ids.block;
packet3.c = ids.chicken;
if (UtilPlayer.is1_9(player))
{
packet3 = new PacketPlayOutNewAttachEntity( ids.chicken, new int[]
{
ids.block
});
}
else
{
PacketPlayOutAttachEntity packet = new PacketPlayOutAttachEntity();
packet.b = ids.block;
packet.c = ids.chicken;
packet3 = packet;
}
packets[i++] = packet1;
packets[i++] = packet2;

View File

@ -1,6 +1,7 @@
package nautilus.game.arcade.game.games.wizards.spells;
import java.util.ArrayList;
import java.util.UUID;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilMath;
@ -325,6 +326,7 @@ public class SpellRumble extends Spell implements SpellClickBlock, SpellClick
fallingSpawn.i = 70;
fallingSpawn.k = block.getTypeId() | block.getData() << 16;
fallingSpawn.f = 10000;
fallingSpawn.uuid = UUID.randomUUID();
final Collection<? extends Player> players = Bukkit.getOnlinePlayers();

View File

@ -77,6 +77,18 @@
<version>1.4.7</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.14</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>net.kencochrane.raven</groupId>
<artifactId>raven</artifactId>
<version>6.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>net.kencochrane.raven</groupId>
<artifactId>raven-log4j2</artifactId>
@ -122,7 +134,7 @@
<dependency>
<groupId>com.mineplex</groupId>
<artifactId>spigot</artifactId>
<version>1.8.8-R0.1-SNAPSHOT</version>
<version>1.8.8-1.9-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>

2
README.md Normal file
View File

@ -0,0 +1,2 @@
# Minecraft-PC
Minecraft PC Edition