Revert "Revert "Merge branch 'master' of ssh://184.154.0.242:7999/min/Mineplex into clans-beta""
This reverts commit 6c17b2926c
.
This commit is contained in:
parent
6c17b2926c
commit
0b41450603
File diff suppressed because it is too large
Load Diff
34
Patches/Bukkit-Patches/0030-LivingEntity-changes.patch
Normal file
34
Patches/Bukkit-Patches/0030-LivingEntity-changes.patch
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
From f037882f13b3ea9d0a0137260e365a4332a8e751 Mon Sep 17 00:00:00 2001
|
||||||
|
From: libraryaddict <libraryaddict115@yahoo.co.nz>
|
||||||
|
Date: Fri, 23 Oct 2015 21:23:18 +1300
|
||||||
|
Subject: [PATCH] LivingEntity changes
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||||
|
index 48e2508..fb623ae 100644
|
||||||
|
--- a/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||||
|
+++ b/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||||
|
@@ -392,4 +392,20 @@ public interface LivingEntity extends Entity, Damageable, ProjectileSource {
|
||||||
|
* @return whether the operation was successful
|
||||||
|
*/
|
||||||
|
public boolean setLeashHolder(Entity holder);
|
||||||
|
+
|
||||||
|
+ public boolean shouldBreakLeash();
|
||||||
|
+
|
||||||
|
+ public void setShouldBreakLeash(boolean shouldBreakLeash);
|
||||||
|
+
|
||||||
|
+ public boolean shouldPullWhileLeashed();
|
||||||
|
+
|
||||||
|
+ public void setPullWhileLeashed(boolean pullWhileLeashed);
|
||||||
|
+
|
||||||
|
+ public boolean isVegetated();
|
||||||
|
+
|
||||||
|
+ public void setVegetated(boolean vegetated);
|
||||||
|
+
|
||||||
|
+ public boolean isGhost();
|
||||||
|
+
|
||||||
|
+ public void setGhost(boolean ghost);
|
||||||
|
}
|
||||||
|
--
|
||||||
|
1.9.5.msysgit.0
|
||||||
|
|
2037
Patches/CraftBukkit-Patches/0161-Modify-packets-to-public.patch
Normal file
2037
Patches/CraftBukkit-Patches/0161-Modify-packets-to-public.patch
Normal file
File diff suppressed because it is too large
Load Diff
804
Patches/CraftBukkit-Patches/0162-Modifiy-entity.patch
Normal file
804
Patches/CraftBukkit-Patches/0162-Modifiy-entity.patch
Normal file
@ -0,0 +1,804 @@
|
|||||||
|
From 9f12f0f7abe2a94fe4a724a7c17245b9c0f33a70 Mon Sep 17 00:00:00 2001
|
||||||
|
From: libraryaddict <libraryaddict115@yahoo.co.nz>
|
||||||
|
Date: Fri, 23 Oct 2015 21:16:07 +1300
|
||||||
|
Subject: [PATCH] Modifiy entity
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||||
|
index e345dd7..cb9ba53 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||||
|
@@ -137,6 +137,31 @@ public abstract class Entity implements ICommandListener {
|
||||||
|
this.die();
|
||||||
|
}
|
||||||
|
|
||||||
|
+ private boolean _silent;
|
||||||
|
+ private boolean _invisible;
|
||||||
|
+
|
||||||
|
+ public boolean isSilent()
|
||||||
|
+ {
|
||||||
|
+ return _silent;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void setSilent(boolean silent)
|
||||||
|
+ {
|
||||||
|
+ _silent = silent;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public boolean isMineplexInvisible()
|
||||||
|
+ {
|
||||||
|
+ return _invisible;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void setMineplexInvisible(boolean invisible)
|
||||||
|
+ {
|
||||||
|
+ _invisible = invisible;
|
||||||
|
+
|
||||||
|
+ setInvisible(isMineplexInvisible() || isInvisible());
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
public Entity(World world) {
|
||||||
|
this.id = Entity.entityCount++;
|
||||||
|
this.j = 1.0D;
|
||||||
|
@@ -684,7 +709,9 @@ public abstract class Entity implements ICommandListener {
|
||||||
|
this.makeSound(this.P(), f, 1.0F + (this.random.nextFloat() - this.random.nextFloat()) * 0.4F);
|
||||||
|
}
|
||||||
|
|
||||||
|
- this.a(blockposition, block);
|
||||||
|
+ if (!isSilent())
|
||||||
|
+ this.a(blockposition, block);
|
||||||
|
+
|
||||||
|
block.a(this.world, blockposition, this); // CraftBukkit moved from above
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -786,7 +813,7 @@ public abstract class Entity implements ICommandListener {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void makeSound(String s, float f, float f1) {
|
||||||
|
- if (!this.R()) {
|
||||||
|
+ if (!isSilent() && !this.R()) {
|
||||||
|
this.world.makeSound(this, s, f, f1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -984,6 +1011,10 @@ public abstract class Entity implements ICommandListener {
|
||||||
|
this.lastZ = this.locZ = d2;
|
||||||
|
this.lastYaw = this.yaw = f;
|
||||||
|
this.lastPitch = this.pitch = f1;
|
||||||
|
+
|
||||||
|
+ if (this instanceof EntityLiving)
|
||||||
|
+ ((EntityLiving) this).aK = f;
|
||||||
|
+
|
||||||
|
double d3 = (double) (this.lastYaw - f);
|
||||||
|
|
||||||
|
if (d3 < -180.0D) {
|
||||||
|
@@ -1537,7 +1568,7 @@ public abstract class Entity implements ICommandListener {
|
||||||
|
if (entity == null) {
|
||||||
|
if (this.vehicle != null) {
|
||||||
|
// CraftBukkit start
|
||||||
|
- if ((this.bukkitEntity instanceof LivingEntity) && (this.vehicle.getBukkitEntity() instanceof Vehicle)) {
|
||||||
|
+ if ((this.bukkitEntity instanceof LivingEntity) && vehicle.getBukkitEntity() instanceof Vehicle) {
|
||||||
|
VehicleExitEvent event = new VehicleExitEvent((Vehicle) this.vehicle.getBukkitEntity(), (LivingEntity) this.bukkitEntity);
|
||||||
|
pluginManager.callEvent(event);
|
||||||
|
|
||||||
|
@@ -1557,7 +1588,7 @@ public abstract class Entity implements ICommandListener {
|
||||||
|
if ((this.bukkitEntity instanceof LivingEntity) && (entity.getBukkitEntity() instanceof Vehicle) && entity.world.isChunkLoaded((int) entity.locX >> 4, (int) entity.locZ >> 4, true)) {
|
||||||
|
// It's possible to move from one vehicle to another. We need to check if they're already in a vehicle, and fire an exit event if they are.
|
||||||
|
VehicleExitEvent exitEvent = null;
|
||||||
|
- if (this.vehicle != null && this.vehicle.getBukkitEntity() instanceof Vehicle) {
|
||||||
|
+ if (this.vehicle != null) {
|
||||||
|
exitEvent = new VehicleExitEvent((Vehicle) this.vehicle.getBukkitEntity(), (LivingEntity) this.bukkitEntity);
|
||||||
|
pluginManager.callEvent(exitEvent);
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/EntityBat.java b/src/main/java/net/minecraft/server/EntityBat.java
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..c078fa6
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/src/main/java/net/minecraft/server/EntityBat.java
|
||||||
|
@@ -0,0 +1,206 @@
|
||||||
|
+package net.minecraft.server;
|
||||||
|
+
|
||||||
|
+import java.util.Calendar;
|
||||||
|
+
|
||||||
|
+public class EntityBat extends EntityAmbient {
|
||||||
|
+
|
||||||
|
+ private BlockPosition a;
|
||||||
|
+ private boolean _vegetated;
|
||||||
|
+
|
||||||
|
+ public EntityBat(World world) {
|
||||||
|
+ super(world);
|
||||||
|
+ this.setSize(0.5F, 0.9F);
|
||||||
|
+ this.setAsleep(true);
|
||||||
|
+
|
||||||
|
+ _vegetated = false;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void setVegetated(boolean flag) {
|
||||||
|
+ _vegetated = flag;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public boolean isVegetated() {
|
||||||
|
+ return _vegetated;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ protected void h() {
|
||||||
|
+ super.h();
|
||||||
|
+ this.datawatcher.a(16, new Byte((byte) 0));
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ protected float bB() {
|
||||||
|
+ return 0.1F;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ protected float bC() {
|
||||||
|
+ return super.bC() * 0.95F;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ protected String z() {
|
||||||
|
+ return this.isAsleep() && this.random.nextInt(4) != 0 ? null : "mob.bat.idle";
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ protected String bo() {
|
||||||
|
+ return "mob.bat.hurt";
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ protected String bp() {
|
||||||
|
+ return "mob.bat.death";
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public boolean ae() {
|
||||||
|
+ return false;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ protected void s(Entity entity) {}
|
||||||
|
+
|
||||||
|
+ protected void bL() {}
|
||||||
|
+
|
||||||
|
+ protected void initAttributes()
|
||||||
|
+ {
|
||||||
|
+ super.initAttributes();
|
||||||
|
+ this.getAttributeInstance(GenericAttributes.maxHealth).setValue(6.0D);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public boolean isAsleep() {
|
||||||
|
+ return (this.datawatcher.getByte(16) & 1) != 0;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void setAsleep(boolean flag) {
|
||||||
|
+ byte b0 = this.datawatcher.getByte(16);
|
||||||
|
+
|
||||||
|
+ if (flag) {
|
||||||
|
+ this.datawatcher.watch(16, Byte.valueOf((byte) (b0 | 1)));
|
||||||
|
+ } else {
|
||||||
|
+ this.datawatcher.watch(16, Byte.valueOf((byte) (b0 & -2)));
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void t_() {
|
||||||
|
+ super.t_();
|
||||||
|
+
|
||||||
|
+ if (isVegetated())
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ if (this.isAsleep()) {
|
||||||
|
+ this.motX = this.motY = this.motZ = 0.0D;
|
||||||
|
+ this.locY = (double) MathHelper.floor(this.locY) + 1.0D - (double) this.length;
|
||||||
|
+ } else {
|
||||||
|
+ this.motY *= 0.6000000238418579D;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ protected void E() {
|
||||||
|
+ super.E();
|
||||||
|
+
|
||||||
|
+ if (isVegetated())
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ BlockPosition blockposition = new BlockPosition(this);
|
||||||
|
+ BlockPosition blockposition1 = blockposition.up();
|
||||||
|
+
|
||||||
|
+ if (this.isAsleep()) {
|
||||||
|
+ if (!this.world.getType(blockposition1).getBlock().isOccluding()) {
|
||||||
|
+ this.setAsleep(false);
|
||||||
|
+ this.world.a((EntityHuman) null, 1015, blockposition, 0);
|
||||||
|
+ } else {
|
||||||
|
+ if (this.random.nextInt(200) == 0) {
|
||||||
|
+ this.aK = (float) this.random.nextInt(360);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (this.world.findNearbyPlayer(this, 4.0D) != null) {
|
||||||
|
+ this.setAsleep(false);
|
||||||
|
+ this.world.a((EntityHuman) null, 1015, blockposition, 0);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ } else {
|
||||||
|
+ if (this.a != null && (!this.world.isEmpty(this.a) || this.a.getY() < 1)) {
|
||||||
|
+ this.a = null;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (this.a == null || this.random.nextInt(30) == 0 || this.a.c((double) ((int) this.locX), (double) ((int) this.locY), (double) ((int) this.locZ)) < 4.0D) {
|
||||||
|
+ this.a = new BlockPosition((int) this.locX + this.random.nextInt(7) - this.random.nextInt(7), (int) this.locY + this.random.nextInt(6) - 2, (int) this.locZ + this.random.nextInt(7) - this.random.nextInt(7));
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ double d0 = (double) this.a.getX() + 0.5D - this.locX;
|
||||||
|
+ double d1 = (double) this.a.getY() + 0.1D - this.locY;
|
||||||
|
+ double d2 = (double) this.a.getZ() + 0.5D - this.locZ;
|
||||||
|
+
|
||||||
|
+ this.motX += (Math.signum(d0) * 0.5D - this.motX) * 0.10000000149011612D;
|
||||||
|
+ this.motY += (Math.signum(d1) * 0.699999988079071D - this.motY) * 0.10000000149011612D;
|
||||||
|
+ this.motZ += (Math.signum(d2) * 0.5D - this.motZ) * 0.10000000149011612D;
|
||||||
|
+ float f = (float) (MathHelper.b(this.motZ, this.motX) * 180.0D / 3.1415927410125732D) - 90.0F;
|
||||||
|
+ float f1 = MathHelper.g(f - this.yaw);
|
||||||
|
+
|
||||||
|
+ this.ba = 0.5F;
|
||||||
|
+ this.yaw += f1;
|
||||||
|
+ if (this.random.nextInt(100) == 0 && this.world.getType(blockposition1).getBlock().isOccluding()) {
|
||||||
|
+ this.setAsleep(true);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ protected boolean s_() {
|
||||||
|
+ return false;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void e(float f, float f1) {}
|
||||||
|
+
|
||||||
|
+ protected void a(double d0, boolean flag, Block block, BlockPosition blockposition) {}
|
||||||
|
+
|
||||||
|
+ public boolean aI() {
|
||||||
|
+ return true;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public boolean damageEntity(DamageSource damagesource, float f) {
|
||||||
|
+ if (this.isInvulnerable(damagesource)) {
|
||||||
|
+ return false;
|
||||||
|
+ } else {
|
||||||
|
+ if (!this.world.isClientSide && this.isAsleep()) {
|
||||||
|
+ this.setAsleep(false);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return super.damageEntity(damagesource, f);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void a(NBTTagCompound nbttagcompound) {
|
||||||
|
+ super.a(nbttagcompound);
|
||||||
|
+ this.datawatcher.watch(16, Byte.valueOf(nbttagcompound.getByte("BatFlags")));
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void b(NBTTagCompound nbttagcompound) {
|
||||||
|
+ super.b(nbttagcompound);
|
||||||
|
+ nbttagcompound.setByte("BatFlags", this.datawatcher.getByte(16));
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public boolean bR() {
|
||||||
|
+ BlockPosition blockposition = new BlockPosition(this.locX, this.getBoundingBox().b, this.locZ);
|
||||||
|
+
|
||||||
|
+ if (blockposition.getY() >= this.world.F()) {
|
||||||
|
+ return false;
|
||||||
|
+ } else {
|
||||||
|
+ int i = this.world.getLightLevel(blockposition);
|
||||||
|
+ byte b0 = 4;
|
||||||
|
+
|
||||||
|
+ if (this.a(this.world.Y())) {
|
||||||
|
+ b0 = 7;
|
||||||
|
+ } else if (this.random.nextBoolean()) {
|
||||||
|
+ return false;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return i > this.random.nextInt(b0) ? false : super.bR();
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ private boolean a(Calendar calendar) {
|
||||||
|
+ return calendar.get(2) + 1 == 10 && calendar.get(5) >= 20 || calendar.get(2) + 1 == 11 && calendar.get(5) <= 3;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public float getHeadHeight() {
|
||||||
|
+ return this.length / 2.0F;
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
\ No newline at end of file
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/EntityBlaze.java b/src/main/java/net/minecraft/server/EntityBlaze.java
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..a759e00
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/src/main/java/net/minecraft/server/EntityBlaze.java
|
||||||
|
@@ -0,0 +1,207 @@
|
||||||
|
+package net.minecraft.server;
|
||||||
|
+
|
||||||
|
+public class EntityBlaze extends EntityMonster {
|
||||||
|
+
|
||||||
|
+ private float a = 0.5F;
|
||||||
|
+ private int b;
|
||||||
|
+
|
||||||
|
+ public EntityBlaze(World world) {
|
||||||
|
+ super(world);
|
||||||
|
+ this.fireProof = true;
|
||||||
|
+ this.b_ = 10;
|
||||||
|
+ this.goalSelector.a(4, new EntityBlaze.PathfinderGoalBlazeFireball(this));
|
||||||
|
+ this.goalSelector.a(5, new PathfinderGoalMoveTowardsRestriction(this, 1.0D));
|
||||||
|
+ this.goalSelector.a(7, new PathfinderGoalRandomStroll(this, 1.0D));
|
||||||
|
+ this.goalSelector.a(8, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 8.0F));
|
||||||
|
+ this.goalSelector.a(8, new PathfinderGoalRandomLookaround(this));
|
||||||
|
+ this.targetSelector.a(1, new PathfinderGoalHurtByTarget(this, true, new Class[0]));
|
||||||
|
+ this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityHuman.class, true));
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ protected void initAttributes() {
|
||||||
|
+ super.initAttributes();
|
||||||
|
+ this.getAttributeInstance(GenericAttributes.ATTACK_DAMAGE).setValue(6.0D);
|
||||||
|
+ this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).setValue(0.23000000417232513D);
|
||||||
|
+ this.getAttributeInstance(GenericAttributes.FOLLOW_RANGE).setValue(48.0D);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ protected void h() {
|
||||||
|
+ super.h();
|
||||||
|
+ this.datawatcher.a(16, new Byte((byte) 0));
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ protected String z() {
|
||||||
|
+ return "mob.blaze.breathe";
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ protected String bo() {
|
||||||
|
+ return "mob.blaze.hit";
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ protected String bp() {
|
||||||
|
+ return "mob.blaze.death";
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public float c(float f) {
|
||||||
|
+ return 1.0F;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void m() {
|
||||||
|
+ if (!isVegetated() && !this.onGround && this.motY < 0.0D) {
|
||||||
|
+ this.motY *= 0.6D;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (this.world.isClientSide) {
|
||||||
|
+ if (this.random.nextInt(24) == 0 && !this.R()) {
|
||||||
|
+ this.world.a(this.locX + 0.5D, this.locY + 0.5D, this.locZ + 0.5D, "fire.fire", 1.0F + this.random.nextFloat(), this.random.nextFloat() * 0.7F + 0.3F, false);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ for (int i = 0; i < 2; ++i) {
|
||||||
|
+ this.world.addParticle(EnumParticle.SMOKE_LARGE, this.locX + (this.random.nextDouble() - 0.5D) * (double) this.width, this.locY + this.random.nextDouble() * (double) this.length, this.locZ + (this.random.nextDouble() - 0.5D) * (double) this.width, 0.0D, 0.0D, 0.0D, new int[0]);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ super.m();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ protected void E() {
|
||||||
|
+ if (this.U()) {
|
||||||
|
+ this.damageEntity(DamageSource.DROWN, 1.0F);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ --this.b;
|
||||||
|
+ if (this.b <= 0) {
|
||||||
|
+ this.b = 100;
|
||||||
|
+ this.a = 0.5F + (float) this.random.nextGaussian() * 3.0F;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ EntityLiving entityliving = this.getGoalTarget();
|
||||||
|
+
|
||||||
|
+ if (!isVegetated() && entityliving != null && entityliving.locY + (double) entityliving.getHeadHeight() > this.locY + (double) this.getHeadHeight() + (double) this.a) {
|
||||||
|
+ this.motY += (0.30000001192092896D - this.motY) * 0.30000001192092896D;
|
||||||
|
+ this.ai = true;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ super.E();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void e(float f, float f1) {}
|
||||||
|
+
|
||||||
|
+ protected Item getLoot() {
|
||||||
|
+ return Items.BLAZE_ROD;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public boolean isBurning() {
|
||||||
|
+ return this.n();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ protected void dropDeathLoot(boolean flag, int i) {
|
||||||
|
+ if (flag) {
|
||||||
|
+ int j = this.random.nextInt(2 + i);
|
||||||
|
+
|
||||||
|
+ for (int k = 0; k < j; ++k) {
|
||||||
|
+ this.a(Items.BLAZE_ROD, 1);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public boolean n() {
|
||||||
|
+ return (this.datawatcher.getByte(16) & 1) != 0;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void a(boolean flag) {
|
||||||
|
+ byte b0 = this.datawatcher.getByte(16);
|
||||||
|
+
|
||||||
|
+ if (flag) {
|
||||||
|
+ b0 = (byte) (b0 | 1);
|
||||||
|
+ } else {
|
||||||
|
+ b0 &= -2;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ this.datawatcher.watch(16, Byte.valueOf(b0));
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ protected boolean n_() {
|
||||||
|
+ return true;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ static class PathfinderGoalBlazeFireball extends PathfinderGoal {
|
||||||
|
+
|
||||||
|
+ private EntityBlaze a;
|
||||||
|
+ private int b;
|
||||||
|
+ private int c;
|
||||||
|
+
|
||||||
|
+ public PathfinderGoalBlazeFireball(EntityBlaze entityblaze) {
|
||||||
|
+ this.a = entityblaze;
|
||||||
|
+ this.a(3);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public boolean a() {
|
||||||
|
+ EntityLiving entityliving = this.a.getGoalTarget();
|
||||||
|
+
|
||||||
|
+ return entityliving != null && entityliving.isAlive();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void c() {
|
||||||
|
+ this.b = 0;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void d() {
|
||||||
|
+ this.a.a(false);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void e() {
|
||||||
|
+ --this.c;
|
||||||
|
+ EntityLiving entityliving = this.a.getGoalTarget();
|
||||||
|
+ double d0 = this.a.h(entityliving);
|
||||||
|
+
|
||||||
|
+ if (d0 < 4.0D) {
|
||||||
|
+ if (this.c <= 0) {
|
||||||
|
+ this.c = 20;
|
||||||
|
+ this.a.r(entityliving);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ this.a.getControllerMove().a(entityliving.locX, entityliving.locY, entityliving.locZ, 1.0D);
|
||||||
|
+ } else if (d0 < 256.0D) {
|
||||||
|
+ double d1 = entityliving.locX - this.a.locX;
|
||||||
|
+ double d2 = entityliving.getBoundingBox().b + (double) (entityliving.length / 2.0F) - (this.a.locY + (double) (this.a.length / 2.0F));
|
||||||
|
+ double d3 = entityliving.locZ - this.a.locZ;
|
||||||
|
+
|
||||||
|
+ if (this.c <= 0) {
|
||||||
|
+ ++this.b;
|
||||||
|
+ if (this.b == 1) {
|
||||||
|
+ this.c = 60;
|
||||||
|
+ this.a.a(true);
|
||||||
|
+ } else if (this.b <= 4) {
|
||||||
|
+ this.c = 6;
|
||||||
|
+ } else {
|
||||||
|
+ this.c = 100;
|
||||||
|
+ this.b = 0;
|
||||||
|
+ this.a.a(false);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (this.b > 1) {
|
||||||
|
+ float f = MathHelper.c(MathHelper.sqrt(d0)) * 0.5F;
|
||||||
|
+
|
||||||
|
+ this.a.world.a((EntityHuman) null, 1009, new BlockPosition((int) this.a.locX, (int) this.a.locY, (int) this.a.locZ), 0);
|
||||||
|
+
|
||||||
|
+ for (int i = 0; i < 1; ++i) {
|
||||||
|
+ EntitySmallFireball entitysmallfireball = new EntitySmallFireball(this.a.world, this.a, d1 + this.a.bc().nextGaussian() * (double) f, d2, d3 + this.a.bc().nextGaussian() * (double) f);
|
||||||
|
+
|
||||||
|
+ entitysmallfireball.locY = this.a.locY + (double) (this.a.length / 2.0F) + 0.5D;
|
||||||
|
+ this.a.world.addEntity(entitysmallfireball);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ this.a.getControllerLook().a(entityliving, 10.0F, 10.0F);
|
||||||
|
+ } else {
|
||||||
|
+ this.a.getNavigation().n();
|
||||||
|
+ this.a.getControllerMove().a(entityliving.locX, entityliving.locY, entityliving.locZ, 1.0D);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ super.e();
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
\ No newline at end of file
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/EntityEnderDragon.java b/src/main/java/net/minecraft/server/EntityEnderDragon.java
|
||||||
|
index d246ae7..ed7f549 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/EntityEnderDragon.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/EntityEnderDragon.java
|
||||||
|
@@ -51,6 +51,18 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo
|
||||||
|
this.ah = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ public void setTargetBlock(int x, int y, int z) {
|
||||||
|
+ // Mineplex
|
||||||
|
+ this.a = x;
|
||||||
|
+ this.b = y;
|
||||||
|
+ this.c = z;
|
||||||
|
+ this.target = null;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void setTargetEntity(Entity e) {
|
||||||
|
+ this.target = e;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
protected void initAttributes() {
|
||||||
|
super.initAttributes();
|
||||||
|
this.getAttributeInstance(GenericAttributes.maxHealth).setValue(200.0D);
|
||||||
|
@@ -170,7 +182,7 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo
|
||||||
|
this.c += this.random.nextGaussian() * 2.0D;
|
||||||
|
}
|
||||||
|
|
||||||
|
- if (this.bw || d2 < 100.0D || d2 > 22500.0D || this.positionChanged || this.E) {
|
||||||
|
+ if (!isVegetated() && (this.bw || d2 < 100.0D || d2 > 22500.0D || this.positionChanged || this.E)) {
|
||||||
|
this.cf();
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -253,7 +265,7 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo
|
||||||
|
this.bs.setPositionRotation(this.locX + (double) (f12 * 4.5F), this.locY + 2.0D, this.locZ + (double) (f11 * 4.5F), 0.0F, 0.0F);
|
||||||
|
this.bt.t_();
|
||||||
|
this.bt.setPositionRotation(this.locX - (double) (f12 * 4.5F), this.locY + 2.0D, this.locZ - (double) (f11 * 4.5F), 0.0F, 0.0F);
|
||||||
|
- if (!this.world.isClientSide && this.hurtTicks == 0) {
|
||||||
|
+ if (!this.world.isClientSide && this.hurtTicks == 0 && !isGhost()) {
|
||||||
|
this.a(this.world.getEntities(this, this.bs.getBoundingBox().grow(4.0D, 2.0D, 4.0D).c(0.0D, -2.0D, 0.0D)));
|
||||||
|
this.a(this.world.getEntities(this, this.bt.getBoundingBox().grow(4.0D, 2.0D, 4.0D).c(0.0D, -2.0D, 0.0D)));
|
||||||
|
this.b(this.world.getEntities(this, this.bn.getBoundingBox().grow(1.0D, 1.0D, 1.0D)));
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java
|
||||||
|
index 7a42040..d3403a1 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/EntityFallingBlock.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java
|
||||||
|
@@ -17,6 +17,8 @@ public class EntityFallingBlock extends Entity {
|
||||||
|
private float fallHurtAmount = 2.0F;
|
||||||
|
public NBTTagCompound tileEntityData;
|
||||||
|
|
||||||
|
+ public boolean spectating;
|
||||||
|
+
|
||||||
|
public EntityFallingBlock(World world) {
|
||||||
|
super(world);
|
||||||
|
}
|
||||||
|
@@ -42,7 +44,15 @@ public class EntityFallingBlock extends Entity {
|
||||||
|
protected void h() {}
|
||||||
|
|
||||||
|
public boolean ad() {
|
||||||
|
- return !this.dead;
|
||||||
|
+ return !this.dead && !spectating;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public boolean damageEntity(DamageSource damagesource, float f)
|
||||||
|
+ {
|
||||||
|
+ CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, f);
|
||||||
|
+
|
||||||
|
+ return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void t_() {
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/EntityHorse.java b/src/main/java/net/minecraft/server/EntityHorse.java
|
||||||
|
index f131419..f293118 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/EntityHorse.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/EntityHorse.java
|
||||||
|
@@ -125,6 +125,9 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener {
|
||||||
|
private void c(int i, boolean flag) {
|
||||||
|
int j = this.datawatcher.getInt(16);
|
||||||
|
|
||||||
|
+ if (isVegetated())
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
if (flag) {
|
||||||
|
this.datawatcher.watch(16, Integer.valueOf(j | i));
|
||||||
|
} else {
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java
|
||||||
|
index a8a327d..b7647bc 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
|
||||||
|
@@ -34,6 +34,10 @@ public abstract class EntityInsentient extends EntityLiving {
|
||||||
|
private Entity bp;
|
||||||
|
private NBTTagCompound bq;
|
||||||
|
|
||||||
|
+ private boolean _vegetated;
|
||||||
|
+ private boolean _shouldBreakLeash = true;
|
||||||
|
+ private boolean _pullWhileLeashed = true;
|
||||||
|
+
|
||||||
|
public EntityInsentient(World world) {
|
||||||
|
super(world);
|
||||||
|
this.goalSelector = new PathfinderGoalSelector(world != null && world.methodProfiler != null ? world.methodProfiler : null);
|
||||||
|
@@ -53,6 +57,32 @@ public abstract class EntityInsentient extends EntityLiving {
|
||||||
|
this.persistent = !isTypeNotPersistent();
|
||||||
|
// CraftBukkit end
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+ public void setVegetated(boolean flag) {
|
||||||
|
+ _vegetated = flag;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void setShouldBreakLeash(boolean shouldBreakLeash)
|
||||||
|
+ {
|
||||||
|
+ _shouldBreakLeash = shouldBreakLeash;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void setPullWhileLeashed(boolean pullWhileLeashed)
|
||||||
|
+ {
|
||||||
|
+ _pullWhileLeashed = pullWhileLeashed;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public boolean isVegetated() {
|
||||||
|
+ return _vegetated;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public boolean shouldBreakLeash() {
|
||||||
|
+ return shouldBreakLeash();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public boolean shouldPullWhileLeashed() {
|
||||||
|
+ return _pullWhileLeashed;
|
||||||
|
+ }
|
||||||
|
|
||||||
|
protected void initAttributes() {
|
||||||
|
super.initAttributes();
|
||||||
|
@@ -148,7 +178,7 @@ public abstract class EntityInsentient extends EntityLiving {
|
||||||
|
public void K() {
|
||||||
|
super.K();
|
||||||
|
this.world.methodProfiler.a("mobBaseTick");
|
||||||
|
- if (this.isAlive() && this.random.nextInt(1000) < this.a_++) {
|
||||||
|
+ if (!isSilent() && this.isAlive() && this.random.nextInt(1000) < this.a_++) {
|
||||||
|
this.a_ = -this.w();
|
||||||
|
this.x();
|
||||||
|
}
|
||||||
|
@@ -770,7 +800,7 @@ public abstract class EntityInsentient extends EntityLiving {
|
||||||
|
}
|
||||||
|
|
||||||
|
public final boolean e(EntityHuman entityhuman) {
|
||||||
|
- if (this.cc() && this.getLeashHolder() == entityhuman) {
|
||||||
|
+ if (this.cc() && this.getLeashHolder() == entityhuman && _shouldBreakLeash) {
|
||||||
|
// CraftBukkit start - fire PlayerUnleashEntityEvent
|
||||||
|
if (CraftEventFactory.callPlayerUnleashEntityEvent(this, entityhuman).isCancelled()) {
|
||||||
|
((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutAttachEntity(1, this, this.getLeashHolder()));
|
||||||
|
@@ -835,7 +865,7 @@ public abstract class EntityInsentient extends EntityLiving {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void unleash(boolean flag, boolean flag1) {
|
||||||
|
- if (this.bo) {
|
||||||
|
+ if (this.bo && _shouldBreakLeash) {
|
||||||
|
this.bo = false;
|
||||||
|
this.bp = null;
|
||||||
|
if (!this.world.isClientSide && flag1) {
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||||
|
index 3c852fd..b861dbe 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||||
|
@@ -101,6 +101,18 @@ public abstract class EntityLiving extends Entity {
|
||||||
|
this.damageEntity(DamageSource.OUT_OF_WORLD, Float.MAX_VALUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
+ private boolean _ghost;
|
||||||
|
+
|
||||||
|
+ public boolean isGhost()
|
||||||
|
+ {
|
||||||
|
+ return _ghost;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void setGhost(boolean ghost)
|
||||||
|
+ {
|
||||||
|
+ _ghost = ghost;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
public EntityLiving(World world) {
|
||||||
|
super(world);
|
||||||
|
this.initAttributes();
|
||||||
|
@@ -1783,7 +1795,7 @@ public abstract class EntityLiving extends Entity {
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean ad() {
|
||||||
|
- return !this.dead;
|
||||||
|
+ return !isGhost() && !this.dead;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean ae() {
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
|
||||||
|
index 3810f86..44ac587 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
|
||||||
|
@@ -65,10 +65,12 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||||
|
// Spigot start
|
||||||
|
public boolean collidesWithEntities = true;
|
||||||
|
|
||||||
|
+ public boolean spectating;
|
||||||
|
+
|
||||||
|
@Override
|
||||||
|
public boolean ad()
|
||||||
|
{
|
||||||
|
- return this.collidesWithEntities && super.ad(); // (first !this.isDead near bottom of EntityLiving)
|
||||||
|
+ return !spectating && this.collidesWithEntities && super.ad(); // (first !this.isDead near bottom of EntityLiving)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
|
||||||
|
index 2d22327..83e71c1 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
|
||||||
|
@@ -9,6 +9,8 @@ public class EntityTNTPrimed extends Entity {
|
||||||
|
public float yield = 4; // CraftBukkit - add field
|
||||||
|
public boolean isIncendiary = false; // CraftBukkit - add field
|
||||||
|
|
||||||
|
+ public boolean spectating;
|
||||||
|
+
|
||||||
|
public EntityTNTPrimed(World world) {
|
||||||
|
super(world);
|
||||||
|
this.k = true;
|
||||||
|
@@ -37,7 +39,7 @@ public class EntityTNTPrimed extends Entity {
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean ad() {
|
||||||
|
- return !this.dead;
|
||||||
|
+ return !spectating && !this.dead;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void t_() {
|
||||||
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||||
|
index 5317cff..60e8584 100644
|
||||||
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||||
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||||
|
@@ -74,6 +74,46 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
+ public boolean shouldBreakLeash()
|
||||||
|
+ {
|
||||||
|
+ return ((EntityInsentient) getHandle()).shouldBreakLeash();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void setShouldBreakLeash(boolean shouldBreakLeash)
|
||||||
|
+ {
|
||||||
|
+ ((EntityInsentient) getHandle()).setShouldBreakLeash(shouldBreakLeash);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public boolean shouldPullWhileLeashed()
|
||||||
|
+ {
|
||||||
|
+ return ((EntityInsentient) getHandle()).shouldPullWhileLeashed();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void setPullWhileLeashed(boolean pullWhileLeashed)
|
||||||
|
+ {
|
||||||
|
+ ((EntityInsentient) getHandle()).setPullWhileLeashed(pullWhileLeashed);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public boolean isVegetated()
|
||||||
|
+ {
|
||||||
|
+ return ((EntityInsentient) getHandle()).isVegetated();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void setVegetated(boolean vegetated)
|
||||||
|
+ {
|
||||||
|
+ ((EntityInsentient) getHandle()).setVegetated(vegetated);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public boolean isGhost()
|
||||||
|
+ {
|
||||||
|
+ return getHandle().isGhost();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void setGhost(boolean ghost)
|
||||||
|
+ {
|
||||||
|
+ getHandle().setGhost(ghost);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
public double getHealth() {
|
||||||
|
return Math.min(Math.max(0, getHandle().getHealth()), getMaxHealth());
|
||||||
|
}
|
||||||
|
--
|
||||||
|
1.9.5.msysgit.0
|
||||||
|
|
235
Patches/CraftBukkit-Patches/0163-Chunk-changes.patch
Normal file
235
Patches/CraftBukkit-Patches/0163-Chunk-changes.patch
Normal file
@ -0,0 +1,235 @@
|
|||||||
|
From 71c20f9d0c8bfa388f6bf0ba1a7b765a83e9de2a Mon Sep 17 00:00:00 2001
|
||||||
|
From: libraryaddict <libraryaddict115@yahoo.co.nz>
|
||||||
|
Date: Fri, 23 Oct 2015 21:21:32 +1300
|
||||||
|
Subject: [PATCH] Chunk changes
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/com/mineplex/spigot/ChunkAddEntityEvent.java b/src/main/java/com/mineplex/spigot/ChunkAddEntityEvent.java
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..3f16935
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/src/main/java/com/mineplex/spigot/ChunkAddEntityEvent.java
|
||||||
|
@@ -0,0 +1,31 @@
|
||||||
|
+package com.mineplex.spigot;
|
||||||
|
+
|
||||||
|
+import org.bukkit.entity.Entity;
|
||||||
|
+import org.bukkit.event.Event;
|
||||||
|
+import org.bukkit.event.HandlerList;
|
||||||
|
+
|
||||||
|
+public class ChunkAddEntityEvent extends Event
|
||||||
|
+{
|
||||||
|
+ private static final HandlerList handlers = new HandlerList();
|
||||||
|
+ private Entity _entity;
|
||||||
|
+
|
||||||
|
+ public ChunkAddEntityEvent(Entity _entity)
|
||||||
|
+ {
|
||||||
|
+ this._entity = _entity;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public Entity getEntity()
|
||||||
|
+ {
|
||||||
|
+ return _entity;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public HandlerList getHandlers()
|
||||||
|
+ {
|
||||||
|
+ return handlers;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public static HandlerList getHandlerList()
|
||||||
|
+ {
|
||||||
|
+ return handlers;
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
diff --git a/src/main/java/com/mineplex/spigot/ChunkPreLoadEvent.java b/src/main/java/com/mineplex/spigot/ChunkPreLoadEvent.java
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..564efe6
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/src/main/java/com/mineplex/spigot/ChunkPreLoadEvent.java
|
||||||
|
@@ -0,0 +1,60 @@
|
||||||
|
+package com.mineplex.spigot;
|
||||||
|
+
|
||||||
|
+import org.bukkit.World;
|
||||||
|
+import org.bukkit.event.Cancellable;
|
||||||
|
+import org.bukkit.event.Event;
|
||||||
|
+import org.bukkit.event.HandlerList;
|
||||||
|
+
|
||||||
|
+public class ChunkPreLoadEvent extends Event implements Cancellable
|
||||||
|
+{
|
||||||
|
+ private static final HandlerList handlers = new HandlerList();
|
||||||
|
+ private boolean _cancelled;
|
||||||
|
+ private World _world;
|
||||||
|
+ private int _x;
|
||||||
|
+ private int _z;
|
||||||
|
+
|
||||||
|
+ public ChunkPreLoadEvent(World world, int x, int z)
|
||||||
|
+ {
|
||||||
|
+ _world = world;
|
||||||
|
+ _x = x;
|
||||||
|
+ _z = z;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public World getWorld()
|
||||||
|
+ {
|
||||||
|
+ return _world;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public int getX()
|
||||||
|
+ {
|
||||||
|
+ return _x;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public int getZ()
|
||||||
|
+ {
|
||||||
|
+ return _z;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public boolean isCancelled()
|
||||||
|
+ {
|
||||||
|
+ return _cancelled;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public void setCancelled(boolean cancel)
|
||||||
|
+ {
|
||||||
|
+ _cancelled = cancel;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public HandlerList getHandlers()
|
||||||
|
+ {
|
||||||
|
+ return handlers;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public static HandlerList getHandlerList()
|
||||||
|
+ {
|
||||||
|
+ return handlers;
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
||||||
|
index 022ba31..464d0c2 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||||
|
@@ -11,6 +11,8 @@ import java.util.Map;
|
||||||
|
import java.util.Random;
|
||||||
|
import java.util.concurrent.Callable;
|
||||||
|
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||||
|
+
|
||||||
|
+import com.mineplex.spigot.ChunkAddEntityEvent;
|
||||||
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
|
@@ -660,6 +662,9 @@ public class Chunk {
|
||||||
|
entity.die();
|
||||||
|
}
|
||||||
|
|
||||||
|
+ ChunkAddEntityEvent event = new ChunkAddEntityEvent(entity.bukkitEntity);
|
||||||
|
+ Bukkit.getServer().getPluginManager().callEvent(event);
|
||||||
|
+
|
||||||
|
int k = MathHelper.floor(entity.locY / 16.0D);
|
||||||
|
|
||||||
|
if (k < 0) {
|
||||||
|
@@ -1317,6 +1322,10 @@ public class Chunk {
|
||||||
|
return this.done;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ public void setDone(boolean done) {
|
||||||
|
+ this.done = done;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
public void d(boolean flag) {
|
||||||
|
this.done = flag;
|
||||||
|
}
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||||
|
index 975d666..a55bd6c 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||||
|
@@ -8,6 +8,8 @@ import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
+
|
||||||
|
+import com.mineplex.spigot.ChunkPreLoadEvent;
|
||||||
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
|
@@ -88,6 +90,13 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
+ private boolean callChunkPreLoad(int i, int j)
|
||||||
|
+ {
|
||||||
|
+ ChunkPreLoadEvent event = new ChunkPreLoadEvent(world.getWorld(), i, j);
|
||||||
|
+ world.getServer().getPluginManager().callEvent(event);
|
||||||
|
+ return event.isCancelled();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
// CraftBukkit start - Add async variant, provide compatibility
|
||||||
|
public Chunk getChunkIfLoaded(int x, int z) {
|
||||||
|
return chunks.get(LongHash.toLong(x, z));
|
||||||
|
@@ -109,10 +118,30 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||||
|
// We can only use the queue for already generated chunks
|
||||||
|
if (chunk == null && loader != null && loader.chunkExists(world, i, j)) {
|
||||||
|
if (runnable != null) {
|
||||||
|
- ChunkIOExecutor.queueChunkLoad(world, loader, this, i, j, runnable);
|
||||||
|
+ if (callChunkPreLoad(i, j))
|
||||||
|
+ {
|
||||||
|
+ runnable.run();
|
||||||
|
+ chunk = new EmptyChunk(world, i, j);
|
||||||
|
+ chunk.setDone(true);
|
||||||
|
+ chunks.put(LongHash.toLong(i, j), chunk);
|
||||||
|
+ }
|
||||||
|
+ else
|
||||||
|
+ {
|
||||||
|
+ ChunkIOExecutor.queueChunkLoad(world, loader, this, i, j, runnable);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
- chunk = ChunkIOExecutor.syncChunkLoad(world, loader, this, i, j);
|
||||||
|
+ if (callChunkPreLoad(i, j))
|
||||||
|
+ {
|
||||||
|
+ chunk = new EmptyChunk(world, i, j);
|
||||||
|
+ chunk.setDone(true);
|
||||||
|
+ chunks.put(LongHash.toLong(i, j), chunk);
|
||||||
|
+ }
|
||||||
|
+ else
|
||||||
|
+ {
|
||||||
|
+ chunk = ChunkIOExecutor.syncChunkLoad(world, loader, this, i, j);
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
} else if (chunk == null) {
|
||||||
|
chunk = originalGetChunkAt(i, j);
|
||||||
|
@@ -131,6 +160,20 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||||
|
boolean newChunk = false;
|
||||||
|
// CraftBukkit end
|
||||||
|
|
||||||
|
+ Server server = world.getServer();
|
||||||
|
+
|
||||||
|
+ if (chunk == null && server != null)
|
||||||
|
+ {
|
||||||
|
+ if (callChunkPreLoad(i, j))
|
||||||
|
+ {
|
||||||
|
+ chunk = new EmptyChunk(world, i, j);
|
||||||
|
+ chunk.setDone(true);
|
||||||
|
+ chunks.put(LongHash.toLong(i, j), chunk);
|
||||||
|
+
|
||||||
|
+ return chunk;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
if (chunk == null) {
|
||||||
|
world.timings.syncChunkLoadTimer.startTiming(); // Spigot
|
||||||
|
chunk = this.loadChunk(i, j);
|
||||||
|
@@ -158,7 +201,6 @@ public class ChunkProviderServer implements IChunkProvider {
|
||||||
|
chunk.addEntities();
|
||||||
|
|
||||||
|
// CraftBukkit start
|
||||||
|
- Server server = world.getServer();
|
||||||
|
if (server != null) {
|
||||||
|
/*
|
||||||
|
* If it's a new world, the first few chunks are generated inside
|
||||||
|
--
|
||||||
|
1.9.5.msysgit.0
|
||||||
|
|
353
Patches/CraftBukkit-Patches/0164-Packet-listener-changes.patch
Normal file
353
Patches/CraftBukkit-Patches/0164-Packet-listener-changes.patch
Normal file
@ -0,0 +1,353 @@
|
|||||||
|
From 47c08a6099856faf0049c0b0cdde495a8ae4166e Mon Sep 17 00:00:00 2001
|
||||||
|
From: libraryaddict <libraryaddict115@yahoo.co.nz>
|
||||||
|
Date: Fri, 23 Oct 2015 21:22:05 +1300
|
||||||
|
Subject: [PATCH] Packet listener changes
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/com/mineplex/spigot/IPacketVerifier.java b/src/main/java/com/mineplex/spigot/IPacketVerifier.java
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..f86dfd1
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/src/main/java/com/mineplex/spigot/IPacketVerifier.java
|
||||||
|
@@ -0,0 +1,8 @@
|
||||||
|
+package com.mineplex.spigot;
|
||||||
|
+
|
||||||
|
+import net.minecraft.server.Packet;
|
||||||
|
+
|
||||||
|
+public interface IPacketVerifier
|
||||||
|
+{
|
||||||
|
+ public boolean handlePacket(Packet packet);
|
||||||
|
+}
|
||||||
|
\ No newline at end of file
|
||||||
|
diff --git a/src/main/java/com/mineplex/spigot/PacketProcessor.java b/src/main/java/com/mineplex/spigot/PacketProcessor.java
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..5695899
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/src/main/java/com/mineplex/spigot/PacketProcessor.java
|
||||||
|
@@ -0,0 +1,250 @@
|
||||||
|
+package com.mineplex.spigot;
|
||||||
|
+
|
||||||
|
+import java.util.ArrayList;
|
||||||
|
+import java.util.List;
|
||||||
|
+import java.util.HashMap;
|
||||||
|
+import io.netty.util.concurrent.GenericFutureListener;
|
||||||
|
+
|
||||||
|
+import net.minecraft.server.NetworkManager;
|
||||||
|
+import net.minecraft.server.IChatBaseComponent;
|
||||||
|
+
|
||||||
|
+import net.minecraft.server.Packet;
|
||||||
|
+import net.minecraft.server.PacketListenerPlayIn;
|
||||||
|
+import net.minecraft.server.IUpdatePlayerListBox;
|
||||||
|
+import net.minecraft.server.PlayerConnection;
|
||||||
|
+import net.minecraft.server.PacketPlayInChat;
|
||||||
|
+import net.minecraft.server.PacketPlayInTabComplete;
|
||||||
|
+import net.minecraft.server.PacketPlayInClientCommand;
|
||||||
|
+import net.minecraft.server.PacketPlayInSettings;
|
||||||
|
+import net.minecraft.server.PacketPlayInTransaction;
|
||||||
|
+import net.minecraft.server.PacketPlayInEnchantItem;
|
||||||
|
+import net.minecraft.server.PacketPlayInWindowClick;
|
||||||
|
+import net.minecraft.server.PacketPlayInCloseWindow;
|
||||||
|
+import net.minecraft.server.PacketPlayInCustomPayload;
|
||||||
|
+import net.minecraft.server.PacketPlayInUseEntity;
|
||||||
|
+import net.minecraft.server.PacketPlayInKeepAlive;
|
||||||
|
+import net.minecraft.server.PacketPlayInFlying;
|
||||||
|
+import net.minecraft.server.PacketPlayInAbilities;
|
||||||
|
+import net.minecraft.server.PacketPlayInBlockDig;
|
||||||
|
+import net.minecraft.server.PacketPlayInEntityAction;
|
||||||
|
+import net.minecraft.server.PacketPlayInSteerVehicle;
|
||||||
|
+import net.minecraft.server.PacketPlayInHeldItemSlot;
|
||||||
|
+import net.minecraft.server.PacketPlayInSetCreativeSlot;
|
||||||
|
+import net.minecraft.server.PacketPlayInUpdateSign;
|
||||||
|
+import net.minecraft.server.PacketPlayInBlockPlace;
|
||||||
|
+import net.minecraft.server.PacketPlayInSpectate;
|
||||||
|
+import net.minecraft.server.PacketPlayInResourcePackStatus;
|
||||||
|
+import net.minecraft.server.PacketPlayInArmAnimation;
|
||||||
|
+
|
||||||
|
+public class PacketProcessor implements PacketListenerPlayIn, IUpdatePlayerListBox
|
||||||
|
+{
|
||||||
|
+ private IPacketVerifier _packetVerifier;
|
||||||
|
+ private PlayerConnection _packetListener;
|
||||||
|
+ private static volatile HashMap<Class, Boolean> _listenedPackets = new HashMap<Class, Boolean>();
|
||||||
|
+
|
||||||
|
+ public PacketProcessor(PlayerConnection packetListener)
|
||||||
|
+ {
|
||||||
|
+ _packetListener = packetListener;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void setPacketVerifier(IPacketVerifier verifier)
|
||||||
|
+ {
|
||||||
|
+ _packetVerifier = verifier;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void c()
|
||||||
|
+ {
|
||||||
|
+ _packetListener.c();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public static void addPacket(Class packetClass, boolean forceMainThread)
|
||||||
|
+ {
|
||||||
|
+ _listenedPackets.put(packetClass, forceMainThread);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public static void removePacket(Class packetClass)
|
||||||
|
+ {
|
||||||
|
+ _listenedPackets.remove(packetClass);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void processOutgoingPacket(Packet packet, NetworkManager networkManager)
|
||||||
|
+ {
|
||||||
|
+ if (!_listenedPackets.containsKey(packet.getClass()))
|
||||||
|
+ {
|
||||||
|
+ networkManager.handle(packet);
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ boolean addDefaultPacket = true;
|
||||||
|
+
|
||||||
|
+ if (_packetVerifier != null)
|
||||||
|
+ {
|
||||||
|
+ if (!_packetVerifier.handlePacket(packet))
|
||||||
|
+ {
|
||||||
|
+ addDefaultPacket = false;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (addDefaultPacket)
|
||||||
|
+ {
|
||||||
|
+ networkManager.handle(packet);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void processIncomingPacket(final Packet packet)
|
||||||
|
+ {
|
||||||
|
+ if (!_listenedPackets.containsKey(packet.getClass()))
|
||||||
|
+ {
|
||||||
|
+ packet.a(_packetListener);
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (!_packetListener.player.u().isMainThread() && _listenedPackets.get(packet.getClass()))
|
||||||
|
+ {
|
||||||
|
+ _packetListener.player.u().postToMainThread(new Runnable()
|
||||||
|
+ {
|
||||||
|
+ public void run()
|
||||||
|
+ {
|
||||||
|
+ processIncomingPacket(packet);
|
||||||
|
+ }
|
||||||
|
+ });
|
||||||
|
+
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ boolean addDefaultPacket = true;
|
||||||
|
+
|
||||||
|
+ if (_packetVerifier != null)
|
||||||
|
+ {
|
||||||
|
+ if (!_packetVerifier.handlePacket(packet))
|
||||||
|
+ {
|
||||||
|
+ addDefaultPacket = false;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (addDefaultPacket)
|
||||||
|
+ {
|
||||||
|
+ packet.a(_packetListener);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void a(PacketPlayInChat packet)
|
||||||
|
+ {
|
||||||
|
+ processIncomingPacket(packet);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void a(PacketPlayInTabComplete packet)
|
||||||
|
+ {
|
||||||
|
+ processIncomingPacket(packet);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void a(PacketPlayInClientCommand packet)
|
||||||
|
+ {
|
||||||
|
+ processIncomingPacket(packet);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void a(PacketPlayInSettings packet)
|
||||||
|
+ {
|
||||||
|
+ processIncomingPacket(packet);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void a(PacketPlayInTransaction packet)
|
||||||
|
+ {
|
||||||
|
+ processIncomingPacket(packet);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void a(PacketPlayInEnchantItem packet)
|
||||||
|
+ {
|
||||||
|
+ processIncomingPacket(packet);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void a(PacketPlayInWindowClick packet)
|
||||||
|
+ {
|
||||||
|
+ processIncomingPacket(packet);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void a(PacketPlayInCloseWindow packet)
|
||||||
|
+ {
|
||||||
|
+ processIncomingPacket(packet);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void a(PacketPlayInCustomPayload packet)
|
||||||
|
+ {
|
||||||
|
+ processIncomingPacket(packet);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void a(PacketPlayInUseEntity packet)
|
||||||
|
+ {
|
||||||
|
+ processIncomingPacket(packet);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void a(PacketPlayInKeepAlive packet)
|
||||||
|
+ {
|
||||||
|
+ processIncomingPacket(packet);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void a(PacketPlayInFlying packet)
|
||||||
|
+ {
|
||||||
|
+ processIncomingPacket(packet);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void a(PacketPlayInAbilities packet)
|
||||||
|
+ {
|
||||||
|
+ processIncomingPacket(packet);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void a(PacketPlayInBlockDig packet)
|
||||||
|
+ {
|
||||||
|
+ processIncomingPacket(packet);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void a(PacketPlayInEntityAction packet)
|
||||||
|
+ {
|
||||||
|
+ processIncomingPacket(packet);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void a(PacketPlayInSteerVehicle packet)
|
||||||
|
+ {
|
||||||
|
+ processIncomingPacket(packet);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void a(PacketPlayInHeldItemSlot packet)
|
||||||
|
+ {
|
||||||
|
+ processIncomingPacket(packet);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void a(PacketPlayInSetCreativeSlot packet)
|
||||||
|
+ {
|
||||||
|
+ processIncomingPacket(packet);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void a(PacketPlayInUpdateSign packet)
|
||||||
|
+ {
|
||||||
|
+ processIncomingPacket(packet);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void a(PacketPlayInBlockPlace packet)
|
||||||
|
+ {
|
||||||
|
+ processIncomingPacket(packet);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void a(PacketPlayInSpectate packet)
|
||||||
|
+ {
|
||||||
|
+ processIncomingPacket(packet);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void a(PacketPlayInResourcePackStatus packet)
|
||||||
|
+ {
|
||||||
|
+ processIncomingPacket(packet);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void a(PacketPlayInArmAnimation packet)
|
||||||
|
+ {
|
||||||
|
+ processIncomingPacket(packet);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void a(IChatBaseComponent packet)
|
||||||
|
+ {
|
||||||
|
+ _packetListener.a(packet);
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
\ No newline at end of file
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java
|
||||||
|
index 9d23c6c..83a600c 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/NetworkManager.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/NetworkManager.java
|
||||||
|
@@ -27,6 +27,8 @@ import org.apache.logging.log4j.Logger;
|
||||||
|
import org.apache.logging.log4j.Marker;
|
||||||
|
import org.apache.logging.log4j.MarkerManager;
|
||||||
|
|
||||||
|
+import com.mineplex.spigot.PacketProcessor;
|
||||||
|
+
|
||||||
|
public class NetworkManager extends SimpleChannelInboundHandler<Packet> {
|
||||||
|
|
||||||
|
private static final Logger g = LogManager.getLogger();
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||||
|
index 5740e49..5edef3e 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||||
|
@@ -62,6 +62,8 @@ import org.bukkit.inventory.InventoryView;
|
||||||
|
import org.bukkit.util.NumberConversions;
|
||||||
|
// CraftBukkit end
|
||||||
|
|
||||||
|
+import com.mineplex.spigot.PacketProcessor;
|
||||||
|
+
|
||||||
|
public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerListBox {
|
||||||
|
|
||||||
|
private static final Logger c = LogManager.getLogger();
|
||||||
|
@@ -87,15 +89,20 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList
|
||||||
|
private boolean checkMovement = true;
|
||||||
|
private boolean processedDisconnect; // CraftBukkit - added
|
||||||
|
|
||||||
|
+ public PacketProcessor PacketVerifier;
|
||||||
|
+
|
||||||
|
public PlayerConnection(MinecraftServer minecraftserver, NetworkManager networkmanager, EntityPlayer entityplayer) {
|
||||||
|
this.minecraftServer = minecraftserver;
|
||||||
|
this.networkManager = networkmanager;
|
||||||
|
- networkmanager.a((PacketListener) this);
|
||||||
|
this.player = entityplayer;
|
||||||
|
entityplayer.playerConnection = this;
|
||||||
|
|
||||||
|
// CraftBukkit start - add fields and methods
|
||||||
|
this.server = minecraftserver.server;
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+ PacketVerifier = new PacketProcessor(this);
|
||||||
|
+ networkmanager.a(PacketVerifier);
|
||||||
|
}
|
||||||
|
|
||||||
|
private final org.bukkit.craftbukkit.CraftServer server;
|
||||||
|
@@ -904,7 +911,7 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList
|
||||||
|
// CraftBukkit end
|
||||||
|
|
||||||
|
try {
|
||||||
|
- this.networkManager.handle(packet);
|
||||||
|
+ PacketVerifier.processOutgoingPacket(packet, networkManager);
|
||||||
|
} catch (Throwable throwable) {
|
||||||
|
CrashReport crashreport = CrashReport.a(throwable, "Sending packet");
|
||||||
|
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Packet being sent");
|
||||||
|
@@ -1408,9 +1415,12 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList
|
||||||
|
if (this.player.dead) return; // CraftBukkit
|
||||||
|
PlayerConnectionUtils.ensureMainThread(packetplayinclosewindow, this, this.player.u());
|
||||||
|
|
||||||
|
- CraftEventFactory.handleInventoryCloseEvent(this.player); // CraftBukkit
|
||||||
|
+ if (packetplayinclosewindow.id == player.activeContainer.windowId)
|
||||||
|
+ {
|
||||||
|
+ CraftEventFactory.handleInventoryCloseEvent(this.player); // CraftBukkit
|
||||||
|
|
||||||
|
- this.player.p();
|
||||||
|
+ this.player.p();
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
public void a(PacketPlayInWindowClick packetplayinwindowclick) {
|
||||||
|
--
|
||||||
|
1.9.5.msysgit.0
|
||||||
|
|
428
Patches/CraftBukkit-Patches/0165-Inventory-changes.patch
Normal file
428
Patches/CraftBukkit-Patches/0165-Inventory-changes.patch
Normal file
@ -0,0 +1,428 @@
|
|||||||
|
From 702360d29859ed580b44255ccb7f2f124e6aa24b Mon Sep 17 00:00:00 2001
|
||||||
|
From: libraryaddict <libraryaddict115@yahoo.co.nz>
|
||||||
|
Date: Fri, 23 Oct 2015 21:22:36 +1300
|
||||||
|
Subject: [PATCH] Inventory changes
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java
|
||||||
|
index e9a3c50..9fd6359 100644
|
||||||
|
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java
|
||||||
|
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java
|
||||||
|
@@ -441,8 +441,8 @@ public class CraftInventory implements Inventory {
|
||||||
|
return InventoryType.ENCHANTING;
|
||||||
|
} else if (inventory instanceof TileEntityBrewingStand) {
|
||||||
|
return InventoryType.BREWING;
|
||||||
|
- } else if (inventory instanceof CraftInventoryCustom.MinecraftInventory) {
|
||||||
|
- return ((CraftInventoryCustom.MinecraftInventory) inventory).getType();
|
||||||
|
+ } else if (inventory instanceof MinecraftInventory) {
|
||||||
|
+ return ((MinecraftInventory) inventory).getType();
|
||||||
|
} else if (inventory instanceof InventoryEnderChest) {
|
||||||
|
return InventoryType.ENDER_CHEST;
|
||||||
|
} else if (inventory instanceof InventoryMerchant) {
|
||||||
|
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java
|
||||||
|
index 947c493..eed9afa 100644
|
||||||
|
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java
|
||||||
|
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java
|
||||||
|
@@ -31,168 +31,4 @@ public class CraftInventoryCustom extends CraftInventory {
|
||||||
|
public CraftInventoryCustom(InventoryHolder owner, int size, String title) {
|
||||||
|
super(new MinecraftInventory(owner, size, title));
|
||||||
|
}
|
||||||
|
-
|
||||||
|
- static class MinecraftInventory implements IInventory {
|
||||||
|
- private final ItemStack[] items;
|
||||||
|
- private int maxStack = MAX_STACK;
|
||||||
|
- private final List<HumanEntity> viewers;
|
||||||
|
- private final String title;
|
||||||
|
- private InventoryType type;
|
||||||
|
- private final InventoryHolder owner;
|
||||||
|
-
|
||||||
|
- public MinecraftInventory(InventoryHolder owner, InventoryType type) {
|
||||||
|
- this(owner, type.getDefaultSize(), type.getDefaultTitle());
|
||||||
|
- this.type = type;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- public MinecraftInventory(InventoryHolder owner, InventoryType type, String title) {
|
||||||
|
- this(owner, type.getDefaultSize(), title);
|
||||||
|
- this.type = type;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- public MinecraftInventory(InventoryHolder owner, int size) {
|
||||||
|
- this(owner, size, "Chest");
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- public MinecraftInventory(InventoryHolder owner, int size, String title) {
|
||||||
|
- Validate.notNull(title, "Title cannot be null");
|
||||||
|
- Validate.isTrue(title.length() <= 32, "Title cannot be longer than 32 characters");
|
||||||
|
- this.items = new ItemStack[size];
|
||||||
|
- this.title = title;
|
||||||
|
- this.viewers = new ArrayList<HumanEntity>();
|
||||||
|
- this.owner = owner;
|
||||||
|
- this.type = InventoryType.CHEST;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- public int getSize() {
|
||||||
|
- return items.length;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- public ItemStack getItem(int i) {
|
||||||
|
- return items[i];
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- public ItemStack splitStack(int i, int j) {
|
||||||
|
- ItemStack stack = this.getItem(i);
|
||||||
|
- ItemStack result;
|
||||||
|
- if (stack == null) return null;
|
||||||
|
- if (stack.count <= j) {
|
||||||
|
- this.setItem(i, null);
|
||||||
|
- result = stack;
|
||||||
|
- } else {
|
||||||
|
- result = CraftItemStack.copyNMSStack(stack, j);
|
||||||
|
- stack.count -= j;
|
||||||
|
- }
|
||||||
|
- this.update();
|
||||||
|
- return result;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- public ItemStack splitWithoutUpdate(int i) {
|
||||||
|
- ItemStack stack = this.getItem(i);
|
||||||
|
- ItemStack result;
|
||||||
|
- if (stack == null) return null;
|
||||||
|
- if (stack.count <= 1) {
|
||||||
|
- this.setItem(i, null);
|
||||||
|
- result = stack;
|
||||||
|
- } else {
|
||||||
|
- result = CraftItemStack.copyNMSStack(stack, 1);
|
||||||
|
- stack.count -= 1;
|
||||||
|
- }
|
||||||
|
- return result;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- public void setItem(int i, ItemStack itemstack) {
|
||||||
|
- items[i] = itemstack;
|
||||||
|
- if (itemstack != null && this.getMaxStackSize() > 0 && itemstack.count > this.getMaxStackSize()) {
|
||||||
|
- itemstack.count = this.getMaxStackSize();
|
||||||
|
- }
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- public int getMaxStackSize() {
|
||||||
|
- return maxStack;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- public void setMaxStackSize(int size) {
|
||||||
|
- maxStack = size;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- public void update() {}
|
||||||
|
-
|
||||||
|
- public boolean a(EntityHuman entityhuman) {
|
||||||
|
- return true;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- public ItemStack[] getContents() {
|
||||||
|
- return items;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- public void onOpen(CraftHumanEntity who) {
|
||||||
|
- viewers.add(who);
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- public void onClose(CraftHumanEntity who) {
|
||||||
|
- viewers.remove(who);
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- public List<HumanEntity> getViewers() {
|
||||||
|
- return viewers;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- public InventoryType getType() {
|
||||||
|
- return type;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- public InventoryHolder getOwner() {
|
||||||
|
- return owner;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- public boolean b(int i, ItemStack itemstack) {
|
||||||
|
- return true;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- @Override
|
||||||
|
- public void startOpen(EntityHuman entityHuman) {
|
||||||
|
-
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- @Override
|
||||||
|
- public void closeContainer(EntityHuman entityHuman) {
|
||||||
|
-
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- @Override
|
||||||
|
- public int getProperty(int i) {
|
||||||
|
- return 0;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- @Override
|
||||||
|
- public void b(int i, int i1) {
|
||||||
|
-
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- @Override
|
||||||
|
- public int g() {
|
||||||
|
- return 0;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- @Override
|
||||||
|
- public void l() {
|
||||||
|
-
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- @Override
|
||||||
|
- public String getName() {
|
||||||
|
- return title;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- @Override
|
||||||
|
- public boolean hasCustomName() {
|
||||||
|
- return title != null;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- @Override
|
||||||
|
- public IChatBaseComponent getScoreboardDisplayName() {
|
||||||
|
- return new ChatComponentText(title);
|
||||||
|
- }
|
||||||
|
- }
|
||||||
|
}
|
||||||
|
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
|
||||||
|
index 23f05f4..fdaf026 100644
|
||||||
|
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
|
||||||
|
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java
|
||||||
|
@@ -26,7 +26,7 @@ import net.minecraft.server.NBTTagString;
|
||||||
|
import org.bukkit.craftbukkit.util.CraftChatMessage;
|
||||||
|
|
||||||
|
@DelegateDeserialization(ItemStack.class)
|
||||||
|
-public final class CraftItemStack extends ItemStack {
|
||||||
|
+public class CraftItemStack extends ItemStack {
|
||||||
|
|
||||||
|
public static net.minecraft.server.ItemStack asNMSCopy(ItemStack original) {
|
||||||
|
if (original instanceof CraftItemStack) {
|
||||||
|
@@ -95,26 +95,30 @@ public final class CraftItemStack extends ItemStack {
|
||||||
|
/**
|
||||||
|
* Mirror
|
||||||
|
*/
|
||||||
|
- private CraftItemStack(net.minecraft.server.ItemStack item) {
|
||||||
|
+ protected CraftItemStack(net.minecraft.server.ItemStack item) {
|
||||||
|
this.handle = item;
|
||||||
|
}
|
||||||
|
|
||||||
|
- private CraftItemStack(ItemStack item) {
|
||||||
|
+ protected CraftItemStack(ItemStack item) {
|
||||||
|
this(item.getTypeId(), item.getAmount(), item.getDurability(), item.hasItemMeta() ? item.getItemMeta() : null);
|
||||||
|
}
|
||||||
|
|
||||||
|
- private CraftItemStack(Material type, int amount, short durability, ItemMeta itemMeta) {
|
||||||
|
+ protected CraftItemStack(Material type, int amount, short durability, ItemMeta itemMeta) {
|
||||||
|
setType(type);
|
||||||
|
setAmount(amount);
|
||||||
|
setDurability(durability);
|
||||||
|
setItemMeta(itemMeta);
|
||||||
|
}
|
||||||
|
|
||||||
|
- private CraftItemStack(int typeId, int amount, short durability, ItemMeta itemMeta) {
|
||||||
|
+ protected CraftItemStack(int typeId, int amount, short durability, ItemMeta itemMeta) {
|
||||||
|
this(Material.getMaterial(typeId), amount, durability, itemMeta);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
+ public net.minecraft.server.ItemStack getHandle() {
|
||||||
|
+ return handle;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
@Override
|
||||||
|
public int getTypeId() {
|
||||||
|
return handle != null ? CraftMagicNumbers.getId(handle.getItem()) : 0;
|
||||||
|
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/MinecraftInventory.java b/src/main/java/org/bukkit/craftbukkit/inventory/MinecraftInventory.java
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..f0d8f81
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/MinecraftInventory.java
|
||||||
|
@@ -0,0 +1,177 @@
|
||||||
|
+package org.bukkit.craftbukkit.inventory;
|
||||||
|
+
|
||||||
|
+import net.minecraft.server.*;
|
||||||
|
+import org.apache.commons.lang.Validate;
|
||||||
|
+import org.bukkit.craftbukkit.entity.CraftHumanEntity;
|
||||||
|
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||||
|
+import org.bukkit.entity.HumanEntity;
|
||||||
|
+import org.bukkit.event.inventory.InventoryType;
|
||||||
|
+import org.bukkit.inventory.InventoryHolder;
|
||||||
|
+
|
||||||
|
+import java.util.ArrayList;
|
||||||
|
+import java.util.List;
|
||||||
|
+
|
||||||
|
+public class MinecraftInventory implements IInventory
|
||||||
|
+{
|
||||||
|
+ private final ItemStack[] items;
|
||||||
|
+ private int maxStack = MAX_STACK;
|
||||||
|
+ private final List<HumanEntity> viewers;
|
||||||
|
+ private final String title;
|
||||||
|
+ private InventoryType type;
|
||||||
|
+ private final InventoryHolder owner;
|
||||||
|
+
|
||||||
|
+ public MinecraftInventory(InventoryHolder owner, InventoryType type) {
|
||||||
|
+ this(owner, type.getDefaultSize(), type.getDefaultTitle());
|
||||||
|
+ this.type = type;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public MinecraftInventory(InventoryHolder owner, InventoryType type, String title) {
|
||||||
|
+ this(owner, type.getDefaultSize(), title);
|
||||||
|
+ this.type = type;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public MinecraftInventory(InventoryHolder owner, int size) {
|
||||||
|
+ this(owner, size, "Chest");
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public MinecraftInventory(InventoryHolder owner, int size, String title) {
|
||||||
|
+ Validate.notNull(title, "Title cannot be null");
|
||||||
|
+ Validate.isTrue(title.length() <= 32, "Title cannot be longer than 32 characters");
|
||||||
|
+ this.items = new ItemStack[size];
|
||||||
|
+ this.title = title;
|
||||||
|
+ this.viewers = new ArrayList<HumanEntity>();
|
||||||
|
+ this.owner = owner;
|
||||||
|
+ this.type = InventoryType.CHEST;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public int getSize() {
|
||||||
|
+ return items.length;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public ItemStack getItem(int i) {
|
||||||
|
+ return items[i];
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public ItemStack splitStack(int i, int j) {
|
||||||
|
+ ItemStack stack = this.getItem(i);
|
||||||
|
+ ItemStack result;
|
||||||
|
+ if (stack == null) return null;
|
||||||
|
+ if (stack.count <= j) {
|
||||||
|
+ this.setItem(i, null);
|
||||||
|
+ result = stack;
|
||||||
|
+ } else {
|
||||||
|
+ result = CraftItemStack.copyNMSStack(stack, j);
|
||||||
|
+ stack.count -= j;
|
||||||
|
+ }
|
||||||
|
+ this.update();
|
||||||
|
+ return result;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public ItemStack splitWithoutUpdate(int i) {
|
||||||
|
+ ItemStack stack = this.getItem(i);
|
||||||
|
+ ItemStack result;
|
||||||
|
+ if (stack == null) return null;
|
||||||
|
+ if (stack.count <= 1) {
|
||||||
|
+ this.setItem(i, null);
|
||||||
|
+ result = stack;
|
||||||
|
+ } else {
|
||||||
|
+ result = CraftItemStack.copyNMSStack(stack, 1);
|
||||||
|
+ stack.count -= 1;
|
||||||
|
+ }
|
||||||
|
+ return result;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void setItem(int i, ItemStack itemstack) {
|
||||||
|
+ items[i] = itemstack;
|
||||||
|
+ if (itemstack != null && this.getMaxStackSize() > 0 && itemstack.count > this.getMaxStackSize()) {
|
||||||
|
+ itemstack.count = this.getMaxStackSize();
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public int getMaxStackSize() {
|
||||||
|
+ return maxStack;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void setMaxStackSize(int size) {
|
||||||
|
+ maxStack = size;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void update() {}
|
||||||
|
+
|
||||||
|
+ public boolean a(EntityHuman entityhuman) {
|
||||||
|
+ return true;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public ItemStack[] getContents() {
|
||||||
|
+ return items;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void onOpen(CraftHumanEntity who) {
|
||||||
|
+ viewers.add(who);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void onClose(CraftHumanEntity who) {
|
||||||
|
+ viewers.remove(who);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public List<HumanEntity> getViewers() {
|
||||||
|
+ return viewers;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public InventoryType getType() {
|
||||||
|
+ return type;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public InventoryHolder getOwner() {
|
||||||
|
+ return owner;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public boolean b(int i, ItemStack itemstack) {
|
||||||
|
+ return true;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public void startOpen(EntityHuman entityHuman) {
|
||||||
|
+
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public void closeContainer(EntityHuman entityHuman) {
|
||||||
|
+
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public int getProperty(int i) {
|
||||||
|
+ return 0;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public void b(int i, int i1) {
|
||||||
|
+
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public int g() {
|
||||||
|
+ return 0;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public void l() {
|
||||||
|
+
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public String getName() {
|
||||||
|
+ return title;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public boolean hasCustomName() {
|
||||||
|
+ return title != null;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public IChatBaseComponent getScoreboardDisplayName() {
|
||||||
|
+ return new ChatComponentText(title);
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
--
|
||||||
|
1.9.5.msysgit.0
|
||||||
|
|
277
Patches/CraftBukkit-Patches/0166-Misc-changes.patch
Normal file
277
Patches/CraftBukkit-Patches/0166-Misc-changes.patch
Normal file
@ -0,0 +1,277 @@
|
|||||||
|
From 088fc9372c061edac80ee5cce669382ebed0b1e3 Mon Sep 17 00:00:00 2001
|
||||||
|
From: libraryaddict <libraryaddict115@yahoo.co.nz>
|
||||||
|
Date: Fri, 23 Oct 2015 21:23:00 +1300
|
||||||
|
Subject: [PATCH] Misc changes
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/ControllerLook.java b/src/main/java/net/minecraft/server/ControllerLook.java
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..2263d5d
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/src/main/java/net/minecraft/server/ControllerLook.java
|
||||||
|
@@ -0,0 +1,101 @@
|
||||||
|
+package net.minecraft.server;
|
||||||
|
+
|
||||||
|
+public class ControllerLook
|
||||||
|
+{
|
||||||
|
+ private EntityInsentient a;
|
||||||
|
+ private float b;
|
||||||
|
+ private float c;
|
||||||
|
+ private boolean d;
|
||||||
|
+ private double e;
|
||||||
|
+ private double f;
|
||||||
|
+ private double g;
|
||||||
|
+
|
||||||
|
+ public ControllerLook(EntityInsentient paramEntityInsentient)
|
||||||
|
+ {
|
||||||
|
+ this.a = paramEntityInsentient;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void a(Entity paramEntity, float paramFloat1, float paramFloat2) {
|
||||||
|
+ this.e = paramEntity.locX;
|
||||||
|
+ if ((paramEntity instanceof EntityLiving))
|
||||||
|
+ this.f = (paramEntity.locY + paramEntity.getHeadHeight());
|
||||||
|
+ else {
|
||||||
|
+ this.f = ((paramEntity.getBoundingBox().b + paramEntity.getBoundingBox().e) / 2.0D);
|
||||||
|
+ }
|
||||||
|
+ this.g = paramEntity.locZ;
|
||||||
|
+ this.b = paramFloat1;
|
||||||
|
+ this.c = paramFloat2;
|
||||||
|
+ this.d = true;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void a(double paramDouble1, double paramDouble2, double paramDouble3, float paramFloat1, float paramFloat2) {
|
||||||
|
+ this.e = paramDouble1;
|
||||||
|
+ this.f = paramDouble2;
|
||||||
|
+ this.g = paramDouble3;
|
||||||
|
+ this.b = paramFloat1;
|
||||||
|
+ this.c = paramFloat2;
|
||||||
|
+ this.d = true;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void a() {
|
||||||
|
+ if (a.isVegetated())
|
||||||
|
+ return;
|
||||||
|
+ this.a.pitch = 0.0F;
|
||||||
|
+
|
||||||
|
+ if (this.d) {
|
||||||
|
+ this.d = false;
|
||||||
|
+
|
||||||
|
+ double d1 = this.e - this.a.locX;
|
||||||
|
+ double d2 = this.f - (this.a.locY + this.a.getHeadHeight());
|
||||||
|
+ double d3 = this.g - this.a.locZ;
|
||||||
|
+ double d4 = MathHelper.sqrt(d1 * d1 + d3 * d3);
|
||||||
|
+
|
||||||
|
+ float f1 = (float)(MathHelper.b(d3, d1) * 180.0D / 3.141592741012573D) - 90.0F;
|
||||||
|
+ float f2 = (float)-(MathHelper.b(d2, d4) * 180.0D / 3.141592741012573D);
|
||||||
|
+ this.a.pitch = a(this.a.pitch, f2, this.c);
|
||||||
|
+ this.a.aK = a(this.a.aK, f1, this.b);
|
||||||
|
+ } else {
|
||||||
|
+ this.a.aK = a(this.a.aK, this.a.aI, 10.0F);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ float f3 = MathHelper.g(this.a.aK - this.a.aI);
|
||||||
|
+
|
||||||
|
+ if (!this.a.getNavigation().m())
|
||||||
|
+ {
|
||||||
|
+ if (f3 < -75.0F) {
|
||||||
|
+ this.a.aK = (this.a.aI - 75.0F);
|
||||||
|
+ }
|
||||||
|
+ if (f3 > 75.0F)
|
||||||
|
+ this.a.aK = (this.a.aI + 75.0F);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ private float a(float paramFloat1, float paramFloat2, float paramFloat3)
|
||||||
|
+ {
|
||||||
|
+ float f1 = MathHelper.g(paramFloat2 - paramFloat1);
|
||||||
|
+ if (f1 > paramFloat3) {
|
||||||
|
+ f1 = paramFloat3;
|
||||||
|
+ }
|
||||||
|
+ if (f1 < -paramFloat3) {
|
||||||
|
+ f1 = -paramFloat3;
|
||||||
|
+ }
|
||||||
|
+ return paramFloat1 + f1;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public boolean b() {
|
||||||
|
+ return this.d;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public double e()
|
||||||
|
+ {
|
||||||
|
+ return this.e;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public double f() {
|
||||||
|
+ return this.f;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public double g() {
|
||||||
|
+ return this.g;
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
\ No newline at end of file
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java
|
||||||
|
index c30867d..b86369b 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/DedicatedServer.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/DedicatedServer.java
|
||||||
|
@@ -132,7 +132,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
|
||||||
|
System.err.println( "If you do not agree to the above EULA please stop your server and remove this flag immediately." );
|
||||||
|
}
|
||||||
|
// Spigot End
|
||||||
|
- if (!this.p.a() && !eulaAgreed) { // Spigot
|
||||||
|
+ if (false && !this.p.a() && !eulaAgreed) { // Spigot
|
||||||
|
DedicatedServer.LOGGER.info("You need to agree to the EULA in order to run the server. Go to eula.txt for more info.");
|
||||||
|
this.p.b();
|
||||||
|
return false;
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
|
||||||
|
index eb54e7f..66c3d0c 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/EntityHuman.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
|
||||||
|
@@ -133,7 +133,7 @@ public abstract class EntityHuman extends EntityLiving {
|
||||||
|
if (this.g != null) {
|
||||||
|
ItemStack itemstack = this.inventory.getItemInHand();
|
||||||
|
|
||||||
|
- if (itemstack == this.g) {
|
||||||
|
+ if (ItemStack.equals(itemstack, this.g)) {
|
||||||
|
if (this.h <= 25 && this.h % 4 == 0) {
|
||||||
|
this.b(itemstack, 5);
|
||||||
|
}
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/TileEntityBeacon.java b/src/main/java/net/minecraft/server/TileEntityBeacon.java
|
||||||
|
index 4f280dd..73a288c 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/TileEntityBeacon.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/TileEntityBeacon.java
|
||||||
|
@@ -59,7 +59,7 @@ public class TileEntityBeacon extends TileEntityContainer implements IUpdatePlay
|
||||||
|
this.A();
|
||||||
|
}
|
||||||
|
|
||||||
|
- private void A() {
|
||||||
|
+ public void A() {
|
||||||
|
if (this.i && this.j > 0 && !this.world.isClientSide && this.k > 0) {
|
||||||
|
double d0 = (double) (this.j * 10 + 10);
|
||||||
|
byte b0 = 0;
|
||||||
|
@@ -94,7 +94,7 @@ public class TileEntityBeacon extends TileEntityContainer implements IUpdatePlay
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
- private void B() {
|
||||||
|
+ public void B() {
|
||||||
|
int i = this.j;
|
||||||
|
int j = this.position.getX();
|
||||||
|
int k = this.position.getY();
|
||||||
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||||
|
index 2759425..f57c785 100644
|
||||||
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||||
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||||
|
@@ -412,7 +412,7 @@ public final class CraftServer implements Server {
|
||||||
|
int delta = Integer.MAX_VALUE;
|
||||||
|
for (Player player : getOnlinePlayers()) {
|
||||||
|
if (player.getName().toLowerCase().startsWith(lowerName)) {
|
||||||
|
- int curDelta = Math.abs(player.getName().length() - lowerName.length());
|
||||||
|
+ int curDelta = player.getName().length() - lowerName.length();
|
||||||
|
if (curDelta < delta) {
|
||||||
|
found = player;
|
||||||
|
delta = curDelta;
|
||||||
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||||
|
index 49c7fa6..0cd36e8 100644
|
||||||
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||||
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||||
|
@@ -836,7 +836,7 @@ public class CraftWorld implements World {
|
||||||
|
|
||||||
|
public <T> void playEffect(Location loc, Effect effect, T data, int radius) {
|
||||||
|
if (data != null) {
|
||||||
|
- Validate.isTrue(data.getClass().isAssignableFrom(effect.getData()), "Wrong kind of data for this effect!");
|
||||||
|
+ Validate.isTrue(data.getClass().equals(effect.getData()), "Wrong kind of data for this effect!");
|
||||||
|
} else {
|
||||||
|
Validate.isTrue(effect.getData() == null, "Wrong kind of data for this effect!");
|
||||||
|
}
|
||||||
|
@@ -1122,10 +1122,6 @@ public class CraftWorld implements World {
|
||||||
|
public <T extends Entity> T addEntity(net.minecraft.server.Entity entity, SpawnReason reason) throws IllegalArgumentException {
|
||||||
|
Preconditions.checkArgument(entity != null, "Cannot spawn null entity");
|
||||||
|
|
||||||
|
- if (entity instanceof EntityInsentient) {
|
||||||
|
- ((EntityInsentient) entity).prepare(getHandle().E(new BlockPosition(entity)), (GroupDataEntity) null);
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
world.addEntity(entity, reason);
|
||||||
|
return (T) entity.getBukkitEntity();
|
||||||
|
}
|
||||||
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||||
|
index 29082aa..e979f69 100644
|
||||||
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||||
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||||
|
@@ -325,7 +325,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||||
|
@Override
|
||||||
|
public <T> void playEffect(Location loc, Effect effect, T data) {
|
||||||
|
if (data != null) {
|
||||||
|
- Validate.isTrue(data.getClass().isAssignableFrom(effect.getData()), "Wrong kind of data for this effect!");
|
||||||
|
+ Validate.isTrue(data.getClass().equals(effect.getData()), "Wrong kind of data for this effect!");
|
||||||
|
} else {
|
||||||
|
Validate.isTrue(effect.getData() == null, "Wrong kind of data for this effect!");
|
||||||
|
}
|
||||||
|
@@ -870,10 +870,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void hidePlayer(Player player) {
|
||||||
|
+ hidePlayer(player, false, true);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void hidePlayer(Player player, boolean override, boolean hideList)
|
||||||
|
+ {
|
||||||
|
Validate.notNull(player, "hidden player cannot be null");
|
||||||
|
if (getHandle().playerConnection == null) return;
|
||||||
|
if (equals(player)) return;
|
||||||
|
- if (hiddenPlayers.contains(player.getUniqueId())) return;
|
||||||
|
+ if (!override && hiddenPlayers.contains(player.getUniqueId())) return;
|
||||||
|
hiddenPlayers.add(player.getUniqueId());
|
||||||
|
|
||||||
|
//remove this player from the hidden player's EntityTrackerEntry
|
||||||
|
@@ -885,11 +890,17 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||||
|
}
|
||||||
|
|
||||||
|
//remove the hidden player from this player user list
|
||||||
|
- getHandle().playerConnection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.REMOVE_PLAYER, other));
|
||||||
|
+ if (hideList)
|
||||||
|
+ getHandle().playerConnection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.REMOVE_PLAYER, other));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void showPlayer(Player player) {
|
||||||
|
+ showPlayer(player, true);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void showPlayer(Player player, boolean showList)
|
||||||
|
+ {
|
||||||
|
Validate.notNull(player, "shown player cannot be null");
|
||||||
|
if (getHandle().playerConnection == null) return;
|
||||||
|
if (equals(player)) return;
|
||||||
|
@@ -899,7 +910,8 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||||
|
EntityTracker tracker = ((WorldServer) entity.world).tracker;
|
||||||
|
EntityPlayer other = ((CraftPlayer) player).getHandle();
|
||||||
|
|
||||||
|
- getHandle().playerConnection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, other));
|
||||||
|
+ if (showList)
|
||||||
|
+ getHandle().playerConnection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, other));
|
||||||
|
|
||||||
|
EntityTrackerEntry entry = (EntityTrackerEntry) tracker.trackedEntities.get(other.getId());
|
||||||
|
if (entry != null && !entry.trackedPlayers.contains(getHandle())) {
|
||||||
|
@@ -1363,13 +1375,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||||
|
@Override
|
||||||
|
public boolean getCollidesWithEntities()
|
||||||
|
{
|
||||||
|
- return getHandle().collidesWithEntities;
|
||||||
|
+ return !getHandle().spectating;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setCollidesWithEntities(boolean collides)
|
||||||
|
{
|
||||||
|
- getHandle().collidesWithEntities = collides;
|
||||||
|
+ getHandle().spectating = collides;
|
||||||
|
getHandle().k = collides; // First boolean of Entity
|
||||||
|
}
|
||||||
|
|
||||||
|
--
|
||||||
|
1.9.5.msysgit.0
|
||||||
|
|
@ -0,0 +1,605 @@
|
|||||||
|
From 9aded83bc47bf6ba8076fc2ed03ebbe480df1296 Mon Sep 17 00:00:00 2001
|
||||||
|
From: libraryaddict <libraryaddict115@yahoo.co.nz>
|
||||||
|
Date: Wed, 28 Oct 2015 09:00:24 +1300
|
||||||
|
Subject: [PATCH] EntityGuardian is now vegetateable
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/EntityGuardian.java b/src/main/java/net/minecraft/server/EntityGuardian.java
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..c14caf2
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/src/main/java/net/minecraft/server/EntityGuardian.java
|
||||||
|
@@ -0,0 +1,590 @@
|
||||||
|
+package net.minecraft.server;
|
||||||
|
+
|
||||||
|
+import com.google.common.base.Predicate;
|
||||||
|
+import java.util.*;
|
||||||
|
+
|
||||||
|
+public class EntityGuardian extends EntityMonster
|
||||||
|
+{
|
||||||
|
+ static class ControllerMoveGuardian extends ControllerMove
|
||||||
|
+ {
|
||||||
|
+
|
||||||
|
+ public void c()
|
||||||
|
+ {
|
||||||
|
+ if(!this.f || g.getNavigation().m())
|
||||||
|
+ {
|
||||||
|
+ g.k(0.0F);
|
||||||
|
+ EntityGuardian.a(g, false);
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+ double d = b - g.locX;
|
||||||
|
+ double d1 = c - g.locY;
|
||||||
|
+ double d2 = this.d - g.locZ;
|
||||||
|
+ double d3 = d * d + d1 * d1 + d2 * d2;
|
||||||
|
+ d3 = MathHelper.sqrt(d3);
|
||||||
|
+ d1 /= d3;
|
||||||
|
+ float f = (float)((MathHelper.b(d2, d) * 180D) / 3.1415927410125732D) - 90F;
|
||||||
|
+ g.yaw = a(g.yaw, f, 30F);
|
||||||
|
+ g.aI = g.yaw;
|
||||||
|
+ float f1 = (float)(e * g.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).getValue());
|
||||||
|
+ g.k(g.bI() + (f1 - g.bI()) * 0.125F);
|
||||||
|
+ double d4 = Math.sin((double)(g.ticksLived + g.getId()) * 0.5D) * 0.050000000000000003D;
|
||||||
|
+ double d5 = Math.cos((g.yaw * 3.141593F) / 180F);
|
||||||
|
+ double d6 = Math.sin((g.yaw * 3.141593F) / 180F);
|
||||||
|
+ g.motX += d4 * d5;
|
||||||
|
+ g.motZ += d4 * d6;
|
||||||
|
+ d4 = Math.sin((double)(g.ticksLived + g.getId()) * 0.75D) * 0.050000000000000003D;
|
||||||
|
+ g.motY += d4 * (d6 + d5) * 0.25D;
|
||||||
|
+ g.motY += (double)g.bI() * d1 * 0.10000000000000001D;
|
||||||
|
+ ControllerLook controllerlook = g.getControllerLook();
|
||||||
|
+ double d7 = g.locX + (d / d3) * 2D;
|
||||||
|
+ double d8 = (double)g.getHeadHeight() + g.locY + (d1 / d3) * 1.0D;
|
||||||
|
+ double d9 = g.locZ + (d2 / d3) * 2D;
|
||||||
|
+ double d10 = controllerlook.e();
|
||||||
|
+ double d11 = controllerlook.f();
|
||||||
|
+ double d12 = controllerlook.g();
|
||||||
|
+ if(!controllerlook.b())
|
||||||
|
+ {
|
||||||
|
+ d10 = d7;
|
||||||
|
+ d11 = d8;
|
||||||
|
+ d12 = d9;
|
||||||
|
+ }
|
||||||
|
+ g.getControllerLook().a(d10 + (d7 - d10) * 0.125D, d11 + (d8 - d11) * 0.125D, d12 + (d9 - d12) * 0.125D, 10F, 40F);
|
||||||
|
+ EntityGuardian.a(g, true);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ private EntityGuardian g;
|
||||||
|
+
|
||||||
|
+ public ControllerMoveGuardian(EntityGuardian entityguardian)
|
||||||
|
+ {
|
||||||
|
+ super(entityguardian);
|
||||||
|
+ g = entityguardian;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ static class PathfinderGoalGuardianAttack extends PathfinderGoal
|
||||||
|
+ {
|
||||||
|
+
|
||||||
|
+ public boolean a()
|
||||||
|
+ {
|
||||||
|
+ EntityLiving entityliving = a.getGoalTarget();
|
||||||
|
+ return entityliving != null && entityliving.isAlive();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public boolean b()
|
||||||
|
+ {
|
||||||
|
+ return super.b() && (a.isElder() || a.h(a.getGoalTarget()) > 9D);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void c()
|
||||||
|
+ {
|
||||||
|
+ b = -10;
|
||||||
|
+ a.getNavigation().n();
|
||||||
|
+ a.getControllerLook().a(a.getGoalTarget(), 90F, 90F);
|
||||||
|
+ a.ai = true;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void d()
|
||||||
|
+ {
|
||||||
|
+ EntityGuardian.a(a, 0);
|
||||||
|
+ a.setGoalTarget(null);
|
||||||
|
+ EntityGuardian.a(a).f();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void e()
|
||||||
|
+ {
|
||||||
|
+ EntityLiving entityliving = a.getGoalTarget();
|
||||||
|
+ a.getNavigation().n();
|
||||||
|
+ a.getControllerLook().a(entityliving, 90F, 90F);
|
||||||
|
+ if(!a.hasLineOfSight(entityliving))
|
||||||
|
+ {
|
||||||
|
+ a.setGoalTarget(null);
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+ b++;
|
||||||
|
+ if(b == 0)
|
||||||
|
+ {
|
||||||
|
+ EntityGuardian.a(a, a.getGoalTarget().getId());
|
||||||
|
+ a.world.broadcastEntityEffect(a, (byte)21);
|
||||||
|
+ } else
|
||||||
|
+ if(b >= a.cm())
|
||||||
|
+ {
|
||||||
|
+ float f = 1.0F;
|
||||||
|
+ if(a.world.getDifficulty() == EnumDifficulty.HARD)
|
||||||
|
+ f += 2.0F;
|
||||||
|
+ if(a.isElder())
|
||||||
|
+ f += 2.0F;
|
||||||
|
+ entityliving.damageEntity(DamageSource.b(a, a), f);
|
||||||
|
+ entityliving.damageEntity(DamageSource.mobAttack(a), (float)a.getAttributeInstance(GenericAttributes.ATTACK_DAMAGE).getValue());
|
||||||
|
+ a.setGoalTarget(null);
|
||||||
|
+ } else
|
||||||
|
+ if(b >= 60)
|
||||||
|
+ if(b % 20 != 0);
|
||||||
|
+ super.e();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ private EntityGuardian a;
|
||||||
|
+ private int b;
|
||||||
|
+
|
||||||
|
+ public PathfinderGoalGuardianAttack(EntityGuardian entityguardian)
|
||||||
|
+ {
|
||||||
|
+ a = entityguardian;
|
||||||
|
+ a(3);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ static class EntitySelectorGuardianTargetHumanSquid
|
||||||
|
+ implements Predicate
|
||||||
|
+ {
|
||||||
|
+
|
||||||
|
+ public boolean a(EntityLiving entityliving)
|
||||||
|
+ {
|
||||||
|
+ return ((entityliving instanceof EntityHuman) || (entityliving instanceof EntitySquid)) && entityliving.h(a) > 9D;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public boolean apply(Object obj)
|
||||||
|
+ {
|
||||||
|
+ return a((EntityLiving)obj);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ private EntityGuardian a;
|
||||||
|
+
|
||||||
|
+ public EntitySelectorGuardianTargetHumanSquid(EntityGuardian entityguardian)
|
||||||
|
+ {
|
||||||
|
+ a = entityguardian;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+ public EntityGuardian(World world)
|
||||||
|
+ {
|
||||||
|
+ super(world);
|
||||||
|
+ b_ = 10;
|
||||||
|
+ setSize(0.85F, 0.85F);
|
||||||
|
+ goalSelector.a(4, new PathfinderGoalGuardianAttack(this));
|
||||||
|
+ PathfinderGoalMoveTowardsRestriction pathfindergoalmovetowardsrestriction;
|
||||||
|
+ goalSelector.a(5, pathfindergoalmovetowardsrestriction = new PathfinderGoalMoveTowardsRestriction(this, 1.0D));
|
||||||
|
+ goalSelector.a(7, goalRandomStroll = new PathfinderGoalRandomStroll(this, 1.0D, 80));
|
||||||
|
+ goalSelector.a(8, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 8F));
|
||||||
|
+ goalSelector.a(8, new PathfinderGoalLookAtPlayer(this, EntityGuardian.class, 12F, 0.01F));
|
||||||
|
+ goalSelector.a(9, new PathfinderGoalRandomLookaround(this));
|
||||||
|
+ goalRandomStroll.a(3);
|
||||||
|
+ pathfindergoalmovetowardsrestriction.a(3);
|
||||||
|
+ targetSelector.a(1, new PathfinderGoalNearestAttackableTarget(this, EntityLiving.class, 10, true, false, new EntitySelectorGuardianTargetHumanSquid(this)));
|
||||||
|
+ moveController = new ControllerMoveGuardian(this);
|
||||||
|
+ b = a = random.nextFloat();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void initAttributes()
|
||||||
|
+ {
|
||||||
|
+ super.initAttributes();
|
||||||
|
+ getAttributeInstance(GenericAttributes.ATTACK_DAMAGE).setValue(6D);
|
||||||
|
+ getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).setValue(0.5D);
|
||||||
|
+ getAttributeInstance(GenericAttributes.FOLLOW_RANGE).setValue(16D);
|
||||||
|
+ getAttributeInstance(GenericAttributes.maxHealth).setValue(30D);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void a(NBTTagCompound nbttagcompound)
|
||||||
|
+ {
|
||||||
|
+ super.a(nbttagcompound);
|
||||||
|
+ setElder(nbttagcompound.getBoolean("Elder"));
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void b(NBTTagCompound nbttagcompound)
|
||||||
|
+ {
|
||||||
|
+ super.b(nbttagcompound);
|
||||||
|
+ nbttagcompound.setBoolean("Elder", isElder());
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ protected NavigationAbstract b(World world)
|
||||||
|
+ {
|
||||||
|
+ return new NavigationGuardian(this, world);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ protected void h()
|
||||||
|
+ {
|
||||||
|
+ super.h();
|
||||||
|
+ datawatcher.a(16, Integer.valueOf(0));
|
||||||
|
+ datawatcher.a(17, Integer.valueOf(0));
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ private boolean a(int j)
|
||||||
|
+ {
|
||||||
|
+ return (datawatcher.getInt(16) & j) != 0;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ private void a(int j, boolean flag)
|
||||||
|
+ {
|
||||||
|
+ int k = datawatcher.getInt(16);
|
||||||
|
+ if(flag)
|
||||||
|
+ datawatcher.watch(16, Integer.valueOf(k | j));
|
||||||
|
+ else
|
||||||
|
+ datawatcher.watch(16, Integer.valueOf(k & ~j));
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public boolean n()
|
||||||
|
+ {
|
||||||
|
+ return a(2);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ private void l(boolean flag)
|
||||||
|
+ {
|
||||||
|
+ a(2, flag);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public int cm()
|
||||||
|
+ {
|
||||||
|
+ return !isElder() ? 80 : 60;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public boolean isElder()
|
||||||
|
+ {
|
||||||
|
+ return a(4);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void setElder(boolean flag)
|
||||||
|
+ {
|
||||||
|
+ a(4, flag);
|
||||||
|
+ if(flag)
|
||||||
|
+ {
|
||||||
|
+ setSize(1.9975F, 1.9975F);
|
||||||
|
+ getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).setValue(0.30000001192092896D);
|
||||||
|
+ getAttributeInstance(GenericAttributes.ATTACK_DAMAGE).setValue(8D);
|
||||||
|
+ getAttributeInstance(GenericAttributes.maxHealth).setValue(80D);
|
||||||
|
+ bX();
|
||||||
|
+ goalRandomStroll.setTimeBetweenMovement(400);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ private void b(int j)
|
||||||
|
+ {
|
||||||
|
+ datawatcher.watch(17, Integer.valueOf(j));
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public boolean cp()
|
||||||
|
+ {
|
||||||
|
+ return datawatcher.getInt(17) != 0;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public EntityLiving cq()
|
||||||
|
+ {
|
||||||
|
+ if(!cp())
|
||||||
|
+ return null;
|
||||||
|
+ if(world.isClientSide)
|
||||||
|
+ {
|
||||||
|
+ if(bo != null)
|
||||||
|
+ return bo;
|
||||||
|
+ Entity entity = world.a(datawatcher.getInt(17));
|
||||||
|
+ if(entity instanceof EntityLiving)
|
||||||
|
+ {
|
||||||
|
+ bo = (EntityLiving)entity;
|
||||||
|
+ return bo;
|
||||||
|
+ } else
|
||||||
|
+ {
|
||||||
|
+ return null;
|
||||||
|
+ }
|
||||||
|
+ } else
|
||||||
|
+ {
|
||||||
|
+ return getGoalTarget();
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void i(int j)
|
||||||
|
+ {
|
||||||
|
+ super.i(j);
|
||||||
|
+ if(j == 16)
|
||||||
|
+ {
|
||||||
|
+ if(isElder() && width < 1.0F)
|
||||||
|
+ setSize(1.9975F, 1.9975F);
|
||||||
|
+ } else
|
||||||
|
+ if(j == 17)
|
||||||
|
+ {
|
||||||
|
+ bp = 0;
|
||||||
|
+ bo = null;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public int w()
|
||||||
|
+ {
|
||||||
|
+ return 160;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ protected String z()
|
||||||
|
+ {
|
||||||
|
+ if(!V())
|
||||||
|
+ return "mob.guardian.land.idle";
|
||||||
|
+ if(isElder())
|
||||||
|
+ return "mob.guardian.elder.idle";
|
||||||
|
+ else
|
||||||
|
+ return "mob.guardian.idle";
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ protected String bo()
|
||||||
|
+ {
|
||||||
|
+ if(!V())
|
||||||
|
+ return "mob.guardian.land.hit";
|
||||||
|
+ if(isElder())
|
||||||
|
+ return "mob.guardian.elder.hit";
|
||||||
|
+ else
|
||||||
|
+ return "mob.guardian.hit";
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ protected String bp()
|
||||||
|
+ {
|
||||||
|
+ if(!V())
|
||||||
|
+ return "mob.guardian.land.death";
|
||||||
|
+ if(isElder())
|
||||||
|
+ return "mob.guardian.elder.death";
|
||||||
|
+ else
|
||||||
|
+ return "mob.guardian.death";
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ protected boolean s_()
|
||||||
|
+ {
|
||||||
|
+ return false;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public float getHeadHeight()
|
||||||
|
+ {
|
||||||
|
+ return length * 0.5F;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public float a(BlockPosition blockposition)
|
||||||
|
+ {
|
||||||
|
+ if(world.getType(blockposition).getBlock().getMaterial() == Material.WATER)
|
||||||
|
+ return (10F + world.o(blockposition)) - 0.5F;
|
||||||
|
+ else
|
||||||
|
+ return super.a(blockposition);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void m()
|
||||||
|
+ {
|
||||||
|
+ if(world.isClientSide)
|
||||||
|
+ {
|
||||||
|
+ b = a;
|
||||||
|
+ if(!V())
|
||||||
|
+ {
|
||||||
|
+ c = 2.0F;
|
||||||
|
+ if(motY > 0.0D && bq && !R())
|
||||||
|
+ world.a(locX, locY, locZ, "mob.guardian.flop", 1.0F, 1.0F, false);
|
||||||
|
+ bq = motY < 0.0D && world.d((new BlockPosition(this)).down(), false);
|
||||||
|
+ } else
|
||||||
|
+ if(n())
|
||||||
|
+ {
|
||||||
|
+ if(c < 0.5F)
|
||||||
|
+ c = 4F;
|
||||||
|
+ else
|
||||||
|
+ c = c + (0.5F - c) * 0.1F;
|
||||||
|
+ } else
|
||||||
|
+ {
|
||||||
|
+ c = c + (0.125F - c) * 0.2F;
|
||||||
|
+ }
|
||||||
|
+ a += c;
|
||||||
|
+ bn = bm;
|
||||||
|
+ if(!V())
|
||||||
|
+ bm = random.nextFloat();
|
||||||
|
+ else
|
||||||
|
+ if(n())
|
||||||
|
+ bm = bm + (0.0F - bm) * 0.25F;
|
||||||
|
+ else
|
||||||
|
+ bm = bm + (1.0F - bm) * 0.06F;
|
||||||
|
+ if(n() && V())
|
||||||
|
+ {
|
||||||
|
+ Vec3D vec3d = d(0.0F);
|
||||||
|
+ for(int j = 0; j < 2; j++)
|
||||||
|
+ world.addParticle(EnumParticle.WATER_BUBBLE, (locX + (random.nextDouble() - 0.5D) * (double)width) - vec3d.a * 1.5D, (locY + random.nextDouble() * (double)length) - vec3d.b * 1.5D, (locZ + (random.nextDouble() - 0.5D) * (double)width) - vec3d.c * 1.5D, 0.0D, 0.0D, 0.0D, new int[0]);
|
||||||
|
+
|
||||||
|
+ }
|
||||||
|
+ if(cp())
|
||||||
|
+ {
|
||||||
|
+ if(bp < cm())
|
||||||
|
+ bp++;
|
||||||
|
+ EntityLiving entityliving = cq();
|
||||||
|
+ if(entityliving != null)
|
||||||
|
+ {
|
||||||
|
+ getControllerLook().a(entityliving, 90F, 90F);
|
||||||
|
+ getControllerLook().a();
|
||||||
|
+ double d = q(0.0F);
|
||||||
|
+ double d1 = entityliving.locX - locX;
|
||||||
|
+ double d2 = (entityliving.locY + (double)(entityliving.length * 0.5F)) - (locY + (double)getHeadHeight());
|
||||||
|
+ double d3 = entityliving.locZ - locZ;
|
||||||
|
+ double d4 = Math.sqrt(d1 * d1 + d2 * d2 + d3 * d3);
|
||||||
|
+ d1 /= d4;
|
||||||
|
+ d2 /= d4;
|
||||||
|
+ d3 /= d4;
|
||||||
|
+ for(double d5 = random.nextDouble(); d5 < d4;)
|
||||||
|
+ {
|
||||||
|
+ d5 += (1.8D - d) + random.nextDouble() * (1.7D - d);
|
||||||
|
+ world.addParticle(EnumParticle.WATER_BUBBLE, locX + d1 * d5, locY + d2 * d5 + (double)getHeadHeight(), locZ + d3 * d5, 0.0D, 0.0D, 0.0D, new int[0]);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ if(isVegetated() || inWater)
|
||||||
|
+ setAirTicks(300);
|
||||||
|
+ else
|
||||||
|
+ if(onGround)
|
||||||
|
+ {
|
||||||
|
+ motY += 0.5D;
|
||||||
|
+ motX += (random.nextFloat() * 2.0F - 1.0F) * 0.4F;
|
||||||
|
+ motZ += (random.nextFloat() * 2.0F - 1.0F) * 0.4F;
|
||||||
|
+ yaw = random.nextFloat() * 360F;
|
||||||
|
+ onGround = false;
|
||||||
|
+ ai = true;
|
||||||
|
+ }
|
||||||
|
+ if(cp())
|
||||||
|
+ yaw = aK;
|
||||||
|
+ super.m();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public float q(float f)
|
||||||
|
+ {
|
||||||
|
+ return ((float)bp + f) / (float)cm();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ protected void E()
|
||||||
|
+ {
|
||||||
|
+ super.E();
|
||||||
|
+ if(isElder())
|
||||||
|
+ {
|
||||||
|
+ int i = 1200;
|
||||||
|
+ int j = 1200;
|
||||||
|
+ int k = 6000;
|
||||||
|
+ int m = 2;
|
||||||
|
+
|
||||||
|
+ if ((this.ticksLived + getId()) % 1200 == 0) {
|
||||||
|
+ MobEffectList mobeffectlist = MobEffectList.SLOWER_DIG;
|
||||||
|
+ List list = world.b(EntityPlayer.class, new Predicate() {
|
||||||
|
+
|
||||||
|
+ public boolean a(EntityPlayer entityplayer1)
|
||||||
|
+ {
|
||||||
|
+ return h(entityplayer1) < 2500D && entityplayer1.playerInteractManager.c();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public boolean apply(Object obj)
|
||||||
|
+ {
|
||||||
|
+ return a((EntityPlayer)obj);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+);
|
||||||
|
+ Iterator iterator = list.iterator();
|
||||||
|
+ do
|
||||||
|
+ {
|
||||||
|
+ if(!iterator.hasNext())
|
||||||
|
+ break;
|
||||||
|
+ EntityPlayer entityplayer = (EntityPlayer)iterator.next();
|
||||||
|
+ if(!entityplayer.hasEffect(mobeffectlist) || entityplayer.getEffect(mobeffectlist).getAmplifier() < 2 || entityplayer.getEffect(mobeffectlist).getDuration() < 1200)
|
||||||
|
+ {
|
||||||
|
+ entityplayer.playerConnection.sendPacket(new PacketPlayOutGameStateChange(10, 0.0F));
|
||||||
|
+ entityplayer.addEffect(new MobEffect(mobeffectlist.id, 6000, 2));
|
||||||
|
+ }
|
||||||
|
+ } while(true);
|
||||||
|
+ }
|
||||||
|
+ if(!ck())
|
||||||
|
+ a(new BlockPosition(this), 16);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ protected void dropDeathLoot(boolean flag, int j)
|
||||||
|
+ {
|
||||||
|
+ int k = random.nextInt(3) + random.nextInt(j + 1);
|
||||||
|
+ if(k > 0)
|
||||||
|
+ a(new ItemStack(Items.PRISMARINE_SHARD, k, 0), 1.0F);
|
||||||
|
+ if(random.nextInt(3 + j) > 1)
|
||||||
|
+ a(new ItemStack(Items.FISH, 1, ItemFish.EnumFish.COD.a()), 1.0F);
|
||||||
|
+ else
|
||||||
|
+ if(random.nextInt(3 + j) > 1)
|
||||||
|
+ a(new ItemStack(Items.PRISMARINE_CRYSTALS, 1, 0), 1.0F);
|
||||||
|
+ if(flag && isElder())
|
||||||
|
+ a(new ItemStack(Blocks.SPONGE, 1, 1), 1.0F);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ protected void getRareDrop()
|
||||||
|
+ {
|
||||||
|
+ ItemStack itemstack = ((PossibleFishingResult)WeightedRandom.a(random, EntityFishingHook.j())).a(random);
|
||||||
|
+ a(itemstack, 1.0F);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ protected boolean n_()
|
||||||
|
+ {
|
||||||
|
+ return true;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public boolean canSpawn()
|
||||||
|
+ {
|
||||||
|
+ return world.a(getBoundingBox(), this) && world.getCubes(this, getBoundingBox()).isEmpty();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public boolean bR()
|
||||||
|
+ {
|
||||||
|
+ return (random.nextInt(20) == 0 || !world.j(new BlockPosition(this))) && super.bR();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public boolean damageEntity(DamageSource damagesource, float f)
|
||||||
|
+ {
|
||||||
|
+ if(!n() && !damagesource.isMagic() && (damagesource.i() instanceof EntityLiving))
|
||||||
|
+ {
|
||||||
|
+ EntityLiving entityliving = (EntityLiving)damagesource.i();
|
||||||
|
+ if(!damagesource.isExplosion())
|
||||||
|
+ {
|
||||||
|
+ entityliving.damageEntity(DamageSource.a(this), 2.0F);
|
||||||
|
+ entityliving.makeSound("damage.thorns", 0.5F, 1.0F);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ goalRandomStroll.f();
|
||||||
|
+ return super.damageEntity(damagesource, f);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public int bQ()
|
||||||
|
+ {
|
||||||
|
+ return 180;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void g(float f, float f1)
|
||||||
|
+ {
|
||||||
|
+ if(bM())
|
||||||
|
+ {
|
||||||
|
+ if(V())
|
||||||
|
+ {
|
||||||
|
+ a(f, f1, 0.1F);
|
||||||
|
+ move(motX, motY, motZ);
|
||||||
|
+ motX *= 0.89999997615814209D;
|
||||||
|
+ motY *= 0.89999997615814209D;
|
||||||
|
+ motZ *= 0.89999997615814209D;
|
||||||
|
+ if(!n() && getGoalTarget() == null)
|
||||||
|
+ motY -= 0.0050000000000000001D;
|
||||||
|
+ } else
|
||||||
|
+ {
|
||||||
|
+ super.g(f, f1);
|
||||||
|
+ }
|
||||||
|
+ } else
|
||||||
|
+ {
|
||||||
|
+ super.g(f, f1);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ static void a(EntityGuardian entityguardian, int j)
|
||||||
|
+ {
|
||||||
|
+ entityguardian.b(j);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ static PathfinderGoalRandomStroll a(EntityGuardian entityguardian)
|
||||||
|
+ {
|
||||||
|
+ return entityguardian.goalRandomStroll;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ static void a(EntityGuardian entityguardian, boolean flag)
|
||||||
|
+ {
|
||||||
|
+ entityguardian.l(flag);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ private float a;
|
||||||
|
+ private float b;
|
||||||
|
+ private float c;
|
||||||
|
+ private float bm;
|
||||||
|
+ private float bn;
|
||||||
|
+ private EntityLiving bo;
|
||||||
|
+ private int bp;
|
||||||
|
+ private boolean bq;
|
||||||
|
+ public PathfinderGoalRandomStroll goalRandomStroll;
|
||||||
|
+}
|
||||||
|
--
|
||||||
|
1.9.5.msysgit.0
|
||||||
|
|
@ -0,0 +1,43 @@
|
|||||||
|
From d3b44ea22080f4d15bf45b74b46b989b29f7b039 Mon Sep 17 00:00:00 2001
|
||||||
|
From: libraryaddict <libraryaddict115@yahoo.co.nz>
|
||||||
|
Date: Fri, 30 Oct 2015 20:02:58 +1300
|
||||||
|
Subject: [PATCH] Controller look vegetateHead, Entity collide changes
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/ControllerLook.java b/src/main/java/net/minecraft/server/ControllerLook.java
|
||||||
|
index 2263d5d..f2d7b1e 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/ControllerLook.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/ControllerLook.java
|
||||||
|
@@ -37,9 +37,15 @@ public class ControllerLook
|
||||||
|
this.d = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ public void vegetateHead(boolean vegetate)
|
||||||
|
+ {
|
||||||
|
+ _vegeHead = vegetate;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ private boolean _vegeHead;
|
||||||
|
+
|
||||||
|
public void a() {
|
||||||
|
- if (a.isVegetated())
|
||||||
|
- return;
|
||||||
|
+ if (_vegeHead)return;
|
||||||
|
this.a.pitch = 0.0F;
|
||||||
|
|
||||||
|
if (this.d) {
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||||
|
index cb9ba53..8660762 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||||
|
@@ -1087,6 +1087,7 @@ public abstract class Entity implements ICommandListener {
|
||||||
|
int numCollisions = 0; // Spigot
|
||||||
|
public void collide(Entity entity) {
|
||||||
|
if (entity.passenger != this && entity.vehicle != this) {
|
||||||
|
+ if ((!(entity instanceof EntityLiving) || !((EntityLiving) entity).isGhost()) && (!(this instanceof EntityLiving) || !((EntityLiving) this).isGhost()))
|
||||||
|
if (!entity.noclip && !this.noclip) {
|
||||||
|
double d0 = entity.locX - this.locX;
|
||||||
|
double d1 = entity.locZ - this.locZ;
|
||||||
|
--
|
||||||
|
1.9.5.msysgit.0
|
||||||
|
|
139
Patches/CraftBukkit-Patches/0169-Vegetate-head-ai.patch
Normal file
139
Patches/CraftBukkit-Patches/0169-Vegetate-head-ai.patch
Normal file
@ -0,0 +1,139 @@
|
|||||||
|
From a793ae3653b54c211b2c40147e031449d3e1cf72 Mon Sep 17 00:00:00 2001
|
||||||
|
From: libraryaddict <libraryaddict115@yahoo.co.nz>
|
||||||
|
Date: Tue, 3 Nov 2015 21:21:02 +1300
|
||||||
|
Subject: [PATCH] Vegetate head ai
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/ControllerLook.java b/src/main/java/net/minecraft/server/ControllerLook.java
|
||||||
|
index f2d7b1e..1538ca6 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/ControllerLook.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/ControllerLook.java
|
||||||
|
@@ -9,6 +9,28 @@ public class ControllerLook
|
||||||
|
private double e;
|
||||||
|
private double f;
|
||||||
|
private double g;
|
||||||
|
+ private boolean _allowInput = true;
|
||||||
|
+ private boolean _resetPitch = true;
|
||||||
|
+
|
||||||
|
+ public boolean isPitchReset()
|
||||||
|
+ {
|
||||||
|
+ return _resetPitch;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public boolean setPitchReset(boolean resetPitch)
|
||||||
|
+ {
|
||||||
|
+ _resetPitch = resetPitch;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public boolean isAllowInput()
|
||||||
|
+ {
|
||||||
|
+ return _allowInput;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void setAllowInput(boolean allowInput)
|
||||||
|
+ {
|
||||||
|
+ _allowInput = allowInput;
|
||||||
|
+ }
|
||||||
|
|
||||||
|
public ControllerLook(EntityInsentient paramEntityInsentient)
|
||||||
|
{
|
||||||
|
@@ -16,6 +38,9 @@ public class ControllerLook
|
||||||
|
}
|
||||||
|
|
||||||
|
public void a(Entity paramEntity, float paramFloat1, float paramFloat2) {
|
||||||
|
+
|
||||||
|
+ if (!isAllowInput())
|
||||||
|
+ return;
|
||||||
|
this.e = paramEntity.locX;
|
||||||
|
if ((paramEntity instanceof EntityLiving))
|
||||||
|
this.f = (paramEntity.locY + paramEntity.getHeadHeight());
|
||||||
|
@@ -29,6 +54,8 @@ public class ControllerLook
|
||||||
|
}
|
||||||
|
|
||||||
|
public void a(double paramDouble1, double paramDouble2, double paramDouble3, float paramFloat1, float paramFloat2) {
|
||||||
|
+ if (!isAllowInput())
|
||||||
|
+ return;
|
||||||
|
this.e = paramDouble1;
|
||||||
|
this.f = paramDouble2;
|
||||||
|
this.g = paramDouble3;
|
||||||
|
@@ -37,15 +64,8 @@ public class ControllerLook
|
||||||
|
this.d = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
- public void vegetateHead(boolean vegetate)
|
||||||
|
- {
|
||||||
|
- _vegeHead = vegetate;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- private boolean _vegeHead;
|
||||||
|
-
|
||||||
|
public void a() {
|
||||||
|
- if (_vegeHead)return;
|
||||||
|
+ if (isResetPitch())
|
||||||
|
this.a.pitch = 0.0F;
|
||||||
|
|
||||||
|
if (this.d) {
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java
|
||||||
|
index b7647bc..c2ef000 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
|
||||||
|
@@ -512,6 +512,7 @@ public abstract class EntityInsentient extends EntityLiving {
|
||||||
|
this.world.methodProfiler.a("move");
|
||||||
|
this.moveController.c();
|
||||||
|
this.world.methodProfiler.c("look");
|
||||||
|
+ if (!isVegetatedHead())
|
||||||
|
this.lookController.a();
|
||||||
|
this.world.methodProfiler.c("jump");
|
||||||
|
this.g.b();
|
||||||
|
@@ -542,6 +543,8 @@ public abstract class EntityInsentient extends EntityLiving {
|
||||||
|
float f2 = (float) (MathHelper.b(d1, d0) * 180.0D / 3.1415927410125732D) - 90.0F;
|
||||||
|
float f3 = (float) (-(MathHelper.b(d2, d3) * 180.0D / 3.1415927410125732D));
|
||||||
|
|
||||||
|
+ if (isVegetatedHead())
|
||||||
|
+ return;
|
||||||
|
this.pitch = this.b(this.pitch, f3, f1);
|
||||||
|
this.yaw = this.b(this.yaw, f2, f);
|
||||||
|
}
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||||
|
index b861dbe..4de7e4c 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||||
|
@@ -113,6 +113,18 @@ public abstract class EntityLiving extends Entity {
|
||||||
|
_ghost = ghost;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ private boolean _vegetateHead;
|
||||||
|
+
|
||||||
|
+ public boolean isHeadVegetated()
|
||||||
|
+ {
|
||||||
|
+ return _vegetateHead;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public void setHeadVegetated(boolean vegetateHead)
|
||||||
|
+ {
|
||||||
|
+ _vegetateHead = vegetateHead;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
public EntityLiving(World world) {
|
||||||
|
super(world);
|
||||||
|
this.initAttributes();
|
||||||
|
@@ -1497,6 +1509,8 @@ public abstract class EntityLiving extends Entity {
|
||||||
|
|
||||||
|
SpigotTimings.timerEntityBaseTick.stopTiming(); // Spigot
|
||||||
|
this.m();
|
||||||
|
+ if (isVegetatedHead())
|
||||||
|
+ return;
|
||||||
|
SpigotTimings.timerEntityTickRest.startTiming(); // Spigot
|
||||||
|
double d0 = this.locX - this.lastX;
|
||||||
|
double d1 = this.locZ - this.lastZ;
|
||||||
|
@@ -1607,6 +1621,7 @@ public abstract class EntityLiving extends Entity {
|
||||||
|
this.pitch = (float) ((double) this.pitch + (this.bh - (double) this.pitch) / (double) this.bc);
|
||||||
|
--this.bc;
|
||||||
|
this.setPosition(d0, d1, d2);
|
||||||
|
+ if (!isHeadVegetated())
|
||||||
|
this.setYawPitch(this.yaw, this.pitch);
|
||||||
|
} else if (!this.bM()) {
|
||||||
|
this.motX *= 0.98D;
|
||||||
|
--
|
||||||
|
1.9.5.msysgit.0
|
||||||
|
|
1618
Patches/CraftBukkit-Patches/0170-Modifications-to-cb.patch
Normal file
1618
Patches/CraftBukkit-Patches/0170-Modifications-to-cb.patch
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,119 @@
|
|||||||
|
From cddf775b575f0db92e478c858283869ac0b9bdc2 Mon Sep 17 00:00:00 2001
|
||||||
|
From: libraryaddict <libraryaddict115@yahoo.co.nz>
|
||||||
|
Date: Mon, 9 Nov 2015 00:07:26 +1300
|
||||||
|
Subject: [PATCH] Add IEntitySelector, have isGhost() return the same as
|
||||||
|
isSpectator()
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/IEntitySelector.java b/src/main/java/net/minecraft/server/IEntitySelector.java
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..1536600
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/src/main/java/net/minecraft/server/IEntitySelector.java
|
||||||
|
@@ -0,0 +1,103 @@
|
||||||
|
+package net.minecraft.server;
|
||||||
|
+
|
||||||
|
+import com.google.common.base.Predicate;
|
||||||
|
+
|
||||||
|
+public final class IEntitySelector
|
||||||
|
+{
|
||||||
|
+ public static class EntitySelectorEquipable
|
||||||
|
+ implements Predicate
|
||||||
|
+ {
|
||||||
|
+
|
||||||
|
+ public boolean a(Entity entity)
|
||||||
|
+ {
|
||||||
|
+ if(!entity.isAlive())
|
||||||
|
+ return false;
|
||||||
|
+ if(!(entity instanceof EntityLiving))
|
||||||
|
+ return false;
|
||||||
|
+ EntityLiving entityliving = (EntityLiving)entity;
|
||||||
|
+ if(entityliving.getEquipment(EntityInsentient.c(a)) != null)
|
||||||
|
+ return false;
|
||||||
|
+ if(entityliving instanceof EntityInsentient)
|
||||||
|
+ return ((EntityInsentient)entityliving).bY();
|
||||||
|
+ if(entityliving instanceof EntityArmorStand)
|
||||||
|
+ return true;
|
||||||
|
+ return entityliving instanceof EntityHuman;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public boolean apply(Object obj)
|
||||||
|
+ {
|
||||||
|
+ return a((Entity)obj);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ private final ItemStack a;
|
||||||
|
+
|
||||||
|
+ public EntitySelectorEquipable(ItemStack itemstack)
|
||||||
|
+ {
|
||||||
|
+ a = itemstack;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+ public static final Predicate a = new Predicate() {
|
||||||
|
+
|
||||||
|
+ public boolean a(Entity entity)
|
||||||
|
+ {
|
||||||
|
+ return entity.isAlive();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public boolean apply(Object obj)
|
||||||
|
+ {
|
||||||
|
+ return a((Entity)obj);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ }
|
||||||
|
+;
|
||||||
|
+ public static final Predicate b = new Predicate() {
|
||||||
|
+
|
||||||
|
+ public boolean a(Entity entity)
|
||||||
|
+ {
|
||||||
|
+ return entity.isAlive() && entity.passenger == null && entity.vehicle == null;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public boolean apply(Object obj)
|
||||||
|
+ {
|
||||||
|
+ return a((Entity)obj);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ }
|
||||||
|
+;
|
||||||
|
+ public static final Predicate c = new Predicate() {
|
||||||
|
+
|
||||||
|
+ public boolean a(Entity entity)
|
||||||
|
+ {
|
||||||
|
+ return (entity instanceof IInventory) && entity.isAlive();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public boolean apply(Object obj)
|
||||||
|
+ {
|
||||||
|
+ return a((Entity)obj);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ }
|
||||||
|
+;
|
||||||
|
+ public static final Predicate d = new Predicate() {
|
||||||
|
+
|
||||||
|
+ public boolean a(Entity entity)
|
||||||
|
+ {
|
||||||
|
+ if (entity instanceof EntityLiving && ((EntityLiving) entity).isGhost())
|
||||||
|
+ {
|
||||||
|
+ return false;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return !(entity instanceof EntityHuman) || !((EntityHuman)entity).isSpectator();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public boolean apply(Object obj)
|
||||||
|
+ {
|
||||||
|
+ return a((Entity)obj);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ }
|
||||||
|
+;
|
||||||
|
+
|
||||||
|
+}
|
||||||
|
--
|
||||||
|
1.9.5.msysgit.0
|
||||||
|
|
22
Patches/CraftBukkit-Patches/0172-Add-player-spectator.patch
Normal file
22
Patches/CraftBukkit-Patches/0172-Add-player-spectator.patch
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
From e81762b9aa4f28474b2ccd06ae6ad5b7c840e1ba Mon Sep 17 00:00:00 2001
|
||||||
|
From: libraryaddict <libraryaddict115@yahoo.co.nz>
|
||||||
|
Date: Mon, 9 Nov 2015 00:13:21 +1300
|
||||||
|
Subject: [PATCH] Add player spectator
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/IEntitySelector.java b/src/main/java/net/minecraft/server/IEntitySelector.java
|
||||||
|
index 1536600..f86cf48 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/IEntitySelector.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/IEntitySelector.java
|
||||||
|
@@ -89,7 +89,7 @@ public final class IEntitySelector
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
- return !(entity instanceof EntityHuman) || !((EntityHuman)entity).isSpectator();
|
||||||
|
+ return !(entity instanceof EntityHuman) || !(((EntityHuman)entity).isSpectator() && !((EntityPlayer)entity).spectating);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean apply(Object obj)
|
||||||
|
--
|
||||||
|
1.9.5.msysgit.0
|
||||||
|
|
22
Patches/CraftBukkit-Patches/0173-Fixed-ai-typo.patch
Normal file
22
Patches/CraftBukkit-Patches/0173-Fixed-ai-typo.patch
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
From 5dac54f90504022449cbd5ea23e5306f17523fe2 Mon Sep 17 00:00:00 2001
|
||||||
|
From: libraryaddict <libraryaddict115@yahoo.co.nz>
|
||||||
|
Date: Mon, 9 Nov 2015 02:41:31 +1300
|
||||||
|
Subject: [PATCH] Fixed ai typo
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/IEntitySelector.java b/src/main/java/net/minecraft/server/IEntitySelector.java
|
||||||
|
index f86cf48..b4d70ad 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/IEntitySelector.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/IEntitySelector.java
|
||||||
|
@@ -89,7 +89,7 @@ public final class IEntitySelector
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
- return !(entity instanceof EntityHuman) || !(((EntityHuman)entity).isSpectator() && !((EntityPlayer)entity).spectating);
|
||||||
|
+ return !(entity instanceof EntityHuman) || !(((EntityHuman)entity).isSpectator() || ((EntityPlayer)entity).spectating);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean apply(Object obj)
|
||||||
|
--
|
||||||
|
1.9.5.msysgit.0
|
||||||
|
|
64
Patches/CraftBukkit-Patches/0174-Fix-casting-bug.patch
Normal file
64
Patches/CraftBukkit-Patches/0174-Fix-casting-bug.patch
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
From ea74383b4c0f5160f0d890d9377bd0d72e31db0c Mon Sep 17 00:00:00 2001
|
||||||
|
From: libraryaddict <libraryaddict115@yahoo.co.nz>
|
||||||
|
Date: Wed, 11 Nov 2015 00:21:54 +1300
|
||||||
|
Subject: [PATCH] Fix casting bug
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||||
|
index 60e8584..746961e 100644
|
||||||
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||||
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||||
|
@@ -76,32 +76,44 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||||
|
|
||||||
|
public boolean shouldBreakLeash()
|
||||||
|
{
|
||||||
|
- return ((EntityInsentient) getHandle()).shouldBreakLeash();
|
||||||
|
+ if (getHandle() instanceof EntityInsentient)
|
||||||
|
+ return ((EntityInsentient) getHandle()).shouldBreakLeash();
|
||||||
|
+
|
||||||
|
+ return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setShouldBreakLeash(boolean shouldBreakLeash)
|
||||||
|
{
|
||||||
|
- ((EntityInsentient) getHandle()).setShouldBreakLeash(shouldBreakLeash);
|
||||||
|
+ if (getHandle() instanceof EntityInsentient)
|
||||||
|
+ ((EntityInsentient) getHandle()).setShouldBreakLeash(shouldBreakLeash);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean shouldPullWhileLeashed()
|
||||||
|
{
|
||||||
|
- return ((EntityInsentient) getHandle()).shouldPullWhileLeashed();
|
||||||
|
+ if (getHandle() instanceof EntityInsentient)
|
||||||
|
+ return ((EntityInsentient) getHandle()).shouldPullWhileLeashed();
|
||||||
|
+
|
||||||
|
+ return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPullWhileLeashed(boolean pullWhileLeashed)
|
||||||
|
{
|
||||||
|
- ((EntityInsentient) getHandle()).setPullWhileLeashed(pullWhileLeashed);
|
||||||
|
+ if (getHandle() instanceof EntityInsentient)
|
||||||
|
+ ((EntityInsentient) getHandle()).setPullWhileLeashed(pullWhileLeashed);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isVegetated()
|
||||||
|
{
|
||||||
|
- return ((EntityInsentient) getHandle()).isVegetated();
|
||||||
|
+ if (getHandle() instanceof EntityInsentient)
|
||||||
|
+ return ((EntityInsentient) getHandle()).isVegetated();
|
||||||
|
+
|
||||||
|
+ return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVegetated(boolean vegetated)
|
||||||
|
{
|
||||||
|
- ((EntityInsentient) getHandle()).setVegetated(vegetated);
|
||||||
|
+ if (getHandle() instanceof EntityInsentient)
|
||||||
|
+ ((EntityInsentient) getHandle()).setVegetated(vegetated);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isGhost()
|
||||||
|
--
|
||||||
|
1.9.5.msysgit.0
|
||||||
|
|
37
Patches/CraftBukkit-Patches/0175-Fix-schedulers.patch
Normal file
37
Patches/CraftBukkit-Patches/0175-Fix-schedulers.patch
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
From 896df3218cf190a29901619e762b5399517dbfbd Mon Sep 17 00:00:00 2001
|
||||||
|
From: libraryaddict <libraryaddict115@yahoo.co.nz>
|
||||||
|
Date: Wed, 11 Nov 2015 11:43:17 +1300
|
||||||
|
Subject: [PATCH] Fix schedulers
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||||
|
index 1d29ae7..55e2afd 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||||
|
@@ -705,6 +705,11 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
|
||||||
|
}
|
||||||
|
|
||||||
|
public void B() {
|
||||||
|
+ SpigotTimings.schedulerTimer.startTiming(); // Spigot
|
||||||
|
+ // CraftBukkit start
|
||||||
|
+ this.server.getScheduler().mainThreadHeartbeat(this.ticks);
|
||||||
|
+ SpigotTimings.schedulerTimer.stopTiming(); // Spigot
|
||||||
|
+
|
||||||
|
this.methodProfiler.a("jobs");
|
||||||
|
Queue queue = this.j;
|
||||||
|
|
||||||
|
@@ -718,11 +723,6 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs
|
||||||
|
|
||||||
|
this.methodProfiler.c("levels");
|
||||||
|
|
||||||
|
- SpigotTimings.schedulerTimer.startTiming(); // Spigot
|
||||||
|
- // CraftBukkit start
|
||||||
|
- this.server.getScheduler().mainThreadHeartbeat(this.ticks);
|
||||||
|
- SpigotTimings.schedulerTimer.stopTiming(); // Spigot
|
||||||
|
-
|
||||||
|
// Run tasks that are waiting on processing
|
||||||
|
SpigotTimings.processQueueTimer.startTiming(); // Spigot
|
||||||
|
while (!processQueue.isEmpty()) {
|
||||||
|
--
|
||||||
|
1.9.5.msysgit.0
|
||||||
|
|
@ -5,6 +5,8 @@
|
|||||||
<excludeFromCompile>
|
<excludeFromCompile>
|
||||||
<directory url="file://$PROJECT_DIR$/Nautilus.Game.PvP" includeSubdirectories="true" />
|
<directory url="file://$PROJECT_DIR$/Nautilus.Game.PvP" includeSubdirectories="true" />
|
||||||
<directory url="file://$PROJECT_DIR$/Mineplex.ServerMonitor" includeSubdirectories="true" />
|
<directory url="file://$PROJECT_DIR$/Mineplex.ServerMonitor" includeSubdirectories="true" />
|
||||||
|
<directory url="file://$PROJECT_DIR$/Nautilus.Game.Arcade" includeSubdirectories="true" />
|
||||||
|
<directory url="file://$PROJECT_DIR$/Mineplex.Hub" includeSubdirectories="true" />
|
||||||
</excludeFromCompile>
|
</excludeFromCompile>
|
||||||
<resourceExtensions />
|
<resourceExtensions />
|
||||||
<wildcardResourcePatterns>
|
<wildcardResourcePatterns>
|
||||||
|
@ -1,73 +0,0 @@
|
|||||||
package net.minecraft.server.v1_7_R4;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
public class PacketPlayOutChat
|
|
||||||
extends Packet
|
|
||||||
{
|
|
||||||
private IChatBaseComponent a;
|
|
||||||
private boolean b;
|
|
||||||
private byte _chatType = 0;
|
|
||||||
|
|
||||||
public PacketPlayOutChat()
|
|
||||||
{
|
|
||||||
this.b = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public PacketPlayOutChat(IChatBaseComponent ichatbasecomponent)
|
|
||||||
{
|
|
||||||
this(ichatbasecomponent, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public PacketPlayOutChat(IChatBaseComponent ichatbasecomponent, boolean flag)
|
|
||||||
{
|
|
||||||
this.b = true;
|
|
||||||
this.a = ichatbasecomponent;
|
|
||||||
this.b = flag;
|
|
||||||
}
|
|
||||||
|
|
||||||
public PacketPlayOutChat(String text)
|
|
||||||
{
|
|
||||||
this(ChatSerializer.a(text));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void a(PacketDataSerializer packetdataserializer)
|
|
||||||
throws IOException
|
|
||||||
{
|
|
||||||
this.a = ChatSerializer.a(packetdataserializer.c(32767));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void b(PacketDataSerializer packetdataserializer)
|
|
||||||
throws IOException
|
|
||||||
{
|
|
||||||
packetdataserializer.a(ChatSerializer.a(this.a));
|
|
||||||
if (packetdataserializer.version >= 16) {
|
|
||||||
packetdataserializer.writeByte(_chatType);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setChatType(byte chatType)
|
|
||||||
{
|
|
||||||
_chatType = chatType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void a(PacketPlayOutListener packetplayoutlistener)
|
|
||||||
{
|
|
||||||
packetplayoutlistener.a(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String b()
|
|
||||||
{
|
|
||||||
return String.format("message='%s'", new Object[] { this.a });
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean d()
|
|
||||||
{
|
|
||||||
return this.b;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void handle(PacketListener packetlistener)
|
|
||||||
{
|
|
||||||
a((PacketPlayOutListener)packetlistener);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,121 +0,0 @@
|
|||||||
package net.minecraft.server.v1_7_R4;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Iterator;
|
|
||||||
|
|
||||||
public class PacketPlayOutScoreboardTeam
|
|
||||||
extends Packet
|
|
||||||
{
|
|
||||||
private String a = "";
|
|
||||||
private String b = "";
|
|
||||||
private String c = "";
|
|
||||||
private String d = "";
|
|
||||||
private String _nameTagVisibility;
|
|
||||||
private Collection e = new ArrayList();
|
|
||||||
private int f;
|
|
||||||
private int g;
|
|
||||||
|
|
||||||
public PacketPlayOutScoreboardTeam() {}
|
|
||||||
|
|
||||||
public PacketPlayOutScoreboardTeam(ScoreboardTeam scoreboardteam, int i)
|
|
||||||
{
|
|
||||||
this.a = scoreboardteam.getName();
|
|
||||||
this.f = i;
|
|
||||||
if ((i == 0) || (i == 2))
|
|
||||||
{
|
|
||||||
this.b = scoreboardteam.getDisplayName();
|
|
||||||
this.c = scoreboardteam.getPrefix();
|
|
||||||
this.d = scoreboardteam.getSuffix();
|
|
||||||
this.g = scoreboardteam.packOptionData();
|
|
||||||
this._nameTagVisibility = scoreboardteam.getNametagVisibility();
|
|
||||||
}
|
|
||||||
if (i == 0) {
|
|
||||||
this.e.addAll(scoreboardteam.getPlayerNameSet());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public PacketPlayOutScoreboardTeam(ScoreboardTeam scoreboardteam, Collection collection, int i)
|
|
||||||
{
|
|
||||||
if ((i != 3) && (i != 4)) {
|
|
||||||
throw new IllegalArgumentException("Method must be join or leave for player constructor");
|
|
||||||
}
|
|
||||||
if ((collection != null) && (!collection.isEmpty()))
|
|
||||||
{
|
|
||||||
this.f = i;
|
|
||||||
this.a = scoreboardteam.getName();
|
|
||||||
this.e.addAll(collection);
|
|
||||||
this._nameTagVisibility = _nameTagVisibility;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
throw new IllegalArgumentException("Players cannot be null/empty");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void a(PacketDataSerializer packetdataserializer)
|
|
||||||
throws IOException
|
|
||||||
{
|
|
||||||
this.a = packetdataserializer.c(16);
|
|
||||||
this.f = packetdataserializer.readByte();
|
|
||||||
if ((this.f == 0) || (this.f == 2))
|
|
||||||
{
|
|
||||||
this.b = packetdataserializer.c(32);
|
|
||||||
this.c = packetdataserializer.c(16);
|
|
||||||
this.d = packetdataserializer.c(16);
|
|
||||||
this.g = packetdataserializer.readByte();
|
|
||||||
}
|
|
||||||
if ((this.f == 0) || (this.f == 3) || (this.f == 4))
|
|
||||||
{
|
|
||||||
short short1 = packetdataserializer.readShort();
|
|
||||||
for (int i = 0; i < short1; i++) {
|
|
||||||
this.e.add(packetdataserializer.c(40));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void b(PacketDataSerializer packetdataserializer)
|
|
||||||
throws IOException
|
|
||||||
{
|
|
||||||
packetdataserializer.a(this.a);
|
|
||||||
packetdataserializer.writeByte(this.f);
|
|
||||||
if ((this.f == 0) || (this.f == 2))
|
|
||||||
{
|
|
||||||
packetdataserializer.a(this.b);
|
|
||||||
packetdataserializer.a(this.c);
|
|
||||||
packetdataserializer.a(this.d);
|
|
||||||
packetdataserializer.writeByte(this.g);
|
|
||||||
if (packetdataserializer.version >= 16)
|
|
||||||
{
|
|
||||||
packetdataserializer.a(_nameTagVisibility);
|
|
||||||
packetdataserializer.writeByte(EnumChatFormat.WHITE.ordinal());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ((this.f == 0) || (this.f == 3) || (this.f == 4))
|
|
||||||
{
|
|
||||||
if (packetdataserializer.version < 16) {
|
|
||||||
packetdataserializer.writeShort(this.e.size());
|
|
||||||
} else {
|
|
||||||
packetdataserializer.b(this.e.size());
|
|
||||||
}
|
|
||||||
Iterator iterator = this.e.iterator();
|
|
||||||
while (iterator.hasNext())
|
|
||||||
{
|
|
||||||
String s = (String)iterator.next();
|
|
||||||
|
|
||||||
packetdataserializer.a(s);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void a(PacketPlayOutListener packetplayoutlistener)
|
|
||||||
{
|
|
||||||
packetplayoutlistener.a(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void handle(PacketListener packetlistener)
|
|
||||||
{
|
|
||||||
a((PacketPlayOutListener)packetlistener);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,42 +0,0 @@
|
|||||||
package net.minecraft.server.v1_7_R4;
|
|
||||||
|
|
||||||
import net.minecraft.server.v1_7_R4.ItemStack;
|
|
||||||
import net.minecraft.server.v1_7_R4.Packet;
|
|
||||||
import net.minecraft.server.v1_7_R4.PacketDataSerializer;
|
|
||||||
import net.minecraft.server.v1_7_R4.PacketListener;
|
|
||||||
import net.minecraft.server.v1_7_R4.PacketPlayOutListener;
|
|
||||||
|
|
||||||
public class PacketPlayOutSetSlot extends Packet {
|
|
||||||
public int a;
|
|
||||||
public int b;
|
|
||||||
public ItemStack c;
|
|
||||||
|
|
||||||
public PacketPlayOutSetSlot() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public PacketPlayOutSetSlot(int i, int j, ItemStack itemstack) {
|
|
||||||
this.a = i;
|
|
||||||
this.b = j;
|
|
||||||
this.c = itemstack == null?null:itemstack.cloneItemStack();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void a(PacketPlayOutListener packetplayoutlistener) {
|
|
||||||
packetplayoutlistener.a(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void a(PacketDataSerializer packetdataserializer) {
|
|
||||||
this.a = packetdataserializer.readByte();
|
|
||||||
this.b = packetdataserializer.readShort();
|
|
||||||
this.c = packetdataserializer.c();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void b(PacketDataSerializer packetdataserializer) {
|
|
||||||
packetdataserializer.writeByte(this.a);
|
|
||||||
packetdataserializer.writeShort(this.b);
|
|
||||||
packetdataserializer.a(this.c);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void handle(PacketListener packetlistener) {
|
|
||||||
this.a((PacketPlayOutListener)packetlistener);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,179 +0,0 @@
|
|||||||
package net.minecraft.server.v1_7_R4;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import net.minecraft.server.v1_7_R4.Packet;
|
|
||||||
import net.minecraft.server.v1_7_R4.PacketDataSerializer;
|
|
||||||
import net.minecraft.server.v1_7_R4.PacketListener;
|
|
||||||
import net.minecraft.server.v1_7_R4.PacketPlayOutListener;
|
|
||||||
|
|
||||||
public class PacketPlayOutWorldParticles extends Packet {
|
|
||||||
private String a;
|
|
||||||
private float b;
|
|
||||||
private float c;
|
|
||||||
private float d;
|
|
||||||
private float e;
|
|
||||||
private float f;
|
|
||||||
private float g;
|
|
||||||
private float h;
|
|
||||||
private int i;
|
|
||||||
private boolean _displayFar;
|
|
||||||
|
|
||||||
public PacketPlayOutWorldParticles() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public PacketPlayOutWorldParticles(String s, float f, float f1, float f2, float f3, float f4, float f5, float f6, int i) {
|
|
||||||
this(s, f, f1, f2, f3, f4, f5, f6, i, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public PacketPlayOutWorldParticles(String s, float f, float f1, float f2, float f3, float f4, float f5, float f6, int i, boolean displayFar) {
|
|
||||||
this.a = s;
|
|
||||||
this.b = f;
|
|
||||||
this.c = f1;
|
|
||||||
this.d = f2;
|
|
||||||
this.e = f3;
|
|
||||||
this.f = f4;
|
|
||||||
this.g = f5;
|
|
||||||
this.h = f6;
|
|
||||||
this.i = i;
|
|
||||||
|
|
||||||
_displayFar = displayFar;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void a(PacketDataSerializer packetdataserializer) throws IOException {
|
|
||||||
this.a = packetdataserializer.c(64);
|
|
||||||
this.b = packetdataserializer.readFloat();
|
|
||||||
this.c = packetdataserializer.readFloat();
|
|
||||||
this.d = packetdataserializer.readFloat();
|
|
||||||
this.e = packetdataserializer.readFloat();
|
|
||||||
this.f = packetdataserializer.readFloat();
|
|
||||||
this.g = packetdataserializer.readFloat();
|
|
||||||
this.h = packetdataserializer.readFloat();
|
|
||||||
this.i = packetdataserializer.readInt();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void b(PacketDataSerializer packetdataserializer) throws IOException {
|
|
||||||
String[] parts = this.a.split("_");
|
|
||||||
PacketPlayOutWorldParticles.Particle particle = PacketPlayOutWorldParticles.Particle.find(parts[0]);
|
|
||||||
if(particle == null) {
|
|
||||||
particle = PacketPlayOutWorldParticles.Particle.CRIT;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(packetdataserializer.version < 17) {
|
|
||||||
packetdataserializer.a(this.a);
|
|
||||||
} else {
|
|
||||||
packetdataserializer.writeInt(particle.ordinal());
|
|
||||||
packetdataserializer.writeBoolean(_displayFar);
|
|
||||||
}
|
|
||||||
|
|
||||||
packetdataserializer.writeFloat(this.b);
|
|
||||||
packetdataserializer.writeFloat(this.c);
|
|
||||||
packetdataserializer.writeFloat(this.d);
|
|
||||||
packetdataserializer.writeFloat(this.e);
|
|
||||||
packetdataserializer.writeFloat(this.f);
|
|
||||||
packetdataserializer.writeFloat(this.g);
|
|
||||||
packetdataserializer.writeFloat(this.h);
|
|
||||||
packetdataserializer.writeInt(this.i);
|
|
||||||
if(packetdataserializer.version >= 17) {
|
|
||||||
for(int i = 0; i < particle.extra; ++i) {
|
|
||||||
int toWrite = 0;
|
|
||||||
if(parts.length - 1 > i) {
|
|
||||||
try {
|
|
||||||
toWrite = Integer.parseInt(parts[i + 1]);
|
|
||||||
if(particle.extra == 1 && parts.length == 3) {
|
|
||||||
++i;
|
|
||||||
toWrite |= Integer.parseInt(parts[i + 1]) << 12;
|
|
||||||
}
|
|
||||||
} catch (NumberFormatException var7) {
|
|
||||||
;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
packetdataserializer.b(toWrite);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void a(PacketPlayOutListener packetplayoutlistener) {
|
|
||||||
packetplayoutlistener.a(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void handle(PacketListener packetlistener) {
|
|
||||||
this.a((PacketPlayOutListener)packetlistener);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static enum Particle {
|
|
||||||
EXPLOSION_NORMAL("explode"),
|
|
||||||
EXPLOSION_LARGE("largeexplode"),
|
|
||||||
EXPLOSION_HUGE("hugeexplosion"),
|
|
||||||
FIREWORKS_SPARK("fireworksSpark"),
|
|
||||||
WATER_BUBBLE("bubble"),
|
|
||||||
WATER_SPLASH("splash"),
|
|
||||||
WATER_WAKE("wake"),
|
|
||||||
SUSPENDED("suspended"),
|
|
||||||
SUSPENDED_DEPTH("depthsuspend"),
|
|
||||||
CRIT("crit"),
|
|
||||||
CRIT_MAGIC("magicCrit"),
|
|
||||||
SMOKE_NORMAL("smoke"),
|
|
||||||
SMOKE_LARGE("largesmoke"),
|
|
||||||
SPELL("spell"),
|
|
||||||
SPELL_INSTANT("instantSpell"),
|
|
||||||
SPELL_MOB("mobSpell"),
|
|
||||||
SPELL_MOB_AMBIENT("mobSpellAmbient"),
|
|
||||||
SPELL_WITCH("witchMagic"),
|
|
||||||
DRIP_WATER("dripWater"),
|
|
||||||
DRIP_LAVA("dripLava"),
|
|
||||||
VILLAGER_ANGRY("angryVillager"),
|
|
||||||
VILLAGER_HAPPY("happyVillager"),
|
|
||||||
TOWN_AURA("townaura"),
|
|
||||||
NOTE("note"),
|
|
||||||
PORTAL("portal"),
|
|
||||||
ENCHANTMENT_TABLE("enchantmenttable"),
|
|
||||||
FLAME("flame"),
|
|
||||||
LAVA("lava"),
|
|
||||||
FOOTSTEP("footstep"),
|
|
||||||
CLOUD("cloud"),
|
|
||||||
REDSTONE("reddust"),
|
|
||||||
SNOWBALL("snowballpoof"),
|
|
||||||
SNOW_SHOVEL("snowshovel"),
|
|
||||||
SLIME("slime"),
|
|
||||||
HEART("heart"),
|
|
||||||
BARRIER("barrier"),
|
|
||||||
ICON_CRACK("iconcrack", 2),
|
|
||||||
BLOCK_CRACK("blockcrack", 1),
|
|
||||||
BLOCK_DUST("blockdust", 1),
|
|
||||||
WATER_DROP("droplet"),
|
|
||||||
ITEM_TAKE("take"),
|
|
||||||
MOB_APPEARANCE("mobappearance");
|
|
||||||
|
|
||||||
public final String name;
|
|
||||||
public final int extra;
|
|
||||||
private static final HashMap<String, PacketPlayOutWorldParticles.Particle> particleMap;
|
|
||||||
|
|
||||||
private Particle(String name) {
|
|
||||||
this(name, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
private Particle(String name, int extra) {
|
|
||||||
this.name = name;
|
|
||||||
this.extra = extra;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static PacketPlayOutWorldParticles.Particle find(String part) {
|
|
||||||
return (PacketPlayOutWorldParticles.Particle)particleMap.get(part);
|
|
||||||
}
|
|
||||||
|
|
||||||
static {
|
|
||||||
particleMap = new HashMap();
|
|
||||||
PacketPlayOutWorldParticles.Particle[] var0 = values();
|
|
||||||
int var1 = var0.length;
|
|
||||||
|
|
||||||
for(int var2 = 0; var2 < var1; ++var2) {
|
|
||||||
PacketPlayOutWorldParticles.Particle particle = var0[var2];
|
|
||||||
particleMap.put(particle.name, particle);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,135 +0,0 @@
|
|||||||
package net.minecraft.server.v1_7_R4;
|
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
public class ScoreboardTeam
|
|
||||||
extends ScoreboardTeamBase
|
|
||||||
{
|
|
||||||
private final Scoreboard a;
|
|
||||||
private final String b;
|
|
||||||
private final Set c = new HashSet();
|
|
||||||
private String d;
|
|
||||||
private String e = "";
|
|
||||||
private String f = "";
|
|
||||||
private String _nametagVisibility = "always";
|
|
||||||
private boolean g = true;
|
|
||||||
private boolean h = true;
|
|
||||||
|
|
||||||
public ScoreboardTeam(Scoreboard paramScoreboard, String paramString)
|
|
||||||
{
|
|
||||||
this.a = paramScoreboard;
|
|
||||||
this.b = paramString;
|
|
||||||
this.d = paramString;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName()
|
|
||||||
{
|
|
||||||
return this.b;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDisplayName()
|
|
||||||
{
|
|
||||||
return this.d;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDisplayName(String paramString)
|
|
||||||
{
|
|
||||||
if (paramString == null) {
|
|
||||||
throw new IllegalArgumentException("Name cannot be null");
|
|
||||||
}
|
|
||||||
this.d = paramString;
|
|
||||||
this.a.handleTeamChanged(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Collection getPlayerNameSet()
|
|
||||||
{
|
|
||||||
return this.c;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPrefix()
|
|
||||||
{
|
|
||||||
return this.e;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPrefix(String paramString)
|
|
||||||
{
|
|
||||||
if (paramString == null) {
|
|
||||||
throw new IllegalArgumentException("Prefix cannot be null");
|
|
||||||
}
|
|
||||||
this.e = paramString;
|
|
||||||
this.a.handleTeamChanged(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSuffix()
|
|
||||||
{
|
|
||||||
return this.f;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSuffix(String paramString)
|
|
||||||
{
|
|
||||||
if (paramString == null) {
|
|
||||||
throw new IllegalArgumentException("Suffix cannot be null");
|
|
||||||
}
|
|
||||||
this.f = paramString;
|
|
||||||
this.a.handleTeamChanged(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getFormattedName(String paramString)
|
|
||||||
{
|
|
||||||
return getPrefix() + paramString + getSuffix();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getPlayerDisplayName(ScoreboardTeamBase paramScoreboardTeamBase, String paramString)
|
|
||||||
{
|
|
||||||
if (paramScoreboardTeamBase == null) {
|
|
||||||
return paramString;
|
|
||||||
}
|
|
||||||
return paramScoreboardTeamBase.getFormattedName(paramString);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean allowFriendlyFire()
|
|
||||||
{
|
|
||||||
return this.g;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAllowFriendlyFire(boolean paramBoolean)
|
|
||||||
{
|
|
||||||
this.g = paramBoolean;
|
|
||||||
this.a.handleTeamChanged(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean canSeeFriendlyInvisibles()
|
|
||||||
{
|
|
||||||
return this.h;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCanSeeFriendlyInvisibles(boolean paramBoolean)
|
|
||||||
{
|
|
||||||
this.h = paramBoolean;
|
|
||||||
this.a.handleTeamChanged(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getNametagVisibility()
|
|
||||||
{
|
|
||||||
return _nametagVisibility;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setNametagVisibility(String visibility)
|
|
||||||
{
|
|
||||||
_nametagVisibility = visibility;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int packOptionData()
|
|
||||||
{
|
|
||||||
int i = 0;
|
|
||||||
if (allowFriendlyFire()) {
|
|
||||||
i |= 0x1;
|
|
||||||
}
|
|
||||||
if (canSeeFriendlyInvisibles()) {
|
|
||||||
i |= 0x2;
|
|
||||||
}
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,225 +0,0 @@
|
|||||||
package org.bukkit.craftbukkit.v1_7_R4.scoreboard;
|
|
||||||
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.OfflinePlayer;
|
|
||||||
import org.bukkit.scoreboard.Team;
|
|
||||||
import org.bukkit.scoreboard.TeamNameTagVisibility;
|
|
||||||
import net.minecraft.server.v1_7_R4.ScoreboardTeam;
|
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
|
||||||
import org.apache.commons.lang.Validate;
|
|
||||||
|
|
||||||
final class CraftTeam
|
|
||||||
extends CraftScoreboardComponent
|
|
||||||
implements Team
|
|
||||||
{
|
|
||||||
private final ScoreboardTeam team;
|
|
||||||
|
|
||||||
CraftTeam(CraftScoreboard scoreboard, ScoreboardTeam team)
|
|
||||||
{
|
|
||||||
super(scoreboard);
|
|
||||||
this.team = team;
|
|
||||||
scoreboard.teams.put(team.getName(), this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName()
|
|
||||||
throws IllegalStateException
|
|
||||||
{
|
|
||||||
CraftScoreboard scoreboard = checkState();
|
|
||||||
|
|
||||||
return this.team.getName();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDisplayName()
|
|
||||||
throws IllegalStateException
|
|
||||||
{
|
|
||||||
CraftScoreboard scoreboard = checkState();
|
|
||||||
|
|
||||||
return this.team.getDisplayName();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDisplayName(String displayName)
|
|
||||||
throws IllegalStateException
|
|
||||||
{
|
|
||||||
Validate.notNull(displayName, "Display name cannot be null");
|
|
||||||
Validate.isTrue(displayName.length() <= 32, "Display name '" + displayName + "' is longer than the limit of 32 characters");
|
|
||||||
CraftScoreboard scoreboard = checkState();
|
|
||||||
|
|
||||||
this.team.setDisplayName(displayName);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPrefix()
|
|
||||||
throws IllegalStateException
|
|
||||||
{
|
|
||||||
CraftScoreboard scoreboard = checkState();
|
|
||||||
|
|
||||||
return this.team.getPrefix();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPrefix(String prefix)
|
|
||||||
throws IllegalStateException, IllegalArgumentException
|
|
||||||
{
|
|
||||||
Validate.notNull(prefix, "Prefix cannot be null");
|
|
||||||
Validate.isTrue(prefix.length() <= 32, "Prefix '" + prefix + "' is longer than the limit of 32 characters");
|
|
||||||
CraftScoreboard scoreboard = checkState();
|
|
||||||
|
|
||||||
this.team.setPrefix(prefix);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSuffix()
|
|
||||||
throws IllegalStateException
|
|
||||||
{
|
|
||||||
CraftScoreboard scoreboard = checkState();
|
|
||||||
|
|
||||||
return this.team.getSuffix();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSuffix(String suffix)
|
|
||||||
throws IllegalStateException, IllegalArgumentException
|
|
||||||
{
|
|
||||||
Validate.notNull(suffix, "Suffix cannot be null");
|
|
||||||
Validate.isTrue(suffix.length() <= 32, "Suffix '" + suffix + "' is longer than the limit of 32 characters");
|
|
||||||
CraftScoreboard scoreboard = checkState();
|
|
||||||
|
|
||||||
this.team.setSuffix(suffix);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean allowFriendlyFire()
|
|
||||||
throws IllegalStateException
|
|
||||||
{
|
|
||||||
CraftScoreboard scoreboard = checkState();
|
|
||||||
|
|
||||||
return this.team.allowFriendlyFire();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Mineplex
|
|
||||||
@Override
|
|
||||||
public void setNameTagVisibility(TeamNameTagVisibility visibility) throws IllegalStateException
|
|
||||||
{
|
|
||||||
this.team.setNametagVisibility(visibility.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAllowFriendlyFire(boolean enabled)
|
|
||||||
throws IllegalStateException
|
|
||||||
{
|
|
||||||
CraftScoreboard scoreboard = checkState();
|
|
||||||
|
|
||||||
this.team.setAllowFriendlyFire(enabled);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean canSeeFriendlyInvisibles()
|
|
||||||
throws IllegalStateException
|
|
||||||
{
|
|
||||||
CraftScoreboard scoreboard = checkState();
|
|
||||||
|
|
||||||
return this.team.canSeeFriendlyInvisibles();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCanSeeFriendlyInvisibles(boolean enabled)
|
|
||||||
throws IllegalStateException
|
|
||||||
{
|
|
||||||
CraftScoreboard scoreboard = checkState();
|
|
||||||
|
|
||||||
this.team.setCanSeeFriendlyInvisibles(enabled);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Set<OfflinePlayer> getPlayers()
|
|
||||||
throws IllegalStateException
|
|
||||||
{
|
|
||||||
CraftScoreboard scoreboard = checkState();
|
|
||||||
|
|
||||||
ImmutableSet.Builder<OfflinePlayer> players = ImmutableSet.builder();
|
|
||||||
for (Object o : this.team.getPlayerNameSet()) {
|
|
||||||
players.add(Bukkit.getOfflinePlayer(o.toString()));
|
|
||||||
}
|
|
||||||
return players.build();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Set<String> getEntries()
|
|
||||||
throws IllegalStateException
|
|
||||||
{
|
|
||||||
CraftScoreboard scoreboard = checkState();
|
|
||||||
|
|
||||||
ImmutableSet.Builder<String> entries = ImmutableSet.builder();
|
|
||||||
for (Object o : this.team.getPlayerNameSet()) {
|
|
||||||
entries.add(o.toString());
|
|
||||||
}
|
|
||||||
return entries.build();
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getSize()
|
|
||||||
throws IllegalStateException
|
|
||||||
{
|
|
||||||
CraftScoreboard scoreboard = checkState();
|
|
||||||
|
|
||||||
return this.team.getPlayerNameSet().size();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addPlayer(OfflinePlayer player)
|
|
||||||
throws IllegalStateException, IllegalArgumentException
|
|
||||||
{
|
|
||||||
Validate.notNull(player, "OfflinePlayer cannot be null");
|
|
||||||
|
|
||||||
addEntry(player.getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addEntry(String entry)
|
|
||||||
throws IllegalStateException, IllegalArgumentException
|
|
||||||
{
|
|
||||||
Validate.notNull(entry, "Entry cannot be null");
|
|
||||||
CraftScoreboard scoreboard = checkState();
|
|
||||||
|
|
||||||
scoreboard.board.addPlayerToTeam(entry, this.team.getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean removePlayer(OfflinePlayer player)
|
|
||||||
throws IllegalStateException, IllegalArgumentException
|
|
||||||
{
|
|
||||||
Validate.notNull(player, "OfflinePlayer cannot be null");
|
|
||||||
|
|
||||||
return removeEntry(player.getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean removeEntry(String entry)
|
|
||||||
throws IllegalStateException, IllegalArgumentException
|
|
||||||
{
|
|
||||||
Validate.notNull(entry, "Entry cannot be null");
|
|
||||||
CraftScoreboard scoreboard = checkState();
|
|
||||||
if (!this.team.getPlayerNameSet().contains(entry)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
scoreboard.board.removePlayerFromTeam(entry, this.team);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasPlayer(OfflinePlayer player)
|
|
||||||
throws IllegalArgumentException, IllegalStateException
|
|
||||||
{
|
|
||||||
Validate.notNull(player, "OfflinePlayer cannot be null");
|
|
||||||
|
|
||||||
return hasEntry(player.getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasEntry(String entry)
|
|
||||||
throws IllegalArgumentException, IllegalStateException
|
|
||||||
{
|
|
||||||
Validate.notNull("Entry cannot be null");
|
|
||||||
|
|
||||||
CraftScoreboard scoreboard = checkState();
|
|
||||||
|
|
||||||
return this.team.getPlayerNameSet().contains(entry);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void unregister()
|
|
||||||
throws IllegalStateException
|
|
||||||
{
|
|
||||||
CraftScoreboard scoreboard = checkState();
|
|
||||||
|
|
||||||
scoreboard.board.removeTeam(this.team);
|
|
||||||
scoreboard.teams.remove(this.team.getName());
|
|
||||||
setUnregistered();
|
|
||||||
}
|
|
||||||
}
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,8 +1,8 @@
|
|||||||
package mineplex.core.common;
|
package mineplex.core.common;
|
||||||
|
|
||||||
import net.minecraft.server.v1_7_R4.Entity;
|
import net.minecraft.server.v1_8_R3.Entity;
|
||||||
import net.minecraft.server.v1_7_R4.NBTTagCompound;
|
import net.minecraft.server.v1_8_R3.NBTTagCompound;
|
||||||
import net.minecraft.server.v1_7_R4.World;
|
import net.minecraft.server.v1_8_R3.World;
|
||||||
|
|
||||||
public class DummyEntity extends Entity
|
public class DummyEntity extends Entity
|
||||||
{
|
{
|
||||||
@ -12,17 +12,20 @@ public class DummyEntity extends Entity
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void c()
|
protected void h()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void a(NBTTagCompound nbttagcompound)
|
protected void a(NBTTagCompound nbtTagCompound)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void b(NBTTagCompound nbttagcompound)
|
protected void b(NBTTagCompound nbtTagCompound)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package mineplex.core.common.jsonchat;
|
package mineplex.core.common.jsonchat;
|
||||||
|
|
||||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import net.minecraft.server.v1_7_R4.ChatSerializer;
|
|
||||||
import net.minecraft.server.v1_7_R4.PacketPlayOutChat;
|
|
||||||
|
|
||||||
|
import net.minecraft.server.v1_8_R3.IChatBaseComponent;
|
||||||
|
import net.minecraft.server.v1_8_R3.PacketPlayOutChat;
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
import mineplex.core.common.util.UtilServer;
|
import mineplex.core.common.util.UtilServer;
|
||||||
|
|
||||||
@ -119,25 +119,12 @@ public class JsonMessage
|
|||||||
*/
|
*/
|
||||||
public void send(MessageType messageType, Player... players)
|
public void send(MessageType messageType, Player... players)
|
||||||
{
|
{
|
||||||
send(messageType, false, players);
|
PacketPlayOutChat chatPacket = new PacketPlayOutChat(IChatBaseComponent.ChatSerializer.a(toString()));
|
||||||
}
|
chatPacket.b = messageType.getId();
|
||||||
|
|
||||||
/**
|
|
||||||
* Send a message to players using the new 1.8 message types
|
|
||||||
*
|
|
||||||
* @param messageType Message type to send
|
|
||||||
* @param defaultToChat Only applies to MessageType.ABOVE_HOTBAR. If true, it will send this to chat for 1.7 clients
|
|
||||||
* @param players Players to send to
|
|
||||||
*/
|
|
||||||
public void send(MessageType messageType, boolean defaultToChat, Player... players)
|
|
||||||
{
|
|
||||||
PacketPlayOutChat chatPacket = new PacketPlayOutChat(ChatSerializer.a(toString()));
|
|
||||||
chatPacket.setChatType(messageType.getId());
|
|
||||||
|
|
||||||
for (Player player : players)
|
for (Player player : players)
|
||||||
{
|
{
|
||||||
if (defaultToChat || messageType != MessageType.ABOVE_HOTBAR || UtilPlayer.is1_8(player))
|
UtilPlayer.sendPacket(player, chatPacket);
|
||||||
((CraftPlayer) player).getHandle().playerConnection.sendPacket(chatPacket);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ package mineplex.core.common.util;
|
|||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
import org.bukkit.craftbukkit.v1_7_R4.inventory.CraftInventory;
|
import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftInventory;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
public class InventoryUtil
|
public class InventoryUtil
|
||||||
|
@ -1,48 +1,41 @@
|
|||||||
package mineplex.core.common.util;
|
package mineplex.core.common.util;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import net.minecraft.server.v1_7_R4.Block;
|
|
||||||
import net.minecraft.server.v1_7_R4.BlockContainer;
|
|
||||||
import net.minecraft.server.v1_7_R4.Blocks;
|
|
||||||
import net.minecraft.server.v1_7_R4.ChunkCoordIntPair;
|
|
||||||
import net.minecraft.server.v1_7_R4.ChunkSection;
|
|
||||||
import net.minecraft.server.v1_7_R4.EnumSkyBlock;
|
|
||||||
import net.minecraft.server.v1_7_R4.ExceptionWorldConflict;
|
|
||||||
import net.minecraft.server.v1_7_R4.IContainer;
|
|
||||||
import net.minecraft.server.v1_7_R4.IProgressUpdate;
|
|
||||||
import net.minecraft.server.v1_7_R4.MinecraftServer;
|
|
||||||
import net.minecraft.server.v1_7_R4.PacketPlayOutMapChunkBulk;
|
|
||||||
import net.minecraft.server.v1_7_R4.PacketPlayOutMultiBlockChange;
|
|
||||||
import net.minecraft.server.v1_7_R4.RegionFile;
|
|
||||||
import net.minecraft.server.v1_7_R4.RegionFileCache;
|
|
||||||
import net.minecraft.server.v1_7_R4.TileEntity;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.craftbukkit.v1_7_R4.CraftChunk;
|
import org.bukkit.craftbukkit.v1_8_R3.CraftChunk;
|
||||||
import org.bukkit.craftbukkit.v1_7_R4.CraftServer;
|
import org.bukkit.craftbukkit.v1_8_R3.CraftServer;
|
||||||
import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
|
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
|
||||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||||
|
import org.bukkit.craftbukkit.v1_8_R3.util.CraftMagicNumbers;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.world.WorldUnloadEvent;
|
import org.bukkit.event.world.WorldUnloadEvent;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
import org.bukkit.util.Vector;
|
|
||||||
|
import net.minecraft.server.v1_8_R3.Block;
|
||||||
|
import net.minecraft.server.v1_8_R3.BlockPosition;
|
||||||
|
import net.minecraft.server.v1_8_R3.ChunkCoordIntPair;
|
||||||
|
import net.minecraft.server.v1_8_R3.ExceptionWorldConflict;
|
||||||
|
import net.minecraft.server.v1_8_R3.IBlockData;
|
||||||
|
import net.minecraft.server.v1_8_R3.IProgressUpdate;
|
||||||
|
import net.minecraft.server.v1_8_R3.MinecraftServer;
|
||||||
|
import net.minecraft.server.v1_8_R3.PacketPlayOutMultiBlockChange;
|
||||||
|
import net.minecraft.server.v1_8_R3.RegionFile;
|
||||||
|
import net.minecraft.server.v1_8_R3.RegionFileCache;
|
||||||
|
|
||||||
public class MapUtil
|
public class MapUtil
|
||||||
{
|
{
|
||||||
public static void ReplaceOreInChunk(Chunk chunk, Material replacee, Material replacer)
|
/*public static void ReplaceOreInChunk(Chunk chunk, Material replacee, Material replacer)
|
||||||
{
|
{
|
||||||
net.minecraft.server.v1_7_R4.Chunk c = ((CraftChunk) chunk).getHandle();
|
net.minecraft.server.v1_8_R3.Chunk c = ((CraftChunk) chunk).getHandle();
|
||||||
|
|
||||||
for (int x = 0; x < 16; x++)
|
for (int x = 0; x < 16; x++)
|
||||||
{
|
{
|
||||||
@ -54,7 +47,7 @@ public class MapUtil
|
|||||||
int bY = y & 0xFF;
|
int bY = y & 0xFF;
|
||||||
int bZ = c.locZ << 4 | z & 0xF;
|
int bZ = c.locZ << 4 | z & 0xF;
|
||||||
|
|
||||||
if (c.getType(bX & 0xF, bY, bZ & 0xF).k() == replacee.getId())
|
if (c.getTypeAbs(bX, bY, bZ).k() == replacee.getId())
|
||||||
{
|
{
|
||||||
c.b(bX & 0xF, bY, bZ & 0xF, replacer.getId());
|
c.b(bX & 0xF, bY, bZ & 0xF, replacer.getId());
|
||||||
}
|
}
|
||||||
@ -63,7 +56,7 @@ public class MapUtil
|
|||||||
}
|
}
|
||||||
|
|
||||||
c.initLighting();
|
c.initLighting();
|
||||||
}
|
}*/
|
||||||
|
|
||||||
public static void QuickChangeBlockAt(Location location, Material setTo)
|
public static void QuickChangeBlockAt(Location location, Material setTo)
|
||||||
{
|
{
|
||||||
@ -94,10 +87,12 @@ public class MapUtil
|
|||||||
public static void QuickChangeBlockAt(World world, int x, int y, int z, int id, int data)
|
public static void QuickChangeBlockAt(World world, int x, int y, int z, int id, int data)
|
||||||
{
|
{
|
||||||
Chunk chunk = world.getChunkAt(x >> 4, z >> 4);
|
Chunk chunk = world.getChunkAt(x >> 4, z >> 4);
|
||||||
net.minecraft.server.v1_7_R4.Chunk c = ((CraftChunk) chunk).getHandle();
|
net.minecraft.server.v1_8_R3.Chunk c = ((CraftChunk) chunk).getHandle();
|
||||||
|
|
||||||
c.a(x & 0xF, y, z & 0xF, Block.getById(id), data);
|
//c.a(x & 0xF, y, z & 0xF, Block.getById(id), data);
|
||||||
((CraftWorld) world).getHandle().notify(x, y, z);
|
IBlockData blockData = CraftMagicNumbers.getBlock(id).fromLegacyData(data);
|
||||||
|
c.a(getBlockPos(x, y, z), blockData);
|
||||||
|
((CraftWorld) world).getHandle().notify(getBlockPos(x, y, z));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int GetHighestBlockInCircleAt(World world, int bx, int bz, int radius)
|
public static int GetHighestBlockInCircleAt(World world, int bx, int bz, int radius)
|
||||||
@ -152,7 +147,7 @@ public class MapUtil
|
|||||||
Block.getById(id), data))
|
Block.getById(id), data))
|
||||||
{
|
{
|
||||||
if (notifyPlayers)
|
if (notifyPlayers)
|
||||||
((CraftWorld) world).getHandle().notify(x, y, z);
|
((CraftWorld) world).getHandle().notify(getBlockPos(x, y, z));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -161,13 +156,15 @@ public class MapUtil
|
|||||||
world.getBlockAt(x, y, z).setTypeIdAndData(id, data, notifyPlayers);
|
world.getBlockAt(x, y, z).setTypeIdAndData(id, data, notifyPlayers);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean changeChunkBlock(int x, int y, int z, net.minecraft.server.v1_7_R4.Chunk chunk, Block block,
|
private static boolean changeChunkBlock(int x, int y, int z, net.minecraft.server.v1_8_R3.Chunk chunk, Block block,
|
||||||
byte data)
|
byte data)
|
||||||
{
|
{
|
||||||
return chunk.a(x, y, z, block, data);
|
chunk.a(getBlockPos(x, y, z), block.fromLegacyData(data));
|
||||||
|
return true; // todo?
|
||||||
|
// return chunk.a(x, y, z, block, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void SendChunkForPlayer(net.minecraft.server.v1_7_R4.Chunk chunk, Player player)
|
public static void SendChunkForPlayer(net.minecraft.server.v1_8_R3.Chunk chunk, Player player)
|
||||||
{
|
{
|
||||||
SendChunkForPlayer(chunk.locX, chunk.locZ, player);
|
SendChunkForPlayer(chunk.locX, chunk.locZ, player);
|
||||||
}
|
}
|
||||||
@ -184,8 +181,8 @@ public class MapUtil
|
|||||||
Player player)
|
Player player)
|
||||||
{
|
{
|
||||||
// System.out.println("Sending MultiBlockChunk " + x + ", " + z);
|
// System.out.println("Sending MultiBlockChunk " + x + ", " + z);
|
||||||
((CraftPlayer) player).getHandle().playerConnection.sendPacket(new PacketPlayOutMultiBlockChange(dirtyCount,
|
UtilPlayer.sendPacket(player, new PacketPlayOutMultiBlockChange(dirtyCount, dirtyBlocks, ((CraftWorld) world).getHandle()
|
||||||
dirtyBlocks, ((CraftWorld) world).getHandle().getChunkAt(x, z)));
|
.getChunkAt(x, z)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void UnloadWorld(JavaPlugin plugin, World world)
|
public static void UnloadWorld(JavaPlugin plugin, World world)
|
||||||
@ -216,7 +213,7 @@ public class MapUtil
|
|||||||
|
|
||||||
Bukkit.getPluginManager().callEvent(new WorldUnloadEvent(((CraftWorld) world).getHandle().getWorld()));
|
Bukkit.getPluginManager().callEvent(new WorldUnloadEvent(((CraftWorld) world).getHandle().getWorld()));
|
||||||
|
|
||||||
Iterator<net.minecraft.server.v1_7_R4.Chunk> chunkIterator = ((CraftWorld) world).getHandle().chunkProviderServer.chunks
|
Iterator<net.minecraft.server.v1_8_R3.Chunk> chunkIterator = ((CraftWorld) world).getHandle().chunkProviderServer.chunks
|
||||||
.values().iterator();
|
.values().iterator();
|
||||||
|
|
||||||
for (Entity entity : world.getEntities())
|
for (Entity entity : world.getEntities())
|
||||||
@ -226,7 +223,7 @@ public class MapUtil
|
|||||||
|
|
||||||
while (chunkIterator.hasNext())
|
while (chunkIterator.hasNext())
|
||||||
{
|
{
|
||||||
net.minecraft.server.v1_7_R4.Chunk chunk = chunkIterator.next();
|
net.minecraft.server.v1_8_R3.Chunk chunk = chunkIterator.next();
|
||||||
chunk.removeEntities();
|
chunk.removeEntities();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -251,23 +248,7 @@ public class MapUtil
|
|||||||
System.out.println("Error removing world from bukkit master list: " + ex.getMessage());
|
System.out.println("Error removing world from bukkit master list: " + ex.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
MinecraftServer ms = null;
|
MinecraftServer ms = server.getServer();
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
Field f = server.getClass().getDeclaredField("console");
|
|
||||||
f.setAccessible(true);
|
|
||||||
ms = (MinecraftServer) f.get(server);
|
|
||||||
f.setAccessible(false);
|
|
||||||
}
|
|
||||||
catch (IllegalAccessException ex)
|
|
||||||
{
|
|
||||||
System.out.println("Error getting minecraftserver variable: " + ex.getMessage());
|
|
||||||
}
|
|
||||||
catch (NoSuchFieldException ex)
|
|
||||||
{
|
|
||||||
System.out.println("Error getting minecraftserver variable: " + ex.getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
ms.worlds.remove(ms.worlds.indexOf(craftWorld.getHandle()));
|
ms.worlds.remove(ms.worlds.indexOf(craftWorld.getHandle()));
|
||||||
}
|
}
|
||||||
@ -303,4 +284,9 @@ public class MapUtil
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static BlockPosition getBlockPos(int x, int y, int z)
|
||||||
|
{
|
||||||
|
return new BlockPosition(x, y, z);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,8 +6,8 @@ import java.util.Scanner;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
import net.minecraft.util.com.mojang.authlib.GameProfile;
|
import com.mojang.authlib.GameProfile;
|
||||||
import net.minecraft.util.com.mojang.authlib.properties.Property;
|
import com.mojang.authlib.properties.Property;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
@ -4,16 +4,17 @@ import java.util.ArrayList;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
|
||||||
import net.minecraft.server.v1_7_R4.Blocks;
|
import net.minecraft.server.v1_8_R3.BlockPosition;
|
||||||
import net.minecraft.server.v1_7_R4.MathHelper;
|
import net.minecraft.server.v1_8_R3.Blocks;
|
||||||
import net.minecraft.server.v1_7_R4.WorldServer;
|
import net.minecraft.server.v1_8_R3.MathHelper;
|
||||||
|
import net.minecraft.server.v1_8_R3.WorldServer;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
|
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
public class UtilBlock
|
public class UtilBlock
|
||||||
@ -52,7 +53,7 @@ public class UtilBlock
|
|||||||
*/
|
*/
|
||||||
public static HashSet<Byte> fullSolid = new HashSet<Byte>();
|
public static HashSet<Byte> fullSolid = new HashSet<Byte>();
|
||||||
/**
|
/**
|
||||||
* A list of blocks that are non-solid, but offer resistance. Eg lily, fence gate, portal
|
* A list of blocks that are non-solid, but can't be moved through. Eg lily, fence gate, portal
|
||||||
*/
|
*/
|
||||||
public static HashSet<Byte> blockPassSet = new HashSet<Byte>();
|
public static HashSet<Byte> blockPassSet = new HashSet<Byte>();
|
||||||
/**
|
/**
|
||||||
@ -61,186 +62,225 @@ public class UtilBlock
|
|||||||
public static HashSet<Byte> blockAirFoliageSet = new HashSet<Byte>();
|
public static HashSet<Byte> blockAirFoliageSet = new HashSet<Byte>();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
blockAirFoliageSet.add((byte)0);
|
|
||||||
blockAirFoliageSet.add((byte)6);
|
|
||||||
blockAirFoliageSet.add((byte)31);
|
|
||||||
blockAirFoliageSet.add((byte)32);
|
|
||||||
blockAirFoliageSet.add((byte)37);
|
|
||||||
blockAirFoliageSet.add((byte)38);
|
|
||||||
blockAirFoliageSet.add((byte)39);
|
|
||||||
blockAirFoliageSet.add((byte)40);
|
|
||||||
blockAirFoliageSet.add((byte)51);
|
|
||||||
blockAirFoliageSet.add((byte)59);
|
|
||||||
blockAirFoliageSet.add((byte)104);
|
|
||||||
blockAirFoliageSet.add((byte)105);
|
|
||||||
blockAirFoliageSet.add((byte)115);
|
|
||||||
blockAirFoliageSet.add((byte)141);
|
|
||||||
blockAirFoliageSet.add((byte)142);
|
|
||||||
|
|
||||||
|
blockAirFoliageSet.add((byte) Material.AIR.getId());
|
||||||
|
blockAirFoliageSet.add((byte) Material.SAPLING.getId());
|
||||||
|
blockAirFoliageSet.add((byte) Material.LONG_GRASS.getId());
|
||||||
|
blockAirFoliageSet.add((byte) Material.DEAD_BUSH.getId());
|
||||||
|
blockAirFoliageSet.add((byte) Material.YELLOW_FLOWER.getId());
|
||||||
|
blockAirFoliageSet.add((byte) Material.RED_ROSE.getId());
|
||||||
|
blockAirFoliageSet.add((byte) Material.BROWN_MUSHROOM.getId());
|
||||||
|
blockAirFoliageSet.add((byte) Material.RED_MUSHROOM.getId());
|
||||||
|
blockAirFoliageSet.add((byte) Material.FIRE.getId());
|
||||||
|
blockAirFoliageSet.add((byte) Material.CROPS.getId());
|
||||||
|
blockAirFoliageSet.add((byte) Material.PUMPKIN_STEM.getId());
|
||||||
|
blockAirFoliageSet.add((byte) Material.MELON_STEM.getId());
|
||||||
|
blockAirFoliageSet.add((byte) Material.NETHER_WARTS.getId());
|
||||||
|
blockAirFoliageSet.add((byte) Material.TRIPWIRE_HOOK.getId());
|
||||||
|
blockAirFoliageSet.add((byte) Material.TRIPWIRE.getId());
|
||||||
|
blockAirFoliageSet.add((byte) Material.CARROT.getId());
|
||||||
|
blockAirFoliageSet.add((byte) Material.POTATO.getId());
|
||||||
|
blockAirFoliageSet.add((byte) Material.DOUBLE_PLANT.getId());
|
||||||
|
blockAirFoliageSet.add((byte) Material.STANDING_BANNER.getId());
|
||||||
|
blockAirFoliageSet.add((byte) Material.WALL_BANNER.getId());
|
||||||
|
|
||||||
blockPassSet.add((byte)0);
|
blockPassSet.add((byte) Material.AIR.getId());
|
||||||
blockPassSet.add((byte)6);
|
blockPassSet.add((byte) Material.SAPLING.getId());
|
||||||
blockPassSet.add((byte)8);
|
blockPassSet.add((byte) Material.WATER.getId());
|
||||||
blockPassSet.add((byte)9);
|
blockPassSet.add((byte) Material.STATIONARY_WATER.getId());
|
||||||
blockPassSet.add((byte)10);
|
blockPassSet.add((byte) Material.LAVA.getId());
|
||||||
blockPassSet.add((byte)11);
|
blockPassSet.add((byte) Material.STATIONARY_LAVA.getId());
|
||||||
blockPassSet.add((byte)26);
|
blockPassSet.add((byte) Material.BED_BLOCK.getId());
|
||||||
blockPassSet.add((byte)27);
|
blockPassSet.add((byte) Material.POWERED_RAIL.getId());
|
||||||
blockPassSet.add((byte)28);
|
blockPassSet.add((byte) Material.DETECTOR_RAIL.getId());
|
||||||
blockPassSet.add((byte)30);
|
blockPassSet.add((byte) Material.WEB.getId());
|
||||||
blockPassSet.add((byte)31);
|
blockPassSet.add((byte) Material.LONG_GRASS.getId());
|
||||||
blockPassSet.add((byte)32);
|
blockPassSet.add((byte) Material.DEAD_BUSH.getId());
|
||||||
blockPassSet.add((byte)37);
|
blockPassSet.add((byte) Material.YELLOW_FLOWER.getId());
|
||||||
blockPassSet.add((byte)38);
|
blockPassSet.add((byte) Material.RED_ROSE.getId());
|
||||||
blockPassSet.add((byte)39);
|
blockPassSet.add((byte) Material.BROWN_MUSHROOM.getId());
|
||||||
blockPassSet.add((byte)40);
|
blockPassSet.add((byte) Material.RED_MUSHROOM.getId());
|
||||||
blockPassSet.add((byte)50);
|
blockPassSet.add((byte) Material.TORCH.getId());
|
||||||
blockPassSet.add((byte)51);
|
blockPassSet.add((byte) Material.FIRE.getId());
|
||||||
blockPassSet.add((byte)55);
|
blockPassSet.add((byte) Material.REDSTONE_WIRE.getId());
|
||||||
blockPassSet.add((byte)59);
|
blockPassSet.add((byte) Material.CROPS.getId());
|
||||||
blockPassSet.add((byte)63);
|
blockPassSet.add((byte) Material.SIGN_POST.getId());
|
||||||
blockPassSet.add((byte)65);
|
blockPassSet.add((byte) Material.WOODEN_DOOR.getId());
|
||||||
blockPassSet.add((byte)66);
|
blockPassSet.add((byte) Material.LADDER.getId());
|
||||||
blockPassSet.add((byte)68);
|
blockPassSet.add((byte) Material.RAILS.getId());
|
||||||
blockPassSet.add((byte)69);
|
blockPassSet.add((byte) Material.WALL_SIGN.getId());
|
||||||
blockPassSet.add((byte)70);
|
blockPassSet.add((byte) Material.LEVER.getId());
|
||||||
blockPassSet.add((byte)72);
|
blockPassSet.add((byte) Material.STONE_PLATE.getId());
|
||||||
blockPassSet.add((byte)75);
|
blockPassSet.add((byte) Material.IRON_DOOR_BLOCK.getId());
|
||||||
blockPassSet.add((byte)76);
|
blockPassSet.add((byte) Material.WOOD_PLATE.getId());
|
||||||
blockPassSet.add((byte)77);
|
blockPassSet.add((byte) Material.REDSTONE_TORCH_OFF.getId());
|
||||||
blockPassSet.add((byte)78);
|
blockPassSet.add((byte) Material.REDSTONE_TORCH_ON.getId());
|
||||||
blockPassSet.add((byte)83);
|
blockPassSet.add((byte) Material.STONE_BUTTON.getId());
|
||||||
blockPassSet.add((byte)90);
|
blockPassSet.add((byte) Material.SNOW.getId());
|
||||||
blockPassSet.add((byte)92);
|
blockPassSet.add((byte) Material.SUGAR_CANE_BLOCK.getId());
|
||||||
blockPassSet.add((byte)93);
|
blockPassSet.add((byte) Material.FENCE.getId());
|
||||||
blockPassSet.add((byte)94);
|
blockPassSet.add((byte) Material.PORTAL.getId());
|
||||||
blockPassSet.add((byte)96);
|
blockPassSet.add((byte) Material.CAKE_BLOCK.getId());
|
||||||
blockPassSet.add((byte)101);
|
blockPassSet.add((byte) Material.DIODE_BLOCK_OFF.getId());
|
||||||
blockPassSet.add((byte)102);
|
blockPassSet.add((byte) Material.DIODE_BLOCK_ON.getId());
|
||||||
blockPassSet.add((byte)104);
|
blockPassSet.add((byte) Material.TRAP_DOOR.getId());
|
||||||
blockPassSet.add((byte)105);
|
blockPassSet.add((byte) Material.IRON_FENCE.getId());
|
||||||
blockPassSet.add((byte)106);
|
blockPassSet.add((byte) Material.THIN_GLASS.getId());
|
||||||
blockPassSet.add((byte)107);
|
blockPassSet.add((byte) Material.PUMPKIN_STEM.getId());
|
||||||
blockPassSet.add((byte)111);
|
blockPassSet.add((byte) Material.MELON_STEM.getId());
|
||||||
blockPassSet.add((byte)115);
|
blockPassSet.add((byte) Material.VINE.getId());
|
||||||
blockPassSet.add((byte)116);
|
blockPassSet.add((byte) Material.FENCE_GATE.getId());
|
||||||
blockPassSet.add((byte)117);
|
blockPassSet.add((byte) Material.WATER_LILY.getId());
|
||||||
blockPassSet.add((byte)118);
|
blockPassSet.add((byte) Material.NETHER_WARTS.getId());
|
||||||
blockPassSet.add((byte)119);
|
blockPassSet.add((byte) Material.ENCHANTMENT_TABLE.getId());
|
||||||
blockPassSet.add((byte)120);
|
blockPassSet.add((byte) Material.BREWING_STAND.getId());
|
||||||
blockPassSet.add((byte)171);
|
blockPassSet.add((byte) Material.CAULDRON.getId());
|
||||||
|
blockPassSet.add((byte) Material.ENDER_PORTAL.getId());
|
||||||
|
blockPassSet.add((byte) Material.ENDER_PORTAL_FRAME.getId());
|
||||||
|
blockPassSet.add((byte) Material.DAYLIGHT_DETECTOR.getId());
|
||||||
|
blockPassSet.add((byte) Material.STAINED_GLASS_PANE.getId());
|
||||||
|
blockPassSet.add((byte) Material.IRON_TRAPDOOR.getId());
|
||||||
|
blockPassSet.add((byte) Material.DAYLIGHT_DETECTOR_INVERTED.getId());
|
||||||
|
|
||||||
fullSolid.add((byte)1); //
|
blockPassSet.add((byte) Material.BIRCH_FENCE_GATE.getId());
|
||||||
fullSolid.add((byte)2); //
|
blockPassSet.add((byte) Material.JUNGLE_FENCE_GATE.getId());
|
||||||
fullSolid.add((byte)3); //
|
blockPassSet.add((byte) Material.DARK_OAK_FENCE_GATE.getId());
|
||||||
fullSolid.add((byte)4); //
|
blockPassSet.add((byte) Material.ACACIA_FENCE_GATE.getId());
|
||||||
fullSolid.add((byte)5); //
|
blockPassSet.add((byte) Material.SPRUCE_FENCE.getId());
|
||||||
fullSolid.add((byte)7); //
|
blockPassSet.add((byte) Material.BIRCH_FENCE.getId());
|
||||||
fullSolid.add((byte)12); //
|
blockPassSet.add((byte) Material.JUNGLE_FENCE.getId());
|
||||||
fullSolid.add((byte)13); //
|
blockPassSet.add((byte) Material.DARK_OAK_FENCE.getId());
|
||||||
fullSolid.add((byte)14); //
|
blockPassSet.add((byte) Material.ACACIA_FENCE.getId());
|
||||||
fullSolid.add((byte)15); //
|
|
||||||
fullSolid.add((byte)16); //
|
|
||||||
fullSolid.add((byte)17); //
|
|
||||||
fullSolid.add((byte)19); //
|
|
||||||
fullSolid.add((byte)20); //
|
|
||||||
fullSolid.add((byte)21); //
|
|
||||||
fullSolid.add((byte)22); //
|
|
||||||
fullSolid.add((byte)23); //
|
|
||||||
fullSolid.add((byte)24); //
|
|
||||||
fullSolid.add((byte)25); //
|
|
||||||
fullSolid.add((byte)29); //
|
|
||||||
fullSolid.add((byte)33); //
|
|
||||||
fullSolid.add((byte)35); //
|
|
||||||
fullSolid.add((byte)41); //
|
|
||||||
fullSolid.add((byte)42); //
|
|
||||||
fullSolid.add((byte)43); //
|
|
||||||
fullSolid.add((byte)44); //
|
|
||||||
fullSolid.add((byte)45); //
|
|
||||||
fullSolid.add((byte)46); //
|
|
||||||
fullSolid.add((byte)47); //
|
|
||||||
fullSolid.add((byte)48); //
|
|
||||||
fullSolid.add((byte)49); //
|
|
||||||
fullSolid.add((byte)56); //
|
|
||||||
fullSolid.add((byte)57); //
|
|
||||||
fullSolid.add((byte)58); //
|
|
||||||
fullSolid.add((byte)60); //
|
|
||||||
fullSolid.add((byte)61); //
|
|
||||||
fullSolid.add((byte)62); //
|
|
||||||
fullSolid.add((byte)73); //
|
|
||||||
fullSolid.add((byte)74); //
|
|
||||||
fullSolid.add((byte)79); //
|
|
||||||
fullSolid.add((byte)80); //
|
|
||||||
fullSolid.add((byte)82); //
|
|
||||||
fullSolid.add((byte)84); //
|
|
||||||
fullSolid.add((byte)86); //
|
|
||||||
fullSolid.add((byte)87); //
|
|
||||||
fullSolid.add((byte)88); //
|
|
||||||
fullSolid.add((byte)89); //
|
|
||||||
fullSolid.add((byte)91); //
|
|
||||||
fullSolid.add((byte)95); //
|
|
||||||
fullSolid.add((byte)97); //
|
|
||||||
fullSolid.add((byte)98); //
|
|
||||||
fullSolid.add((byte)99); //
|
|
||||||
fullSolid.add((byte)100); //
|
|
||||||
fullSolid.add((byte)103); //
|
|
||||||
fullSolid.add((byte)110); //
|
|
||||||
fullSolid.add((byte)112); //
|
|
||||||
fullSolid.add((byte)121); //
|
|
||||||
fullSolid.add((byte)123); //
|
|
||||||
fullSolid.add((byte)124); //
|
|
||||||
fullSolid.add((byte)125); //
|
|
||||||
fullSolid.add((byte)126); //
|
|
||||||
fullSolid.add((byte)129); //
|
|
||||||
fullSolid.add((byte)133); //
|
|
||||||
fullSolid.add((byte)137); //
|
|
||||||
fullSolid.add((byte)138); //
|
|
||||||
fullSolid.add((byte)152); //
|
|
||||||
fullSolid.add((byte)153); //
|
|
||||||
fullSolid.add((byte)155); //
|
|
||||||
fullSolid.add((byte)158); //
|
|
||||||
|
|
||||||
blockUseSet.add((byte)23); //Dispenser
|
blockPassSet.add((byte) Material.SPRUCE_DOOR.getId());
|
||||||
blockUseSet.add((byte)26); //Bed
|
blockPassSet.add((byte) Material.BIRCH_DOOR.getId());
|
||||||
blockUseSet.add((byte)33); //Piston
|
blockPassSet.add((byte) Material.JUNGLE_DOOR.getId());
|
||||||
blockUseSet.add((byte)47); //Bookcase
|
blockPassSet.add((byte) Material.ACACIA_DOOR.getId());
|
||||||
blockUseSet.add((byte)54); //Chest
|
blockPassSet.add((byte) Material.DARK_OAK_DOOR.getId());
|
||||||
blockUseSet.add((byte)58); //Workbench
|
|
||||||
blockUseSet.add((byte)61); //Furnace
|
|
||||||
blockUseSet.add((byte)62); //Furnace
|
|
||||||
blockUseSet.add((byte)64); //Wood Door
|
|
||||||
blockUseSet.add((byte)69); //Lever
|
|
||||||
blockUseSet.add((byte)71); //Iron Door
|
|
||||||
blockUseSet.add((byte)77); //Button
|
|
||||||
blockUseSet.add((byte)85); //Fence (stupid minecraft)
|
|
||||||
blockUseSet.add((byte)93); //Repeater
|
|
||||||
blockUseSet.add((byte)94); //Repeater
|
|
||||||
blockUseSet.add((byte)96); //Trapdoor
|
|
||||||
blockUseSet.add((byte)107); //Fence Gate
|
|
||||||
blockUseSet.add((byte)113); //Nether Fence (stupid minecraft)
|
|
||||||
blockUseSet.add((byte)116); //Enchantment Table
|
|
||||||
blockUseSet.add((byte)117); //Brewing Stand
|
|
||||||
blockUseSet.add((byte)130); //Ender Chest
|
|
||||||
blockUseSet.add((byte)145); //Anvil
|
|
||||||
blockUseSet.add((byte)146); //Trapped Chest
|
|
||||||
blockUseSet.add((byte)154); //Hopper
|
|
||||||
blockUseSet.add((byte)158); //Dropper
|
|
||||||
|
|
||||||
blockUseSet.add((byte)184); //Fences/Gates
|
fullSolid.add((byte) Material.STONE.getId());
|
||||||
blockUseSet.add((byte)185); //Fences/Gates
|
fullSolid.add((byte) Material.GRASS.getId());
|
||||||
blockUseSet.add((byte)186); //Fences/Gates
|
fullSolid.add((byte) Material.DIRT.getId());
|
||||||
blockUseSet.add((byte)187); //Fences/Gates
|
fullSolid.add((byte) Material.COBBLESTONE.getId());
|
||||||
blockUseSet.add((byte)188); //Fences/Gates
|
fullSolid.add((byte) Material.WOOD.getId());
|
||||||
blockUseSet.add((byte)189); //Fences/Gates
|
fullSolid.add((byte) Material.BEDROCK.getId());
|
||||||
blockUseSet.add((byte)190); //Fences/Gates
|
fullSolid.add((byte) Material.SAND.getId());
|
||||||
blockUseSet.add((byte)191); //Fences/Gates
|
fullSolid.add((byte) Material.GRAVEL.getId());
|
||||||
blockUseSet.add((byte)192); //Fences/Gates
|
fullSolid.add((byte) Material.GOLD_ORE.getId());
|
||||||
|
fullSolid.add((byte) Material.IRON_ORE.getId());
|
||||||
|
fullSolid.add((byte) Material.COAL_ORE.getId());
|
||||||
|
fullSolid.add((byte) Material.LOG.getId());
|
||||||
|
fullSolid.add((byte) Material.LEAVES.getId());
|
||||||
|
fullSolid.add((byte) Material.SPONGE.getId());
|
||||||
|
fullSolid.add((byte) Material.GLASS.getId());
|
||||||
|
fullSolid.add((byte) Material.LAPIS_ORE.getId());
|
||||||
|
fullSolid.add((byte) Material.LAPIS_BLOCK.getId());
|
||||||
|
fullSolid.add((byte) Material.DISPENSER.getId());
|
||||||
|
fullSolid.add((byte) Material.SANDSTONE.getId());
|
||||||
|
fullSolid.add((byte) Material.NOTE_BLOCK.getId());
|
||||||
|
fullSolid.add((byte) Material.PISTON_STICKY_BASE.getId());
|
||||||
|
fullSolid.add((byte) Material.PISTON_BASE.getId());
|
||||||
|
fullSolid.add((byte) Material.WOOL.getId());
|
||||||
|
fullSolid.add((byte) Material.GOLD_BLOCK.getId());
|
||||||
|
fullSolid.add((byte) Material.IRON_BLOCK.getId());
|
||||||
|
fullSolid.add((byte) Material.DOUBLE_STEP.getId());
|
||||||
|
fullSolid.add((byte) Material.STEP.getId());
|
||||||
|
fullSolid.add((byte) Material.BRICK.getId());
|
||||||
|
fullSolid.add((byte) Material.TNT.getId());
|
||||||
|
fullSolid.add((byte) Material.BOOKSHELF.getId());
|
||||||
|
fullSolid.add((byte) Material.MOSSY_COBBLESTONE.getId());
|
||||||
|
fullSolid.add((byte) Material.OBSIDIAN.getId());
|
||||||
|
fullSolid.add((byte) Material.DIAMOND_ORE.getId());
|
||||||
|
fullSolid.add((byte) Material.DIAMOND_BLOCK.getId());
|
||||||
|
fullSolid.add((byte) Material.WORKBENCH.getId());
|
||||||
|
fullSolid.add((byte) Material.SOIL.getId());
|
||||||
|
fullSolid.add((byte) Material.FURNACE.getId());
|
||||||
|
fullSolid.add((byte) Material.BURNING_FURNACE.getId());
|
||||||
|
fullSolid.add((byte) Material.REDSTONE_ORE.getId());
|
||||||
|
fullSolid.add((byte) Material.GLOWING_REDSTONE_ORE.getId());
|
||||||
|
fullSolid.add((byte) Material.ICE.getId());
|
||||||
|
fullSolid.add((byte) Material.SNOW_BLOCK.getId());
|
||||||
|
fullSolid.add((byte) Material.CLAY.getId());
|
||||||
|
fullSolid.add((byte) Material.JUKEBOX.getId());
|
||||||
|
fullSolid.add((byte) Material.PUMPKIN.getId());
|
||||||
|
fullSolid.add((byte) Material.NETHERRACK.getId());
|
||||||
|
fullSolid.add((byte) Material.SOUL_SAND.getId());
|
||||||
|
fullSolid.add((byte) Material.GLOWSTONE.getId());
|
||||||
|
fullSolid.add((byte) Material.JACK_O_LANTERN.getId());
|
||||||
|
fullSolid.add((byte) Material.STAINED_GLASS.getId());
|
||||||
|
fullSolid.add((byte) Material.MONSTER_EGGS.getId());
|
||||||
|
fullSolid.add((byte) Material.SMOOTH_BRICK.getId());
|
||||||
|
fullSolid.add((byte) Material.HUGE_MUSHROOM_1.getId());
|
||||||
|
fullSolid.add((byte) Material.HUGE_MUSHROOM_2.getId());
|
||||||
|
fullSolid.add((byte) Material.MELON_BLOCK.getId());
|
||||||
|
fullSolid.add((byte) Material.MYCEL.getId());
|
||||||
|
fullSolid.add((byte) Material.NETHER_BRICK.getId());
|
||||||
|
fullSolid.add((byte) Material.ENDER_STONE.getId());
|
||||||
|
fullSolid.add((byte) Material.REDSTONE_LAMP_OFF.getId());
|
||||||
|
fullSolid.add((byte) Material.REDSTONE_LAMP_ON.getId());
|
||||||
|
fullSolid.add((byte) Material.WOOD_DOUBLE_STEP.getId());
|
||||||
|
fullSolid.add((byte) Material.WOOD_STEP.getId());
|
||||||
|
fullSolid.add((byte) Material.EMERALD_ORE.getId());
|
||||||
|
fullSolid.add((byte) Material.EMERALD_BLOCK.getId());
|
||||||
|
fullSolid.add((byte) Material.COMMAND.getId());
|
||||||
|
fullSolid.add((byte) Material.BEACON.getId());
|
||||||
|
fullSolid.add((byte) Material.REDSTONE_BLOCK.getId());
|
||||||
|
fullSolid.add((byte) Material.QUARTZ_ORE.getId());
|
||||||
|
fullSolid.add((byte) Material.QUARTZ_BLOCK.getId());
|
||||||
|
fullSolid.add((byte) Material.DROPPER.getId());
|
||||||
|
fullSolid.add((byte) Material.STAINED_CLAY.getId());
|
||||||
|
fullSolid.add((byte) Material.LEAVES_2.getId());
|
||||||
|
fullSolid.add((byte) Material.LOG_2.getId());
|
||||||
|
fullSolid.add((byte) Material.PRISMARINE.getId());
|
||||||
|
fullSolid.add((byte) Material.SEA_LANTERN.getId());
|
||||||
|
fullSolid.add((byte) Material.HAY_BLOCK.getId());
|
||||||
|
fullSolid.add((byte) Material.HARD_CLAY.getId());
|
||||||
|
fullSolid.add((byte) Material.COAL_BLOCK.getId());
|
||||||
|
fullSolid.add((byte) Material.PACKED_ICE.getId());
|
||||||
|
fullSolid.add((byte) Material.RED_SANDSTONE.getId());
|
||||||
|
fullSolid.add((byte) Material.DOUBLE_STONE_SLAB2.getId());
|
||||||
|
|
||||||
blockUseSet.add((byte)193); //Wood Doors
|
blockUseSet.add((byte) Material.DISPENSER.getId());
|
||||||
blockUseSet.add((byte)194); //Wood Doors
|
blockUseSet.add((byte) Material.BED_BLOCK.getId());
|
||||||
blockUseSet.add((byte)195); //Wood Doors
|
blockUseSet.add((byte) Material.PISTON_BASE.getId());
|
||||||
blockUseSet.add((byte)196); //Wood Doors
|
blockUseSet.add((byte) Material.BOOKSHELF.getId());
|
||||||
blockUseSet.add((byte)197); //Wood Doors
|
blockUseSet.add((byte) Material.CHEST.getId());
|
||||||
|
blockUseSet.add((byte) Material.WORKBENCH.getId());
|
||||||
|
blockUseSet.add((byte) Material.FURNACE.getId());
|
||||||
|
blockUseSet.add((byte) Material.BURNING_FURNACE.getId());
|
||||||
|
blockUseSet.add((byte) Material.WOODEN_DOOR.getId());
|
||||||
|
blockUseSet.add((byte) Material.LEVER.getId());
|
||||||
|
blockUseSet.add((byte) Material.IRON_DOOR_BLOCK.getId());
|
||||||
|
blockUseSet.add((byte) Material.STONE_BUTTON.getId());
|
||||||
|
blockUseSet.add((byte) Material.FENCE.getId());
|
||||||
|
blockUseSet.add((byte) Material.DIODE_BLOCK_OFF.getId());
|
||||||
|
blockUseSet.add((byte) Material.DIODE_BLOCK_ON.getId());
|
||||||
|
blockUseSet.add((byte) Material.TRAP_DOOR.getId());
|
||||||
|
blockUseSet.add((byte) Material.FENCE_GATE.getId());
|
||||||
|
blockUseSet.add((byte) Material.NETHER_FENCE.getId());
|
||||||
|
blockUseSet.add((byte) Material.ENCHANTMENT_TABLE.getId());
|
||||||
|
blockUseSet.add((byte) Material.BREWING_STAND.getId());
|
||||||
|
blockUseSet.add((byte) Material.ENDER_CHEST.getId());
|
||||||
|
blockUseSet.add((byte) Material.ANVIL.getId());
|
||||||
|
blockUseSet.add((byte) Material.TRAPPED_CHEST.getId());
|
||||||
|
blockUseSet.add((byte) Material.HOPPER.getId());
|
||||||
|
blockUseSet.add((byte) Material.DROPPER.getId());
|
||||||
|
|
||||||
|
blockUseSet.add((byte) Material.BIRCH_FENCE_GATE.getId());
|
||||||
|
blockUseSet.add((byte) Material.JUNGLE_FENCE_GATE.getId());
|
||||||
|
blockUseSet.add((byte) Material.DARK_OAK_FENCE_GATE.getId());
|
||||||
|
blockUseSet.add((byte) Material.ACACIA_FENCE_GATE.getId());
|
||||||
|
blockUseSet.add((byte) Material.SPRUCE_FENCE.getId());
|
||||||
|
blockUseSet.add((byte) Material.BIRCH_FENCE.getId());
|
||||||
|
blockUseSet.add((byte) Material.JUNGLE_FENCE.getId());
|
||||||
|
blockUseSet.add((byte) Material.DARK_OAK_FENCE.getId());
|
||||||
|
blockUseSet.add((byte) Material.ACACIA_FENCE.getId());
|
||||||
|
|
||||||
|
blockUseSet.add((byte) Material.SPRUCE_DOOR.getId());
|
||||||
|
blockUseSet.add((byte) Material.BIRCH_DOOR.getId());
|
||||||
|
blockUseSet.add((byte) Material.JUNGLE_DOOR.getId());
|
||||||
|
blockUseSet.add((byte) Material.ACACIA_DOOR.getId());
|
||||||
|
blockUseSet.add((byte) Material.DARK_OAK_DOOR.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean solid(Block block)
|
public static boolean solid(Block block)
|
||||||
@ -449,8 +489,9 @@ public class UtilBlock
|
|||||||
|
|
||||||
if (block.getType() != Material.AIR)
|
if (block.getType() != Material.AIR)
|
||||||
{
|
{
|
||||||
float f3 = (damageBlocksEqually ? Blocks.DIRT : world.getType(block.getX(), block.getY(),
|
Blocks.DIRT.a((net.minecraft.server.v1_8_R3.Entity) null);
|
||||||
block.getZ())).a((net.minecraft.server.v1_7_R4.Entity) null);
|
float f3 = (damageBlocksEqually ? Blocks.DIRT : world.getType(new BlockPosition(block.getX(), block.getY(),
|
||||||
|
block.getZ())).getBlock()).a((net.minecraft.server.v1_8_R3.Entity) null);
|
||||||
|
|
||||||
f1 -= (f3 + 0.3F) * f2;
|
f1 -= (f3 + 0.3F) * f2;
|
||||||
}
|
}
|
||||||
|
@ -5,22 +5,23 @@ import java.util.HashMap;
|
|||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import net.minecraft.server.v1_7_R4.AxisAlignedBB;
|
import net.minecraft.server.v1_8_R3.AxisAlignedBB;
|
||||||
import net.minecraft.server.v1_7_R4.EntityBat;
|
import net.minecraft.server.v1_8_R3.EntityBat;
|
||||||
import net.minecraft.server.v1_7_R4.EntityCreature;
|
import net.minecraft.server.v1_8_R3.EntityCreature;
|
||||||
import net.minecraft.server.v1_7_R4.EntityEnderDragon;
|
import net.minecraft.server.v1_8_R3.EntityEnderDragon;
|
||||||
import net.minecraft.server.v1_7_R4.EntityHuman;
|
import net.minecraft.server.v1_8_R3.EntityHuman;
|
||||||
import net.minecraft.server.v1_7_R4.EntityInsentient;
|
import net.minecraft.server.v1_8_R3.EntityInsentient;
|
||||||
import net.minecraft.server.v1_7_R4.EntityLiving;
|
import net.minecraft.server.v1_8_R3.EntityLiving;
|
||||||
import net.minecraft.server.v1_7_R4.EntityTrackerEntry;
|
import net.minecraft.server.v1_8_R3.EntityTrackerEntry;
|
||||||
import net.minecraft.server.v1_7_R4.Navigation;
|
import net.minecraft.server.v1_8_R3.NavigationAbstract;
|
||||||
import net.minecraft.server.v1_7_R4.PacketPlayOutEntityHeadRotation;
|
import net.minecraft.server.v1_8_R3.PacketPlayOutEntity;
|
||||||
import net.minecraft.server.v1_7_R4.PathfinderGoal;
|
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityHeadRotation;
|
||||||
import net.minecraft.server.v1_7_R4.PathfinderGoalLookAtPlayer;
|
import net.minecraft.server.v1_8_R3.PathfinderGoal;
|
||||||
import net.minecraft.server.v1_7_R4.PathfinderGoalMoveTowardsRestriction;
|
import net.minecraft.server.v1_8_R3.PathfinderGoalLookAtPlayer;
|
||||||
import net.minecraft.server.v1_7_R4.PathfinderGoalRandomLookaround;
|
import net.minecraft.server.v1_8_R3.PathfinderGoalMoveTowardsRestriction;
|
||||||
import net.minecraft.server.v1_7_R4.PathfinderGoalSelector;
|
import net.minecraft.server.v1_8_R3.PathfinderGoalRandomLookaround;
|
||||||
import net.minecraft.server.v1_7_R4.WorldServer;
|
import net.minecraft.server.v1_8_R3.PathfinderGoalSelector;
|
||||||
|
import net.minecraft.server.v1_8_R3.WorldServer;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@ -28,10 +29,11 @@ import org.bukkit.Material;
|
|||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftCreature;
|
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
|
||||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
|
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftCreature;
|
||||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftLivingEntity;
|
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
|
||||||
|
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftLivingEntity;
|
||||||
import org.bukkit.entity.Creature;
|
import org.bukkit.entity.Creature;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
@ -60,29 +62,24 @@ public class UtilEnt
|
|||||||
|
|
||||||
public static void silence(Entity entity, boolean silence)
|
public static void silence(Entity entity, boolean silence)
|
||||||
{
|
{
|
||||||
((CraftEntity)entity).getHandle().Silent = silence;
|
((CraftEntity)entity).getHandle().setSilent(silence);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ghost(Entity entity, boolean ghost, boolean invisible)
|
public static void ghost(Entity entity, boolean ghost, boolean invisible)
|
||||||
{
|
{
|
||||||
if (entity instanceof LivingEntity)
|
if (entity instanceof LivingEntity)
|
||||||
{
|
{
|
||||||
((CraftLivingEntity)entity).getHandle().ghost = ghost;
|
((CraftLivingEntity)entity).getHandle().setGhost(ghost);
|
||||||
}
|
}
|
||||||
|
|
||||||
((CraftEntity)entity).getHandle().Invisible = invisible;
|
// ((CraftEntity)entity).getHandle().Invisible = invisible;
|
||||||
((CraftEntity)entity).getHandle().setInvisible(invisible);
|
((CraftEntity)entity).getHandle().setInvisible(invisible);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Leash(LivingEntity leashed, Entity holder, boolean pull, boolean breakable)
|
public static void Leash(LivingEntity leashed, Entity holder, boolean pull, boolean breakable)
|
||||||
{
|
{
|
||||||
if (((CraftEntity)leashed).getHandle() instanceof EntityInsentient)
|
leashed.setPullWhileLeashed(pull);
|
||||||
{
|
leashed.setShouldBreakLeash(breakable);
|
||||||
EntityInsentient creature = (EntityInsentient)((CraftEntity)leashed).getHandle();
|
|
||||||
|
|
||||||
creature.PullWhileLeashed = pull;
|
|
||||||
creature.BreakLeash = breakable;
|
|
||||||
}
|
|
||||||
|
|
||||||
leashed.setLeashHolder(holder);
|
leashed.setLeashHolder(holder);
|
||||||
}
|
}
|
||||||
@ -167,7 +164,7 @@ public class UtilEnt
|
|||||||
|
|
||||||
if (_bsRestrictionGoal == null)
|
if (_bsRestrictionGoal == null)
|
||||||
{
|
{
|
||||||
_bsRestrictionGoal = EntityCreature.class.getDeclaredField("bs");
|
_bsRestrictionGoal = EntityCreature.class.getDeclaredField("c");
|
||||||
_bsRestrictionGoal.setAccessible(true);
|
_bsRestrictionGoal.setAccessible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -178,8 +175,8 @@ public class UtilEnt
|
|||||||
{
|
{
|
||||||
EntityInsentient creature = (EntityInsentient)((CraftEntity)entity).getHandle();
|
EntityInsentient creature = (EntityInsentient)((CraftEntity)entity).getHandle();
|
||||||
|
|
||||||
creature.Vegetated = true;
|
creature.setVegetated(true);
|
||||||
creature.Silent = mute;
|
creature.setSilent(mute);
|
||||||
|
|
||||||
((List) _pathfinderBList.get(((PathfinderGoalSelector)_goalSelector.get(creature)))).clear();
|
((List) _pathfinderBList.get(((PathfinderGoalSelector)_goalSelector.get(creature)))).clear();
|
||||||
((List)_pathfinderCList.get(((PathfinderGoalSelector)_goalSelector.get(creature)))).clear();
|
((List)_pathfinderCList.get(((PathfinderGoalSelector)_goalSelector.get(creature)))).clear();
|
||||||
@ -190,14 +187,14 @@ public class UtilEnt
|
|||||||
|
|
||||||
if (((CraftEntity)entity).getHandle() instanceof EntityBat)
|
if (((CraftEntity)entity).getHandle() instanceof EntityBat)
|
||||||
{
|
{
|
||||||
((EntityBat)((CraftEntity)entity).getHandle()).Vegetated = true;
|
((EntityBat)((CraftEntity)entity).getHandle()).setVegetated(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((CraftEntity)entity).getHandle() instanceof EntityEnderDragon)
|
if (((CraftEntity)entity).getHandle() instanceof EntityEnderDragon)
|
||||||
{
|
{
|
||||||
EntityEnderDragon creature = (EntityEnderDragon)((CraftEntity)entity).getHandle();
|
EntityEnderDragon creature = (EntityEnderDragon)((CraftEntity)entity).getHandle();
|
||||||
|
|
||||||
creature.Vegetated = true;
|
creature.setVegetated(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (IllegalArgumentException e)
|
catch (IllegalArgumentException e)
|
||||||
@ -509,7 +506,7 @@ public class UtilEnt
|
|||||||
|
|
||||||
public static boolean isGrounded(Entity ent)
|
public static boolean isGrounded(Entity ent)
|
||||||
{
|
{
|
||||||
AxisAlignedBB box = ((CraftEntity)ent).getHandle().boundingBox;
|
AxisAlignedBB box = ((CraftEntity)ent).getHandle().getBoundingBox();
|
||||||
Location bottom_corner_1 = new Location(ent.getWorld(), box.a, ent.getLocation().getY()-0.1, box.c);
|
Location bottom_corner_1 = new Location(ent.getWorld(), box.a, ent.getLocation().getY()-0.1, box.c);
|
||||||
Location bottom_corner_2 = new Location(ent.getWorld(), box.d, ent.getLocation().getY()-0.1, box.f);
|
Location bottom_corner_2 = new Location(ent.getWorld(), box.d, ent.getLocation().getY()-0.1, box.f);
|
||||||
|
|
||||||
@ -616,24 +613,57 @@ public class UtilEnt
|
|||||||
return CreatureLook(ent, UtilAlg.GetPitch(vec), UtilAlg.GetYaw(vec));
|
return CreatureLook(ent, UtilAlg.GetPitch(vec), UtilAlg.GetYaw(vec));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void setFakeHead(Entity ent, boolean fakeHead)
|
||||||
|
{
|
||||||
|
net.minecraft.server.v1_8_R3.Entity ec = ((CraftEntity) ent).getHandle();
|
||||||
|
|
||||||
|
ec.setFakeHead(fakeHead);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void CreatureForceLook(Entity ent, float pitch, float yaw)
|
||||||
|
{
|
||||||
|
net.minecraft.server.v1_8_R3.Entity ec = ((CraftEntity) ent).getHandle();
|
||||||
|
|
||||||
|
ec.setFakeHead(true);
|
||||||
|
|
||||||
|
ec.fakePitch = pitch;
|
||||||
|
ec.fakeYaw = yaw;
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean CreatureLook(Entity ent, float pitch, float yaw)
|
public static boolean CreatureLook(Entity ent, float pitch, float yaw)
|
||||||
{
|
{
|
||||||
if (!(ent instanceof LivingEntity))
|
if (!(ent instanceof LivingEntity))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
EntityLiving ec = ((CraftLivingEntity) ent).getHandle();
|
EntityLiving ec = ((CraftLivingEntity) ent).getHandle();
|
||||||
Location loc = ent.getLocation();
|
|
||||||
|
|
||||||
ec.setPositionRotation(loc.getX(), loc.getY(), loc.getZ(), yaw, pitch);
|
ec.yaw = yaw;
|
||||||
ec.al = true;
|
ec.pitch = pitch;
|
||||||
|
ec.aK = yaw;
|
||||||
|
ec.fakePitch = pitch;
|
||||||
|
ec.fakeYaw = yaw;
|
||||||
|
|
||||||
EntityTrackerEntry entry = (EntityTrackerEntry) ((WorldServer) ec.world).tracker.trackedEntities.get(ec.getId());
|
EntityTrackerEntry entry = (EntityTrackerEntry) ((WorldServer) ec.getWorld()).tracker.trackedEntities.get(ec.getId());
|
||||||
|
|
||||||
entry.broadcast(new PacketPlayOutEntityHeadRotation(ec, (byte) (ec.yaw * 256.0F / 360.0F)));
|
byte ya = (byte) (yaw * 256.0F / 360.0F);
|
||||||
|
byte pi = (byte) (pitch * 256.0F / 360.0F);
|
||||||
|
|
||||||
|
entry.yRot = ya;
|
||||||
|
entry.xRot = pi;
|
||||||
|
entry.i = ya;
|
||||||
|
|
||||||
|
// Looks like both packets need to be sent. EntityLook packet for body yaw and head pitch. Head rotation for head yaw.
|
||||||
|
entry.broadcast(new PacketPlayOutEntity.PacketPlayOutEntityLook(ent.getEntityId(), ya, pi, ec.onGround));
|
||||||
|
entry.broadcast(new PacketPlayOutEntityHeadRotation(ec, ya));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean CreatureLook(Entity ent, float yaw)
|
||||||
|
{
|
||||||
|
return CreatureLook(ent, 0, yaw);
|
||||||
|
}
|
||||||
|
|
||||||
public static void CreatureMove(Entity ent, Location target, float speed)
|
public static void CreatureMove(Entity ent, Location target, float speed)
|
||||||
{
|
{
|
||||||
if (!(ent instanceof Creature))
|
if (!(ent instanceof Creature))
|
||||||
@ -643,7 +673,7 @@ public class UtilEnt
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
EntityCreature ec = ((CraftCreature)ent).getHandle();
|
EntityCreature ec = ((CraftCreature)ent).getHandle();
|
||||||
Navigation nav = ec.getNavigation();
|
NavigationAbstract nav = ec.getNavigation();
|
||||||
|
|
||||||
if (UtilMath.offset(ent.getLocation(), target) > 16)
|
if (UtilMath.offset(ent.getLocation(), target) > 16)
|
||||||
{
|
{
|
||||||
@ -695,7 +725,7 @@ public class UtilEnt
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Field field = net.minecraft.server.v1_7_R4.Entity.class.getDeclaredField("entityCount");
|
Field field = net.minecraft.server.v1_8_R3.Entity.class.getDeclaredField("entityCount");
|
||||||
field.setAccessible(true);
|
field.setAccessible(true);
|
||||||
int entityId = field.getInt(null);
|
int entityId = field.getInt(null);
|
||||||
if (modifynumber) {
|
if (modifynumber) {
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
package mineplex.core.common.util;
|
package mineplex.core.common.util;
|
||||||
|
|
||||||
import net.minecraft.server.v1_7_R4.PacketPlayOutEntityDestroy;
|
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy;
|
||||||
|
|
||||||
import org.bukkit.Color;
|
import org.bukkit.Color;
|
||||||
import org.bukkit.FireworkEffect;
|
import org.bukkit.FireworkEffect;
|
||||||
import org.bukkit.FireworkEffect.Type;
|
import org.bukkit.FireworkEffect.Type;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
|
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
|
||||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
|
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
|
||||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftFirework;
|
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftFirework;
|
||||||
import org.bukkit.entity.Firework;
|
import org.bukkit.entity.Firework;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.meta.FireworkMeta;
|
import org.bukkit.inventory.meta.FireworkMeta;
|
||||||
@ -18,9 +18,9 @@ public class UtilFirework
|
|||||||
{
|
{
|
||||||
public static void playFirework(Location loc, FireworkEffect fe)
|
public static void playFirework(Location loc, FireworkEffect fe)
|
||||||
{
|
{
|
||||||
Firework firework = (Firework) loc.getWorld().spawn(loc, Firework.class);
|
Firework firework = loc.getWorld().spawn(loc, Firework.class);
|
||||||
|
|
||||||
FireworkMeta data = (FireworkMeta) firework.getFireworkMeta();
|
FireworkMeta data = firework.getFireworkMeta();
|
||||||
data.clearEffects();
|
data.clearEffects();
|
||||||
data.setPower(1);
|
data.setPower(1);
|
||||||
data.addEffect(fe);
|
data.addEffect(fe);
|
||||||
@ -35,9 +35,9 @@ public class UtilFirework
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Firework fw = (Firework) loc.getWorld().spawn(loc, Firework.class);
|
Firework fw = loc.getWorld().spawn(loc, Firework.class);
|
||||||
|
|
||||||
FireworkMeta data = (FireworkMeta) fw.getFireworkMeta();
|
FireworkMeta data = fw.getFireworkMeta();
|
||||||
data.clearEffects();
|
data.clearEffects();
|
||||||
data.setPower(power);
|
data.setPower(power);
|
||||||
data.addEffect(fe);
|
data.addEffect(fe);
|
||||||
@ -59,7 +59,6 @@ public class UtilFirework
|
|||||||
public void detonateFirework(Firework firework)
|
public void detonateFirework(Firework firework)
|
||||||
{
|
{
|
||||||
((CraftWorld)firework.getWorld()).getHandle().broadcastEntityEffect(((CraftEntity)firework).getHandle(), (byte)17);
|
((CraftWorld)firework.getWorld()).getHandle().broadcastEntityEffect(((CraftEntity)firework).getHandle(), (byte)17);
|
||||||
|
|
||||||
firework.remove();
|
firework.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,7 +85,10 @@ public class UtilFirework
|
|||||||
|
|
||||||
((CraftFirework) firework).getHandle().expectedLifespan = 1;
|
((CraftFirework) firework).getHandle().expectedLifespan = 1;
|
||||||
|
|
||||||
PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(firework.getEntityId());
|
PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(new int[]
|
||||||
|
{
|
||||||
|
firework.getEntityId()
|
||||||
|
});
|
||||||
|
|
||||||
for (Player viewing : UtilServer.getPlayers())
|
for (Player viewing : UtilServer.getPlayers())
|
||||||
{
|
{
|
||||||
|
@ -12,6 +12,7 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.event.inventory.InventoryAction;
|
import org.bukkit.event.inventory.InventoryAction;
|
||||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||||
import org.bukkit.event.inventory.InventoryType;
|
import org.bukkit.event.inventory.InventoryType;
|
||||||
|
import org.bukkit.inventory.Inventory;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.PlayerInventory;
|
import org.bukkit.inventory.PlayerInventory;
|
||||||
|
|
||||||
@ -70,13 +71,13 @@ public class UtilInv
|
|||||||
|
|
||||||
public static boolean contains(Player player, String itemNameContains, Material item, byte data, int required)
|
public static boolean contains(Player player, String itemNameContains, Material item, byte data, int required)
|
||||||
{
|
{
|
||||||
return contains(player, itemNameContains, item, data, required, true, true);
|
return contains(player, itemNameContains, item, data, required, true, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean contains(Player player, String itemNameContains, Material item, byte data, int required, boolean checkArmor, boolean checkCursor)
|
public static boolean contains(Player player, String itemNameContains, Material item, byte data, int required, boolean checkArmor, boolean checkCursor, boolean checkCrafting)
|
||||||
{
|
{
|
||||||
|
|
||||||
for (ItemStack stack : getItems(player, checkArmor, checkCursor))
|
for (ItemStack stack : getItems(player, checkArmor, checkCursor, checkCrafting))
|
||||||
{
|
{
|
||||||
if (required <= 0)
|
if (required <= 0)
|
||||||
{
|
{
|
||||||
@ -157,15 +158,22 @@ public class UtilInv
|
|||||||
inv.setArmorContents(new ItemStack[4]);
|
inv.setArmorContents(new ItemStack[4]);
|
||||||
player.setItemOnCursor(new ItemStack(Material.AIR));
|
player.setItemOnCursor(new ItemStack(Material.AIR));
|
||||||
|
|
||||||
|
Inventory openInventory = player.getOpenInventory().getTopInventory();
|
||||||
|
|
||||||
|
if (openInventory.getHolder() == player)
|
||||||
|
{
|
||||||
|
openInventory.clear();
|
||||||
|
}
|
||||||
|
|
||||||
player.saveData();
|
player.saveData();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ArrayList<ItemStack> getItems(Player player)
|
public static ArrayList<ItemStack> getItems(Player player)
|
||||||
{
|
{
|
||||||
return getItems(player, true, true);
|
return getItems(player, true, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ArrayList<ItemStack> getItems(Player player, boolean getArmor, boolean getCursor)
|
public static ArrayList<ItemStack> getItems(Player player, boolean getArmor, boolean getCursor, boolean getCrafting)
|
||||||
{
|
{
|
||||||
ArrayList<ItemStack> items = new ArrayList<ItemStack>();
|
ArrayList<ItemStack> items = new ArrayList<ItemStack>();
|
||||||
PlayerInventory inv = player.getInventory();
|
PlayerInventory inv = player.getInventory();
|
||||||
@ -197,6 +205,22 @@ public class UtilInv
|
|||||||
items.add(cursorItem.clone());
|
items.add(cursorItem.clone());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (getCrafting)
|
||||||
|
{
|
||||||
|
Inventory openInventory = player.getOpenInventory().getTopInventory();
|
||||||
|
|
||||||
|
if (openInventory.getHolder() == player && openInventory.getType() == InventoryType.CRAFTING)
|
||||||
|
{
|
||||||
|
for (ItemStack item : openInventory.getContents())
|
||||||
|
{
|
||||||
|
if (item != null && item.getType() != Material.AIR)
|
||||||
|
{
|
||||||
|
items.add(item.clone());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -357,11 +381,12 @@ public class UtilInv
|
|||||||
return getAmount(player, mat, true);
|
return getAmount(player, mat, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getAmount(Player player, Material mat, boolean includeArmorAndCursor)
|
public static int getAmount(Player player, Material mat, boolean includeArmorAndCursorAndCrafting)
|
||||||
{
|
{
|
||||||
int amount = 0;
|
int amount = 0;
|
||||||
|
|
||||||
for (ItemStack item : getItems(player, true, true))
|
for (ItemStack item : getItems(player, includeArmorAndCursorAndCrafting, includeArmorAndCursorAndCrafting,
|
||||||
|
includeArmorAndCursorAndCrafting))
|
||||||
{
|
{
|
||||||
if (item.getType() == mat)
|
if (item.getType() == mat)
|
||||||
{
|
{
|
||||||
|
@ -3,7 +3,8 @@ package mineplex.core.common.util;
|
|||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
|
|
||||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||||
import net.minecraft.server.v1_7_R4.PacketPlayOutWorldParticles;
|
import net.minecraft.server.v1_8_R3.EnumParticle;
|
||||||
|
import net.minecraft.server.v1_8_R3.PacketPlayOutWorldParticles;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -13,11 +14,7 @@ public class UtilParticle
|
|||||||
{
|
{
|
||||||
public enum ViewDist
|
public enum ViewDist
|
||||||
{
|
{
|
||||||
SHORT(8),
|
SHORT(8), NORMAL(24), LONG(48), LONGER(96), MAX(256);
|
||||||
NORMAL(24),
|
|
||||||
LONG(48),
|
|
||||||
LONGER(96),
|
|
||||||
MAX(256);
|
|
||||||
|
|
||||||
private int _dist;
|
private int _dist;
|
||||||
|
|
||||||
@ -34,9 +31,9 @@ public class UtilParticle
|
|||||||
|
|
||||||
public enum ParticleType
|
public enum ParticleType
|
||||||
{
|
{
|
||||||
ANGRY_VILLAGER("angryVillager", "Lightning Cloud", Material.INK_SACK, (byte) 11),
|
ANGRY_VILLAGER(EnumParticle.VILLAGER_ANGRY, "angryVillager", "Lightning Cloud", Material.INK_SACK, (byte) 11),
|
||||||
|
|
||||||
BLOCK_CRACK("blockcrack_1_0")
|
BLOCK_CRACK(EnumParticle.BLOCK_CRACK, "blockcrack")
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public String getParticle(Material type, int data)
|
public String getParticle(Material type, int data)
|
||||||
@ -45,7 +42,7 @@ public class UtilParticle
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
BLOCK_DUST("blockdust_1_0")
|
BLOCK_DUST(EnumParticle.BLOCK_DUST, "blockdust")
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public String getParticle(Material type, int data)
|
public String getParticle(Material type, int data)
|
||||||
@ -54,37 +51,37 @@ public class UtilParticle
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
BUBBLE("bubble"),
|
BUBBLE(EnumParticle.WATER_BUBBLE, "bubble"),
|
||||||
|
|
||||||
CLOUD("cloud", "White Smoke", Material.INK_SACK, (byte) 7),
|
CLOUD(EnumParticle.CLOUD, "cloud", "White Smoke", Material.INK_SACK, (byte) 7),
|
||||||
|
|
||||||
CRIT("crit", "Brown Magic", Material.INK_SACK, (byte) 14),
|
CRIT(EnumParticle.CRIT, "crit", "Brown Magic", Material.INK_SACK, (byte) 14),
|
||||||
|
|
||||||
DEPTH_SUSPEND("depthSuspend"),
|
DEPTH_SUSPEND(EnumParticle.SUSPENDED_DEPTH, "depthSuspend"),
|
||||||
|
|
||||||
DRIP_LAVA("dripLava", "Lava Drip", Material.LAVA_BUCKET, (byte) 0),
|
DRIP_LAVA(EnumParticle.DRIP_LAVA, "dripLava", "Lava Drip", Material.LAVA_BUCKET, (byte) 0),
|
||||||
|
|
||||||
DRIP_WATER("dripWater", "Water Drop", Material.WATER_BUCKET, (byte) 0),
|
DRIP_WATER(EnumParticle.DRIP_WATER, "dripWater", "Water Drop", Material.WATER_BUCKET, (byte) 0),
|
||||||
|
|
||||||
DROPLET("droplet", "Water Splash", Material.INK_SACK, (byte) 4),
|
DROPLET(EnumParticle.WATER_DROP, "droplet", "Water Splash", Material.INK_SACK, (byte) 4),
|
||||||
|
|
||||||
ENCHANTMENT_TABLE("enchantmenttable", "Enchantment Words", Material.BOOK, (byte) 0),
|
ENCHANTMENT_TABLE(EnumParticle.ENCHANTMENT_TABLE, "enchantmenttable", "Enchantment Words", Material.BOOK, (byte) 0),
|
||||||
|
|
||||||
EXPLODE("explode", "Big White Smoke", Material.INK_SACK, (byte) 15),
|
EXPLODE(EnumParticle.EXPLOSION_NORMAL, "explode", "Big White Smoke", Material.INK_SACK, (byte) 15),
|
||||||
|
|
||||||
FIREWORKS_SPARK("fireworksSpark", "White Sparkle", Material.GHAST_TEAR, (byte) 0),
|
FIREWORKS_SPARK(EnumParticle.FIREWORKS_SPARK, "fireworksSpark", "White Sparkle", Material.GHAST_TEAR, (byte) 0),
|
||||||
|
|
||||||
FLAME("flame", "Flame", Material.BLAZE_POWDER, (byte) 0),
|
FLAME(EnumParticle.FLAME, "flame", "Flame", Material.BLAZE_POWDER, (byte) 0),
|
||||||
|
|
||||||
FOOTSTEP("footstep", "Foot Step", Material.LEATHER_BOOTS, (byte) 0),
|
FOOTSTEP(EnumParticle.FOOTSTEP, "footstep", "Foot Step", Material.LEATHER_BOOTS, (byte) 0),
|
||||||
|
|
||||||
HAPPY_VILLAGER("happyVillager", "Emerald Sparkle", Material.EMERALD, (byte) 0),
|
HAPPY_VILLAGER(EnumParticle.VILLAGER_HAPPY, "happyVillager", "Emerald Sparkle", Material.EMERALD, (byte) 0),
|
||||||
|
|
||||||
HEART("heart", "Love Heart", Material.APPLE, (byte) 0),
|
HEART(EnumParticle.HEART, "heart", "Love Heart", Material.APPLE, (byte) 0),
|
||||||
|
|
||||||
HUGE_EXPLOSION("hugeexplosion", "Huge Explosion", Material.TNT, (byte) 0),
|
HUGE_EXPLOSION(EnumParticle.EXPLOSION_HUGE, "hugeexplosion", "Huge Explosion", Material.TNT, (byte) 0),
|
||||||
|
|
||||||
ICON_CRACK("iconcrack_1_0")
|
ICON_CRACK(EnumParticle.ITEM_CRACK, "iconcrack")
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public String getParticle(Material type, int data)
|
public String getParticle(Material type, int data)
|
||||||
@ -93,68 +90,84 @@ public class UtilParticle
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
INSTANT_SPELL("instantSpell"),
|
INSTANT_SPELL(EnumParticle.SPELL_INSTANT, "instantSpell"),
|
||||||
|
|
||||||
LARGE_EXPLODE("largeexplode", "Explosion", Material.FIREBALL, (byte) 0),
|
LARGE_EXPLODE(EnumParticle.EXPLOSION_LARGE, "largeexplode", "Explosion", Material.FIREBALL, (byte) 0),
|
||||||
|
|
||||||
LARGE_SMOKE("largesmoke", "Black Smoke", Material.INK_SACK, (byte) 0),
|
LARGE_SMOKE(EnumParticle.SMOKE_LARGE, "largesmoke", "Black Smoke", Material.INK_SACK, (byte) 0),
|
||||||
|
|
||||||
SMOKE("smoke", "Small Black Smoke", Material.INK_SACK, (byte)0),
|
SMOKE(EnumParticle.SMOKE_NORMAL, "smoke", "Smoke", Material.INK_SACK, (byte) 0),
|
||||||
|
|
||||||
LAVA("lava", "Lava Debris", Material.LAVA, (byte) 0),
|
LAVA(EnumParticle.LAVA, "lava", "Lava Debris", Material.LAVA, (byte) 0),
|
||||||
|
|
||||||
MAGIC_CRIT("magicCrit", "Teal Magic", Material.INK_SACK, (byte) 6),
|
MAGIC_CRIT(EnumParticle.CRIT_MAGIC, "magicCrit", "Teal Magic", Material.INK_SACK, (byte) 6),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Can be colored if count is 0, color is RGB and depends on the offset of xyz
|
* Can be colored if count is 0, color is RGB and depends on the offset of xyz
|
||||||
*/
|
*/
|
||||||
MOB_SPELL("mobSpell", "Black Swirls", Material.getMaterial(2263), (byte) 0),
|
MOB_SPELL(EnumParticle.SPELL_MOB, "mobSpell", "Black Swirls", Material.getMaterial(2263), (byte) 0),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Can be colored if count is 0, color is RGB and depends on the offset of xyz
|
* Can be colored if count is 0, color is RGB and depends on the offset of xyz
|
||||||
*/
|
*/
|
||||||
MOB_SPELL_AMBIENT("mobSpellAmbient", "Transparent Black Swirls", Material.getMaterial(2266), (byte) 0),
|
MOB_SPELL_AMBIENT(EnumParticle.SPELL_MOB_AMBIENT, "mobSpellAmbient", "Transparent Black Swirls", Material
|
||||||
|
.getMaterial(2266), (byte) 0),
|
||||||
NOTE("note", "Musical Note", Material.JUKEBOX, (byte) 0),
|
|
||||||
|
|
||||||
PORTAL("portal", "Portal Effect", Material.INK_SACK, (byte) 5),
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Can be colored if count is 0, color is RGB and depends on the offset of xyz. Offset y if 0 will default to 1, counter by making it 0.0001
|
* To do certain colors, use "no / 24F" for the random X value, 1 for speed. 0 for count.
|
||||||
*/
|
*/
|
||||||
RED_DUST("reddust", "Red Smoke", Material.INK_SACK, (byte) 1),
|
NOTE(EnumParticle.NOTE, "note", "Musical Note", Material.JUKEBOX, (byte) 0),
|
||||||
|
|
||||||
SLIME("slime", "Slime Particles", Material.SLIME_BALL, (byte) 0),
|
PORTAL(EnumParticle.PORTAL, "portal", "Portal Effect", Material.INK_SACK, (byte) 5),
|
||||||
|
|
||||||
SNOW_SHOVEL("snowshovel", "Snow Puffs", Material.SNOW_BALL, (byte) 0),
|
/**
|
||||||
|
* Can be colored if count is 0, color is RGB and depends on the offset of xyz. Offset y if 0 will default to 1, counter
|
||||||
|
* by making it 0.0001
|
||||||
|
*/
|
||||||
|
RED_DUST(EnumParticle.REDSTONE, "reddust", "Red Smoke", Material.INK_SACK, (byte) 1),
|
||||||
|
|
||||||
SNOWBALL_POOF("snowballpoof"),
|
SLIME(EnumParticle.SLIME, "slime", "Slime Particles", Material.SLIME_BALL, (byte) 0),
|
||||||
|
|
||||||
SPELL("spell", "White Swirls", Material.getMaterial(2264), (byte) 0),
|
SNOW_SHOVEL(EnumParticle.SNOW_SHOVEL, "snowshovel", "Snow Puffs", Material.SNOW_BALL, (byte) 0),
|
||||||
|
|
||||||
SPLASH("splash"),
|
SNOWBALL_POOF(EnumParticle.SNOWBALL, "snowballpoof"),
|
||||||
|
|
||||||
SUSPEND("suspended"),
|
SPELL(EnumParticle.SPELL, "spell", "White Swirls", Material.getMaterial(2264), (byte) 0),
|
||||||
|
|
||||||
TOWN_AURA("townaura", "Black Specks", Material.COAL, (byte) 0),
|
SPLASH(EnumParticle.WATER_SPLASH, "splash"),
|
||||||
|
|
||||||
WITCH_MAGIC("witchMagic", "Purple Magic", Material.INK_SACK, (byte) 13);
|
SUSPEND(EnumParticle.SUSPENDED, "suspended"),
|
||||||
|
|
||||||
|
TOWN_AURA(EnumParticle.TOWN_AURA, "townaura", "Black Specks", Material.COAL, (byte) 0),
|
||||||
|
|
||||||
|
WITCH_MAGIC(EnumParticle.SPELL_WITCH, "witchMagic", "Purple Magic", Material.INK_SACK, (byte) 13),
|
||||||
|
|
||||||
|
MOB_APPEARANCE(EnumParticle.MOB_APPEARANCE, "mobappearance"),
|
||||||
|
|
||||||
|
BARRIER(EnumParticle.BARRIER, "barrier"),
|
||||||
|
|
||||||
|
ITEM_TAKE(EnumParticle.ITEM_TAKE, "take"),
|
||||||
|
|
||||||
|
WATER_WAKE(EnumParticle.WATER_WAKE, "wake");
|
||||||
|
|
||||||
|
public EnumParticle particle;
|
||||||
public String particleName;
|
public String particleName;
|
||||||
private boolean _friendlyData;
|
private boolean _friendlyData;
|
||||||
private String _friendlyName;
|
private String _friendlyName;
|
||||||
private Material _material;
|
private Material _material;
|
||||||
private byte _data;
|
private byte _data;
|
||||||
|
|
||||||
ParticleType(String particleName)
|
ParticleType(EnumParticle particle, String particleName)
|
||||||
{
|
{
|
||||||
this.particleName = particleName;
|
this.particleName = particleName;
|
||||||
_friendlyData = false;
|
_friendlyData = false;
|
||||||
|
this.particle = particle;
|
||||||
}
|
}
|
||||||
|
|
||||||
ParticleType(String particleName, String friendlyName, Material material, byte data)
|
ParticleType(EnumParticle particle, String particleName, String friendlyName, Material material, byte data)
|
||||||
{
|
{
|
||||||
this.particleName = particleName;
|
this.particleName = particleName;
|
||||||
|
this.particle = particle;
|
||||||
_friendlyData = true;
|
_friendlyData = true;
|
||||||
_friendlyName = friendlyName;
|
_friendlyName = friendlyName;
|
||||||
_material = material;
|
_material = material;
|
||||||
@ -205,8 +218,28 @@ public class UtilParticle
|
|||||||
private static PacketPlayOutWorldParticles getPacket(String particleName, Location location, float offsetX, float offsetY,
|
private static PacketPlayOutWorldParticles getPacket(String particleName, Location location, float offsetX, float offsetY,
|
||||||
float offsetZ, float speed, int count, boolean displayFar)
|
float offsetZ, float speed, int count, boolean displayFar)
|
||||||
{
|
{
|
||||||
|
String[] parts = particleName.split("_");
|
||||||
|
int[] details = new int[parts.length - 1];
|
||||||
|
|
||||||
|
for (int i = 0; i < details.length; i++)
|
||||||
|
{
|
||||||
|
details[i] = Integer.parseInt(parts[i + 1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
ParticleType particleType = ParticleType.CRIT;
|
||||||
|
|
||||||
|
for (ParticleType type : ParticleType.values())
|
||||||
|
{
|
||||||
|
if (type.particleName.equalsIgnoreCase(parts[0]))
|
||||||
|
{
|
||||||
|
particleType = type;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles(particleType.particle, displayFar,
|
||||||
|
(float) location.getX(), (float) location.getY(), (float) location.getZ(), offsetX, offsetY, offsetZ, speed,
|
||||||
|
count, details);
|
||||||
|
|
||||||
PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles(particleName, (float) location.getX(), (float) location.getY(), (float) location.getZ(), offsetX, offsetY, offsetZ, speed, count, displayFar);
|
|
||||||
return packet;
|
return packet;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -222,8 +255,8 @@ public class UtilParticle
|
|||||||
PlayParticle(type.particleName, location, offsetX, offsetY, offsetZ, speed, count, dist, players);
|
PlayParticle(type.particleName, location, offsetX, offsetY, offsetZ, speed, count, dist, players);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void PlayParticle(String particle, Location location, float offsetX, float offsetY, float offsetZ,
|
public static void PlayParticle(String particle, Location location, float offsetX, float offsetY, float offsetZ, float speed,
|
||||||
float speed, int count, ViewDist dist, Player... players)
|
int count, ViewDist dist, Player... players)
|
||||||
{
|
{
|
||||||
PacketPlayOutWorldParticles packet = getPacket(particle, location, offsetX, offsetY, offsetZ, speed, count, true);
|
PacketPlayOutWorldParticles packet = getPacket(particle, location, offsetX, offsetY, offsetZ, speed, count, true);
|
||||||
|
|
||||||
|
@ -8,17 +8,17 @@ import java.util.Map;
|
|||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import net.minecraft.server.v1_7_R4.EntityPlayer;
|
import net.minecraft.server.v1_8_R3.EntityPlayer;
|
||||||
import net.minecraft.server.v1_7_R4.Packet;
|
import net.minecraft.server.v1_8_R3.Packet;
|
||||||
import net.minecraft.server.v1_7_R4.PlayerConnection;
|
import net.minecraft.server.v1_8_R3.PlayerConnection;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
|
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
|
||||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||||
import org.bukkit.craftbukkit.v1_7_R4.event.CraftEventFactory;
|
import org.bukkit.craftbukkit.v1_8_R3.event.CraftEventFactory;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -647,11 +647,6 @@ public class UtilPlayer
|
|||||||
return (((CraftEntity) player).getHandle().getDataWatcher().getByte(0) & 1 << 4) != 0;
|
return (((CraftEntity) player).getHandle().getDataWatcher().getByte(0) & 1 << 4) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean is1_8(Player player)
|
|
||||||
{
|
|
||||||
return ((CraftPlayer) player).getHandle().playerConnection.networkManager.getVersion() >= 47;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void clearInventory(Player player)
|
public static void clearInventory(Player player)
|
||||||
{
|
{
|
||||||
player.getInventory().clear();
|
player.getInventory().clear();
|
||||||
@ -675,6 +670,9 @@ public class UtilPlayer
|
|||||||
|
|
||||||
for (Packet packet : packets)
|
for (Packet packet : packets)
|
||||||
{
|
{
|
||||||
|
if (packet == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
connection.sendPacket(packet);
|
connection.sendPacket(packet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,19 +1,19 @@
|
|||||||
package mineplex.core.common.util;
|
package mineplex.core.common.util;
|
||||||
|
|
||||||
import net.minecraft.server.v1_7_R4.ChatSerializer;
|
|
||||||
import net.minecraft.server.v1_7_R4.IChatBaseComponent;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.spigotmc.ProtocolInjector;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import net.minecraft.server.v1_8_R3.IChatBaseComponent;
|
||||||
|
import net.minecraft.server.v1_8_R3.PacketPlayOutPlayerListHeaderFooter;
|
||||||
|
import net.minecraft.server.v1_8_R3.PacketPlayOutTitle;
|
||||||
|
|
||||||
public class UtilTabTitle
|
public class UtilTabTitle
|
||||||
{
|
{
|
||||||
private static final int PROTOCOL_VERSION = 47;
|
|
||||||
|
|
||||||
public static void broadcastHeader(String header)
|
public static void broadcastHeader(String header)
|
||||||
{
|
{
|
||||||
broadcastHeaderAndFooter(header, null);
|
broadcastHeaderAndFooter(header, null);
|
||||||
@ -51,10 +51,8 @@ public class UtilTabTitle
|
|||||||
|
|
||||||
public static void doHeaderAndFooter(Player p, String rawHeader, String rawFooter)
|
public static void doHeaderAndFooter(Player p, String rawHeader, String rawFooter)
|
||||||
{
|
{
|
||||||
CraftPlayer player = (CraftPlayer) p;
|
IChatBaseComponent header = IChatBaseComponent.ChatSerializer.a(TextConverter.convert(rawHeader));
|
||||||
if (player.getHandle().playerConnection.networkManager.getVersion() != PROTOCOL_VERSION) return;
|
IChatBaseComponent footer = IChatBaseComponent.ChatSerializer.a(TextConverter.convert(rawFooter));
|
||||||
IChatBaseComponent header = ChatSerializer.a(TextConverter.convert(rawHeader));
|
|
||||||
IChatBaseComponent footer = ChatSerializer.a(TextConverter.convert(rawFooter));
|
|
||||||
if (header == null || footer == null)
|
if (header == null || footer == null)
|
||||||
{
|
{
|
||||||
TabTitleCache titleCache = TabTitleCache.getTabTitle(p.getUniqueId());
|
TabTitleCache titleCache = TabTitleCache.getTabTitle(p.getUniqueId());
|
||||||
@ -66,7 +64,7 @@ public class UtilTabTitle
|
|||||||
if (headerString != null)
|
if (headerString != null)
|
||||||
{
|
{
|
||||||
rawHeader = headerString;
|
rawHeader = headerString;
|
||||||
header = ChatSerializer.a(TextConverter.convert(headerString));
|
header = IChatBaseComponent.ChatSerializer.a(TextConverter.convert(headerString));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (footer == null)
|
if (footer == null)
|
||||||
@ -75,14 +73,17 @@ public class UtilTabTitle
|
|||||||
if (footerString != null)
|
if (footerString != null)
|
||||||
{
|
{
|
||||||
rawHeader = footerString;
|
rawHeader = footerString;
|
||||||
header = ChatSerializer.a(TextConverter.convert(footerString));
|
header = IChatBaseComponent.ChatSerializer.a(TextConverter.convert(footerString));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TabTitleCache.addTabTitle(p.getUniqueId(), new TabTitleCache(rawHeader, rawFooter));
|
TabTitleCache.addTabTitle(p.getUniqueId(), new TabTitleCache(rawHeader, rawFooter));
|
||||||
ProtocolInjector.PacketTabHeader packet = new ProtocolInjector.PacketTabHeader(header, footer);
|
PacketPlayOutPlayerListHeaderFooter packet = new PacketPlayOutPlayerListHeaderFooter();
|
||||||
player.getHandle().playerConnection.sendPacket(packet);
|
packet.a = header;
|
||||||
|
packet.b = footer;
|
||||||
|
UtilPlayer.sendPacket(p, packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class TextConverter
|
private static class TextConverter
|
||||||
|
@ -14,15 +14,6 @@ public class UtilTextBottom
|
|||||||
|
|
||||||
//1.8
|
//1.8
|
||||||
msg.send(MessageType.ABOVE_HOTBAR, players);
|
msg.send(MessageType.ABOVE_HOTBAR, players);
|
||||||
|
|
||||||
//1.7 Players
|
|
||||||
for (Player player : players)
|
|
||||||
{
|
|
||||||
if (!UtilPlayer.is1_8(player))
|
|
||||||
{
|
|
||||||
UtilTextTop.display(text, player);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void displayProgress(double amount, Player... players)
|
public static void displayProgress(double amount, Player... players)
|
||||||
@ -60,20 +51,6 @@ public class UtilTextBottom
|
|||||||
progressBar += "▌";
|
progressBar += "▌";
|
||||||
}
|
}
|
||||||
|
|
||||||
//Send to Player
|
|
||||||
for (Player player : players)
|
|
||||||
{
|
|
||||||
//1.7 - Add Color
|
|
||||||
if (!UtilPlayer.is1_8(player))
|
|
||||||
{
|
|
||||||
UtilTextTop.displayProgress((prefix == null ? "" : C.cYellow + C.Bold + prefix) + (suffix == null ? "" : ChatColor.RESET + C.Bold + " - " + C.cGreen + C.Bold + suffix),
|
|
||||||
amount, player);
|
|
||||||
}
|
|
||||||
//1.8
|
|
||||||
else
|
|
||||||
{
|
|
||||||
display((prefix == null ? "" : prefix + ChatColor.RESET + " ") + progressBar + (suffix == null ? "" : ChatColor.RESET + " " + suffix), players);
|
display((prefix == null ? "" : prefix + ChatColor.RESET + " ") + progressBar + (suffix == null ? "" : ChatColor.RESET + " " + suffix), players);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -1,12 +1,11 @@
|
|||||||
package mineplex.core.common.util;
|
package mineplex.core.common.util;
|
||||||
|
|
||||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import net.minecraft.server.v1_7_R4.ChatMessage;
|
import net.minecraft.server.v1_8_R3.ChatMessage;
|
||||||
|
import net.minecraft.server.v1_8_R3.Packet;
|
||||||
import org.spigotmc.ProtocolInjector.PacketTitle;
|
import net.minecraft.server.v1_8_R3.PacketPlayOutTitle;
|
||||||
import org.spigotmc.ProtocolInjector.PacketTitle.Action;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Shaun on 9/5/2014.
|
* Created by Shaun on 9/5/2014.
|
||||||
@ -52,7 +51,7 @@ public class UtilTextMiddle
|
|||||||
text = "";
|
text = "";
|
||||||
|
|
||||||
ChatMessage message = new ChatMessage(text);
|
ChatMessage message = new ChatMessage(text);
|
||||||
PacketTitle packet = new PacketTitle(Action.TITLE, message);
|
PacketPlayOutTitle packet = new PacketPlayOutTitle(PacketPlayOutTitle.EnumTitleAction.TITLE, message);
|
||||||
sendPacket(packet, players);
|
sendPacket(packet, players);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,7 +66,7 @@ public class UtilTextMiddle
|
|||||||
text = "";
|
text = "";
|
||||||
|
|
||||||
ChatMessage message = new ChatMessage(text);
|
ChatMessage message = new ChatMessage(text);
|
||||||
PacketTitle packet = new PacketTitle(Action.SUBTITLE, message);
|
PacketPlayOutTitle packet = new PacketPlayOutTitle(PacketPlayOutTitle.EnumTitleAction.SUBTITLE, message);
|
||||||
sendPacket(packet, players);
|
sendPacket(packet, players);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,7 +77,7 @@ public class UtilTextMiddle
|
|||||||
*/
|
*/
|
||||||
private static void setTimings(int fadeInTicks, int stayTicks, int fadeOutTicks, Player... players)
|
private static void setTimings(int fadeInTicks, int stayTicks, int fadeOutTicks, Player... players)
|
||||||
{
|
{
|
||||||
PacketTitle packet = new PacketTitle(Action.TIMES, fadeInTicks, stayTicks, fadeOutTicks);
|
PacketPlayOutTitle packet = new PacketPlayOutTitle(fadeInTicks, stayTicks, fadeOutTicks);
|
||||||
sendPacket(packet, players);
|
sendPacket(packet, players);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,7 +86,7 @@ public class UtilTextMiddle
|
|||||||
*/
|
*/
|
||||||
public static void clear(Player... players)
|
public static void clear(Player... players)
|
||||||
{
|
{
|
||||||
PacketTitle packet = new PacketTitle(Action.CLEAR);
|
PacketPlayOutTitle packet = new PacketPlayOutTitle(PacketPlayOutTitle.EnumTitleAction.CLEAR, null);
|
||||||
sendPacket(packet, players);
|
sendPacket(packet, players);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,18 +97,15 @@ public class UtilTextMiddle
|
|||||||
*/
|
*/
|
||||||
public static void reset(Player... players)
|
public static void reset(Player... players)
|
||||||
{
|
{
|
||||||
PacketTitle packet = new PacketTitle(Action.RESET);
|
PacketPlayOutTitle packet = new PacketPlayOutTitle(PacketPlayOutTitle.EnumTitleAction.RESET, null);
|
||||||
sendPacket(packet, players);
|
sendPacket(packet, players);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void sendPacket(PacketTitle packet, Player... players)
|
private static void sendPacket(Packet packet, Player... players)
|
||||||
{
|
{
|
||||||
for (Player player : players)
|
for (Player player : players)
|
||||||
{
|
{
|
||||||
if (UtilPlayer.is1_8(player))
|
UtilPlayer.sendPacket(player, packet);
|
||||||
{
|
|
||||||
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
package mineplex.core.common.util;
|
package mineplex.core.common.util;
|
||||||
|
|
||||||
import mineplex.core.common.DummyEntity;
|
import mineplex.core.common.DummyEntity;
|
||||||
import net.minecraft.server.v1_7_R4.DataWatcher;
|
import net.minecraft.server.v1_8_R3.DataWatcher;
|
||||||
import net.minecraft.server.v1_7_R4.MathHelper;
|
import net.minecraft.server.v1_8_R3.MathHelper;
|
||||||
import net.minecraft.server.v1_7_R4.PacketPlayOutEntityDestroy;
|
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy;
|
||||||
import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntityLiving;
|
import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
|
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
|
||||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@ -38,23 +38,19 @@ public class UtilTextTop
|
|||||||
deleteOld(player);
|
deleteOld(player);
|
||||||
|
|
||||||
healthPercent = Math.min(1, healthPercent);
|
healthPercent = Math.min(1, healthPercent);
|
||||||
boolean halfHealth = UtilPlayer.is1_8(player);
|
|
||||||
|
|
||||||
//Display Dragon
|
//Display Dragon
|
||||||
{
|
{
|
||||||
Location loc = player.getLocation().subtract(0, 200, 0);
|
Location loc = player.getLocation().subtract(0, 200, 0);
|
||||||
|
|
||||||
((CraftPlayer)player).getHandle().playerConnection.sendPacket(getDragonPacket(text, healthPercent, halfHealth, loc));
|
UtilPlayer.sendPacket(player, getDragonPacket(text, healthPercent, loc));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//Display Wither (as well as Dragon)
|
//Display Wither (as well as Dragon)
|
||||||
if (UtilPlayer.is1_8(player))
|
|
||||||
{
|
|
||||||
Location loc = player.getEyeLocation().add(player.getLocation().getDirection().multiply(24));
|
Location loc = player.getEyeLocation().add(player.getLocation().getDirection().multiply(24));
|
||||||
|
|
||||||
((CraftPlayer)player).getHandle().playerConnection.sendPacket(getWitherPacket(text, healthPercent, halfHealth, loc));
|
UtilPlayer.sendPacket(player, getWitherPacket(text, healthPercent, loc));
|
||||||
}
|
|
||||||
|
|
||||||
//Remove
|
//Remove
|
||||||
Bukkit.getServer().getScheduler().runTaskLater(Bukkit.getPluginManager().getPlugins()[0], new Runnable()
|
Bukkit.getServer().getScheduler().runTaskLater(Bukkit.getPluginManager().getPlugins()[0], new Runnable()
|
||||||
@ -69,18 +65,21 @@ public class UtilTextTop
|
|||||||
private static void deleteOld(Player player)
|
private static void deleteOld(Player player)
|
||||||
{
|
{
|
||||||
// Delete Dragon (All Clients)
|
// Delete Dragon (All Clients)
|
||||||
PacketPlayOutEntityDestroy destroyDragonPacket = new PacketPlayOutEntityDestroy(EntityDragonId);
|
PacketPlayOutEntityDestroy destroyDragonPacket = new PacketPlayOutEntityDestroy(new int[]
|
||||||
((CraftPlayer)player).getHandle().playerConnection.sendPacket(destroyDragonPacket);
|
{
|
||||||
|
EntityDragonId
|
||||||
|
});
|
||||||
|
UtilPlayer.sendPacket(player, destroyDragonPacket);
|
||||||
|
|
||||||
// Delete Wither (1.8+ Only)
|
// Delete Wither (1.8+ Only)
|
||||||
if (UtilPlayer.is1_8(player))
|
PacketPlayOutEntityDestroy destroyWitherPacket = new PacketPlayOutEntityDestroy(new int[]
|
||||||
{
|
{
|
||||||
PacketPlayOutEntityDestroy destroyWitherPacket = new PacketPlayOutEntityDestroy(EntityWitherId);
|
EntityWitherId
|
||||||
((CraftPlayer)player).getHandle().playerConnection.sendPacket(destroyWitherPacket);
|
});
|
||||||
}
|
UtilPlayer.sendPacket(player, destroyWitherPacket);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PacketPlayOutSpawnEntityLiving getDragonPacket(String text, double healthPercent, boolean halfHealth, Location loc)
|
public static PacketPlayOutSpawnEntityLiving getDragonPacket(String text, double healthPercent, Location loc)
|
||||||
{
|
{
|
||||||
PacketPlayOutSpawnEntityLiving mobPacket = new PacketPlayOutSpawnEntityLiving();
|
PacketPlayOutSpawnEntityLiving mobPacket = new PacketPlayOutSpawnEntityLiving();
|
||||||
|
|
||||||
@ -108,7 +107,7 @@ public class UtilTextTop
|
|||||||
return mobPacket;
|
return mobPacket;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PacketPlayOutSpawnEntityLiving getWitherPacket(String text, double healthPercent, boolean halfHealth, Location loc)
|
public static PacketPlayOutSpawnEntityLiving getWitherPacket(String text, double healthPercent, Location loc)
|
||||||
{
|
{
|
||||||
PacketPlayOutSpawnEntityLiving mobPacket = new PacketPlayOutSpawnEntityLiving();
|
PacketPlayOutSpawnEntityLiving mobPacket = new PacketPlayOutSpawnEntityLiving();
|
||||||
|
|
||||||
@ -143,13 +142,11 @@ public class UtilTextTop
|
|||||||
watcher.a(0, (Byte) (byte) 0); //Flags, 0x20 = invisible
|
watcher.a(0, (Byte) (byte) 0); //Flags, 0x20 = invisible
|
||||||
watcher.a(6, (Float) (float) health);
|
watcher.a(6, (Float) (float) health);
|
||||||
watcher.a(2, (String) text); //Entity name
|
watcher.a(2, (String) text); //Entity name
|
||||||
watcher.a(10, (String) text); //Entity name
|
|
||||||
watcher.a(3, (Byte) (byte) 0); //Show name, 1 = show, 0 = don't show
|
watcher.a(3, (Byte) (byte) 0); //Show name, 1 = show, 0 = don't show
|
||||||
watcher.a(11, (Byte) (byte) 0); //Show name, 1 = show, 0 = don't show
|
|
||||||
watcher.a(16, (Integer) (int) health); //Health
|
watcher.a(16, (Integer) (int) health); //Health
|
||||||
watcher.a(20, (Integer) (int) 881); //Inv
|
watcher.a(20, (Integer) (int) 881); //Inv
|
||||||
|
|
||||||
int i1 = watcher.getInt(0);
|
int i1 = watcher.getByte(0);
|
||||||
watcher.watch(0, Byte.valueOf((byte)(i1 | 1 << 5)));
|
watcher.watch(0, Byte.valueOf((byte)(i1 | 1 << 5)));
|
||||||
|
|
||||||
return watcher;
|
return watcher;
|
||||||
|
@ -2,23 +2,22 @@ package mineplex.core.common.util;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
import net.minecraft.server.v1_7_R4.ConvertProgressUpdater;
|
import net.minecraft.server.v1_8_R3.Convertable;
|
||||||
import net.minecraft.server.v1_7_R4.Convertable;
|
import net.minecraft.server.v1_8_R3.EntityTracker;
|
||||||
import net.minecraft.server.v1_7_R4.EntityTracker;
|
import net.minecraft.server.v1_8_R3.EnumDifficulty;
|
||||||
import net.minecraft.server.v1_7_R4.EnumDifficulty;
|
import net.minecraft.server.v1_8_R3.IDataManager;
|
||||||
import net.minecraft.server.v1_7_R4.EnumGamemode;
|
import net.minecraft.server.v1_8_R3.IProgressUpdate;
|
||||||
import net.minecraft.server.v1_7_R4.IWorldAccess;
|
import net.minecraft.server.v1_8_R3.MinecraftServer;
|
||||||
import net.minecraft.server.v1_7_R4.ServerNBTManager;
|
import net.minecraft.server.v1_8_R3.ServerNBTManager;
|
||||||
import net.minecraft.server.v1_7_R4.WorldLoaderServer;
|
import net.minecraft.server.v1_8_R3.WorldData;
|
||||||
import net.minecraft.server.v1_7_R4.WorldManager;
|
import net.minecraft.server.v1_8_R3.WorldLoaderServer;
|
||||||
import net.minecraft.server.v1_7_R4.WorldServer;
|
import net.minecraft.server.v1_8_R3.WorldManager;
|
||||||
import net.minecraft.server.v1_7_R4.WorldSettings;
|
import net.minecraft.server.v1_8_R3.WorldServer;
|
||||||
import net.minecraft.server.v1_7_R4.WorldType;
|
import net.minecraft.server.v1_8_R3.WorldSettings;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.WorldCreator;
|
import org.bukkit.WorldCreator;
|
||||||
import org.bukkit.craftbukkit.v1_7_R4.CraftServer;
|
import org.bukkit.craftbukkit.v1_8_R3.CraftServer;
|
||||||
import org.bukkit.event.world.WorldInitEvent;
|
import org.bukkit.event.world.WorldInitEvent;
|
||||||
import org.bukkit.event.world.WorldLoadEvent;
|
import org.bukkit.event.world.WorldLoadEvent;
|
||||||
import org.bukkit.generator.ChunkGenerator;
|
import org.bukkit.generator.ChunkGenerator;
|
||||||
@ -34,11 +33,10 @@ public class WorldUtil
|
|||||||
}
|
}
|
||||||
|
|
||||||
String name = creator.name();
|
String name = creator.name();
|
||||||
System.out.println("Loading world '" + name + "'");
|
|
||||||
ChunkGenerator generator = creator.generator();
|
ChunkGenerator generator = creator.generator();
|
||||||
File folder = new File(server.getWorldContainer(), name);
|
File folder = new File(server.getWorldContainer(), name);
|
||||||
World world = server.getWorld(name);
|
World world = server.getWorld(name);
|
||||||
WorldType type = WorldType.getType(creator.type().getName());
|
net.minecraft.server.v1_8_R3.WorldType type = net.minecraft.server.v1_8_R3.WorldType.getType(creator.type().getName());
|
||||||
boolean generateStructures = creator.generateStructures();
|
boolean generateStructures = creator.generateStructures();
|
||||||
|
|
||||||
if (world != null)
|
if (world != null)
|
||||||
@ -60,28 +58,55 @@ public class WorldUtil
|
|||||||
if (converter.isConvertable(name))
|
if (converter.isConvertable(name))
|
||||||
{
|
{
|
||||||
server.getLogger().info("Converting world '" + name + "'");
|
server.getLogger().info("Converting world '" + name + "'");
|
||||||
converter.convert(name, new ConvertProgressUpdater(server.getServer()));
|
converter.convert(name, new IProgressUpdate()
|
||||||
|
{
|
||||||
|
private long b = System.currentTimeMillis();
|
||||||
|
|
||||||
|
public void a(String s)
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
int dimension = server.getWorlds().size() + 1;
|
public void a(int i)
|
||||||
|
{
|
||||||
|
if (System.currentTimeMillis() - this.b >= 1000L)
|
||||||
|
{
|
||||||
|
this.b = System.currentTimeMillis();
|
||||||
|
MinecraftServer.LOGGER.info("Converting... " + i + "%");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void c(String s)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
int dimension = 10 + server.getServer().worlds.size();
|
||||||
boolean used = false;
|
boolean used = false;
|
||||||
do
|
do
|
||||||
|
for (WorldServer s : server.getServer().worlds)
|
||||||
{
|
{
|
||||||
for (WorldServer worldServer : server.getServer().worlds)
|
used = s.dimension == dimension;
|
||||||
{
|
|
||||||
used = worldServer.dimension == dimension;
|
|
||||||
if (used)
|
if (used)
|
||||||
{
|
{
|
||||||
dimension++;
|
dimension++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} while(used);
|
while (used);
|
||||||
boolean hardcore = false;
|
boolean hardcore = false;
|
||||||
|
|
||||||
System.out.println("Loaded world with dimension : " + dimension);
|
Object sdm = new ServerNBTManager(server.getWorldContainer(), name, true);
|
||||||
|
WorldData worlddata = ((IDataManager) sdm).getWorldData();
|
||||||
WorldServer internal = new WorldServer(server.getServer(), new ServerNBTManager(server.getWorldContainer(), name, true), name, dimension, new WorldSettings(creator.seed(), EnumGamemode.getById(server.getDefaultGameMode().getValue()), generateStructures, hardcore, type), server.getServer().methodProfiler, creator.environment(), generator);
|
if (worlddata == null)
|
||||||
|
{
|
||||||
|
WorldSettings worldSettings = new WorldSettings(creator.seed(),
|
||||||
|
WorldSettings.EnumGamemode.getById(server.getDefaultGameMode().getValue()), generateStructures, hardcore, type);
|
||||||
|
worldSettings.setGeneratorSettings(creator.generatorSettings());
|
||||||
|
worlddata = new WorldData(worldSettings, name);
|
||||||
|
}
|
||||||
|
worlddata.checkName(name);
|
||||||
|
WorldServer internal = (WorldServer) new WorldServer(server.getServer(), (IDataManager) sdm, worlddata, dimension,
|
||||||
|
server.getServer().methodProfiler, creator.environment(), generator).b();
|
||||||
|
|
||||||
boolean containsWorld = false;
|
boolean containsWorld = false;
|
||||||
for (World otherWorld : server.getWorlds())
|
for (World otherWorld : server.getWorlds())
|
||||||
@ -96,23 +121,13 @@ public class WorldUtil
|
|||||||
if (!containsWorld)
|
if (!containsWorld)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
System.out.println("Created world with dimension : " + dimension);
|
|
||||||
|
|
||||||
internal.scoreboard = server.getScoreboardManager().getMainScoreboard().getHandle();
|
internal.scoreboard = server.getScoreboardManager().getMainScoreboard().getHandle();
|
||||||
internal.worldMaps = server.getServer().worlds.get(0).worldMaps;
|
|
||||||
internal.tracker = new EntityTracker(internal); // CraftBukkit
|
|
||||||
internal.addIWorldAccess((IWorldAccess) new WorldManager(server.getServer(), internal));
|
|
||||||
internal.difficulty = EnumDifficulty.HARD;
|
|
||||||
internal.setSpawnFlags(true, true);
|
|
||||||
internal.savingDisabled = true;
|
|
||||||
server.getServer().worlds.add(internal);
|
|
||||||
|
|
||||||
/*
|
internal.tracker = new EntityTracker(internal);
|
||||||
for (WorldServer worlder : server.getServer().worlds)
|
internal.addIWorldAccess(new WorldManager(server.getServer(), internal));
|
||||||
{
|
internal.worldData.setDifficulty(EnumDifficulty.EASY);
|
||||||
System.out.println(worlder.getWorldData().getName() + " with dimension: " + worlder.dimension);
|
internal.setSpawnFlags(true, true);
|
||||||
}
|
server.getServer().worlds.add(internal);
|
||||||
*/
|
|
||||||
|
|
||||||
if (generator != null)
|
if (generator != null)
|
||||||
{
|
{
|
||||||
|
@ -174,7 +174,15 @@ public class ZipUtil
|
|||||||
int size;
|
int size;
|
||||||
byte[] buffer = new byte[2048];
|
byte[] buffer = new byte[2048];
|
||||||
|
|
||||||
fileOutputStream = new FileOutputStream(outputDirectory + File.separator + entry.getName());
|
String fileName = outputDirectory + File.separator + entry.getName();
|
||||||
|
|
||||||
|
if (fileName.endsWith("/"))
|
||||||
|
{
|
||||||
|
new File(fileName).mkdirs();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
fileOutputStream = new FileOutputStream(fileName);
|
||||||
bufferedOutputStream = new BufferedOutputStream(fileOutputStream, buffer.length);
|
bufferedOutputStream = new BufferedOutputStream(fileOutputStream, buffer.length);
|
||||||
|
|
||||||
while ((size = zipInputStream.read(buffer, 0, buffer.length)) != -1)
|
while ((size = zipInputStream.read(buffer, 0, buffer.length)) != -1)
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package mineplex.core;
|
package mineplex.core;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -9,28 +8,30 @@ import java.util.UUID;
|
|||||||
|
|
||||||
import mineplex.core.common.DummyEntity;
|
import mineplex.core.common.DummyEntity;
|
||||||
import mineplex.core.common.util.NautHashMap;
|
import mineplex.core.common.util.NautHashMap;
|
||||||
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
import mineplex.core.event.CustomTagEvent;
|
import mineplex.core.event.CustomTagEvent;
|
||||||
import mineplex.core.packethandler.IPacketHandler;
|
import mineplex.core.packethandler.IPacketHandler;
|
||||||
import mineplex.core.common.util.UtilEnt;
|
import mineplex.core.common.util.UtilEnt;
|
||||||
import mineplex.core.packethandler.PacketHandler;
|
import mineplex.core.packethandler.PacketHandler;
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
|
||||||
import mineplex.core.packethandler.PacketVerifier;
|
import mineplex.core.packethandler.PacketVerifier;
|
||||||
import mineplex.core.packethandler.PacketInfo;
|
import mineplex.core.packethandler.PacketInfo;
|
||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
import net.minecraft.server.v1_7_R4.DataWatcher;
|
import net.minecraft.server.v1_8_R3.DataWatcher;
|
||||||
import net.minecraft.server.v1_7_R4.EnumEntitySize;
|
import net.minecraft.server.v1_8_R3.DataWatcher.WatchableObject;
|
||||||
import net.minecraft.server.v1_7_R4.MathHelper;
|
import net.minecraft.server.v1_8_R3.MathHelper;
|
||||||
import net.minecraft.server.v1_7_R4.Packet;
|
import net.minecraft.server.v1_8_R3.Packet;
|
||||||
import net.minecraft.server.v1_7_R4.PacketPlayOutAttachEntity;
|
import net.minecraft.server.v1_8_R3.PacketPlayInUseEntity;
|
||||||
import net.minecraft.server.v1_7_R4.PacketPlayOutEntityDestroy;
|
import net.minecraft.server.v1_8_R3.PacketPlayOutAttachEntity;
|
||||||
import net.minecraft.server.v1_7_R4.PacketPlayOutEntityMetadata;
|
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy;
|
||||||
import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntity;
|
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityMetadata;
|
||||||
import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntityLiving;
|
import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntity;
|
||||||
import net.minecraft.server.v1_7_R4.WatchableObject;
|
import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
|
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.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
@ -49,31 +50,22 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
|
|||||||
{
|
{
|
||||||
private NautHashMap<String, NautHashMap<Integer, Integer>> _entityMap = new NautHashMap<String, NautHashMap<Integer, Integer>>();
|
private NautHashMap<String, NautHashMap<Integer, Integer>> _entityMap = new NautHashMap<String, NautHashMap<Integer, Integer>>();
|
||||||
private NautHashMap<String, NautHashMap<Integer, String>> _entityNameMap = new NautHashMap<String, NautHashMap<Integer, String>>();
|
private NautHashMap<String, NautHashMap<Integer, String>> _entityNameMap = new NautHashMap<String, NautHashMap<Integer, String>>();
|
||||||
private NautHashMap<String, NautHashMap<Integer, Integer>> _entityVehicleMap = new NautHashMap<String, NautHashMap<Integer, Integer>>();
|
|
||||||
private HashSet<String> _loggedIn = new HashSet<String>();
|
private HashSet<String> _loggedIn = new HashSet<String>();
|
||||||
private HashSet<Integer> _ignoreSkulls = new HashSet<Integer>();
|
private HashSet<Integer> _ignoreSkulls = new HashSet<Integer>();
|
||||||
|
|
||||||
private NautHashMap<UUID, Long> _exemptTimeMap = new NautHashMap<UUID, Long>();
|
private NautHashMap<UUID, Long> _exemptTimeMap = new NautHashMap<UUID, Long>();
|
||||||
private NautHashMap<UUID, NautHashMap<CheckType, Long>> _doubleStrike = new NautHashMap<UUID, NautHashMap<CheckType, Long>>();
|
private NautHashMap<UUID, NautHashMap<CheckType, Long>> _doubleStrike = new NautHashMap<UUID, NautHashMap<CheckType, Long>>();
|
||||||
|
private PacketHandler _packetHandler;
|
||||||
private Field _destroyId;
|
|
||||||
|
|
||||||
public CustomTagFix(JavaPlugin plugin, PacketHandler packetHandler)
|
public CustomTagFix(JavaPlugin plugin, PacketHandler packetHandler)
|
||||||
{
|
{
|
||||||
super("Custom Tag Fix", plugin);
|
super("Custom Tag Fix", plugin);
|
||||||
|
|
||||||
packetHandler.addPacketHandler(this);
|
_packetHandler = packetHandler;
|
||||||
|
|
||||||
try
|
packetHandler.addPacketHandler(this, PacketPlayOutAttachEntity.class, PacketPlayOutEntityDestroy.class,
|
||||||
{
|
PacketPlayOutEntityMetadata.class, PacketPlayOutSpawnEntity.class, PacketPlayOutSpawnEntityLiving.class,
|
||||||
_destroyId = PacketPlayOutEntityDestroy.class.getDeclaredField("a");
|
PacketPlayInUseEntity.class);
|
||||||
_destroyId.setAccessible(true);
|
|
||||||
}
|
|
||||||
catch (Exception exception)
|
|
||||||
{
|
|
||||||
System.out.println("Field exception in CustomTagFix : ");
|
|
||||||
exception.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
NCPHookManager.addHook(CheckType.MOVING_SURVIVALFLY, this);
|
NCPHookManager.addHook(CheckType.MOVING_SURVIVALFLY, this);
|
||||||
NCPHookManager.addHook(CheckType.MOVING_PASSABLE, this);
|
NCPHookManager.addHook(CheckType.MOVING_PASSABLE, this);
|
||||||
@ -85,7 +77,6 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
|
|||||||
{
|
{
|
||||||
_entityMap.remove(event.getPlayer().getName());
|
_entityMap.remove(event.getPlayer().getName());
|
||||||
_entityNameMap.remove(event.getPlayer().getName());
|
_entityNameMap.remove(event.getPlayer().getName());
|
||||||
_entityVehicleMap.remove(event.getPlayer().getName());
|
|
||||||
_loggedIn.remove(event.getPlayer());
|
_loggedIn.remove(event.getPlayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,7 +87,8 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
|
|||||||
|
|
||||||
if (_exemptTimeMap.containsKey(event.getPlayer().getUniqueId()))
|
if (_exemptTimeMap.containsKey(event.getPlayer().getUniqueId()))
|
||||||
{
|
{
|
||||||
_exemptTimeMap.put(event.getPlayer().getUniqueId(), Math.max(ignoreTime, _exemptTimeMap.get(event.getPlayer().getUniqueId())));
|
_exemptTimeMap.put(event.getPlayer().getUniqueId(),
|
||||||
|
Math.max(ignoreTime, _exemptTimeMap.get(event.getPlayer().getUniqueId())));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,7 +110,8 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
|
|||||||
long ignoreTime = System.currentTimeMillis() + (long) (event.getVelocity().length() * 2000);
|
long ignoreTime = System.currentTimeMillis() + (long) (event.getVelocity().length() * 2000);
|
||||||
if (_exemptTimeMap.containsKey(event.getPlayer().getUniqueId()))
|
if (_exemptTimeMap.containsKey(event.getPlayer().getUniqueId()))
|
||||||
{
|
{
|
||||||
_exemptTimeMap.put(event.getPlayer().getUniqueId(), Math.max(ignoreTime, _exemptTimeMap.get(event.getPlayer().getUniqueId())));
|
_exemptTimeMap.put(event.getPlayer().getUniqueId(),
|
||||||
|
Math.max(ignoreTime, _exemptTimeMap.get(event.getPlayer().getUniqueId())));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,7 +134,8 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Iterator<Entry<UUID, NautHashMap<CheckType, Long>>> iterator = _doubleStrike.entrySet().iterator(); iterator.hasNext();)
|
for (Iterator<Entry<UUID, NautHashMap<CheckType, Long>>> iterator = _doubleStrike.entrySet().iterator(); iterator
|
||||||
|
.hasNext();)
|
||||||
{
|
{
|
||||||
Entry<UUID, NautHashMap<CheckType, Long>> entry = iterator.next();
|
Entry<UUID, NautHashMap<CheckType, Long>> entry = iterator.next();
|
||||||
|
|
||||||
@ -175,7 +169,6 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
|
|||||||
iterator.remove();
|
iterator.remove();
|
||||||
_entityMap.remove(player);
|
_entityMap.remove(player);
|
||||||
_entityNameMap.remove(player);
|
_entityNameMap.remove(player);
|
||||||
_entityVehicleMap.remove(player);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -195,13 +188,12 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
|
|||||||
Player owner = packetInfo.getPlayer();
|
Player owner = packetInfo.getPlayer();
|
||||||
PacketVerifier verifier = packetInfo.getVerifier();
|
PacketVerifier verifier = packetInfo.getVerifier();
|
||||||
|
|
||||||
if (owner.isOnline() && UtilPlayer.is1_8(owner))
|
if (owner.isOnline())
|
||||||
{
|
{
|
||||||
if (owner.isOnline() && !_entityMap.containsKey(owner.getName()))
|
if (owner.isOnline() && !_entityMap.containsKey(owner.getName()))
|
||||||
{
|
{
|
||||||
_entityMap.put(owner.getName(), new NautHashMap<Integer, Integer>());
|
_entityMap.put(owner.getName(), new NautHashMap<Integer, Integer>());
|
||||||
_entityNameMap.put(owner.getName(), new NautHashMap<Integer, String>());
|
_entityNameMap.put(owner.getName(), new NautHashMap<Integer, String>());
|
||||||
_entityVehicleMap.put(owner.getName(), new NautHashMap<Integer, Integer>());
|
|
||||||
_loggedIn.add(owner.getName());
|
_loggedIn.add(owner.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -210,9 +202,10 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
|
|||||||
PacketPlayOutSpawnEntityLiving spawnPacket = (PacketPlayOutSpawnEntityLiving) packet;
|
PacketPlayOutSpawnEntityLiving spawnPacket = (PacketPlayOutSpawnEntityLiving) packet;
|
||||||
|
|
||||||
// Ignore Armor stand packets
|
// Ignore Armor stand packets
|
||||||
if (spawnPacket.b == 30 || spawnPacket.l == null || spawnPacket.l.c() == null || spawnPacket.a == 777777)
|
if (spawnPacket.b == EntityType.ARMOR_STAND.getTypeId() || spawnPacket.l == null || spawnPacket.l.c() == null
|
||||||
|
|| spawnPacket.a == 777777)
|
||||||
{
|
{
|
||||||
if (spawnPacket.b == 30)
|
if (spawnPacket.b == EntityType.ARMOR_STAND.getTypeId())
|
||||||
{
|
{
|
||||||
_ignoreSkulls.add(spawnPacket.a);
|
_ignoreSkulls.add(spawnPacket.a);
|
||||||
}
|
}
|
||||||
@ -222,19 +215,20 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
|
|||||||
|
|
||||||
for (WatchableObject watchable : (List<WatchableObject>) spawnPacket.l.c())
|
for (WatchableObject watchable : (List<WatchableObject>) spawnPacket.l.c())
|
||||||
{
|
{
|
||||||
if ((watchable.a() == 11 || watchable.a() == 3) && watchable.b() instanceof Byte
|
if (watchable.a() == 3 && watchable.b() instanceof Byte && ((Byte) watchable.b()) == 1)
|
||||||
&& ((Byte) watchable.b()) == 1)
|
|
||||||
{
|
{
|
||||||
if (_entityMap.get(owner.getName()).containsKey(spawnPacket.a))
|
if (_entityMap.get(owner.getName()).containsKey(spawnPacket.a))
|
||||||
{
|
{
|
||||||
verifier.bypassProcess(new PacketPlayOutEntityDestroy(_entityMap.get(owner.getName()).get(
|
UtilPlayer.sendPacket(owner, new PacketPlayOutEntityDestroy(new int[]
|
||||||
spawnPacket.a)));
|
{
|
||||||
|
_entityMap.get(owner.getName()).get(spawnPacket.a)
|
||||||
|
}));
|
||||||
|
|
||||||
_entityNameMap.get(owner.getName()).remove(spawnPacket.a);
|
_entityNameMap.get(owner.getName()).remove(spawnPacket.a);
|
||||||
_entityMap.get(owner.getName()).remove(spawnPacket.a);
|
_entityMap.get(owner.getName()).remove(spawnPacket.a);
|
||||||
}
|
}
|
||||||
|
|
||||||
final String entityName = spawnPacket.l.getString(10);
|
final String entityName = spawnPacket.l.getString(2);
|
||||||
|
|
||||||
if (entityName.isEmpty())
|
if (entityName.isEmpty())
|
||||||
{
|
{
|
||||||
@ -270,12 +264,12 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
|
|||||||
|
|
||||||
for (WatchableObject watchable : (List<WatchableObject>) metaPacket.b)
|
for (WatchableObject watchable : (List<WatchableObject>) metaPacket.b)
|
||||||
{
|
{
|
||||||
if ((watchable.a() == 11 || watchable.a() == 3) && watchable.b() instanceof Byte)
|
if (watchable.a() == 3 && watchable.b() instanceof Byte)
|
||||||
{
|
{
|
||||||
newDisplay = ((Byte) watchable.b()) == 1;
|
newDisplay = ((Byte) watchable.b()) == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((watchable.a() == 10 || watchable.a() == 2) && watchable.b() instanceof String)
|
if (watchable.a() == 2 && watchable.b() instanceof String)
|
||||||
{
|
{
|
||||||
newName = (String) watchable.b();
|
newName = (String) watchable.b();
|
||||||
}
|
}
|
||||||
@ -293,7 +287,8 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
|
|||||||
{
|
{
|
||||||
newId = _entityMap.get(owner.getName()).get(metaPacket.a);
|
newId = _entityMap.get(owner.getName()).get(metaPacket.a);
|
||||||
}
|
}
|
||||||
else // Spawning new entity
|
else
|
||||||
|
// Spawning new entity
|
||||||
{
|
{
|
||||||
newId = UtilEnt.getNewEntityId();
|
newId = UtilEnt.getNewEntityId();
|
||||||
_entityMap.get(owner.getName()).put(metaPacket.a, newId);
|
_entityMap.get(owner.getName()).put(metaPacket.a, newId);
|
||||||
@ -322,13 +317,15 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
for (int id : (int[])_destroyId.get(packet))
|
for (int id : ((PacketPlayOutEntityDestroy) packet).a)
|
||||||
{
|
{
|
||||||
if (_entityMap.get(owner.getName()).containsKey(id))
|
if (_entityMap.get(owner.getName()).containsKey(id))
|
||||||
{
|
{
|
||||||
verifier.bypassProcess(new PacketPlayOutEntityDestroy(_entityMap.get(owner.getName()).get(id)));
|
UtilPlayer.sendPacket(owner, new PacketPlayOutEntityDestroy(new int[]
|
||||||
|
{
|
||||||
|
_entityMap.get(owner.getName()).get(id)
|
||||||
|
}));
|
||||||
_entityMap.get(owner.getName()).remove(id);
|
_entityMap.get(owner.getName()).remove(id);
|
||||||
_entityVehicleMap.get(owner.getName()).remove(id);
|
|
||||||
_entityNameMap.get(owner.getName()).remove(id);
|
_entityNameMap.get(owner.getName()).remove(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -346,146 +343,32 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
|
|||||||
_ignoreSkulls.add(spawnPacket.a);
|
_ignoreSkulls.add(spawnPacket.a);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
else if (packet instanceof PacketPlayInUseEntity)
|
||||||
else if (packet instanceof PacketPlayOutAttachEntity)
|
|
||||||
{
|
{
|
||||||
PacketPlayOutAttachEntity attachPacket = (PacketPlayOutAttachEntity)packet;
|
PacketPlayInUseEntity usePacket = (PacketPlayInUseEntity) packet;
|
||||||
|
|
||||||
/* TODO dynamic attach handling?
|
for (Entry<Integer, Integer> entry : _entityMap.get(owner.getName()).entrySet())
|
||||||
if (attachPacket.c == -1)
|
|
||||||
{
|
{
|
||||||
if (_entityVehicleMap.get(owner).containsKey(attachPacket.b) && _entityNameMap.get(owner).containsKey(_entityVehicleMap.get(owner).get(attachPacket.b)))
|
if (entry.getValue() == usePacket.a)
|
||||||
{
|
{
|
||||||
int newId = UtilEnt.getNewEntityId();
|
PacketPlayInUseEntity newPacket = new PacketPlayInUseEntity();
|
||||||
sendProtocolPackets(owner, _entityVehicleMap.get(owner).get(attachPacket.b), newId, _entityNameMap.get(owner).get(_entityVehicleMap.get(owner).get(attachPacket.b)), verifier);
|
newPacket.a = entry.getKey();
|
||||||
_entityMap.get(owner).put(attachPacket.b, newId);
|
newPacket.action = usePacket.action;
|
||||||
_entityVehicleMap.get(owner).remove(attachPacket.b);
|
newPacket.c = usePacket.c;
|
||||||
|
|
||||||
packetInfo.setCancelled(true);
|
if (_packetHandler.handlePacket(owner, newPacket))
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
_entityVehicleMap.get(owner).put(attachPacket.b, attachPacket.c);
|
((CraftPlayer) owner).getHandle().playerConnection.a(newPacket);
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_entityMap.get(owner).containsKey(attachPacket.c))
|
|
||||||
{
|
|
||||||
verifier.bypassProcess(new PacketPlayOutEntityDestroy(_entityMap.get(owner).get(attachPacket.c)));
|
|
||||||
_entityMap.get(owner).remove(attachPacket.c);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
//System.out.println(owner.getName() + " id=" + owner.getEntityId() + " recieving AttachPacket b=" + attachPacket.b + " c=" + attachPacket.c);
|
|
||||||
if (attachPacket.c == -1 && _entityMap.get(owner).containsKey(attachPacket.b))
|
|
||||||
{
|
|
||||||
verifier.bypassProcess(new PacketPlayOutEntityDestroy(_entityMap.get(owner).get(attachPacket.b)));
|
|
||||||
_entityMap.get(owner).remove(attachPacket.b);
|
|
||||||
}
|
|
||||||
else if (attachPacket.c == owner.getEntityId())
|
|
||||||
{
|
|
||||||
if (_entityMap.get(owner).containsKey(attachPacket.b))
|
|
||||||
{
|
|
||||||
verifier.bypassProcess(new PacketPlayOutEntityDestroy(_entityMap.get(owner).get(attachPacket.b)));
|
|
||||||
}
|
|
||||||
|
|
||||||
PacketPlayOutSpawnEntityLiving armorPacket = new PacketPlayOutSpawnEntityLiving();
|
|
||||||
armorPacket.a = UtilEnt.getNewEntityId();
|
|
||||||
armorPacket.b = (byte) 30;
|
|
||||||
armorPacket.c = (int)EnumEntitySize.SIZE_2.a(100);
|
|
||||||
armorPacket.d = (int)MathHelper.floor(64 * 32.0D);
|
|
||||||
armorPacket.e = (int)EnumEntitySize.SIZE_2.a(100);
|
|
||||||
armorPacket.i = (byte) ((int) (0 * 256.0F / 360.0F));
|
|
||||||
armorPacket.j = (byte) ((int) (0 * 256.0F / 360.0F));
|
|
||||||
armorPacket.k = (byte) ((int) (0 * 256.0F / 360.0F));
|
|
||||||
|
|
||||||
double var2 = 3.9D;
|
|
||||||
double var4 = 0;
|
|
||||||
double var6 = 0;
|
|
||||||
double var8 = 0;
|
|
||||||
|
|
||||||
if (var4 < -var2)
|
|
||||||
{
|
|
||||||
var4 = -var2;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (var6 < -var2)
|
|
||||||
{
|
|
||||||
var6 = -var2;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (var8 < -var2)
|
|
||||||
{
|
|
||||||
var8 = -var2;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (var4 > var2)
|
|
||||||
{
|
|
||||||
var4 = var2;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (var6 > var2)
|
|
||||||
{
|
|
||||||
var6 = var2;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (var8 > var2)
|
|
||||||
{
|
|
||||||
var8 = var2;
|
|
||||||
}
|
|
||||||
|
|
||||||
armorPacket.f = (int)(var4 * 8000.0D);
|
|
||||||
armorPacket.g = (int)(var6 * 8000.0D);
|
|
||||||
armorPacket.h = (int)(var8 * 8000.0D);
|
|
||||||
|
|
||||||
final DataWatcher watcher = new DataWatcher(new DummyEntity(((CraftWorld)owner.getWorld()).getHandle()));
|
|
||||||
|
|
||||||
watcher.a(0, Byte.valueOf((byte)0));
|
|
||||||
watcher.a(1, Short.valueOf((short)300));
|
|
||||||
watcher.a(2, "");
|
|
||||||
watcher.a(3, Byte.valueOf((byte) 0));
|
|
||||||
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.valueOf((byte)0));
|
|
||||||
|
|
||||||
// Set invisible
|
|
||||||
int i1 = watcher.getInt(0);
|
|
||||||
watcher.watch(0, Byte.valueOf((byte)(i1 | 1 << 5)));
|
|
||||||
|
|
||||||
// Set small
|
|
||||||
byte b1 = watcher.getByte(10);
|
|
||||||
b1 = (byte)(b1 | 0x1);
|
|
||||||
|
|
||||||
watcher.watch(10, Byte.valueOf(b1));
|
|
||||||
|
|
||||||
armorPacket.l = watcher;
|
|
||||||
|
|
||||||
// Spawn armor packet
|
|
||||||
verifier.bypassProcess(armorPacket);
|
|
||||||
|
|
||||||
PacketPlayOutAttachEntity attachPacket2 = new PacketPlayOutAttachEntity();
|
|
||||||
attachPacket2.c = owner.getEntityId();
|
|
||||||
attachPacket2.b = armorPacket.a;
|
|
||||||
attachPacket2.a = 0;
|
|
||||||
|
|
||||||
// Send armor attach to player.
|
|
||||||
verifier.bypassProcess(attachPacket2);
|
|
||||||
|
|
||||||
// Change original packet to attach to armor stand
|
|
||||||
attachPacket.c = armorPacket.a;
|
|
||||||
|
|
||||||
_entityMap.get(owner).put(attachPacket.b, armorPacket.a);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendProtocolPackets(final Player owner, final int entityId, final int newEntityId, final String entityName, final PacketVerifier packetList, final boolean newPacket)
|
private void sendProtocolPackets(final Player owner, final int entityId, final int newEntityId, String entityName,
|
||||||
|
final PacketVerifier packetList, final boolean newPacket)
|
||||||
{
|
{
|
||||||
CustomTagEvent event = new CustomTagEvent(owner, entityId, entityName);
|
CustomTagEvent event = new CustomTagEvent(owner, entityId, entityName);
|
||||||
_plugin.getServer().getPluginManager().callEvent(event);
|
_plugin.getServer().getPluginManager().callEvent(event);
|
||||||
@ -509,7 +392,7 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
|
|||||||
watcher.a(10, Byte.valueOf((byte) 0));
|
watcher.a(10, Byte.valueOf((byte) 0));
|
||||||
|
|
||||||
// Set invisible
|
// Set invisible
|
||||||
int i1 = watcher.getInt(0);
|
int i1 = watcher.getByte(0);
|
||||||
watcher.watch(0, Byte.valueOf((byte) (i1 | 1 << 5)));
|
watcher.watch(0, Byte.valueOf((byte) (i1 | 1 << 5)));
|
||||||
|
|
||||||
// Set small
|
// Set small
|
||||||
@ -523,15 +406,15 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
|
|||||||
|
|
||||||
if (newPacket)
|
if (newPacket)
|
||||||
{
|
{
|
||||||
final PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving();
|
final PacketPlayOutSpawnEntityLiving spawnPacket = new PacketPlayOutSpawnEntityLiving();
|
||||||
packet.a = newEntityId;
|
spawnPacket.a = newEntityId;
|
||||||
packet.b = (byte) 30;
|
spawnPacket.b = (byte) 30;
|
||||||
packet.c = (int) EnumEntitySize.SIZE_2.a(100);
|
spawnPacket.c = (int) MathHelper.floor(100 * 32);
|
||||||
packet.d = (int) MathHelper.floor(64 * 32.0D);
|
spawnPacket.d = (int) MathHelper.floor(64 * 32.0D);
|
||||||
packet.e = (int) EnumEntitySize.SIZE_2.a(100);
|
spawnPacket.e = (int) MathHelper.floor(100 * 32);
|
||||||
packet.i = (byte) ((int) (0 * 256.0F / 360.0F));
|
spawnPacket.i = (byte) ((int) (0 * 256.0F / 360.0F));
|
||||||
packet.j = (byte) ((int) (0 * 256.0F / 360.0F));
|
spawnPacket.j = (byte) ((int) (0 * 256.0F / 360.0F));
|
||||||
packet.k = (byte) ((int) (0 * 256.0F / 360.0F));
|
spawnPacket.k = (byte) ((int) (0 * 256.0F / 360.0F));
|
||||||
|
|
||||||
double var2 = 3.9D;
|
double var2 = 3.9D;
|
||||||
double var4 = 0;
|
double var4 = 0;
|
||||||
@ -568,20 +451,20 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
|
|||||||
var8 = var2;
|
var8 = var2;
|
||||||
}
|
}
|
||||||
|
|
||||||
packet.f = (int) (var4 * 8000.0D);
|
spawnPacket.f = (int) (var4 * 8000.0D);
|
||||||
packet.g = (int) (var6 * 8000.0D);
|
spawnPacket.g = (int) (var6 * 8000.0D);
|
||||||
packet.h = (int) (var8 * 8000.0D);
|
spawnPacket.h = (int) (var8 * 8000.0D);
|
||||||
|
|
||||||
packet.l = watcher;
|
spawnPacket.l = watcher;
|
||||||
|
|
||||||
packetList.bypassProcess(packet);
|
UtilPlayer.sendPacket(owner, spawnPacket);
|
||||||
|
|
||||||
PacketPlayOutAttachEntity vehiclePacket = new PacketPlayOutAttachEntity();
|
PacketPlayOutAttachEntity vehiclePacket = new PacketPlayOutAttachEntity();
|
||||||
vehiclePacket.a = 0;
|
vehiclePacket.a = 0;
|
||||||
vehiclePacket.b = packet.a;
|
vehiclePacket.b = spawnPacket.a;
|
||||||
vehiclePacket.c = entityId;
|
vehiclePacket.c = entityId;
|
||||||
|
|
||||||
packetList.bypassProcess(vehiclePacket);
|
UtilPlayer.sendPacket(owner, vehiclePacket);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -591,22 +474,6 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
|
|||||||
|
|
||||||
packetList.bypassProcess(entityMetadata);
|
packetList.bypassProcess(entityMetadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO dynamic attach handling?
|
|
||||||
if (_entityVehicleMap.get(owner).containsValue(entityId))
|
|
||||||
{
|
|
||||||
vehiclePacket = new PacketPlayOutAttachEntity();
|
|
||||||
vehiclePacket.a = 0;
|
|
||||||
|
|
||||||
for (Entry<Integer, Integer> entry : _entityVehicleMap.get(owner).entrySet())
|
|
||||||
{
|
|
||||||
if (entry.getValue() == entityId)
|
|
||||||
vehiclePacket.b = entry.getKey();
|
|
||||||
}
|
|
||||||
|
|
||||||
vehiclePacket.c = packet.a;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -639,7 +506,8 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
|
|||||||
// This is the second strike system.
|
// This is the second strike system.
|
||||||
if (!failure)
|
if (!failure)
|
||||||
{
|
{
|
||||||
if (!_doubleStrike.containsKey(player.getUniqueId()) || !_doubleStrike.get(player.getUniqueId()).containsKey(checkType.getParent()))
|
if (!_doubleStrike.containsKey(player.getUniqueId())
|
||||||
|
|| !_doubleStrike.get(player.getUniqueId()).containsKey(checkType.getParent()))
|
||||||
failure = true;
|
failure = true;
|
||||||
|
|
||||||
if (!_doubleStrike.containsKey(player.getUniqueId()))
|
if (!_doubleStrike.containsKey(player.getUniqueId()))
|
||||||
@ -651,4 +519,3 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
|
|||||||
return failure;
|
return failure;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,183 @@
|
|||||||
|
package mineplex.core;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
import net.minecraft.server.v1_8_R3.PacketPlayInUseEntity;
|
||||||
|
import net.minecraft.server.v1_8_R3.PacketPlayInUseEntity.EnumEntityUseAction;
|
||||||
|
import net.minecraft.server.v1_8_R3.MinecraftServer;
|
||||||
|
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy;
|
||||||
|
import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||||
|
import org.bukkit.craftbukkit.v1_8_R3.event.CraftEventFactory;
|
||||||
|
import org.bukkit.entity.EntityType;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.block.Action;
|
||||||
|
import org.bukkit.event.player.PlayerAnimationEvent;
|
||||||
|
import org.bukkit.event.player.PlayerAnimationType;
|
||||||
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
import mineplex.core.packethandler.IPacketHandler;
|
||||||
|
import mineplex.core.packethandler.PacketHandler;
|
||||||
|
import mineplex.core.packethandler.PacketInfo;
|
||||||
|
import mineplex.core.updater.UpdateType;
|
||||||
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
|
|
||||||
|
public class PacketsInteractionFix extends MiniPlugin implements IPacketHandler
|
||||||
|
{
|
||||||
|
private HashMap<String, HashSet<Integer>> _armorStands = new HashMap<String, HashSet<Integer>>();
|
||||||
|
private HashSet<Player> _leftClicked = new HashSet<Player>();
|
||||||
|
private int _lastTick;
|
||||||
|
|
||||||
|
public PacketsInteractionFix(JavaPlugin plugin, PacketHandler packetHandler)
|
||||||
|
{
|
||||||
|
super("Packets Interaction Fix", plugin);
|
||||||
|
|
||||||
|
packetHandler.addPacketHandler(this, true, PacketPlayOutSpawnEntityLiving.class, PacketPlayOutEntityDestroy.class,
|
||||||
|
PacketPlayInUseEntity.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void checkLeftClicks()
|
||||||
|
{
|
||||||
|
if (MinecraftServer.currentTick == _lastTick)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_lastTick = MinecraftServer.currentTick;
|
||||||
|
_leftClicked.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
//@EventHandler
|
||||||
|
public void onArmAnimation(PlayerAnimationEvent event)
|
||||||
|
{
|
||||||
|
if (event.getAnimationType() != PlayerAnimationType.ARM_SWING)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
checkLeftClicks();
|
||||||
|
|
||||||
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
|
if (_leftClicked.remove(player))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
CraftEventFactory.callPlayerInteractEvent(((CraftPlayer) player).getHandle(), Action.LEFT_CLICK_AIR,
|
||||||
|
((CraftPlayer) player).getHandle().inventory.getItemInHand());
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onQuit(PlayerQuitEvent event)
|
||||||
|
{
|
||||||
|
_leftClicked.remove(event.getPlayer().getName());
|
||||||
|
_armorStands.remove(event.getPlayer().getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void removeDeadNames(UpdateEvent event)
|
||||||
|
{
|
||||||
|
if (event.getType() != UpdateType.SEC)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
checkLeftClicks();
|
||||||
|
|
||||||
|
Iterator<String> itel = _armorStands.keySet().iterator();
|
||||||
|
|
||||||
|
while (itel.hasNext())
|
||||||
|
{
|
||||||
|
String name = itel.next();
|
||||||
|
|
||||||
|
Player player = Bukkit.getPlayerExact(name);
|
||||||
|
|
||||||
|
if (player != null)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
itel.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//@EventHandler
|
||||||
|
public void onPlayerInteract(PlayerInteractEvent event)
|
||||||
|
{
|
||||||
|
if (!event.getAction().name().contains("LEFT"))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
checkLeftClicks();
|
||||||
|
|
||||||
|
_leftClicked.add(event.getPlayer());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handle(PacketInfo packetInfo)
|
||||||
|
{
|
||||||
|
Player player = packetInfo.getPlayer();
|
||||||
|
|
||||||
|
if (!player.isOnline())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (packetInfo.isCancelled())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!_armorStands.containsKey(player.getName()))
|
||||||
|
{
|
||||||
|
_armorStands.put(player.getName(), new HashSet<Integer>());
|
||||||
|
}
|
||||||
|
|
||||||
|
HashSet<Integer> list = _armorStands.get(player.getName());
|
||||||
|
|
||||||
|
if (packetInfo.getPacket() instanceof PacketPlayOutSpawnEntityLiving)
|
||||||
|
{
|
||||||
|
PacketPlayOutSpawnEntityLiving packet = (PacketPlayOutSpawnEntityLiving) packetInfo.getPacket();
|
||||||
|
|
||||||
|
if (packet.b != EntityType.ARMOR_STAND.getTypeId())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
list.add(packet.a);
|
||||||
|
}
|
||||||
|
else if (packetInfo.getPacket() instanceof PacketPlayOutEntityDestroy)
|
||||||
|
{
|
||||||
|
PacketPlayOutEntityDestroy packet = (PacketPlayOutEntityDestroy) packetInfo.getPacket();
|
||||||
|
|
||||||
|
list.removeAll(Arrays.asList(packet.a));
|
||||||
|
}
|
||||||
|
else if (packetInfo.getPacket() instanceof PacketPlayInUseEntity)
|
||||||
|
{
|
||||||
|
PacketPlayInUseEntity packet = (PacketPlayInUseEntity) packetInfo.getPacket();
|
||||||
|
|
||||||
|
if (!list.contains(packet.a))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (packet.action == EnumEntityUseAction.ATTACK)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
CraftEventFactory.callPlayerInteractEvent(((CraftPlayer) player).getHandle(), Action.RIGHT_CLICK_AIR,
|
||||||
|
((CraftPlayer) player).getHandle().inventory.getItemInHand());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,66 +0,0 @@
|
|||||||
package mineplex.core;
|
|
||||||
|
|
||||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.EventPriority;
|
|
||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
|
||||||
|
|
||||||
import net.minecraft.server.v1_7_R4.PacketPlayOutPlayerInfo;
|
|
||||||
|
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
|
||||||
import mineplex.core.common.util.UtilServer;
|
|
||||||
|
|
||||||
public class TablistFix extends MiniPlugin
|
|
||||||
{
|
|
||||||
public TablistFix(JavaPlugin plugin)
|
|
||||||
{
|
|
||||||
super("Tablist Fix", plugin);
|
|
||||||
}
|
|
||||||
|
|
||||||
// This is sort of experimental!
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
|
||||||
public void onJoin(PlayerJoinEvent event)
|
|
||||||
{/*
|
|
||||||
final Player player = event.getPlayer();
|
|
||||||
runSyncLater(new Runnable()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
if (!player.isOnline())
|
|
||||||
return;
|
|
||||||
|
|
||||||
for (Player other : UtilServer.getPlayers())
|
|
||||||
{
|
|
||||||
PacketPlayOutPlayerInfo packet = PacketPlayOutPlayerInfo.updateDisplayName(((CraftPlayer) other).getHandle(), ((CraftPlayer) player).getHandle());
|
|
||||||
PacketPlayOutPlayerInfo toLoginPlayer = PacketPlayOutPlayerInfo.updateDisplayName(((CraftPlayer) player).getHandle(), ((CraftPlayer) other).getHandle());
|
|
||||||
|
|
||||||
if (other.canSee(player) && UtilPlayer.is1_8(other))
|
|
||||||
UtilPlayer.sendPacket(other, packet);
|
|
||||||
|
|
||||||
if (player.canSee(other) && UtilPlayer.is1_8(player))
|
|
||||||
UtilPlayer.sendPacket(player, toLoginPlayer);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, 20L);
|
|
||||||
}
|
|
||||||
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
public static void refreshForPlayer(Player player)
|
|
||||||
{
|
|
||||||
if (!UtilPlayer.is1_8(player))
|
|
||||||
return;
|
|
||||||
|
|
||||||
for (Player other : UtilServer.getPlayers())
|
|
||||||
{
|
|
||||||
if (player.canSee(other))
|
|
||||||
{
|
|
||||||
// PacketPlayOutPlayerInfo packet = PacketPlayOutPlayerInfo.updateDisplayName(((CraftPlayer) player).getHandle(), ((CraftPlayer) other).getHandle());
|
|
||||||
// UtilPlayer.sendPacket(player, packet);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -8,6 +8,7 @@ import java.util.Map.Entry;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
import mineplex.core.MiniPlugin;
|
import mineplex.core.MiniPlugin;
|
||||||
import mineplex.core.account.command.TestRank;
|
import mineplex.core.account.command.TestRank;
|
||||||
import mineplex.core.account.command.UpdateRank;
|
import mineplex.core.account.command.UpdateRank;
|
||||||
@ -28,7 +29,6 @@ import mineplex.playerCache.PlayerInfo;
|
|||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
import org.bukkit.craftbukkit.libs.com.google.gson.Gson;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package mineplex.core.account.event;
|
package mineplex.core.account.event;
|
||||||
|
|
||||||
import org.bukkit.craftbukkit.libs.com.google.gson.stream.JsonWriter;
|
import com.google.gson.stream.JsonWriter;
|
||||||
import org.bukkit.event.Event;
|
import org.bukkit.event.Event;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ import java.util.List;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.craftbukkit.libs.com.google.gson.reflect.TypeToken;
|
import com.google.gson.reflect.TypeToken;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
import mineplex.core.account.ILoginProcessor;
|
import mineplex.core.account.ILoginProcessor;
|
||||||
|
@ -6,7 +6,7 @@ import java.sql.SQLException;
|
|||||||
|
|
||||||
import mineplex.core.database.DBPool;
|
import mineplex.core.database.DBPool;
|
||||||
|
|
||||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class AntiHackRepository
|
public class AntiHackRepository
|
||||||
|
@ -62,7 +62,7 @@ import org.jooq.SQLDialect;
|
|||||||
import org.jooq.impl.DSL;
|
import org.jooq.impl.DSL;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
|
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
@ -72,8 +72,8 @@ import org.bukkit.event.player.PlayerJoinEvent;
|
|||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
import net.minecraft.server.v1_7_R4.DataWatcher;
|
import net.minecraft.server.v1_8_R3.DataWatcher;
|
||||||
import net.minecraft.server.v1_7_R4.PacketPlayOutEntityMetadata;
|
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityMetadata;
|
||||||
|
|
||||||
public class BonusManager extends MiniClientPlugin<BonusClientData> implements ILoginProcessor
|
public class BonusManager extends MiniClientPlugin<BonusClientData> implements ILoginProcessor
|
||||||
{
|
{
|
||||||
@ -405,7 +405,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
|||||||
if (!_enabled)
|
if (!_enabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
((CraftEntity)_carlNpc.getEntity()).getHandle().getDataWatcher().watch(16, -1);
|
((CraftEntity)_carlNpc.getEntity()).getHandle().getDataWatcher().watch(16, (byte) -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void IncreaseSize(Entity player)
|
public void IncreaseSize(Entity player)
|
||||||
@ -413,7 +413,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
|||||||
if (!_enabled)
|
if (!_enabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
((CraftEntity)_carlNpc.getEntity()).getHandle().getDataWatcher().watch(16, 1);
|
((CraftEntity)_carlNpc.getEntity()).getHandle().getDataWatcher().watch(16, (byte) 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// DAILY BONUS
|
// DAILY BONUS
|
||||||
@ -892,7 +892,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
|||||||
|
|
||||||
if (client.getHologram() == null)
|
if (client.getHologram() == null)
|
||||||
{
|
{
|
||||||
double yAdd = UtilPlayer.is1_8(player) ? 2.18 : 2.3;
|
double yAdd = 2.18;
|
||||||
hologram = new Hologram(_hologramManager, _carlNpc.getLocation().clone().add(0, yAdd, 0), "");
|
hologram = new Hologram(_hologramManager, _carlNpc.getLocation().clone().add(0, yAdd, 0), "");
|
||||||
hologram.setHologramTarget(Hologram.HologramTarget.WHITELIST);
|
hologram.setHologramTarget(Hologram.HologramTarget.WHITELIST);
|
||||||
hologram.addPlayer(player);
|
hologram.addPlayer(player);
|
||||||
|
@ -134,9 +134,10 @@ public class Chat extends MiniPlugin
|
|||||||
public void preventMe(PlayerCommandPreprocessEvent event)
|
public void preventMe(PlayerCommandPreprocessEvent event)
|
||||||
{
|
{
|
||||||
if (event.getMessage().toLowerCase().startsWith("/me ")
|
if (event.getMessage().toLowerCase().startsWith("/me ")
|
||||||
|| event.getMessage().toLowerCase().startsWith("/bukkit"))
|
|| event.getMessage().toLowerCase().startsWith("/bukkit")
|
||||||
|
|| event.getMessage().toLowerCase().startsWith("/minecraft"))
|
||||||
{
|
{
|
||||||
event.getPlayer().sendMessage(F.main(getName(), "No, you!"));
|
event.getPlayer().sendMessage(F.main(getName(), "Nope, not allowed!"));
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,6 @@ import mineplex.core.recharge.Recharge;
|
|||||||
|
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.TabCompleteEvent;
|
|
||||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
@ -4,14 +4,17 @@ import java.util.ArrayList;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import net.minecraft.server.v1_7_R4.EntityPlayer;
|
import net.minecraft.server.v1_8_R3.Blocks;
|
||||||
import net.minecraft.server.v1_7_R4.Items;
|
import net.minecraft.server.v1_8_R3.ChatMessage;
|
||||||
import net.minecraft.server.v1_7_R4.PacketPlayOutOpenWindow;
|
import net.minecraft.server.v1_8_R3.EntityPlayer;
|
||||||
import net.minecraft.server.v1_7_R4.PacketPlayOutSetSlot;
|
import net.minecraft.server.v1_8_R3.IChatBaseComponent;
|
||||||
|
import net.minecraft.server.v1_8_R3.Items;
|
||||||
|
import net.minecraft.server.v1_8_R3.PacketPlayOutOpenWindow;
|
||||||
|
import net.minecraft.server.v1_8_R3.PacketPlayOutSetSlot;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.inventory.ClickType;
|
import org.bukkit.event.inventory.ClickType;
|
||||||
@ -19,6 +22,7 @@ import org.bukkit.event.inventory.ClickType;
|
|||||||
import mineplex.core.account.CoreClientManager;
|
import mineplex.core.account.CoreClientManager;
|
||||||
import mineplex.core.common.CurrencyType;
|
import mineplex.core.common.CurrencyType;
|
||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
import mineplex.core.cosmetic.CosmeticManager;
|
import mineplex.core.cosmetic.CosmeticManager;
|
||||||
import mineplex.core.cosmetic.ui.CosmeticShop;
|
import mineplex.core.cosmetic.ui.CosmeticShop;
|
||||||
import mineplex.core.cosmetic.ui.PetSorter;
|
import mineplex.core.cosmetic.ui.PetSorter;
|
||||||
@ -166,11 +170,11 @@ public class PetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
|
|||||||
PetTagPage petTagPage = new PetTagPage(getPlugin(), getShop(), getClientManager(), getDonationManager(), "Repairing", getPlayer(), pet, petPurchase);
|
PetTagPage petTagPage = new PetTagPage(getPlugin(), getShop(), getClientManager(), getDonationManager(), "Repairing", getPlayer(), pet, petPurchase);
|
||||||
EntityPlayer entityPlayer = ((CraftPlayer) getPlayer()).getHandle();
|
EntityPlayer entityPlayer = ((CraftPlayer) getPlayer()).getHandle();
|
||||||
int containerCounter = entityPlayer.nextContainerCounter();
|
int containerCounter = entityPlayer.nextContainerCounter();
|
||||||
entityPlayer.playerConnection.sendPacket(new PacketPlayOutOpenWindow(containerCounter, 8, "Repairing", 0, true));
|
UtilPlayer.sendPacket(player, new PacketPlayOutOpenWindow(containerCounter, "minecraft:anvil", new ChatMessage(Blocks.ANVIL.a() + ".name", new Object[0])));
|
||||||
entityPlayer.activeContainer = new AnvilContainer(entityPlayer.inventory, petTagPage.getInventory());
|
entityPlayer.activeContainer = new AnvilContainer(entityPlayer.inventory, petTagPage.getInventory());
|
||||||
entityPlayer.activeContainer.windowId = containerCounter;
|
entityPlayer.activeContainer.windowId = containerCounter;
|
||||||
entityPlayer.activeContainer.addSlotListener(entityPlayer);
|
entityPlayer.activeContainer.addSlotListener(entityPlayer);
|
||||||
entityPlayer.playerConnection.sendPacket(new PacketPlayOutSetSlot(containerCounter, 0, new net.minecraft.server.v1_7_R4.ItemStack(Items.NAME_TAG)));
|
UtilPlayer.sendPacket(player, new PacketPlayOutSetSlot(containerCounter, 0, new net.minecraft.server.v1_8_R3.ItemStack(Items.NAME_TAG)));
|
||||||
|
|
||||||
getShop().setCurrentPageForPlayer(getPlayer(), petTagPage);
|
getShop().setCurrentPageForPlayer(getPlayer(), petTagPage);
|
||||||
}
|
}
|
||||||
|
@ -17,8 +17,8 @@ import mineplex.core.pet.repository.token.PetToken;
|
|||||||
import mineplex.core.shop.page.ConfirmationPage;
|
import mineplex.core.shop.page.ConfirmationPage;
|
||||||
import mineplex.core.shop.page.ShopPageBase;
|
import mineplex.core.shop.page.ShopPageBase;
|
||||||
import mineplex.playerCache.PlayerCache;
|
import mineplex.playerCache.PlayerCache;
|
||||||
import net.minecraft.server.v1_7_R4.ItemStack;
|
import net.minecraft.server.v1_8_R3.ItemStack;
|
||||||
import net.minecraft.server.v1_7_R4.Items;
|
import net.minecraft.server.v1_8_R3.Items;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
@ -2,9 +2,11 @@ package mineplex.core.creature.command;
|
|||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftLivingEntity;
|
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftLivingEntity;
|
||||||
import org.bukkit.entity.Ageable;
|
import org.bukkit.entity.Ageable;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
@ -110,7 +112,7 @@ public class MobCommand extends MultiCommandBase<Creature>
|
|||||||
HashSet<Entity> entSet = new HashSet<Entity>();
|
HashSet<Entity> entSet = new HashSet<Entity>();
|
||||||
for (int i = 0 ; i < count ; i++)
|
for (int i = 0 ; i < count ; i++)
|
||||||
{
|
{
|
||||||
entSet.add(Plugin.SpawnEntity(caller.getTargetBlock(null, 0).getLocation().add(0.5, 1, 0.5), type));
|
entSet.add(Plugin.SpawnEntity(caller.getTargetBlock((Set<Material>) null, 0).getLocation().add(0.5, 1, 0.5), type));
|
||||||
}
|
}
|
||||||
|
|
||||||
//Search Vars
|
//Search Vars
|
||||||
|
@ -9,59 +9,43 @@ import java.util.HashSet;
|
|||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
import mineplex.core.MiniPlugin;
|
import net.minecraft.server.v1_8_R3.Block;
|
||||||
import mineplex.core.common.util.NautHashMap;
|
import net.minecraft.server.v1_8_R3.BlockPosition;
|
||||||
import mineplex.core.common.util.UtilEnt;
|
import net.minecraft.server.v1_8_R3.Chunk;
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
import net.minecraft.server.v1_8_R3.ChunkSection;
|
||||||
import mineplex.core.disguise.disguises.DisguiseArmorStand;
|
import net.minecraft.server.v1_8_R3.EntityTrackerEntry;
|
||||||
import mineplex.core.disguise.disguises.DisguiseBase;
|
import net.minecraft.server.v1_8_R3.PacketPlayOutAnimation;
|
||||||
import mineplex.core.disguise.disguises.DisguiseBlock;
|
import net.minecraft.server.v1_8_R3.EntityPlayer;
|
||||||
import mineplex.core.disguise.disguises.DisguiseInsentient;
|
import net.minecraft.server.v1_8_R3.Packet;
|
||||||
import mineplex.core.disguise.disguises.DisguiseLiving;
|
import net.minecraft.server.v1_8_R3.PacketPlayOutBed;
|
||||||
import mineplex.core.disguise.disguises.DisguisePlayer;
|
import net.minecraft.server.v1_8_R3.PacketPlayOutEntity;
|
||||||
import mineplex.core.disguise.disguises.DisguiseRabbit;
|
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityStatus;
|
||||||
import mineplex.core.packethandler.IPacketHandler;
|
import net.minecraft.server.v1_8_R3.PacketPlayOutMapChunk;
|
||||||
import mineplex.core.packethandler.PacketHandler;
|
import net.minecraft.server.v1_8_R3.PacketPlayOutMapChunkBulk;
|
||||||
import mineplex.core.packethandler.PacketInfo;
|
import net.minecraft.server.v1_8_R3.PacketPlayOutNamedEntitySpawn;
|
||||||
import mineplex.core.packethandler.PacketVerifier;
|
import net.minecraft.server.v1_8_R3.PacketPlayOutPlayerInfo;
|
||||||
import mineplex.core.timing.TimingManager;
|
import net.minecraft.server.v1_8_R3.PacketPlayOutEntity.PacketPlayOutRelEntityMove;
|
||||||
import mineplex.core.updater.UpdateType;
|
import net.minecraft.server.v1_8_R3.PacketPlayOutEntity.PacketPlayOutRelEntityMoveLook;
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
import net.minecraft.server.v1_8_R3.PacketPlayOutPlayerInfo.PlayerInfoData;
|
||||||
import net.minecraft.server.v1_7_R4.Block;
|
import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntity;
|
||||||
import net.minecraft.server.v1_7_R4.Chunk;
|
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityVelocity;
|
||||||
import net.minecraft.server.v1_7_R4.ChunkAddEntityEvent;
|
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy;
|
||||||
import net.minecraft.server.v1_7_R4.ChunkSection;
|
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityTeleport;
|
||||||
import net.minecraft.server.v1_7_R4.EntityPlayer;
|
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityMetadata;
|
||||||
import net.minecraft.server.v1_7_R4.EntityTrackerEntry;
|
import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving;
|
||||||
import net.minecraft.server.v1_7_R4.Packet;
|
import net.minecraft.server.v1_8_R3.PacketPlayOutUpdateAttributes;
|
||||||
import net.minecraft.server.v1_7_R4.PacketPlayOutAnimation;
|
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityEquipment;
|
||||||
import net.minecraft.server.v1_7_R4.PacketPlayOutBed;
|
import net.minecraft.server.v1_8_R3.PacketPlayOutNamedSoundEffect;
|
||||||
import net.minecraft.server.v1_7_R4.PacketPlayOutEntityDestroy;
|
import net.minecraft.server.v1_8_R3.WorldServer;
|
||||||
import net.minecraft.server.v1_7_R4.PacketPlayOutEntityEquipment;
|
|
||||||
import net.minecraft.server.v1_7_R4.PacketPlayOutEntityMetadata;
|
|
||||||
import net.minecraft.server.v1_7_R4.PacketPlayOutEntityStatus;
|
|
||||||
import net.minecraft.server.v1_7_R4.PacketPlayOutEntityTeleport;
|
|
||||||
import net.minecraft.server.v1_7_R4.PacketPlayOutEntityVelocity;
|
|
||||||
import net.minecraft.server.v1_7_R4.PacketPlayOutMapChunk;
|
|
||||||
import net.minecraft.server.v1_7_R4.PacketPlayOutMapChunkBulk;
|
|
||||||
import net.minecraft.server.v1_7_R4.PacketPlayOutNamedEntitySpawn;
|
|
||||||
import net.minecraft.server.v1_7_R4.PacketPlayOutNamedSoundEffect;
|
|
||||||
import net.minecraft.server.v1_7_R4.PacketPlayOutPlayerInfo;
|
|
||||||
import net.minecraft.server.v1_7_R4.PacketPlayOutRelEntityMove;
|
|
||||||
import net.minecraft.server.v1_7_R4.PacketPlayOutRelEntityMoveLook;
|
|
||||||
import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntity;
|
|
||||||
import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntityLiving;
|
|
||||||
import net.minecraft.server.v1_7_R4.PacketPlayOutUpdateAttributes;
|
|
||||||
import net.minecraft.server.v1_7_R4.WorldServer;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
|
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
|
||||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
|
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
|
||||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -75,6 +59,26 @@ import org.bukkit.event.player.PlayerTeleportEvent;
|
|||||||
import org.bukkit.event.world.ChunkUnloadEvent;
|
import org.bukkit.event.world.ChunkUnloadEvent;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
import com.mineplex.spigot.ChunkAddEntityEvent;
|
||||||
|
|
||||||
|
import mineplex.core.MiniPlugin;
|
||||||
|
import mineplex.core.common.util.NautHashMap;
|
||||||
|
import mineplex.core.common.util.UtilEnt;
|
||||||
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
|
import mineplex.core.disguise.disguises.DisguiseBase;
|
||||||
|
import mineplex.core.disguise.disguises.DisguiseBlock;
|
||||||
|
import mineplex.core.disguise.disguises.DisguiseInsentient;
|
||||||
|
import mineplex.core.disguise.disguises.DisguiseLiving;
|
||||||
|
import mineplex.core.disguise.disguises.DisguisePlayer;
|
||||||
|
import mineplex.core.disguise.disguises.DisguiseRabbit;
|
||||||
|
import mineplex.core.packethandler.IPacketHandler;
|
||||||
|
import mineplex.core.packethandler.PacketHandler;
|
||||||
|
import mineplex.core.packethandler.PacketVerifier;
|
||||||
|
import mineplex.core.packethandler.PacketInfo;
|
||||||
|
import mineplex.core.timing.TimingManager;
|
||||||
|
import mineplex.core.updater.UpdateType;
|
||||||
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
|
|
||||||
public class DisguiseManager extends MiniPlugin implements IPacketHandler
|
public class DisguiseManager extends MiniPlugin implements IPacketHandler
|
||||||
{
|
{
|
||||||
private NautHashMap<Integer, DisguiseBase> _spawnPacketMap = new NautHashMap<Integer, DisguiseBase>();
|
private NautHashMap<Integer, DisguiseBase> _spawnPacketMap = new NautHashMap<Integer, DisguiseBase>();
|
||||||
@ -89,18 +93,8 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler
|
|||||||
|
|
||||||
private boolean _handlingPacket = false;
|
private boolean _handlingPacket = false;
|
||||||
|
|
||||||
private Field _attributesA;
|
|
||||||
private Field _attributesB;
|
|
||||||
private Field _soundB;
|
|
||||||
private Field _soundC;
|
|
||||||
private Field _soundD;
|
|
||||||
private Field _bedA;
|
|
||||||
private Field _bedB;
|
|
||||||
private Field _bedD;
|
|
||||||
private Field _xChunk;
|
private Field _xChunk;
|
||||||
private Field _zChunk;
|
private Field _zChunk;
|
||||||
private Field _eStatusId;
|
|
||||||
private Field _eStatusState;
|
|
||||||
|
|
||||||
private Chunk _bedChunk;
|
private Chunk _bedChunk;
|
||||||
private boolean _bedPackets;
|
private boolean _bedPackets;
|
||||||
@ -109,36 +103,21 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler
|
|||||||
{
|
{
|
||||||
super("Disguise Manager", plugin);
|
super("Disguise Manager", plugin);
|
||||||
|
|
||||||
packetHandler.addPacketHandler(this);
|
packetHandler.addPacketHandler(this, PacketPlayOutAnimation.class, PacketPlayOutBed.class,
|
||||||
|
PacketPlayOutEntityStatus.class, PacketPlayOutMapChunk.class, PacketPlayOutMapChunkBulk.class,
|
||||||
|
PacketPlayOutNamedEntitySpawn.class, PacketPlayOutPlayerInfo.class,
|
||||||
|
PacketPlayOutEntity.PacketPlayOutRelEntityMove.class, PacketPlayOutEntity.PacketPlayOutRelEntityMoveLook.class,
|
||||||
|
PacketPlayOutSpawnEntity.class, PacketPlayOutEntityVelocity.class, PacketPlayOutEntityDestroy.class,
|
||||||
|
PacketPlayOutEntityTeleport.class, PacketPlayOutEntityMetadata.class, PacketPlayOutSpawnEntityLiving.class,
|
||||||
|
PacketPlayOutUpdateAttributes.class, PacketPlayOutEntityEquipment.class, PacketPlayOutNamedSoundEffect.class);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_attributesA = PacketPlayOutUpdateAttributes.class.getDeclaredField("a");
|
_bedChunk = new Chunk(((CraftWorld) Bukkit.getWorlds().get(0)).getHandle(), 0, 0);
|
||||||
_attributesA.setAccessible(true);
|
|
||||||
_attributesB = PacketPlayOutUpdateAttributes.class.getDeclaredField("b");
|
|
||||||
_attributesB.setAccessible(true);
|
|
||||||
_soundB = PacketPlayOutNamedSoundEffect.class.getDeclaredField("b");
|
|
||||||
_soundB.setAccessible(true);
|
|
||||||
_soundC = PacketPlayOutNamedSoundEffect.class.getDeclaredField("c");
|
|
||||||
_soundC.setAccessible(true);
|
|
||||||
_soundD = PacketPlayOutNamedSoundEffect.class.getDeclaredField("d");
|
|
||||||
_soundD.setAccessible(true);
|
|
||||||
_bedA = PacketPlayOutBed.class.getDeclaredField("a");
|
|
||||||
_bedA.setAccessible(true);
|
|
||||||
_bedB = PacketPlayOutBed.class.getDeclaredField("b");
|
|
||||||
_bedB.setAccessible(true);
|
|
||||||
_bedD = PacketPlayOutBed.class.getDeclaredField("d");
|
|
||||||
_bedD.setAccessible(true);
|
|
||||||
_eStatusId = PacketPlayOutEntityStatus.class.getDeclaredField("a");
|
|
||||||
_eStatusId.setAccessible(true);
|
|
||||||
_eStatusState = PacketPlayOutEntityStatus.class.getDeclaredField("b");
|
|
||||||
_eStatusState.setAccessible(true);
|
|
||||||
|
|
||||||
_bedChunk = new Chunk(null, 0, 0);
|
|
||||||
Field cSection = Chunk.class.getDeclaredField("sections");
|
Field cSection = Chunk.class.getDeclaredField("sections");
|
||||||
cSection.setAccessible(true);
|
cSection.setAccessible(true);
|
||||||
|
|
||||||
ChunkSection chunkSection = new ChunkSection(0, false);
|
ChunkSection chunkSection = new ChunkSection(0, true);
|
||||||
Block block = Block.getById(Material.BED_BLOCK.getId());
|
Block block = Block.getById(Material.BED_BLOCK.getId());
|
||||||
|
|
||||||
// block = ((Object[]) ReflectionManager.getNmsField(ReflectionManager.getNmsClass("Block"),"byId")
|
// block = ((Object[]) ReflectionManager.getNmsField(ReflectionManager.getNmsClass("Block"),"byId")
|
||||||
@ -149,17 +128,20 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler
|
|||||||
BlockFace.EAST, BlockFace.WEST, BlockFace.NORTH, BlockFace.SOUTH
|
BlockFace.EAST, BlockFace.WEST, BlockFace.NORTH, BlockFace.SOUTH
|
||||||
})
|
})
|
||||||
{
|
{
|
||||||
chunkSection.setTypeId(1 + face.getModX(), 0, 1 + face.getModZ(), block);
|
int x = 1 + face.getModX();
|
||||||
chunkSection.setData(1 + face.getModX(), 0, 1 + face.getModZ(), face.ordinal());
|
int z = 1 + face.getModZ();
|
||||||
chunkSection.setSkyLight(1 + face.getModX(), 0, 1 + face.getModZ(), 0);
|
|
||||||
chunkSection.setEmittedLight(1 + face.getModX(), 0, 1 + face.getModZ(), 0);
|
chunkSection.setType(x, 0, z, block.fromLegacyData(face.ordinal()));
|
||||||
|
chunkSection.a(x, 0, z, 0);
|
||||||
|
chunkSection.b(x, 0, z, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
ChunkSection[] chunkSections = new ChunkSection[16];
|
ChunkSection[] chunkSections = new ChunkSection[16];
|
||||||
chunkSections[0] = chunkSection;
|
chunkSections[0] = chunkSection;
|
||||||
cSection.set(_bedChunk, chunkSections);
|
cSection.set(_bedChunk, chunkSections);
|
||||||
|
|
||||||
_bedChunk.world = ((CraftWorld) Bukkit.getWorlds().get(0)).getHandle();
|
// TODO
|
||||||
|
// _bedChunk.world = ((CraftWorld) Bukkit.getWorlds().get(0)).getHandle();
|
||||||
|
|
||||||
_xChunk = Chunk.class.getField("locX");
|
_xChunk = Chunk.class.getField("locX");
|
||||||
_xChunk.setAccessible(true);
|
_xChunk.setAccessible(true);
|
||||||
@ -226,13 +208,13 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void ChunkAddEntity(ChunkAddEntityEvent event)
|
public void ChunkAddEntity(ChunkAddEntityEvent event)
|
||||||
{
|
{
|
||||||
DisguiseBase disguise = _entityDisguiseMap.get(event.GetEntity().getUniqueId().toString());
|
DisguiseBase disguise = _entityDisguiseMap.get(event.getEntity().getUniqueId().toString());
|
||||||
|
|
||||||
if (disguise != null)
|
if (disguise != null)
|
||||||
{
|
{
|
||||||
disguise.setEntity(event.GetEntity());
|
disguise.setEntity(event.getEntity());
|
||||||
_spawnPacketMap.put(event.GetEntity().getEntityId(), disguise);
|
_spawnPacketMap.put(event.getEntity().getEntityId(), disguise);
|
||||||
_entityDisguiseMap.remove(event.GetEntity().getUniqueId().toString());
|
_entityDisguiseMap.remove(event.getEntity().getUniqueId().toString());
|
||||||
|
|
||||||
if (disguise instanceof DisguiseRabbit)
|
if (disguise instanceof DisguiseRabbit)
|
||||||
{
|
{
|
||||||
@ -427,10 +409,10 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler
|
|||||||
Packet[] packets = new Packet[2];
|
Packet[] packets = new Packet[2];
|
||||||
|
|
||||||
// Make unload
|
// Make unload
|
||||||
packets[0] = new PacketPlayOutMapChunk(_bedChunk, true, 0, UtilPlayer.is1_8(player) ? 48 : 0);
|
packets[0] = new PacketPlayOutMapChunk(_bedChunk, true, 0);
|
||||||
|
|
||||||
// Make load
|
// Make load
|
||||||
packets[1] = new PacketPlayOutMapChunkBulk(Arrays.asList(_bedChunk), UtilPlayer.is1_8(player) ? 48 : 0);
|
packets[1] = new PacketPlayOutMapChunkBulk(Arrays.asList(_bedChunk));
|
||||||
|
|
||||||
return packets;
|
return packets;
|
||||||
}
|
}
|
||||||
@ -439,26 +421,26 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler
|
|||||||
{
|
{
|
||||||
prepareChunk(oldLoc);
|
prepareChunk(oldLoc);
|
||||||
|
|
||||||
return new PacketPlayOutMapChunk(_bedChunk, true, 0, UtilPlayer.is1_8(player) ? 48 : 0);
|
return new PacketPlayOutMapChunk(_bedChunk, true, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Packet[] getBedPackets(Location recieving, DisguisePlayer playerDisguise, boolean is18)
|
private Packet[] getBedPackets(Location recieving, DisguisePlayer playerDisguise)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PacketPlayOutBed bedPacket = new PacketPlayOutBed();
|
PacketPlayOutBed bedPacket = new PacketPlayOutBed();
|
||||||
|
|
||||||
_bedA.set(bedPacket, playerDisguise.GetEntityId());
|
bedPacket.a = playerDisguise.GetEntityId();
|
||||||
|
|
||||||
int chunkX = getChunk(recieving.getX());
|
int chunkX = getChunk(recieving.getX());
|
||||||
int chunkZ = getChunk(recieving.getZ());
|
int chunkZ = getChunk(recieving.getZ());
|
||||||
|
|
||||||
_bedB.set(bedPacket, (chunkX * 16) + 1 + playerDisguise.getSleepingDirection().getModX());
|
bedPacket.b = new BlockPosition((chunkX * 16) + 1 + playerDisguise.getSleepingDirection().getModX(), 0, (chunkZ * 16)
|
||||||
_bedD.set(bedPacket, (chunkZ * 16) + 1 + playerDisguise.getSleepingDirection().getModZ());
|
+ 1 + playerDisguise.getSleepingDirection().getModZ());
|
||||||
|
|
||||||
PacketPlayOutEntityTeleport teleportPacket = new PacketPlayOutEntityTeleport(playerDisguise.GetEntity());
|
PacketPlayOutEntityTeleport teleportPacket = new PacketPlayOutEntityTeleport(playerDisguise.GetEntity());
|
||||||
|
|
||||||
teleportPacket.c += (int) ((is18 ? 0.07D : 0.25D) * 32);
|
teleportPacket.c += (int) (0.35D * 32);
|
||||||
|
|
||||||
return new Packet[]
|
return new Packet[]
|
||||||
{
|
{
|
||||||
@ -502,7 +484,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler
|
|||||||
&& ((DisguisePlayer) entry.getKey()).getSleepingDirection() != null)
|
&& ((DisguisePlayer) entry.getKey()).getSleepingDirection() != null)
|
||||||
{
|
{
|
||||||
|
|
||||||
packets.addAll(Arrays.asList(getBedPackets(newLoc, (DisguisePlayer) entry.getKey(), UtilPlayer.is1_8(player))));
|
packets.addAll(Arrays.asList(getBedPackets(newLoc, (DisguisePlayer) entry.getKey())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -522,7 +504,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler
|
|||||||
return _spawnPacketMap.get(entity.getEntityId());
|
return _spawnPacketMap.get(entity.getEntityId());
|
||||||
}
|
}
|
||||||
|
|
||||||
private EntityTrackerEntry getEntityTracker(net.minecraft.server.v1_7_R4.Entity entity)
|
private EntityTrackerEntry getEntityTracker(net.minecraft.server.v1_8_R3.Entity entity)
|
||||||
{
|
{
|
||||||
return (EntityTrackerEntry) ((WorldServer) entity.world).tracker.trackedEntities.get(entity.getId());
|
return (EntityTrackerEntry) ((WorldServer) entity.world).tracker.trackedEntities.get(entity.getId());
|
||||||
}
|
}
|
||||||
@ -536,8 +518,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler
|
|||||||
final Player owner = packetInfo.getPlayer();
|
final Player owner = packetInfo.getPlayer();
|
||||||
final PacketVerifier packetVerifier = packetInfo.getVerifier();
|
final PacketVerifier packetVerifier = packetInfo.getVerifier();
|
||||||
|
|
||||||
if (UtilPlayer.is1_8(owner)
|
if (packet instanceof PacketPlayOutRelEntityMoveLook || packet instanceof PacketPlayOutRelEntityMove)
|
||||||
&& (packet instanceof PacketPlayOutRelEntityMoveLook || packet instanceof PacketPlayOutRelEntityMove))
|
|
||||||
{
|
{
|
||||||
int entityId = -1;
|
int entityId = -1;
|
||||||
|
|
||||||
@ -577,27 +558,25 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler
|
|||||||
rabbitHops.put(owner.getEntityId(), System.currentTimeMillis());
|
rabbitHops.put(owner.getEntityId(), System.currentTimeMillis());
|
||||||
|
|
||||||
PacketPlayOutEntityStatus entityStatus = new PacketPlayOutEntityStatus();
|
PacketPlayOutEntityStatus entityStatus = new PacketPlayOutEntityStatus();
|
||||||
try
|
|
||||||
{
|
entityStatus.a = entityId;
|
||||||
_eStatusId.set(entityStatus, entityId);
|
entityStatus.b = (byte) 1;
|
||||||
_eStatusState.set(entityStatus, (byte) 1);
|
|
||||||
|
|
||||||
handlePacket(entityStatus, packetVerifier);
|
handlePacket(entityStatus, packetVerifier);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
ex.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (packet instanceof PacketPlayOutPlayerInfo)
|
if (packet instanceof PacketPlayOutPlayerInfo)
|
||||||
{
|
{
|
||||||
if (_blockedNames.contains(((PacketPlayOutPlayerInfo) packet).username))
|
for (PlayerInfoData info : ((PacketPlayOutPlayerInfo) packet).b)
|
||||||
|
{
|
||||||
|
if (_blockedNames.contains(info.a().getName()))
|
||||||
{
|
{
|
||||||
packetInfo.setCancelled(true);
|
packetInfo.setCancelled(true);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (packet instanceof PacketPlayOutSpawnEntity || packet instanceof PacketPlayOutSpawnEntityLiving
|
else if (packet instanceof PacketPlayOutSpawnEntity || packet instanceof PacketPlayOutSpawnEntityLiving
|
||||||
@ -659,20 +638,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler
|
|||||||
}
|
}
|
||||||
else if (packet instanceof PacketPlayOutUpdateAttributes)
|
else if (packet instanceof PacketPlayOutUpdateAttributes)
|
||||||
{
|
{
|
||||||
int entityId = -1;
|
int entityId = ((PacketPlayOutUpdateAttributes) packet).a;
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
entityId = (int) _attributesA.get((PacketPlayOutUpdateAttributes) packet);
|
|
||||||
}
|
|
||||||
catch (IllegalArgumentException e)
|
|
||||||
{
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
catch (IllegalAccessException e)
|
|
||||||
{
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_spawnPacketMap.containsKey(entityId)
|
if (_spawnPacketMap.containsKey(entityId)
|
||||||
&& owner.getEntityId() != entityId
|
&& owner.getEntityId() != entityId
|
||||||
@ -847,11 +813,6 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler
|
|||||||
{
|
{
|
||||||
final Player player = packetInfo.getPlayer();
|
final Player player = packetInfo.getPlayer();
|
||||||
|
|
||||||
if (!UtilPlayer.is1_8(player) && (disguise instanceof DisguiseRabbit || disguise instanceof DisguiseArmorStand))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
final PacketVerifier packetVerifier = packetInfo.getVerifier();
|
final PacketVerifier packetVerifier = packetInfo.getVerifier();
|
||||||
|
|
||||||
if (disguise instanceof DisguisePlayer)
|
if (disguise instanceof DisguisePlayer)
|
||||||
@ -869,7 +830,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler
|
|||||||
|
|
||||||
if (pDisguise.getSleepingDirection() != null)
|
if (pDisguise.getSleepingDirection() != null)
|
||||||
{
|
{
|
||||||
for (Packet packet : getBedPackets(player.getLocation(), pDisguise, UtilPlayer.is1_8(player)))
|
for (Packet packet : getBedPackets(player.getLocation(), pDisguise))
|
||||||
{
|
{
|
||||||
handlePacket(packet, packetVerifier);
|
handlePacket(packet, packetVerifier);
|
||||||
}
|
}
|
||||||
@ -1083,7 +1044,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (otherPlayer.getLocation().subtract(0, .5, 0).getBlock().getTypeId() != 0)
|
if (otherPlayer.getLocation().subtract(0, .5, 0).getBlock().getTypeId() != 0)
|
||||||
((CraftPlayer) player).getHandle().playerConnection.sendPacket(new PacketPlayOutEntityTeleport(
|
UtilPlayer.sendPacket(player, new PacketPlayOutEntityTeleport(
|
||||||
((CraftPlayer) otherPlayer).getHandle()));
|
((CraftPlayer) otherPlayer).getHandle()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1142,9 +1103,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler
|
|||||||
if (disguise.GetEntity() == ((CraftPlayer) player).getHandle())
|
if (disguise.GetEntity() == ((CraftPlayer) player).getHandle())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
EntityPlayer entityPlayer = ((CraftPlayer) player).getHandle();
|
UtilPlayer.sendPacket(player, disguise.GetMetaDataPacket());
|
||||||
|
|
||||||
entityPlayer.playerConnection.sendPacket(disguise.GetMetaDataPacket());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1163,11 +1122,10 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler
|
|||||||
|
|
||||||
EntityPlayer disguisedPlayer = (EntityPlayer) disguise.GetEntity();
|
EntityPlayer disguisedPlayer = (EntityPlayer) disguise.GetEntity();
|
||||||
|
|
||||||
|
|
||||||
if (Bukkit.getPlayerExact(disguisedPlayer.getName()) == null || !disguisedPlayer.isAlive() || !disguisedPlayer.valid)
|
if (Bukkit.getPlayerExact(disguisedPlayer.getName()) == null || !disguisedPlayer.isAlive() || !disguisedPlayer.valid)
|
||||||
disguiseIterator.remove();
|
disguiseIterator.remove();
|
||||||
|
else
|
||||||
try{
|
{
|
||||||
for (Iterator<Player> playerIterator = _disguisePlayerMap.get(disguise).iterator(); playerIterator.hasNext();)
|
for (Iterator<Player> playerIterator = _disguisePlayerMap.get(disguise).iterator(); playerIterator.hasNext();)
|
||||||
{
|
{
|
||||||
Player player = playerIterator.next();
|
Player player = playerIterator.next();
|
||||||
@ -1176,7 +1134,6 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler
|
|||||||
playerIterator.remove();
|
playerIterator.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception exception) {}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package mineplex.core.disguise.disguises;
|
package mineplex.core.disguise.disguises;
|
||||||
|
|
||||||
import org.bukkit.entity.*;
|
import org.bukkit.entity.*;
|
||||||
import org.spigotmc.ProtocolData;
|
|
||||||
|
|
||||||
public abstract class DisguiseAgeable extends DisguiseCreature
|
public abstract class DisguiseAgeable extends DisguiseCreature
|
||||||
{
|
{
|
||||||
@ -9,23 +8,23 @@ public abstract class DisguiseAgeable extends DisguiseCreature
|
|||||||
{
|
{
|
||||||
super(disguiseType, entity);
|
super(disguiseType, entity);
|
||||||
|
|
||||||
DataWatcher.a(12, new ProtocolData.IntByte(0, (byte)0));
|
DataWatcher.a(12, new Byte((byte)0));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateDataWatcher()
|
public void UpdateDataWatcher()
|
||||||
{
|
{
|
||||||
super.UpdateDataWatcher();
|
super.UpdateDataWatcher();
|
||||||
|
|
||||||
DataWatcher.watch(12, DataWatcher.getIntByte(12));
|
DataWatcher.watch(12, DataWatcher.getByte(12));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isBaby()
|
public boolean isBaby()
|
||||||
{
|
{
|
||||||
return DataWatcher.getIntByte(12).value < 0;
|
return DataWatcher.getByte(12) < 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBaby()
|
public void setBaby()
|
||||||
{
|
{
|
||||||
DataWatcher.watch(12, new ProtocolData.IntByte(-24000, (byte) ( -1 )));
|
DataWatcher.watch(12, new Byte((byte) ( -1 )));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,15 +2,13 @@ package mineplex.core.disguise.disguises;
|
|||||||
|
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
import net.minecraft.server.v1_7_R4.EnumEntitySize;
|
import net.minecraft.server.v1_8_R3.MathHelper;
|
||||||
import net.minecraft.server.v1_7_R4.MathHelper;
|
import net.minecraft.server.v1_8_R3.Packet;
|
||||||
import net.minecraft.server.v1_7_R4.Packet;
|
import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving;
|
||||||
import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntityLiving;
|
import net.minecraft.server.v1_8_R3.Vector3f;
|
||||||
|
|
||||||
public class DisguiseArmorStand extends DisguiseInsentient
|
public class DisguiseArmorStand extends DisguiseInsentient
|
||||||
{
|
{
|
||||||
private Vector _headPosition = new Vector();
|
|
||||||
|
|
||||||
public DisguiseArmorStand(org.bukkit.entity.Entity entity)
|
public DisguiseArmorStand(org.bukkit.entity.Entity entity)
|
||||||
{
|
{
|
||||||
super(entity);
|
super(entity);
|
||||||
@ -19,15 +17,25 @@ public class DisguiseArmorStand extends DisguiseInsentient
|
|||||||
|
|
||||||
for (int i = 11; i < 17; i++)
|
for (int i = 11; i < 17; i++)
|
||||||
{
|
{
|
||||||
DataWatcher.a(i, new Vector(0, 0, 0));
|
DataWatcher.a(i, new Vector3f(0, 0, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Rotations are from -360 to 360
|
// Rotations are from -360 to 360
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Vector3f convert(Vector vector)
|
||||||
|
{
|
||||||
|
return new Vector3f((float) vector.getX(), (float) vector.getY(), (float) vector.getZ());
|
||||||
|
}
|
||||||
|
|
||||||
|
private Vector convert(Vector3f vector)
|
||||||
|
{
|
||||||
|
return new Vector(vector.getX(), vector.getY(), vector.getZ());
|
||||||
|
}
|
||||||
|
|
||||||
public Vector getHeadPosition()
|
public Vector getHeadPosition()
|
||||||
{
|
{
|
||||||
return _headPosition.clone();
|
return convert(DataWatcher.h(11));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String getHurtSound()
|
protected String getHurtSound()
|
||||||
@ -41,9 +49,9 @@ public class DisguiseArmorStand extends DisguiseInsentient
|
|||||||
PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving();
|
PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving();
|
||||||
packet.a = Entity.getId();
|
packet.a = Entity.getId();
|
||||||
packet.b = (byte) 30;
|
packet.b = (byte) 30;
|
||||||
packet.c = (int) EnumEntitySize.SIZE_2.a(Entity.locX);
|
packet.c = (int) MathHelper.floor(Entity.locX * 32.0D);
|
||||||
packet.d = (int) MathHelper.floor(Entity.locY * 32.0D);
|
packet.d = (int) MathHelper.floor(Entity.locY * 32.0D);
|
||||||
packet.e = (int) EnumEntitySize.SIZE_2.a(Entity.locZ);
|
packet.e = (int) MathHelper.floor(Entity.locZ * 32.0D);
|
||||||
packet.i = (byte) ((int) (Entity.yaw * 256.0F / 360.0F));
|
packet.i = (byte) ((int) (Entity.yaw * 256.0F / 360.0F));
|
||||||
packet.j = (byte) ((int) (Entity.pitch * 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.k = (byte) ((int) (Entity.yaw * 256.0F / 360.0F));
|
||||||
@ -95,7 +103,7 @@ public class DisguiseArmorStand extends DisguiseInsentient
|
|||||||
|
|
||||||
public void setBodyPosition(Vector vector)
|
public void setBodyPosition(Vector vector)
|
||||||
{
|
{
|
||||||
DataWatcher.watch(12, vector);
|
DataWatcher.watch(12, convert(vector));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHasArms()
|
public void setHasArms()
|
||||||
@ -105,18 +113,17 @@ public class DisguiseArmorStand extends DisguiseInsentient
|
|||||||
|
|
||||||
public void setHeadPosition(Vector vector)
|
public void setHeadPosition(Vector vector)
|
||||||
{
|
{
|
||||||
_headPosition = vector;
|
DataWatcher.watch(11, convert(vector));
|
||||||
DataWatcher.watch(11, vector);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLeftArmPosition(Vector vector)
|
public void setLeftArmPosition(Vector vector)
|
||||||
{
|
{
|
||||||
DataWatcher.watch(13, vector);
|
DataWatcher.watch(13, convert(vector));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLeftLegPosition(Vector vector)
|
public void setLeftLegPosition(Vector vector)
|
||||||
{
|
{
|
||||||
DataWatcher.watch(15, vector);
|
DataWatcher.watch(15, convert(vector));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRemoveBase()
|
public void setRemoveBase()
|
||||||
@ -126,12 +133,12 @@ public class DisguiseArmorStand extends DisguiseInsentient
|
|||||||
|
|
||||||
public void setRightArmPosition(Vector vector)
|
public void setRightArmPosition(Vector vector)
|
||||||
{
|
{
|
||||||
DataWatcher.watch(14, vector);
|
DataWatcher.watch(14, convert(vector));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRightLegPosition(Vector vector)
|
public void setRightLegPosition(Vector vector)
|
||||||
{
|
{
|
||||||
DataWatcher.watch(16, vector);
|
DataWatcher.watch(16, convert(vector));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSmall()
|
public void setSmall()
|
||||||
|
@ -1,14 +1,18 @@
|
|||||||
package mineplex.core.disguise.disguises;
|
package mineplex.core.disguise.disguises;
|
||||||
|
|
||||||
import mineplex.core.common.*;
|
import mineplex.core.common.*;
|
||||||
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
|
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
|
||||||
|
import net.minecraft.server.v1_8_R3.DataWatcher;
|
||||||
import net.minecraft.server.v1_7_R4.DataWatcher;
|
import net.minecraft.server.v1_8_R3.Entity;
|
||||||
import net.minecraft.server.v1_7_R4.Entity;
|
import net.minecraft.server.v1_8_R3.EntityPlayer;
|
||||||
import net.minecraft.server.v1_7_R4.Packet;
|
import net.minecraft.server.v1_8_R3.EntityTrackerEntry;
|
||||||
import net.minecraft.server.v1_7_R4.PacketPlayOutEntityMetadata;
|
import net.minecraft.server.v1_8_R3.IntHashMap;
|
||||||
|
import net.minecraft.server.v1_8_R3.Packet;
|
||||||
|
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityMetadata;
|
||||||
|
import net.minecraft.server.v1_8_R3.WorldServer;
|
||||||
|
|
||||||
public abstract class DisguiseBase
|
public abstract class DisguiseBase
|
||||||
{
|
{
|
||||||
@ -53,6 +57,24 @@ public abstract class DisguiseBase
|
|||||||
return new PacketPlayOutEntityMetadata(Entity.getId(), DataWatcher, true);
|
return new PacketPlayOutEntityMetadata(Entity.getId(), DataWatcher, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void resendMetadata()
|
||||||
|
{
|
||||||
|
if (Entity == null || !Entity.getBukkitEntity().isValid() || !(Entity.world instanceof WorldServer))
|
||||||
|
return;
|
||||||
|
|
||||||
|
IntHashMap<EntityTrackerEntry> tracker = ((WorldServer) Entity.world).tracker.trackedEntities;
|
||||||
|
|
||||||
|
if (tracker.get(Entity.getId()) == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Packet packet = GetMetaDataPacket();
|
||||||
|
|
||||||
|
for (EntityPlayer player : tracker.get(Entity.getId()).trackedPlayers)
|
||||||
|
{
|
||||||
|
UtilPlayer.sendPacket(player.getBukkitEntity(), packet);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void setSoundDisguise(DisguiseBase soundDisguise)
|
public void setSoundDisguise(DisguiseBase soundDisguise)
|
||||||
{
|
{
|
||||||
_soundDisguise = soundDisguise;
|
_soundDisguise = soundDisguise;
|
||||||
|
@ -2,9 +2,9 @@ package mineplex.core.disguise.disguises;
|
|||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import net.minecraft.server.v1_7_R4.MathHelper;
|
import net.minecraft.server.v1_8_R3.MathHelper;
|
||||||
import net.minecraft.server.v1_7_R4.Packet;
|
import net.minecraft.server.v1_8_R3.Packet;
|
||||||
import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntity;
|
import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntity;
|
||||||
|
|
||||||
public class DisguiseBlock extends DisguiseBase
|
public class DisguiseBlock extends DisguiseBase
|
||||||
{
|
{
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
package mineplex.core.disguise.disguises;
|
package mineplex.core.disguise.disguises;
|
||||||
|
|
||||||
import net.minecraft.server.v1_7_R4.EnumEntitySize;
|
import net.minecraft.server.v1_8_R3.MathHelper;
|
||||||
import net.minecraft.server.v1_7_R4.MathHelper;
|
import net.minecraft.server.v1_8_R3.Packet;
|
||||||
import net.minecraft.server.v1_7_R4.Packet;
|
import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving;
|
||||||
import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntityLiving;
|
|
||||||
import org.bukkit.entity.*;
|
import org.bukkit.entity.*;
|
||||||
|
|
||||||
public abstract class DisguiseCreature extends DisguiseInsentient
|
public abstract class DisguiseCreature extends DisguiseInsentient
|
||||||
@ -28,9 +27,9 @@ public abstract class DisguiseCreature extends DisguiseInsentient
|
|||||||
PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving();
|
PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving();
|
||||||
packet.a = Entity.getId();
|
packet.a = Entity.getId();
|
||||||
packet.b = (byte) getDisguiseType().getTypeId();
|
packet.b = (byte) getDisguiseType().getTypeId();
|
||||||
packet.c = (int)EnumEntitySize.SIZE_2.a(Entity.locX);
|
packet.c = (int) MathHelper.floor(Entity.locX*32D);
|
||||||
packet.d = (int) MathHelper.floor(Entity.locY * 32.0D);
|
packet.d = (int) MathHelper.floor(Entity.locY * 32.0D);
|
||||||
packet.e = (int)EnumEntitySize.SIZE_2.a(Entity.locZ);
|
packet.e = (int) MathHelper.floor(Entity.locZ*32D);
|
||||||
packet.i = (byte) ((int) (Entity.yaw * 256.0F / 360.0F));
|
packet.i = (byte) ((int) (Entity.yaw * 256.0F / 360.0F));
|
||||||
packet.j = (byte) ((int) (Entity.pitch * 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.k = (byte) ((int) (Entity.yaw * 256.0F / 360.0F));
|
||||||
|
@ -2,12 +2,11 @@ package mineplex.core.disguise.disguises;
|
|||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
import net.minecraft.server.v1_7_R4.MobEffect;
|
import net.minecraft.server.v1_8_R3.MobEffect;
|
||||||
import net.minecraft.server.v1_7_R4.MobEffectList;
|
import net.minecraft.server.v1_8_R3.MobEffectList;
|
||||||
import net.minecraft.server.v1_7_R4.PotionBrewer;
|
import net.minecraft.server.v1_8_R3.PotionBrewer;
|
||||||
|
|
||||||
import org.bukkit.entity.*;
|
import org.bukkit.entity.*;
|
||||||
import org.spigotmc.ProtocolData;
|
|
||||||
|
|
||||||
public class DisguiseEnderman extends DisguiseMonster
|
public class DisguiseEnderman extends DisguiseMonster
|
||||||
{
|
{
|
||||||
@ -15,7 +14,7 @@ public class DisguiseEnderman extends DisguiseMonster
|
|||||||
{
|
{
|
||||||
super(EntityType.ENDERMAN, entity);
|
super(EntityType.ENDERMAN, entity);
|
||||||
|
|
||||||
DataWatcher.a(16, new ProtocolData.ByteShort( (short) 0 ) );
|
DataWatcher.a(16, new Short( (short) 0));
|
||||||
DataWatcher.a(17, new Byte( (byte) 0));
|
DataWatcher.a(17, new Byte( (byte) 0));
|
||||||
DataWatcher.a(18, new Byte( (byte) 0));
|
DataWatcher.a(18, new Byte( (byte) 0));
|
||||||
|
|
||||||
@ -29,12 +28,12 @@ public class DisguiseEnderman extends DisguiseMonster
|
|||||||
super.UpdateDataWatcher();
|
super.UpdateDataWatcher();
|
||||||
|
|
||||||
DataWatcher.watch(0, Byte.valueOf((byte)(DataWatcher.getByte(0) & ~(1 << 0))));
|
DataWatcher.watch(0, Byte.valueOf((byte)(DataWatcher.getByte(0) & ~(1 << 0))));
|
||||||
DataWatcher.watch(16, new ProtocolData.ByteShort( DataWatcher.getShort(16) ));
|
DataWatcher.watch(16, DataWatcher.getShort(16));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetCarriedId(int i)
|
public void SetCarriedId(int i)
|
||||||
{
|
{
|
||||||
DataWatcher.watch(16, new ProtocolData.ByteShort( (short)(i & 0xFF)) );
|
DataWatcher.watch(16, new Short( (short)(i & 0xFF)) );
|
||||||
}
|
}
|
||||||
|
|
||||||
public int GetCarriedId()
|
public int GetCarriedId()
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package mineplex.core.disguise.disguises;
|
package mineplex.core.disguise.disguises;
|
||||||
|
|
||||||
import org.bukkit.entity.*;
|
import org.bukkit.entity.*;
|
||||||
import org.spigotmc.ProtocolData;
|
|
||||||
|
|
||||||
public class DisguiseHorse extends DisguiseAnimal
|
public class DisguiseHorse extends DisguiseAnimal
|
||||||
{
|
{
|
||||||
|
@ -1,15 +1,13 @@
|
|||||||
package mineplex.core.disguise.disguises;
|
package mineplex.core.disguise.disguises;
|
||||||
|
|
||||||
import org.spigotmc.ProtocolData;
|
|
||||||
|
|
||||||
public abstract class DisguiseHuman extends DisguiseLiving
|
public abstract class DisguiseHuman extends DisguiseLiving
|
||||||
{
|
{
|
||||||
public DisguiseHuman(org.bukkit.entity.Entity entity)
|
public DisguiseHuman(org.bukkit.entity.Entity entity)
|
||||||
{
|
{
|
||||||
super(entity);
|
super(entity);
|
||||||
|
|
||||||
DataWatcher.a(10, new ProtocolData.HiddenByte( (byte) 0 ) ); // Spigot - protocol patch, handle new metadata value
|
DataWatcher.a(10, (byte) 0); // todo
|
||||||
DataWatcher.a(16, new ProtocolData.DualByte( (byte) 0, (byte) 0 ) );
|
DataWatcher.a(16, (byte) 0);
|
||||||
DataWatcher.a(17, Float.valueOf(0.0F));
|
DataWatcher.a(17, Float.valueOf(0.0F));
|
||||||
DataWatcher.a(18, Integer.valueOf(0));
|
DataWatcher.a(18, Integer.valueOf(0));
|
||||||
}
|
}
|
||||||
|
@ -13,12 +13,6 @@ public abstract class DisguiseInsentient extends DisguiseLiving
|
|||||||
|
|
||||||
DataWatcher.a(3, Byte.valueOf((byte) 0));
|
DataWatcher.a(3, Byte.valueOf((byte) 0));
|
||||||
DataWatcher.a(2, "");
|
DataWatcher.a(2, "");
|
||||||
|
|
||||||
if (!(this instanceof DisguiseArmorStand))
|
|
||||||
{
|
|
||||||
DataWatcher.a(11, Byte.valueOf((byte) 0));
|
|
||||||
DataWatcher.a(10, "");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setName(String name)
|
public void setName(String name)
|
||||||
@ -36,19 +30,17 @@ public abstract class DisguiseInsentient extends DisguiseLiving
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DataWatcher.watch(10, name);
|
|
||||||
DataWatcher.watch(2, name);
|
DataWatcher.watch(2, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public boolean hasCustomName()
|
public boolean hasCustomName()
|
||||||
{
|
{
|
||||||
return DataWatcher.getString(10).length() > 0;
|
return DataWatcher.getString(2).length() > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCustomNameVisible(boolean visible)
|
public void setCustomNameVisible(boolean visible)
|
||||||
{
|
{
|
||||||
DataWatcher.watch(11, Byte.valueOf((byte)(visible ? 1 : 0)));
|
|
||||||
DataWatcher.watch(3, Byte.valueOf((byte)(visible ? 1 : 0)));
|
DataWatcher.watch(3, Byte.valueOf((byte)(visible ? 1 : 0)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,12 +4,12 @@ import java.util.ArrayList;
|
|||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.craftbukkit.v1_7_R4.inventory.CraftItemStack;
|
import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import net.minecraft.server.v1_7_R4.EntityLiving;
|
import net.minecraft.server.v1_8_R3.EntityLiving;
|
||||||
import net.minecraft.server.v1_7_R4.Packet;
|
import net.minecraft.server.v1_8_R3.Packet;
|
||||||
import net.minecraft.server.v1_7_R4.PacketPlayOutEntityEquipment;
|
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityEquipment;
|
||||||
|
|
||||||
public abstract class DisguiseLiving extends DisguiseBase
|
public abstract class DisguiseLiving extends DisguiseBase
|
||||||
{
|
{
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
package mineplex.core.disguise.disguises;
|
package mineplex.core.disguise.disguises;
|
||||||
|
|
||||||
import net.minecraft.server.v1_7_R4.EnumEntitySize;
|
import net.minecraft.server.v1_8_R3.MathHelper;
|
||||||
import net.minecraft.server.v1_7_R4.MathHelper;
|
import net.minecraft.server.v1_8_R3.Packet;
|
||||||
import net.minecraft.server.v1_7_R4.Packet;
|
import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving;
|
||||||
import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntityLiving;
|
|
||||||
|
|
||||||
public class DisguiseMagmaCube extends DisguiseInsentient
|
public class DisguiseMagmaCube extends DisguiseInsentient
|
||||||
{
|
{
|
||||||
@ -29,9 +28,9 @@ public class DisguiseMagmaCube extends DisguiseInsentient
|
|||||||
PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving();
|
PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving();
|
||||||
packet.a = Entity.getId();
|
packet.a = Entity.getId();
|
||||||
packet.b = (byte) 62;
|
packet.b = (byte) 62;
|
||||||
packet.c = (int)EnumEntitySize.SIZE_2.a(Entity.locX);
|
packet.c = (int)MathHelper.floor(Entity.locX * 32D);
|
||||||
packet.d = (int)MathHelper.floor(Entity.locY * 32.0D);
|
packet.d = (int)MathHelper.floor(Entity.locY * 32.0D);
|
||||||
packet.e = (int)EnumEntitySize.SIZE_2.a(Entity.locZ);
|
packet.e = (int)MathHelper.floor(Entity.locZ * 32D);
|
||||||
packet.i = (byte) ((int) (Entity.yaw * 256.0F / 360.0F));
|
packet.i = (byte) ((int) (Entity.yaw * 256.0F / 360.0F));
|
||||||
packet.j = (byte) ((int) (Entity.pitch * 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.k = (byte) ((int) (Entity.yaw * 256.0F / 360.0F));
|
||||||
|
@ -5,18 +5,20 @@ import java.util.UUID;
|
|||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.spigotmc.ProtocolData;
|
|
||||||
|
import com.mojang.authlib.GameProfile;
|
||||||
|
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
import mineplex.core.common.util.UtilServer;
|
import mineplex.core.common.util.UtilServer;
|
||||||
import net.minecraft.server.v1_7_R4.MathHelper;
|
import net.minecraft.server.v1_8_R3.MathHelper;
|
||||||
import net.minecraft.server.v1_7_R4.Packet;
|
import net.minecraft.server.v1_8_R3.Packet;
|
||||||
import net.minecraft.server.v1_7_R4.PacketPlayInSettings;
|
import net.minecraft.server.v1_8_R3.PacketPlayInSettings;
|
||||||
import net.minecraft.server.v1_7_R4.PacketPlayOutNamedEntitySpawn;
|
import net.minecraft.server.v1_8_R3.PacketPlayOutNamedEntitySpawn;
|
||||||
import net.minecraft.server.v1_7_R4.PacketPlayOutPlayerInfo;
|
import net.minecraft.server.v1_8_R3.PacketPlayOutPlayerInfo;
|
||||||
import net.minecraft.util.com.mojang.authlib.GameProfile;
|
import net.minecraft.server.v1_8_R3.WorldSettings;
|
||||||
|
import net.minecraft.server.v1_8_R3.PacketPlayOutPlayerInfo.EnumPlayerInfoAction;
|
||||||
|
|
||||||
public class DisguisePlayer extends DisguiseHuman
|
public class DisguisePlayer extends DisguiseHuman
|
||||||
{
|
{
|
||||||
@ -69,35 +71,19 @@ public class DisguisePlayer extends DisguiseHuman
|
|||||||
return _sneaking;
|
return _sneaking;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Packet getOldInfoPacket(boolean add)
|
|
||||||
{
|
|
||||||
PacketPlayOutPlayerInfo playerInfo = new PacketPlayOutPlayerInfo();
|
|
||||||
|
|
||||||
if(Entity instanceof Player)
|
|
||||||
{
|
|
||||||
playerInfo.username = Entity.getName();
|
|
||||||
playerInfo.action = add ? 0 : 4;
|
|
||||||
playerInfo.ping = 90;
|
|
||||||
playerInfo.player = ((CraftPlayer) (Player) Entity).getProfile();
|
|
||||||
playerInfo.gamemode = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return playerInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Packet getNewInfoPacket(boolean add)
|
public Packet getNewInfoPacket(boolean add)
|
||||||
{
|
{
|
||||||
PacketPlayOutPlayerInfo newDisguiseInfo = new PacketPlayOutPlayerInfo();
|
PacketPlayOutPlayerInfo newDisguiseInfo = new PacketPlayOutPlayerInfo();
|
||||||
newDisguiseInfo.username = _profile.getName();
|
newDisguiseInfo.a = add ? EnumPlayerInfoAction.ADD_PLAYER : EnumPlayerInfoAction.REMOVE_PLAYER;
|
||||||
newDisguiseInfo.action = add ? 0 : 4;
|
|
||||||
newDisguiseInfo.ping = 90;
|
PacketPlayOutPlayerInfo.PlayerInfoData info = newDisguiseInfo.new PlayerInfoData(_profile, 90,
|
||||||
newDisguiseInfo.player = _profile;
|
WorldSettings.EnumGamemode.SURVIVAL, null);
|
||||||
newDisguiseInfo.gamemode = 0;
|
|
||||||
|
newDisguiseInfo.b.add(info);
|
||||||
|
|
||||||
return newDisguiseInfo;
|
return newDisguiseInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("static-access")
|
|
||||||
@Override
|
@Override
|
||||||
public void UpdateDataWatcher()
|
public void UpdateDataWatcher()
|
||||||
{
|
{
|
||||||
@ -119,7 +105,7 @@ public class DisguisePlayer extends DisguiseHuman
|
|||||||
|
|
||||||
PacketPlayOutNamedEntitySpawn packet = new PacketPlayOutNamedEntitySpawn();
|
PacketPlayOutNamedEntitySpawn packet = new PacketPlayOutNamedEntitySpawn();
|
||||||
packet.a = Entity.getId();
|
packet.a = Entity.getId();
|
||||||
packet.b = _profile;
|
packet.b = _profile.getId();
|
||||||
packet.c = MathHelper.floor(loc.getX() * 32.0D);
|
packet.c = MathHelper.floor(loc.getX() * 32.0D);
|
||||||
packet.d = MathHelper.floor(loc.getY() * 32.0D);
|
packet.d = MathHelper.floor(loc.getY() * 32.0D);
|
||||||
packet.e = MathHelper.floor(loc.getZ() * 32.0D);
|
packet.e = MathHelper.floor(loc.getZ() * 32.0D);
|
||||||
@ -135,7 +121,7 @@ public class DisguisePlayer extends DisguiseHuman
|
|||||||
{
|
{
|
||||||
PacketPlayOutNamedEntitySpawn packet = new PacketPlayOutNamedEntitySpawn();
|
PacketPlayOutNamedEntitySpawn packet = new PacketPlayOutNamedEntitySpawn();
|
||||||
packet.a = Entity.getId();
|
packet.a = Entity.getId();
|
||||||
packet.b = _profile;
|
packet.b = _profile.getId();
|
||||||
packet.c = MathHelper.floor(Entity.locX * 32.0D);
|
packet.c = MathHelper.floor(Entity.locX * 32.0D);
|
||||||
packet.d = MathHelper.floor(Entity.locY * 32.0D);
|
packet.d = MathHelper.floor(Entity.locY * 32.0D);
|
||||||
packet.e = MathHelper.floor(Entity.locZ * 32.0D);
|
packet.e = MathHelper.floor(Entity.locZ * 32.0D);
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
package mineplex.core.disguise.disguises;
|
package mineplex.core.disguise.disguises;
|
||||||
|
|
||||||
import net.minecraft.server.v1_7_R4.EnumEntitySize;
|
import net.minecraft.server.v1_8_R3.MathHelper;
|
||||||
import net.minecraft.server.v1_7_R4.MathHelper;
|
import net.minecraft.server.v1_8_R3.Packet;
|
||||||
import net.minecraft.server.v1_7_R4.Packet;
|
import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving;
|
||||||
import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntityLiving;
|
|
||||||
|
|
||||||
public class DisguiseRabbit extends DisguiseInsentient
|
public class DisguiseRabbit extends DisguiseInsentient
|
||||||
{
|
{
|
||||||
@ -25,9 +24,9 @@ public class DisguiseRabbit extends DisguiseInsentient
|
|||||||
PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving();
|
PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving();
|
||||||
packet.a = Entity.getId();
|
packet.a = Entity.getId();
|
||||||
packet.b = (byte) 101;
|
packet.b = (byte) 101;
|
||||||
packet.c = (int) EnumEntitySize.SIZE_2.a(Entity.locX);
|
packet.c = (int) MathHelper.floor(Entity.locX * 32D);
|
||||||
packet.d = (int) MathHelper.floor(Entity.locY * 32.0D);
|
packet.d = (int) MathHelper.floor(Entity.locY * 32.0D);
|
||||||
packet.e = (int) EnumEntitySize.SIZE_2.a(Entity.locZ);
|
packet.e = (int) MathHelper.floor(Entity.locZ * 32D);
|
||||||
packet.i = (byte) ((int) (Entity.yaw * 256.0F / 360.0F));
|
packet.i = (byte) ((int) (Entity.yaw * 256.0F / 360.0F));
|
||||||
packet.j = (byte) ((int) (Entity.pitch * 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.k = (byte) ((int) (Entity.yaw * 256.0F / 360.0F));
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
package mineplex.core.disguise.disguises;
|
package mineplex.core.disguise.disguises;
|
||||||
|
|
||||||
import net.minecraft.server.v1_7_R4.EnumEntitySize;
|
import net.minecraft.server.v1_8_R3.MathHelper;
|
||||||
import net.minecraft.server.v1_7_R4.MathHelper;
|
import net.minecraft.server.v1_8_R3.Packet;
|
||||||
import net.minecraft.server.v1_7_R4.Packet;
|
import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving;
|
||||||
import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntityLiving;
|
|
||||||
|
|
||||||
public class DisguiseSlime extends DisguiseInsentient
|
public class DisguiseSlime extends DisguiseInsentient
|
||||||
{
|
{
|
||||||
@ -29,9 +28,9 @@ public class DisguiseSlime extends DisguiseInsentient
|
|||||||
PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving();
|
PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving();
|
||||||
packet.a = Entity.getId();
|
packet.a = Entity.getId();
|
||||||
packet.b = (byte) 55;
|
packet.b = (byte) 55;
|
||||||
packet.c = (int)EnumEntitySize.SIZE_2.a(Entity.locX);
|
packet.c = (int) MathHelper.floor(Entity.locX * 32D);
|
||||||
packet.d = (int)MathHelper.floor(Entity.locY * 32.0D);
|
packet.d = (int)MathHelper.floor(Entity.locY * 32.0D);
|
||||||
packet.e = (int)EnumEntitySize.SIZE_2.a(Entity.locZ);
|
packet.e = (int)MathHelper.floor(Entity.locZ * 32D);
|
||||||
packet.i = (byte) ((int) (Entity.yaw * 256.0F / 360.0F));
|
packet.i = (byte) ((int) (Entity.yaw * 256.0F / 360.0F));
|
||||||
packet.j = (byte) ((int) (Entity.pitch * 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.k = (byte) ((int) (Entity.yaw * 256.0F / 360.0F));
|
||||||
|
@ -15,12 +15,12 @@ public class DisguiseWither extends DisguiseMonster
|
|||||||
DataWatcher.a(20, new Integer(0));
|
DataWatcher.a(20, new Integer(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
public int ca()
|
public int getInvulTime()
|
||||||
{
|
{
|
||||||
return DataWatcher.getInt(20);
|
return DataWatcher.getInt(20);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void s(int i)
|
public void setInvulTime(int i)
|
||||||
{
|
{
|
||||||
DataWatcher.watch(20, Integer.valueOf(i));
|
DataWatcher.watch(20, Integer.valueOf(i));
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package mineplex.core.disguise.disguises;
|
package mineplex.core.disguise.disguises;
|
||||||
|
|
||||||
import net.minecraft.server.v1_7_R4.BlockCloth;
|
|
||||||
import org.bukkit.entity.*;
|
import org.bukkit.entity.*;
|
||||||
|
|
||||||
public class DisguiseWolf extends DisguiseTameableAnimal
|
public class DisguiseWolf extends DisguiseTameableAnimal
|
||||||
@ -11,7 +10,7 @@ public class DisguiseWolf extends DisguiseTameableAnimal
|
|||||||
|
|
||||||
DataWatcher.a(18, new Float(20F));
|
DataWatcher.a(18, new Float(20F));
|
||||||
DataWatcher.a(19, new Byte((byte)0));
|
DataWatcher.a(19, new Byte((byte)0));
|
||||||
DataWatcher.a(20, new Byte((byte)BlockCloth.b(1)));
|
DataWatcher.a(20, new Byte((byte)14));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAngry()
|
public boolean isAngry()
|
||||||
|
@ -5,11 +5,11 @@ import java.sql.SQLException;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.craftbukkit.libs.com.google.gson.Gson;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
import mineplex.core.MiniDbClientPlugin;
|
import mineplex.core.MiniDbClientPlugin;
|
||||||
import mineplex.core.account.CoreClientManager;
|
import mineplex.core.account.CoreClientManager;
|
||||||
import mineplex.core.account.event.ClientWebResponseEvent;
|
import mineplex.core.account.event.ClientWebResponseEvent;
|
||||||
|
@ -3,17 +3,21 @@ package mineplex.core.friend.ui;
|
|||||||
import mineplex.core.command.CommandCenter;
|
import mineplex.core.command.CommandCenter;
|
||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
import mineplex.core.common.util.Callback;
|
import mineplex.core.common.util.Callback;
|
||||||
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
import mineplex.core.friend.FriendManager;
|
import mineplex.core.friend.FriendManager;
|
||||||
import mineplex.core.itemstack.ItemBuilder;
|
import mineplex.core.itemstack.ItemBuilder;
|
||||||
import net.minecraft.server.v1_7_R4.ContainerAnvil;
|
import net.minecraft.server.v1_8_R3.BlockPosition;
|
||||||
import net.minecraft.server.v1_7_R4.EntityHuman;
|
import net.minecraft.server.v1_8_R3.Blocks;
|
||||||
import net.minecraft.server.v1_7_R4.EntityPlayer;
|
import net.minecraft.server.v1_8_R3.ChatMessage;
|
||||||
import net.minecraft.server.v1_7_R4.PacketPlayOutOpenWindow;
|
import net.minecraft.server.v1_8_R3.ContainerAnvil;
|
||||||
|
import net.minecraft.server.v1_8_R3.EntityHuman;
|
||||||
|
import net.minecraft.server.v1_8_R3.EntityPlayer;
|
||||||
|
import net.minecraft.server.v1_8_R3.PacketPlayOutOpenWindow;
|
||||||
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
@ -31,7 +35,7 @@ public class AddFriendPage implements Listener
|
|||||||
|
|
||||||
public AnvilContainer(EntityHuman entity)
|
public AnvilContainer(EntityHuman entity)
|
||||||
{
|
{
|
||||||
super(entity.inventory, entity.world, 0, 0, 0, entity);
|
super(entity.inventory, entity.world, new BlockPosition(0, 0, 0), entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -48,10 +52,10 @@ public class AddFriendPage implements Listener
|
|||||||
|
|
||||||
if (getSlot(2).hasItem())
|
if (getSlot(2).hasItem())
|
||||||
{
|
{
|
||||||
net.minecraft.server.v1_7_R4.ItemStack itemstack = getSlot(2).getItem();
|
net.minecraft.server.v1_8_R3.ItemStack itemstack = getSlot(2).getItem();
|
||||||
|
|
||||||
if (StringUtils.isBlank(origString))
|
if (StringUtils.isBlank(origString))
|
||||||
itemstack.t();
|
itemstack.r();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
itemstack.c(this.n);
|
itemstack.c(this.n);
|
||||||
@ -163,9 +167,9 @@ public class AddFriendPage implements Listener
|
|||||||
AnvilContainer container = new AnvilContainer(p);
|
AnvilContainer container = new AnvilContainer(p);
|
||||||
int c = p.nextContainerCounter();
|
int c = p.nextContainerCounter();
|
||||||
|
|
||||||
PacketPlayOutOpenWindow packet = new PacketPlayOutOpenWindow(c, 8, "Repairing", 0, true);
|
PacketPlayOutOpenWindow packet = new PacketPlayOutOpenWindow(c, "minecraft:anvil", new ChatMessage(Blocks.ANVIL.a() + ".name", new Object[0]));
|
||||||
|
|
||||||
p.playerConnection.sendPacket(packet);
|
UtilPlayer.sendPacket(_player, packet);
|
||||||
|
|
||||||
// Set their active container to the container
|
// Set their active container to the container
|
||||||
p.activeContainer = container;
|
p.activeContainer = container;
|
||||||
|
@ -8,8 +8,8 @@ import java.util.Iterator;
|
|||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||||
import org.bukkit.craftbukkit.v1_7_R4.event.CraftEventFactory;
|
import org.bukkit.craftbukkit.v1_8_R3.event.CraftEventFactory;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
@ -21,7 +21,7 @@ import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
|||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
import org.bukkit.inventory.Inventory;
|
import org.bukkit.inventory.Inventory;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import net.minecraft.server.v1_7_R4.EntityPlayer;
|
import net.minecraft.server.v1_8_R3.EntityPlayer;
|
||||||
|
|
||||||
import mineplex.core.command.CommandCenter;
|
import mineplex.core.command.CommandCenter;
|
||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
|
@ -1,85 +0,0 @@
|
|||||||
package mineplex.core.friend.ui;
|
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import net.minecraft.server.v1_7_R4.EntityPlayer;
|
|
||||||
import net.minecraft.server.v1_7_R4.PacketPlayOutPlayerInfo;
|
|
||||||
import net.minecraft.util.com.mojang.authlib.GameProfile;
|
|
||||||
|
|
||||||
public class LineTracker
|
|
||||||
{
|
|
||||||
private String _line = null;
|
|
||||||
private String _oldLine = null;
|
|
||||||
private PacketPlayOutPlayerInfo _clearOldPacket;
|
|
||||||
private PacketPlayOutPlayerInfo _addNewPacket;
|
|
||||||
private PacketPlayOutPlayerInfo _clearNewPacket;
|
|
||||||
|
|
||||||
public LineTracker(String line)
|
|
||||||
{
|
|
||||||
setLine(line);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean setLine(String s)
|
|
||||||
{
|
|
||||||
if (s != null && s.length() > 16)
|
|
||||||
s = s.substring(0, 16);
|
|
||||||
|
|
||||||
if (_line != null && _line.compareTo(s) == 0)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
_oldLine = _line;
|
|
||||||
_line = s;
|
|
||||||
|
|
||||||
if (_oldLine != null)
|
|
||||||
{
|
|
||||||
_clearOldPacket = new PacketPlayOutPlayerInfo();
|
|
||||||
_clearOldPacket.username = _oldLine;
|
|
||||||
_clearOldPacket.action = PacketPlayOutPlayerInfo.REMOVE_PLAYER;
|
|
||||||
_clearOldPacket.ping = 0;
|
|
||||||
_clearOldPacket.player = new GameProfile(UUID.randomUUID(), _oldLine);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_line != null)
|
|
||||||
{
|
|
||||||
_addNewPacket = new PacketPlayOutPlayerInfo();
|
|
||||||
_addNewPacket.username = _line;
|
|
||||||
_addNewPacket.action = PacketPlayOutPlayerInfo.ADD_PLAYER;
|
|
||||||
_addNewPacket.ping = 0;
|
|
||||||
_addNewPacket.player = new GameProfile(UUID.randomUUID(), _line);
|
|
||||||
|
|
||||||
_clearNewPacket = new PacketPlayOutPlayerInfo();
|
|
||||||
_clearNewPacket.username = _line;
|
|
||||||
_clearNewPacket.action = PacketPlayOutPlayerInfo.REMOVE_PLAYER;
|
|
||||||
_clearNewPacket.ping = 0;
|
|
||||||
_clearNewPacket.player = new GameProfile(UUID.randomUUID(), _line);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void displayLineToPlayer(EntityPlayer entityPlayer)
|
|
||||||
{
|
|
||||||
if (_oldLine != null)
|
|
||||||
{
|
|
||||||
entityPlayer.playerConnection.sendPacket(_clearOldPacket);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_line != null)
|
|
||||||
{
|
|
||||||
entityPlayer.playerConnection.sendPacket(_addNewPacket);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void removeLineForPlayer(EntityPlayer entityPlayer)
|
|
||||||
{
|
|
||||||
if (_line != null)
|
|
||||||
{
|
|
||||||
entityPlayer.playerConnection.sendPacket(_clearNewPacket);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void clearOldLine()
|
|
||||||
{
|
|
||||||
_oldLine = null;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,116 +0,0 @@
|
|||||||
package mineplex.core.friend.ui;
|
|
||||||
|
|
||||||
import java.util.HashSet;
|
|
||||||
|
|
||||||
import net.minecraft.server.v1_7_R4.EntityPlayer;
|
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
|
|
||||||
import mineplex.core.common.util.NautHashMap;
|
|
||||||
|
|
||||||
public class TabList implements Listener
|
|
||||||
{
|
|
||||||
private static int MAX_SLOTS = 64;
|
|
||||||
private static int COLUMN_SLOTS = 16;
|
|
||||||
|
|
||||||
private static NautHashMap<Integer, String> _invisibleHolders = new NautHashMap<Integer, String>();
|
|
||||||
|
|
||||||
private NautHashMap<Integer, LineTracker> _tabSlots = new NautHashMap<Integer, LineTracker>();
|
|
||||||
private HashSet<Integer> _updatedSlots = new HashSet<Integer>();
|
|
||||||
|
|
||||||
private boolean _update;
|
|
||||||
|
|
||||||
static {
|
|
||||||
String spaces = "";
|
|
||||||
|
|
||||||
for (int i=0; i < MAX_SLOTS; i++)
|
|
||||||
{
|
|
||||||
int markerSymbol = i / COLUMN_SLOTS;
|
|
||||||
String symbol = null;
|
|
||||||
|
|
||||||
if (i % COLUMN_SLOTS == 0)
|
|
||||||
spaces = "";
|
|
||||||
else
|
|
||||||
spaces += " ";
|
|
||||||
|
|
||||||
if (markerSymbol == 0)
|
|
||||||
{
|
|
||||||
symbol = ChatColor.GREEN + "";
|
|
||||||
}
|
|
||||||
else if (markerSymbol == 1)
|
|
||||||
{
|
|
||||||
symbol = ChatColor.RED + "";
|
|
||||||
}
|
|
||||||
else if (markerSymbol == 2)
|
|
||||||
{
|
|
||||||
symbol = ChatColor.BLUE + "";
|
|
||||||
}
|
|
||||||
else if (markerSymbol == 3)
|
|
||||||
{
|
|
||||||
symbol = ChatColor.BLACK + "";
|
|
||||||
}
|
|
||||||
|
|
||||||
_invisibleHolders.put(i, symbol + spaces);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public TabList()
|
|
||||||
{
|
|
||||||
for (Integer i=0; i < MAX_SLOTS; i++)
|
|
||||||
{
|
|
||||||
_tabSlots.put(i, new LineTracker(_invisibleHolders.get(i)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void set(int column, int row, String lineContent)
|
|
||||||
{
|
|
||||||
int index = row * 4 + column;
|
|
||||||
|
|
||||||
if (index >= MAX_SLOTS)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (lineContent == null || lineContent.isEmpty())
|
|
||||||
lineContent = _invisibleHolders.get(index);
|
|
||||||
|
|
||||||
if (_tabSlots.get(index).setLine(lineContent))
|
|
||||||
{
|
|
||||||
_updatedSlots.add(index);
|
|
||||||
_update = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void refreshForPlayer(Player player)
|
|
||||||
{
|
|
||||||
EntityPlayer entityPlayer = ((CraftPlayer)player).getHandle();
|
|
||||||
|
|
||||||
int indexChanged = MAX_SLOTS;
|
|
||||||
|
|
||||||
for (int i=0; i < MAX_SLOTS; i++)
|
|
||||||
{
|
|
||||||
if (indexChanged == MAX_SLOTS && _updatedSlots.contains(i))
|
|
||||||
{
|
|
||||||
indexChanged = i;
|
|
||||||
}
|
|
||||||
else if (indexChanged != MAX_SLOTS && !_updatedSlots.contains(i))
|
|
||||||
{
|
|
||||||
_tabSlots.get(i).removeLineForPlayer(entityPlayer);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i=indexChanged; i < MAX_SLOTS; i++)
|
|
||||||
{
|
|
||||||
_tabSlots.get(i).displayLineToPlayer(entityPlayer);
|
|
||||||
}
|
|
||||||
|
|
||||||
_update = false;
|
|
||||||
_updatedSlots.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean shouldUpdate()
|
|
||||||
{
|
|
||||||
return _update;
|
|
||||||
}
|
|
||||||
}
|
|
@ -21,8 +21,8 @@ import org.bukkit.Material;
|
|||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
|
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
|
||||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftFallingSand;
|
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftFallingSand;
|
||||||
import org.bukkit.entity.FallingBlock;
|
import org.bukkit.entity.FallingBlock;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ import org.bukkit.Color;
|
|||||||
import org.bukkit.FireworkEffect;
|
import org.bukkit.FireworkEffect;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.FireworkEffect.Type;
|
import org.bukkit.FireworkEffect.Type;
|
||||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||||
import org.bukkit.entity.EnderPearl;
|
import org.bukkit.entity.EnderPearl;
|
||||||
import org.bukkit.entity.Item;
|
import org.bukkit.entity.Item;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
@ -4,7 +4,7 @@ import java.util.HashSet;
|
|||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftFallingSand;
|
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftFallingSand;
|
||||||
import org.bukkit.entity.Bat;
|
import org.bukkit.entity.Bat;
|
||||||
import org.bukkit.entity.FallingBlock;
|
import org.bukkit.entity.FallingBlock;
|
||||||
import org.bukkit.entity.Item;
|
import org.bukkit.entity.Item;
|
||||||
|
@ -2,6 +2,7 @@ package mineplex.core.gadget.gadgets;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@ -111,7 +112,7 @@ public class ItemPaintbrush extends ItemGadget
|
|||||||
if (!UtilGear.isMat(player.getItemInHand(), Material.WOOD_SWORD))
|
if (!UtilGear.isMat(player.getItemInHand(), Material.WOOD_SWORD))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Block block = player.getTargetBlock(null, 100);
|
Block block = player.getTargetBlock((HashSet<Byte>)null, 100);
|
||||||
if (block == null || block.getType() != Material.STAINED_CLAY)
|
if (block == null || block.getType() != Material.STAINED_CLAY)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -158,7 +159,7 @@ public class ItemPaintbrush extends ItemGadget
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Block block = player.getTargetBlock(null, 100);
|
Block block = player.getTargetBlock((HashSet<Byte>)null, 100);
|
||||||
if (block == null || block.getType() != Material.WOOL)
|
if (block == null || block.getType() != Material.WOOL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package mineplex.core.gadget.gadgets;
|
package mineplex.core.gadget.gadgets;
|
||||||
|
|
||||||
import net.minecraft.util.com.mojang.authlib.GameProfile;
|
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
@ -9,6 +7,8 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.player.*;
|
import org.bukkit.event.player.*;
|
||||||
|
|
||||||
|
import com.mojang.authlib.GameProfile;
|
||||||
|
|
||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
import mineplex.core.common.util.ProfileLoader;
|
import mineplex.core.common.util.ProfileLoader;
|
||||||
import mineplex.core.common.util.UUIDFetcher;
|
import mineplex.core.common.util.UUIDFetcher;
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
package mineplex.core.gadget.gadgets;
|
package mineplex.core.gadget.gadgets;
|
||||||
|
|
||||||
import net.minecraft.util.com.mojang.authlib.GameProfile;
|
|
||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.player.*;
|
import org.bukkit.event.player.*;
|
||||||
|
|
||||||
|
import com.mojang.authlib.GameProfile;
|
||||||
|
|
||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
import mineplex.core.common.util.ProfileLoader;
|
import mineplex.core.common.util.ProfileLoader;
|
||||||
import mineplex.core.common.util.UUIDFetcher;
|
import mineplex.core.common.util.UUIDFetcher;
|
||||||
|
@ -27,7 +27,7 @@ public class ParticleLegend extends ParticleGadget
|
|||||||
C.cGreen + "Unlocked with Legend Rank",
|
C.cGreen + "Unlocked with Legend Rank",
|
||||||
},
|
},
|
||||||
-2,
|
-2,
|
||||||
Material.ENDER_PORTAL, (byte)0);
|
Material.ENDER_PORTAL_FRAME, (byte)0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
@ -23,7 +23,7 @@ public enum GameDisplay
|
|||||||
Draw("Draw My Thing", Material.BOOK_AND_QUILL, (byte)0, GameCategory.CLASSICS, 15),
|
Draw("Draw My Thing", Material.BOOK_AND_QUILL, (byte)0, GameCategory.CLASSICS, 15),
|
||||||
Evolution("Evolution", Material.EMERALD, (byte)0, GameCategory.ARCADE, 16),
|
Evolution("Evolution", Material.EMERALD, (byte)0, GameCategory.ARCADE, 16),
|
||||||
//FlappyBird(FlappyBird.class, "Flappy Bird", Material.FEATHER, (byte)0, GameCategory.ARCADE, 17),
|
//FlappyBird(FlappyBird.class, "Flappy Bird", Material.FEATHER, (byte)0, GameCategory.ARCADE, 17),
|
||||||
Gravity("Gravity", Material.ENDER_PORTAL, (byte)0, GameCategory.EXTRA, 18),
|
Gravity("Gravity", Material.SEA_LANTERN, (byte)0, GameCategory.EXTRA, 18),
|
||||||
Halloween("Halloween Horror", Material.PUMPKIN, (byte)0, GameCategory.CLASSICS, 19),
|
Halloween("Halloween Horror", Material.PUMPKIN, (byte)0, GameCategory.CLASSICS, 19),
|
||||||
HideSeek("Block Hunt", Material.GRASS, (byte)0, GameCategory.CLASSICS, 20),
|
HideSeek("Block Hunt", Material.GRASS, (byte)0, GameCategory.CLASSICS, 20),
|
||||||
HoleInTheWall("Hole in the Wall", Material.STAINED_GLASS, (byte) 2, GameCategory.ARCADE, 52),
|
HoleInTheWall("Hole in the Wall", Material.STAINED_GLASS, (byte) 2, GameCategory.ARCADE, 52),
|
||||||
|
@ -79,7 +79,7 @@ public class GiveawayManager extends MiniDbClientPlugin<PlayerGiveawayData>
|
|||||||
if (_repository.canGiveaway(accountId, giveawayName, cooldownName))
|
if (_repository.canGiveaway(accountId, giveawayName, cooldownName))
|
||||||
{
|
{
|
||||||
UUID uuid = UUID.randomUUID();
|
UUID uuid = UUID.randomUUID();
|
||||||
if (_repository.addGiveaway(accountId, giveaway.getId(), cooldown.getId(), _statusManager.getRegion(), _statusManager.getName(), uuid))
|
if (_repository.addGiveaway(accountId, giveaway.getId(), cooldown.getId(), _statusManager.getRegion(), _statusManager.getCurrentServerName(), uuid))
|
||||||
{
|
{
|
||||||
response = new GiveawayResponse(uuid);
|
response = new GiveawayResponse(uuid);
|
||||||
}
|
}
|
||||||
|
@ -7,22 +7,18 @@ import java.util.HashSet;
|
|||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
import net.minecraft.server.v1_7_R4.DataWatcher;
|
|
||||||
import net.minecraft.server.v1_7_R4.Packet;
|
|
||||||
import net.minecraft.server.v1_7_R4.PacketPlayOutAttachEntity;
|
|
||||||
import net.minecraft.server.v1_7_R4.PacketPlayOutEntityDestroy;
|
|
||||||
import net.minecraft.server.v1_7_R4.PacketPlayOutEntityMetadata;
|
|
||||||
import net.minecraft.server.v1_7_R4.PacketPlayOutEntityTeleport;
|
|
||||||
import net.minecraft.server.v1_7_R4.PacketPlayOutRelEntityMove;
|
|
||||||
import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntity;
|
|
||||||
import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntityLiving;
|
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
|
import net.minecraft.server.v1_8_R3.DataWatcher;
|
||||||
|
import net.minecraft.server.v1_8_R3.Packet;
|
||||||
|
import net.minecraft.server.v1_8_R3.PacketPlayOutEntity;
|
||||||
|
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy;
|
||||||
|
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 mineplex.core.common.util.UtilEnt;
|
import mineplex.core.common.util.UtilEnt;
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
|
|
||||||
@ -34,7 +30,6 @@ public class Hologram
|
|||||||
BLACKLIST, WHITELIST;
|
BLACKLIST, WHITELIST;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Packet _destroy1_7;
|
|
||||||
private Packet _destroy1_8;
|
private Packet _destroy1_8;
|
||||||
/**
|
/**
|
||||||
* 1.7 packets uses both EntityIDs while 1.8 uses only the first.
|
* 1.7 packets uses both EntityIDs while 1.8 uses only the first.
|
||||||
@ -50,7 +45,6 @@ public class Hologram
|
|||||||
private Location _location;
|
private Location _location;
|
||||||
private boolean _makeDestroyPackets = true;
|
private boolean _makeDestroyPackets = true;
|
||||||
private boolean _makeSpawnPackets = true;
|
private boolean _makeSpawnPackets = true;
|
||||||
private Packet[] _packets1_7;
|
|
||||||
private Packet[] _packets1_8;
|
private Packet[] _packets1_8;
|
||||||
private HashSet<String> _playersInList = new HashSet<String>();
|
private HashSet<String> _playersInList = new HashSet<String>();
|
||||||
private ArrayList<Player> _playersTracking = new ArrayList<Player>();
|
private ArrayList<Player> _playersTracking = new ArrayList<Player>();
|
||||||
@ -58,6 +52,7 @@ public class Hologram
|
|||||||
private HologramTarget _target = HologramTarget.BLACKLIST;
|
private HologramTarget _target = HologramTarget.BLACKLIST;
|
||||||
private int _viewDistance = 70;
|
private int _viewDistance = 70;
|
||||||
protected Vector relativeToEntity;
|
protected Vector relativeToEntity;
|
||||||
|
private boolean _hideBoundingBox;
|
||||||
|
|
||||||
public Hologram(HologramManager hologramManager, Location location, String... text)
|
public Hologram(HologramManager hologramManager, Location location, String... text)
|
||||||
{
|
{
|
||||||
@ -83,6 +78,17 @@ public class Hologram
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Warning! Bounding box if hidden will hide holograms for 1.8 to 1.8.2
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Hologram setHideBoundingBox()
|
||||||
|
{
|
||||||
|
_hideBoundingBox = true;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is there a player entry in the hologram for Whitelist and Blacklist
|
* Is there a player entry in the hologram for Whitelist and Blacklist
|
||||||
*/
|
*/
|
||||||
@ -99,7 +105,7 @@ public class Hologram
|
|||||||
return _playersInList.contains(player);
|
return _playersInList.contains(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Packet getDestroyPacket(Player player)
|
protected Packet getDestroyPacket()
|
||||||
{
|
{
|
||||||
if (_makeDestroyPackets)
|
if (_makeDestroyPackets)
|
||||||
{
|
{
|
||||||
@ -107,7 +113,7 @@ public class Hologram
|
|||||||
_makeDestroyPackets = false;
|
_makeDestroyPackets = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return UtilPlayer.is1_8(player) ? _destroy1_8 : _destroy1_7;
|
return _destroy1_8;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Entity getEntityFollowing()
|
public Entity getEntityFollowing()
|
||||||
@ -153,7 +159,7 @@ public class Hologram
|
|||||||
return _playersTracking;
|
return _playersTracking;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Packet[] getSpawnPackets(Player player)
|
protected Packet[] getSpawnPackets()
|
||||||
{
|
{
|
||||||
if (_makeSpawnPackets)
|
if (_makeSpawnPackets)
|
||||||
{
|
{
|
||||||
@ -161,7 +167,7 @@ public class Hologram
|
|||||||
_makeSpawnPackets = false;
|
_makeSpawnPackets = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return UtilPlayer.is1_8(player) ? _packets1_8 : _packets1_7;
|
return _packets1_8;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -219,26 +225,20 @@ public class Hologram
|
|||||||
|
|
||||||
private void makeDestroyPacket()
|
private void makeDestroyPacket()
|
||||||
{
|
{
|
||||||
int[] entityIds1_7 = new int[_entityIds.size() * 2];
|
|
||||||
int[] entityIds1_8 = new int[_entityIds.size()];
|
int[] entityIds1_8 = new int[_entityIds.size()];
|
||||||
|
|
||||||
for (int i = 0; i < _entityIds.size(); i++)
|
for (int i = 0; i < _entityIds.size(); i++)
|
||||||
{
|
{
|
||||||
Entry<Integer, Integer> entry = _entityIds.get(i);
|
Entry<Integer, Integer> entry = _entityIds.get(i);
|
||||||
|
|
||||||
entityIds1_7[i * 2] = entry.getKey();
|
|
||||||
entityIds1_7[(i * 2) + 1] = entry.getValue();
|
|
||||||
|
|
||||||
entityIds1_8[i] = entry.getKey();
|
entityIds1_8[i] = entry.getKey();
|
||||||
}
|
}
|
||||||
|
|
||||||
_destroy1_7 = new PacketPlayOutEntityDestroy(entityIds1_7);
|
|
||||||
_destroy1_8 = new PacketPlayOutEntityDestroy(entityIds1_8);
|
_destroy1_8 = new PacketPlayOutEntityDestroy(entityIds1_8);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void makeSpawnPackets()
|
private void makeSpawnPackets()
|
||||||
{
|
{
|
||||||
_packets1_7 = new Packet[_hologramText.length * 3];
|
|
||||||
_packets1_8 = new Packet[_hologramText.length * 1];
|
_packets1_8 = new Packet[_hologramText.length * 1];
|
||||||
|
|
||||||
if (_entityIds.size() < _hologramText.length)
|
if (_entityIds.size() < _hologramText.length)
|
||||||
@ -263,13 +263,6 @@ public class Hologram
|
|||||||
{
|
{
|
||||||
Entry<Integer, Integer> entityIds = this._entityIds.get(textRow);
|
Entry<Integer, Integer> entityIds = this._entityIds.get(textRow);
|
||||||
|
|
||||||
Packet[] packets1_7 = makeSpawnPackets1_7(textRow, entityIds.getKey(), entityIds.getValue(), _hologramText[textRow]);
|
|
||||||
|
|
||||||
for (int i = 0; i < packets1_7.length; i++)
|
|
||||||
{
|
|
||||||
_packets1_7[(textRow * 3) + i] = packets1_7[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
Packet[] packets1_8 = makeSpawnPackets1_8(textRow, entityIds.getKey(), _hologramText[textRow]);
|
Packet[] packets1_8 = makeSpawnPackets1_8(textRow, entityIds.getKey(), _hologramText[textRow]);
|
||||||
|
|
||||||
for (int i = 0; i < packets1_8.length; i++)
|
for (int i = 0; i < packets1_8.length; i++)
|
||||||
@ -279,47 +272,6 @@ public class Hologram
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Packet[] makeSpawnPackets1_7(int height, int witherId, int horseId, String horseName)
|
|
||||||
{
|
|
||||||
// Spawn wither skull
|
|
||||||
PacketPlayOutSpawnEntity spawnWitherSkull = new PacketPlayOutSpawnEntity();
|
|
||||||
|
|
||||||
spawnWitherSkull.a = witherId;
|
|
||||||
spawnWitherSkull.b = (int) (getLocation().getX() * 32);
|
|
||||||
spawnWitherSkull.c = (int) ((getLocation().getY() + 54.6 + ((double) height * 0.285D)) * 32);
|
|
||||||
spawnWitherSkull.d = (int) (getLocation().getZ() * 32);
|
|
||||||
spawnWitherSkull.j = 66;
|
|
||||||
|
|
||||||
// Spawn horse
|
|
||||||
PacketPlayOutSpawnEntityLiving spawnHorse = new PacketPlayOutSpawnEntityLiving();
|
|
||||||
DataWatcher watcher = new DataWatcher(null);
|
|
||||||
|
|
||||||
spawnHorse.a = horseId;
|
|
||||||
spawnHorse.b = 100;
|
|
||||||
spawnHorse.c = (int) (getLocation().getX() * 32);
|
|
||||||
spawnHorse.d = (int) ((getLocation().getY() + 54.83 + ((double) height * 0.285D) + 0.23D) * 32);
|
|
||||||
spawnHorse.e = (int) (getLocation().getZ() * 32);
|
|
||||||
spawnHorse.l = watcher;
|
|
||||||
|
|
||||||
// Setup datawatcher
|
|
||||||
watcher.a(0, (byte) 0);
|
|
||||||
watcher.a(1, (short) 300);
|
|
||||||
watcher.a(10, horseName);
|
|
||||||
watcher.a(11, (byte) 1);
|
|
||||||
watcher.a(12, -1700000);
|
|
||||||
|
|
||||||
// Make horse ride wither
|
|
||||||
PacketPlayOutAttachEntity attachEntity = new PacketPlayOutAttachEntity();
|
|
||||||
|
|
||||||
attachEntity.b = horseId;
|
|
||||||
attachEntity.c = witherId;
|
|
||||||
|
|
||||||
return new Packet[]
|
|
||||||
{
|
|
||||||
spawnWitherSkull, spawnHorse, attachEntity
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
private Packet[] makeSpawnPackets1_8(int textRow, int entityId, String lineOfText)
|
private Packet[] makeSpawnPackets1_8(int textRow, int entityId, String lineOfText)
|
||||||
{
|
{
|
||||||
PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving();
|
PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving();
|
||||||
@ -328,7 +280,7 @@ public class Hologram
|
|||||||
packet.a = entityId;
|
packet.a = entityId;
|
||||||
packet.b = 30;
|
packet.b = 30;
|
||||||
packet.c = (int) (getLocation().getX() * 32);
|
packet.c = (int) (getLocation().getX() * 32);
|
||||||
packet.d = (int) ((getLocation().getY() + -2.1 + ((double) textRow * 0.285)) * 32);
|
packet.d = (int) ((getLocation().getY() + (_hideBoundingBox ? 0 : -2.1) + ((double) textRow * 0.285)) * 32);
|
||||||
packet.e = (int) (getLocation().getZ() * 32);
|
packet.e = (int) (getLocation().getZ() * 32);
|
||||||
packet.l = watcher;
|
packet.l = watcher;
|
||||||
|
|
||||||
@ -336,7 +288,11 @@ public class Hologram
|
|||||||
watcher.a(0, (byte) 32);
|
watcher.a(0, (byte) 32);
|
||||||
watcher.a(2, lineOfText);
|
watcher.a(2, lineOfText);
|
||||||
watcher.a(3, (byte) 1);
|
watcher.a(3, (byte) 1);
|
||||||
// watcher.a(10, (byte) 16); // TODO Uncomment after we can enforce 1.8.3
|
|
||||||
|
if (_hideBoundingBox)
|
||||||
|
{
|
||||||
|
watcher.a(10, (byte) 16); // TODO Uncomment after we can enforce 1.8.3
|
||||||
|
}
|
||||||
// Also correct hologram positioning
|
// Also correct hologram positioning
|
||||||
|
|
||||||
return new Packet[]
|
return new Packet[]
|
||||||
@ -416,7 +372,7 @@ public class Hologram
|
|||||||
|
|
||||||
if (player.getWorld() == getLocation().getWorld())
|
if (player.getWorld() == getLocation().getWorld())
|
||||||
{
|
{
|
||||||
((CraftPlayer) player).getHandle().playerConnection.sendPacket(getDestroyPacket(player));
|
UtilPlayer.sendPacket(player, getDestroyPacket());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -430,10 +386,7 @@ public class Hologram
|
|||||||
_playersTracking.add(player);
|
_playersTracking.add(player);
|
||||||
itel.remove();
|
itel.remove();
|
||||||
|
|
||||||
for (Packet packet : getSpawnPackets(player))
|
UtilPlayer.sendPacket(player, getSpawnPackets());
|
||||||
{
|
|
||||||
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!canSee.isEmpty())
|
if (!canSee.isEmpty())
|
||||||
@ -445,7 +398,6 @@ public class Hologram
|
|||||||
int y = (int) Math.floor(32 * _lastMovement.getY());
|
int y = (int) Math.floor(32 * _lastMovement.getY());
|
||||||
int z = (int) Math.floor(32 * _lastMovement.getZ());
|
int z = (int) Math.floor(32 * _lastMovement.getZ());
|
||||||
|
|
||||||
Packet[] packets1_7 = new Packet[_hologramText.length];
|
|
||||||
Packet[] packets1_8 = new Packet[_hologramText.length];
|
Packet[] packets1_8 = new Packet[_hologramText.length];
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
@ -455,14 +407,13 @@ public class Hologram
|
|||||||
_lastMovement.subtract(new Vector(x / 32D, y / 32D, z / 32D));
|
_lastMovement.subtract(new Vector(x / 32D, y / 32D, z / 32D));
|
||||||
for (Entry<Integer, Integer> entityId : this._entityIds)
|
for (Entry<Integer, Integer> entityId : this._entityIds)
|
||||||
{
|
{
|
||||||
PacketPlayOutRelEntityMove relMove = new PacketPlayOutRelEntityMove();
|
PacketPlayOutEntity.PacketPlayOutRelEntityMove relMove = new PacketPlayOutEntity.PacketPlayOutRelEntityMove();
|
||||||
|
|
||||||
relMove.a = entityId.getKey();
|
relMove.a = entityId.getKey();
|
||||||
relMove.b = (byte) x;
|
relMove.b = (byte) x;
|
||||||
relMove.c = (byte) y;
|
relMove.c = (byte) y;
|
||||||
relMove.d = (byte) z;
|
relMove.d = (byte) z;
|
||||||
|
|
||||||
packets1_7[i] = relMove;
|
|
||||||
packets1_8[i] = relMove;
|
packets1_8[i] = relMove;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
@ -475,25 +426,15 @@ public class Hologram
|
|||||||
_lastMovement = new Vector(newLocation.getX() - (x / 32D), 0, newLocation.getZ() - (z / 32D));
|
_lastMovement = new Vector(newLocation.getX() - (x / 32D), 0, newLocation.getZ() - (z / 32D));
|
||||||
|
|
||||||
for (Entry<Integer, Integer> entityId : this._entityIds)
|
for (Entry<Integer, Integer> entityId : this._entityIds)
|
||||||
{
|
|
||||||
for (int b = 0; b < 2; b++)
|
|
||||||
{
|
{
|
||||||
PacketPlayOutEntityTeleport teleportPacket = new PacketPlayOutEntityTeleport();
|
PacketPlayOutEntityTeleport teleportPacket = new PacketPlayOutEntityTeleport();
|
||||||
teleportPacket.a = entityId.getKey();
|
teleportPacket.a = entityId.getKey();
|
||||||
teleportPacket.b = x;
|
teleportPacket.b = x;
|
||||||
teleportPacket.c = (int) Math
|
teleportPacket.c = (int) Math
|
||||||
.floor((oldLocation.getY() + (b == 0 ? 54.6 : -2.1) + ((double) i * 0.285)) * 32);
|
.floor((oldLocation.getY() + (-2.1) + ((double) i * 0.285)) * 32);
|
||||||
teleportPacket.d = z;
|
teleportPacket.d = z;
|
||||||
|
|
||||||
if (b == 0)
|
|
||||||
{
|
|
||||||
packets1_7[i] = teleportPacket;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
packets1_8[i] = teleportPacket;
|
packets1_8[i] = teleportPacket;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
@ -501,9 +442,9 @@ public class Hologram
|
|||||||
|
|
||||||
for (Player player : canSee)
|
for (Player player : canSee)
|
||||||
{
|
{
|
||||||
for (Packet packet : UtilPlayer.is1_8(player) ? packets1_8 : packets1_7)
|
for (Packet packet : packets1_8)
|
||||||
{
|
{
|
||||||
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
|
UtilPlayer.sendPacket(player, packet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -534,10 +475,8 @@ public class Hologram
|
|||||||
|
|
||||||
if (isInUse())
|
if (isInUse())
|
||||||
{
|
{
|
||||||
int[] destroy1_7 = new int[0];
|
|
||||||
int[] destroy1_8 = new int[0];
|
int[] destroy1_8 = new int[0];
|
||||||
|
|
||||||
ArrayList<Packet> packets1_7 = new ArrayList<Packet>();
|
|
||||||
ArrayList<Packet> packets1_8 = new ArrayList<Packet>();
|
ArrayList<Packet> packets1_8 = new ArrayList<Packet>();
|
||||||
|
|
||||||
if (_hologramText.length != newText.length)
|
if (_hologramText.length != newText.length)
|
||||||
@ -555,8 +494,6 @@ public class Hologram
|
|||||||
Entry<Integer, Integer> entry = new HashMap.SimpleEntry(UtilEnt.getNewEntityId(), UtilEnt.getNewEntityId());
|
Entry<Integer, Integer> entry = new HashMap.SimpleEntry(UtilEnt.getNewEntityId(), UtilEnt.getNewEntityId());
|
||||||
_entityIds.add(entry);
|
_entityIds.add(entry);
|
||||||
|
|
||||||
packets1_7.addAll(Arrays.asList(makeSpawnPackets1_7(i, entry.getKey(), entry.getValue(), newText[i])));
|
|
||||||
|
|
||||||
packets1_8.addAll(Arrays.asList(makeSpawnPackets1_8(i, entry.getKey(), newText[i])));
|
packets1_8.addAll(Arrays.asList(makeSpawnPackets1_8(i, entry.getKey(), newText[i])));
|
||||||
}
|
}
|
||||||
// If less lines than previously
|
// If less lines than previously
|
||||||
@ -565,11 +502,6 @@ public class Hologram
|
|||||||
// Remove entity id and send destroy packets
|
// Remove entity id and send destroy packets
|
||||||
Entry<Integer, Integer> entry = _entityIds.remove(newText.length);
|
Entry<Integer, Integer> entry = _entityIds.remove(newText.length);
|
||||||
|
|
||||||
destroy1_7 = Arrays.copyOf(destroy1_7, destroy1_7.length + 2);
|
|
||||||
|
|
||||||
destroy1_7[destroy1_7.length - 2] = entry.getKey();
|
|
||||||
destroy1_7[destroy1_7.length - 1] = entry.getValue();
|
|
||||||
|
|
||||||
destroy1_8 = Arrays.copyOf(destroy1_8, destroy1_8.length + 1);
|
destroy1_8 = Arrays.copyOf(destroy1_8, destroy1_8.length + 1);
|
||||||
destroy1_8[destroy1_8.length - 1] = entry.getKey();
|
destroy1_8[destroy1_8.length - 1] = entry.getKey();
|
||||||
}
|
}
|
||||||
@ -577,21 +509,6 @@ public class Hologram
|
|||||||
{
|
{
|
||||||
// Send update metadata packets
|
// Send update metadata packets
|
||||||
Entry<Integer, Integer> entry = _entityIds.get(i);
|
Entry<Integer, Integer> entry = _entityIds.get(i);
|
||||||
PacketPlayOutEntityMetadata metadata1_7 = new PacketPlayOutEntityMetadata();
|
|
||||||
|
|
||||||
metadata1_7.a = entry.getValue();
|
|
||||||
|
|
||||||
DataWatcher watcher1_7 = new DataWatcher(null);
|
|
||||||
|
|
||||||
watcher1_7.a(0, (byte) 0);
|
|
||||||
watcher1_7.a(1, (short) 300);
|
|
||||||
watcher1_7.a(10, newText[i]);
|
|
||||||
watcher1_7.a(11, (byte) 1);
|
|
||||||
watcher1_7.a(12, -1700000);
|
|
||||||
|
|
||||||
metadata1_7.b = watcher1_7.c();
|
|
||||||
|
|
||||||
packets1_7.add(metadata1_7);
|
|
||||||
|
|
||||||
PacketPlayOutEntityMetadata metadata1_8 = new PacketPlayOutEntityMetadata();
|
PacketPlayOutEntityMetadata metadata1_8 = new PacketPlayOutEntityMetadata();
|
||||||
|
|
||||||
@ -610,11 +527,6 @@ public class Hologram
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (destroy1_7.length > 0)
|
|
||||||
{
|
|
||||||
packets1_7.add(new PacketPlayOutEntityDestroy(destroy1_7));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (destroy1_8.length > 0)
|
if (destroy1_8.length > 0)
|
||||||
{
|
{
|
||||||
packets1_8.add(new PacketPlayOutEntityDestroy(destroy1_8));
|
packets1_8.add(new PacketPlayOutEntityDestroy(destroy1_8));
|
||||||
@ -622,9 +534,9 @@ public class Hologram
|
|||||||
|
|
||||||
for (Player player : _playersTracking)
|
for (Player player : _playersTracking)
|
||||||
{
|
{
|
||||||
for (Packet packet : UtilPlayer.is1_8(player) ? packets1_8 : packets1_7)
|
for (Packet packet : packets1_8)
|
||||||
{
|
{
|
||||||
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
|
UtilPlayer.sendPacket(player, packet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -656,10 +568,7 @@ public class Hologram
|
|||||||
|
|
||||||
for (Player player : _playersTracking)
|
for (Player player : _playersTracking)
|
||||||
{
|
{
|
||||||
for (Packet packet : getSpawnPackets(player))
|
UtilPlayer.sendPacket(player, getSpawnPackets());
|
||||||
{
|
|
||||||
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_lastMovement = new Vector();
|
_lastMovement = new Vector();
|
||||||
@ -678,7 +587,7 @@ public class Hologram
|
|||||||
|
|
||||||
for (Player player : _playersTracking)
|
for (Player player : _playersTracking)
|
||||||
{
|
{
|
||||||
((CraftPlayer) player).getHandle().playerConnection.sendPacket(getDestroyPacket(player));
|
UtilPlayer.sendPacket(player, getDestroyPacket());
|
||||||
}
|
}
|
||||||
|
|
||||||
_playersTracking.clear();
|
_playersTracking.clear();
|
||||||
|
@ -4,13 +4,14 @@ import java.util.ArrayList;
|
|||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
import net.minecraft.server.v1_7_R4.Packet;
|
import net.minecraft.server.v1_8_R3.Packet;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
@ -83,7 +84,7 @@ public class HologramManager implements Listener
|
|||||||
itel2.remove();
|
itel2.remove();
|
||||||
if (player.getWorld() == hologram.getLocation().getWorld())
|
if (player.getWorld() == hologram.getLocation().getWorld())
|
||||||
{
|
{
|
||||||
((CraftPlayer) player).getHandle().playerConnection.sendPacket(hologram.getDestroyPacket(player));
|
UtilPlayer.sendPacket(player, hologram.getDestroyPacket());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -92,10 +93,8 @@ public class HologramManager implements Listener
|
|||||||
if (!hologram.getPlayersTracking().contains(player))
|
if (!hologram.getPlayersTracking().contains(player))
|
||||||
{
|
{
|
||||||
hologram.getPlayersTracking().add(player);
|
hologram.getPlayersTracking().add(player);
|
||||||
for (Packet packet : hologram.getSpawnPackets(player))
|
|
||||||
{
|
UtilPlayer.sendPacket(player, hologram.getSpawnPackets());
|
||||||
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,8 +7,19 @@ import java.util.Map;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.HumanEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
|
import org.bukkit.event.block.BlockBreakEvent;
|
||||||
|
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||||
|
import org.bukkit.event.inventory.InventoryCloseEvent;
|
||||||
|
import org.bukkit.event.inventory.InventoryOpenEvent;
|
||||||
|
import org.bukkit.event.inventory.InventoryType;
|
||||||
|
import org.bukkit.inventory.EnchantingInventory;
|
||||||
|
import org.bukkit.inventory.Inventory;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
import mineplex.core.MiniDbClientPlugin;
|
import mineplex.core.MiniDbClientPlugin;
|
||||||
@ -167,6 +178,101 @@ public class InventoryManager extends MiniDbClientPlugin<ClientInventory>
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onOpenEnchantingTable(InventoryOpenEvent event)
|
||||||
|
{
|
||||||
|
if (event.getInventory().getType() != InventoryType.ENCHANTING)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int level = ((Player) event.getPlayer()).getLevel();
|
||||||
|
|
||||||
|
for (HumanEntity viewer : event.getViewers())
|
||||||
|
{
|
||||||
|
level = Math.max(((Player) viewer).getLevel(), level);
|
||||||
|
}
|
||||||
|
|
||||||
|
event.getInventory().setItem(1, new ItemStack(Material.INK_SACK, level, (byte) 4));
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||||
|
public void onBlockBreak(BlockBreakEvent event)
|
||||||
|
{
|
||||||
|
if (event.getBlock().getType() != Material.ENCHANTMENT_TABLE)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
((EnchantingInventory) event.getBlock().getState()).setSecondary(new ItemStack(Material.AIR));
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onInventoryClose(InventoryCloseEvent event)
|
||||||
|
{
|
||||||
|
if (event.getInventory().getType() != InventoryType.ENCHANTING)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.getViewers().size() > 1)
|
||||||
|
{
|
||||||
|
int level = ((Player) event.getPlayer()).getLevel();
|
||||||
|
|
||||||
|
for (HumanEntity viewer : event.getViewers())
|
||||||
|
{
|
||||||
|
level = Math.max(((Player) viewer).getLevel(), level);
|
||||||
|
}
|
||||||
|
|
||||||
|
event.getInventory().setItem(1, new ItemStack(Material.INK_SACK, level, (byte) 4));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
event.getInventory().setItem(1, new ItemStack(Material.AIR));
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onInventoryClick(final InventoryClickEvent event)
|
||||||
|
{
|
||||||
|
if (event.getView().getTopInventory().getType() != InventoryType.ENCHANTING)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.getSlot() == 1)
|
||||||
|
{
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.getSlot() != 2)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Bukkit.getScheduler().scheduleSyncDelayedTask(getPlugin(), new Runnable()
|
||||||
|
{
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
Inventory inv = event.getInventory();
|
||||||
|
|
||||||
|
if (inv.getViewers().isEmpty())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int level = 0;
|
||||||
|
|
||||||
|
for (HumanEntity viewer : inv.getViewers())
|
||||||
|
{
|
||||||
|
level = Math.max(((Player) viewer).getLevel(), level);
|
||||||
|
}
|
||||||
|
|
||||||
|
event.getInventory().setItem(1, new ItemStack(Material.INK_SACK, level, (byte) 4));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void updateInventoryQueue(UpdateEvent event)
|
public void updateInventoryQueue(UpdateEvent event)
|
||||||
{
|
{
|
||||||
@ -204,7 +310,6 @@ public class InventoryManager extends MiniDbClientPlugin<ClientInventory>
|
|||||||
_inventoryQueue.clear();
|
_inventoryQueue.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ClientInventory AddPlayer(String player)
|
protected ClientInventory AddPlayer(String player)
|
||||||
{
|
{
|
||||||
|
@ -9,9 +9,11 @@ import java.util.Map;
|
|||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Color;
|
import org.bukkit.Color;
|
||||||
|
import org.bukkit.FireworkEffect;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.enchantments.Enchantment;
|
import org.bukkit.enchantments.Enchantment;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.inventory.meta.FireworkEffectMeta;
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
import org.bukkit.inventory.meta.LeatherArmorMeta;
|
import org.bukkit.inventory.meta.LeatherArmorMeta;
|
||||||
import org.bukkit.inventory.meta.SkullMeta;
|
import org.bukkit.inventory.meta.SkullMeta;
|
||||||
@ -54,8 +56,8 @@ public class ItemBuilder
|
|||||||
public ItemBuilder(ItemStack item)
|
public ItemBuilder(ItemStack item)
|
||||||
{
|
{
|
||||||
this(item.getType(), item.getDurability());
|
this(item.getType(), item.getDurability());
|
||||||
this._amount = item.getAmount();
|
_amount = item.getAmount();
|
||||||
this._enchants.putAll(item.getEnchantments());
|
_enchants.putAll(item.getEnchantments());
|
||||||
if (item.getType() == Material.POTION)
|
if (item.getType() == Material.POTION)
|
||||||
{
|
{
|
||||||
// setPotion(Potion.fromItemStack(item));
|
// setPotion(Potion.fromItemStack(item));
|
||||||
@ -63,19 +65,23 @@ public class ItemBuilder
|
|||||||
if (item.hasItemMeta())
|
if (item.hasItemMeta())
|
||||||
{
|
{
|
||||||
ItemMeta meta = item.getItemMeta();
|
ItemMeta meta = item.getItemMeta();
|
||||||
|
|
||||||
if (meta.hasDisplayName())
|
if (meta.hasDisplayName())
|
||||||
{
|
{
|
||||||
this._title = meta.getDisplayName();
|
_title = meta.getDisplayName();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (meta.hasLore())
|
if (meta.hasLore())
|
||||||
{
|
{
|
||||||
this._lore.addAll(meta.getLore());
|
_lore.addAll(meta.getLore());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (meta instanceof LeatherArmorMeta)
|
if (meta instanceof LeatherArmorMeta)
|
||||||
{
|
{
|
||||||
this.setColor(((LeatherArmorMeta) meta).getColor());
|
setColor(((LeatherArmorMeta) meta).getColor());
|
||||||
}
|
}
|
||||||
this._unbreakable = meta.spigot().isUnbreakable();
|
|
||||||
|
_unbreakable = meta.spigot().isUnbreakable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -91,9 +97,9 @@ public class ItemBuilder
|
|||||||
|
|
||||||
public ItemBuilder(Material mat, int amount, short data)
|
public ItemBuilder(Material mat, int amount, short data)
|
||||||
{
|
{
|
||||||
this._mat = mat;
|
_mat = mat;
|
||||||
this._amount = amount;
|
_amount = amount;
|
||||||
this._data = data;
|
_data = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemBuilder(Material mat, short data)
|
public ItemBuilder(Material mat, short data)
|
||||||
@ -115,20 +121,20 @@ public class ItemBuilder
|
|||||||
{
|
{
|
||||||
for (String lore : lores)
|
for (String lore : lores)
|
||||||
{
|
{
|
||||||
this._lore.add(ChatColor.GRAY + lore);
|
_lore.add(ChatColor.GRAY + lore);
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemBuilder addLore(String lore, int maxLength)
|
public ItemBuilder addLore(String lore, int maxLength)
|
||||||
{
|
{
|
||||||
this._lore.addAll(split(lore, maxLength));
|
_lore.addAll(split(lore, maxLength));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemBuilder addLores(List<String> lores)
|
public ItemBuilder addLores(List<String> lores)
|
||||||
{
|
{
|
||||||
this._lore.addAll(lores);
|
_lore.addAll(lores);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -148,7 +154,7 @@ public class ItemBuilder
|
|||||||
|
|
||||||
public ItemStack build()
|
public ItemStack build()
|
||||||
{
|
{
|
||||||
Material mat = this._mat;
|
Material mat = _mat;
|
||||||
if (mat == null)
|
if (mat == null)
|
||||||
{
|
{
|
||||||
mat = Material.AIR;
|
mat = Material.AIR;
|
||||||
@ -158,32 +164,38 @@ public class ItemBuilder
|
|||||||
{
|
{
|
||||||
Bukkit.getLogger().warning("Air material!");
|
Bukkit.getLogger().warning("Air material!");
|
||||||
}
|
}
|
||||||
ItemStack item = new ItemStack(mat, this._amount, this._data);
|
ItemStack item = new ItemStack(mat, _amount, _data);
|
||||||
ItemMeta meta = item.getItemMeta();
|
ItemMeta meta = item.getItemMeta();
|
||||||
if (meta != null)
|
if (meta != null)
|
||||||
{
|
{
|
||||||
if (this._title != null)
|
if (_title != null)
|
||||||
{
|
{
|
||||||
meta.setDisplayName(this._title);
|
meta.setDisplayName(_title);
|
||||||
}
|
}
|
||||||
if (!this._lore.isEmpty())
|
if (!_lore.isEmpty())
|
||||||
{
|
{
|
||||||
meta.setLore(this._lore);
|
meta.setLore(_lore);
|
||||||
}
|
}
|
||||||
if (meta instanceof LeatherArmorMeta)
|
if (meta instanceof LeatherArmorMeta && _color != null)
|
||||||
{
|
{
|
||||||
((LeatherArmorMeta) meta).setColor(this._color);
|
((LeatherArmorMeta) meta).setColor(_color);
|
||||||
}
|
}
|
||||||
else if (meta instanceof SkullMeta && _playerHeadName != null)
|
else if (meta instanceof SkullMeta && _playerHeadName != null)
|
||||||
{
|
{
|
||||||
((SkullMeta) meta).setOwner(_playerHeadName);
|
((SkullMeta) meta).setOwner(_playerHeadName);
|
||||||
}
|
}
|
||||||
|
else if (meta instanceof FireworkEffectMeta && _color != null)
|
||||||
|
{
|
||||||
|
((FireworkEffectMeta) meta).setEffect(FireworkEffect.builder().withColor(_color).build());
|
||||||
|
}
|
||||||
|
|
||||||
meta.spigot().setUnbreakable(isUnbreakable());
|
meta.spigot().setUnbreakable(isUnbreakable());
|
||||||
item.setItemMeta(meta);
|
item.setItemMeta(meta);
|
||||||
}
|
}
|
||||||
item.addUnsafeEnchantments(this._enchants);
|
|
||||||
// if (this.potion != null) {
|
item.addUnsafeEnchantments(_enchants);
|
||||||
// this.potion.apply(item);
|
// if (potion != null) {
|
||||||
|
// potion.apply(item);
|
||||||
// }
|
// }
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
@ -191,150 +203,163 @@ public class ItemBuilder
|
|||||||
@Override
|
@Override
|
||||||
public ItemBuilder clone()
|
public ItemBuilder clone()
|
||||||
{
|
{
|
||||||
ItemBuilder newBuilder = new ItemBuilder(this._mat);
|
ItemBuilder newBuilder = new ItemBuilder(_mat);
|
||||||
|
|
||||||
newBuilder.setTitle(this._title);
|
newBuilder.setTitle(_title);
|
||||||
for (String lore : this._lore)
|
|
||||||
|
for (String lore : _lore)
|
||||||
{
|
{
|
||||||
newBuilder.addLore(lore);
|
newBuilder.addLore(lore);
|
||||||
}
|
}
|
||||||
for (Map.Entry<Enchantment, Integer> entry : this._enchants.entrySet())
|
|
||||||
|
for (Map.Entry<Enchantment, Integer> entry : _enchants.entrySet())
|
||||||
{
|
{
|
||||||
newBuilder.addEnchantment(entry.getKey(), entry.getValue());
|
newBuilder.addEnchantment(entry.getKey(), entry.getValue());
|
||||||
}
|
}
|
||||||
newBuilder.setColor(this._color);
|
|
||||||
// newBuilder.potion = this.potion;
|
newBuilder.setColor(_color);
|
||||||
|
// newBuilder.potion = potion;
|
||||||
|
|
||||||
return newBuilder;
|
return newBuilder;
|
||||||
}
|
}
|
||||||
|
|
||||||
public HashMap<Enchantment, Integer> getAllEnchantments()
|
public HashMap<Enchantment, Integer> getAllEnchantments()
|
||||||
{
|
{
|
||||||
return this._enchants;
|
return _enchants;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Color getColor()
|
public Color getColor()
|
||||||
{
|
{
|
||||||
return this._color;
|
return _color;
|
||||||
}
|
}
|
||||||
|
|
||||||
public short getData()
|
public short getData()
|
||||||
{
|
{
|
||||||
return this._data;
|
return _data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getEnchantmentLevel(Enchantment enchant)
|
public int getEnchantmentLevel(Enchantment enchant)
|
||||||
{
|
{
|
||||||
return this._enchants.get(enchant);
|
return _enchants.get(enchant);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getLore()
|
public List<String> getLore()
|
||||||
{
|
{
|
||||||
return this._lore;
|
return _lore;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTitle()
|
public String getTitle()
|
||||||
{
|
{
|
||||||
return this._title;
|
return _title;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Material getType()
|
public Material getType()
|
||||||
{
|
{
|
||||||
return this._mat;
|
return _mat;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasEnchantment(Enchantment enchant)
|
public boolean hasEnchantment(Enchantment enchant)
|
||||||
{
|
{
|
||||||
return this._enchants.containsKey(enchant);
|
return _enchants.containsKey(enchant);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isItem(ItemStack item)
|
public boolean isItem(ItemStack item)
|
||||||
{
|
{
|
||||||
ItemMeta meta = item.getItemMeta();
|
ItemMeta meta = item.getItemMeta();
|
||||||
if (item.getType() != this.getType())
|
|
||||||
|
if (item.getType() != getType())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!meta.hasDisplayName() && this.getTitle() != null)
|
|
||||||
|
if (!meta.hasDisplayName() && getTitle() != null)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!meta.getDisplayName().equals(this.getTitle()))
|
|
||||||
|
if (!meta.getDisplayName().equals(getTitle()))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!meta.hasLore() && !this.getLore().isEmpty())
|
|
||||||
|
if (!meta.hasLore() && !getLore().isEmpty())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (meta.hasLore())
|
if (meta.hasLore())
|
||||||
{
|
{
|
||||||
for (String lore : meta.getLore())
|
for (String lore : meta.getLore())
|
||||||
{
|
{
|
||||||
if (!this.getLore().contains(lore))
|
if (!getLore().contains(lore))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Enchantment enchant : item.getEnchantments().keySet())
|
for (Enchantment enchant : item.getEnchantments().keySet())
|
||||||
{
|
{
|
||||||
if (!this.hasEnchantment(enchant))
|
if (!hasEnchantment(enchant))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isUnbreakable()
|
public boolean isUnbreakable()
|
||||||
{
|
{
|
||||||
return this._unbreakable;
|
return _unbreakable;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemBuilder setAmount(int amount)
|
public ItemBuilder setAmount(int amount)
|
||||||
{
|
{
|
||||||
this._amount = amount;
|
_amount = amount;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemBuilder setColor(Color color)
|
public ItemBuilder setColor(Color color)
|
||||||
{
|
{
|
||||||
if (!this._mat.name().contains("LEATHER_"))
|
/* (!_mat.name().contains("LEATHER_"))
|
||||||
{
|
{
|
||||||
throw new IllegalArgumentException("Can only dye leather armor!");
|
throw new IllegalArgumentException("Can only dye leather armor!");
|
||||||
}
|
}*/
|
||||||
this._color = color;
|
|
||||||
|
_color = color;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemBuilder setData(short newData)
|
public ItemBuilder setData(short newData)
|
||||||
{
|
{
|
||||||
this._data = newData;
|
_data = newData;
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemBuilder setPotion(Potion potion)
|
public ItemBuilder setPotion(Potion potion)
|
||||||
{
|
{
|
||||||
if (this._mat != Material.POTION)
|
if (_mat != Material.POTION)
|
||||||
{
|
{
|
||||||
this._mat = Material.POTION;
|
_mat = Material.POTION;
|
||||||
}
|
}
|
||||||
// this.potion = potion;
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemBuilder setRawTitle(String title)
|
public ItemBuilder setRawTitle(String title)
|
||||||
{
|
{
|
||||||
this._title = title;
|
_title = title;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemBuilder setTitle(String title)
|
public ItemBuilder setTitle(String title)
|
||||||
{
|
{
|
||||||
this._title = (title == null ? null
|
_title = (title == null ? null
|
||||||
: (title.length() > 2 && ChatColor.getLastColors(title.substring(0, 2)).length() == 0 ? ChatColor.WHITE : ""))
|
: (title.length() > 2 && ChatColor.getLastColors(title.substring(0, 2)).length() == 0 ? ChatColor.WHITE : ""))
|
||||||
+ title;
|
+ title;
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -343,25 +368,29 @@ public class ItemBuilder
|
|||||||
if (title != null && ChatColor.stripColor(title).length() > maxLength)
|
if (title != null && ChatColor.stripColor(title).length() > maxLength)
|
||||||
{
|
{
|
||||||
ArrayList<String> lores = split(title, maxLength);
|
ArrayList<String> lores = split(title, maxLength);
|
||||||
|
|
||||||
for (int i = 1; i < lores.size(); i++)
|
for (int i = 1; i < lores.size(); i++)
|
||||||
{
|
{
|
||||||
this._lore.add(lores.get(i));
|
_lore.add(lores.get(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
title = lores.get(0);
|
title = lores.get(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
setTitle(title);
|
setTitle(title);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemBuilder setType(Material mat)
|
public ItemBuilder setType(Material mat)
|
||||||
{
|
{
|
||||||
this._mat = mat;
|
_mat = mat;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemBuilder setUnbreakable(boolean setUnbreakable)
|
public ItemBuilder setUnbreakable(boolean setUnbreakable)
|
||||||
{
|
{
|
||||||
this._unbreakable = setUnbreakable;return this;
|
_unbreakable = setUnbreakable;
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemBuilder setPlayerHead(String playerName)
|
public ItemBuilder setPlayerHead(String playerName)
|
||||||
|
@ -16,7 +16,7 @@ import mineplex.core.common.util.UtilTime;
|
|||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.craftbukkit.v1_7_R4.inventory.CraftItemStack;
|
import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack;
|
||||||
import org.bukkit.enchantments.Enchantment;
|
import org.bukkit.enchantments.Enchantment;
|
||||||
import org.bukkit.entity.Monster;
|
import org.bukkit.entity.Monster;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
@ -14,9 +14,12 @@ import javax.imageio.ImageIO;
|
|||||||
import mineplex.core.MiniPlugin;
|
import mineplex.core.MiniPlugin;
|
||||||
import mineplex.core.common.util.UtilBlock;
|
import mineplex.core.common.util.UtilBlock;
|
||||||
import mineplex.core.common.util.UtilServer;
|
import mineplex.core.common.util.UtilServer;
|
||||||
import net.minecraft.server.v1_7_R4.EntityItemFrame;
|
|
||||||
import net.minecraft.server.v1_7_R4.PersistentCollection;
|
import net.minecraft.server.v1_8_R3.BlockPosition;
|
||||||
import net.minecraft.server.v1_7_R4.WorldServer;
|
import net.minecraft.server.v1_8_R3.EntityItemFrame;
|
||||||
|
import net.minecraft.server.v1_8_R3.EnumDirection;
|
||||||
|
import net.minecraft.server.v1_8_R3.PersistentCollection;
|
||||||
|
import net.minecraft.server.v1_8_R3.WorldServer;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@ -24,7 +27,7 @@ import org.bukkit.Material;
|
|||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
|
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
|
||||||
import org.bukkit.entity.Hanging;
|
import org.bukkit.entity.Hanging;
|
||||||
import org.bukkit.entity.ItemFrame;
|
import org.bukkit.entity.ItemFrame;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -53,7 +56,7 @@ public class BlockMap implements Listener
|
|||||||
{
|
{
|
||||||
// Make sure the world doesn't change the mapcount information
|
// Make sure the world doesn't change the mapcount information
|
||||||
PersistentCollection collection = ((CraftWorld) corner1.getWorld()).getHandle().worldMaps;
|
PersistentCollection collection = ((CraftWorld) corner1.getWorld()).getHandle().worldMaps;
|
||||||
Field f = collection.getClass().getDeclaredField("a");
|
Field f = collection.getClass().getDeclaredField("b");
|
||||||
f.setAccessible(true);
|
f.setAccessible(true);
|
||||||
f.set(collection, null);
|
f.set(collection, null);
|
||||||
}
|
}
|
||||||
@ -338,27 +341,27 @@ public class BlockMap implements Listener
|
|||||||
|
|
||||||
private ItemFrame spawnItemFrame(Block block, BlockFace bf)
|
private ItemFrame spawnItemFrame(Block block, BlockFace bf)
|
||||||
{
|
{
|
||||||
int dir;
|
EnumDirection dir;
|
||||||
switch (bf)
|
switch (bf)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
case SOUTH:
|
case SOUTH:
|
||||||
dir = 0;
|
dir = EnumDirection.SOUTH;
|
||||||
break;
|
break;
|
||||||
case WEST:
|
case WEST:
|
||||||
dir = 1;
|
dir = EnumDirection.WEST;
|
||||||
break;
|
break;
|
||||||
case NORTH:
|
case NORTH:
|
||||||
dir = 2;
|
dir = EnumDirection.NORTH;
|
||||||
break;
|
break;
|
||||||
case EAST:
|
case EAST:
|
||||||
dir = 3;
|
dir = EnumDirection.EAST;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
WorldServer world = ((CraftWorld) block.getWorld()).getHandle();
|
WorldServer world = ((CraftWorld) block.getWorld()).getHandle();
|
||||||
|
|
||||||
EntityItemFrame entity = new EntityItemFrame(world, block.getX(), block.getY(), block.getZ(), dir);
|
EntityItemFrame entity = new EntityItemFrame(world, new BlockPosition(block.getX(), block.getY(), block.getZ()), dir);
|
||||||
|
|
||||||
entity.setDirection(dir);
|
entity.setDirection(dir);
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package mineplex.core.map;
|
package mineplex.core.map;
|
||||||
|
|
||||||
import net.minecraft.server.v1_7_R4.WorldMap;
|
import net.minecraft.server.v1_8_R3.WorldMap;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
@ -3,18 +3,20 @@ package mineplex.core.map;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
import net.minecraft.server.v1_7_R4.Block;
|
import net.minecraft.server.v1_8_R3.Block;
|
||||||
import net.minecraft.server.v1_7_R4.Blocks;
|
import net.minecraft.server.v1_8_R3.BlockPosition;
|
||||||
import net.minecraft.server.v1_7_R4.Chunk;
|
import net.minecraft.server.v1_8_R3.Blocks;
|
||||||
import net.minecraft.server.v1_7_R4.MaterialMapColor;
|
import net.minecraft.server.v1_8_R3.Chunk;
|
||||||
import net.minecraft.server.v1_7_R4.MathHelper;
|
import net.minecraft.server.v1_8_R3.MaterialMapColor;
|
||||||
import net.minecraft.server.v1_7_R4.WorldMap;
|
import net.minecraft.server.v1_8_R3.MathHelper;
|
||||||
import net.minecraft.util.com.google.common.collect.HashMultiset;
|
import net.minecraft.server.v1_8_R3.WorldMap;
|
||||||
import net.minecraft.util.com.google.common.collect.Iterables;
|
|
||||||
import net.minecraft.util.com.google.common.collect.Multisets;
|
import com.google.common.collect.HashMultiset;
|
||||||
|
import com.google.common.collect.Iterables;
|
||||||
|
import com.google.common.collect.Multisets;
|
||||||
|
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
|
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.map.MapCanvas;
|
import org.bukkit.map.MapCanvas;
|
||||||
import org.bukkit.map.MapRenderer;
|
import org.bukkit.map.MapRenderer;
|
||||||
@ -33,7 +35,7 @@ public class ChunkMapRenderer extends MapRenderer
|
|||||||
|
|
||||||
public void setupMap(World world)
|
public void setupMap(World world)
|
||||||
{
|
{
|
||||||
int i = 1 << worldmap.scale;
|
/*int i = 1 << worldmap.scale;
|
||||||
int j = worldmap.centerX;
|
int j = worldmap.centerX;
|
||||||
int k = worldmap.centerZ;
|
int k = worldmap.centerZ;
|
||||||
int l = MathHelper.floor(0) / i + 64;
|
int l = MathHelper.floor(0) / i + 64;
|
||||||
@ -56,7 +58,7 @@ public class ChunkMapRenderer extends MapRenderer
|
|||||||
int i3 = (j / i + k1 - 64) * i;
|
int i3 = (j / i + k1 - 64) * i;
|
||||||
int j3 = (k / i + j2 - 64) * i;
|
int j3 = (k / i + j2 - 64) * i;
|
||||||
HashMultiset hashmultiset = HashMultiset.create();
|
HashMultiset hashmultiset = HashMultiset.create();
|
||||||
Chunk chunk = ((CraftWorld) world).getHandle().getChunkAtWorldCoords(i3, j3);
|
Chunk chunk = ((CraftWorld) world).getHandle().getChunkAtWorldCoords(new BlockPosition(i3, 0, j3));
|
||||||
|
|
||||||
if (!chunk.isEmpty())
|
if (!chunk.isEmpty())
|
||||||
{
|
{
|
||||||
@ -160,7 +162,7 @@ public class ChunkMapRenderer extends MapRenderer
|
|||||||
|
|
||||||
if (l1 <= i2)
|
if (l1 <= i2)
|
||||||
worldmap.flagDirty(k1, l1, i2);
|
worldmap.flagDirty(k1, l1, i2);
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -6,13 +6,13 @@ import java.util.Iterator;
|
|||||||
import mineplex.core.MiniPlugin;
|
import mineplex.core.MiniPlugin;
|
||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
import net.minecraft.server.v1_7_R4.CraftingManager;
|
import net.minecraft.server.v1_8_R3.CraftingManager;
|
||||||
import net.minecraft.server.v1_7_R4.IInventory;
|
import net.minecraft.server.v1_8_R3.IInventory;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
|
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
|
||||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||||
import org.bukkit.entity.HumanEntity;
|
import org.bukkit.entity.HumanEntity;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
@ -6,7 +6,7 @@ import mineplex.core.common.util.UtilEnt;
|
|||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEnderDragon;
|
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEnderDragon;
|
||||||
import org.bukkit.entity.Chicken;
|
import org.bukkit.entity.Chicken;
|
||||||
import org.bukkit.entity.EnderDragon;
|
import org.bukkit.entity.EnderDragon;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
|
@ -8,12 +8,12 @@ import mineplex.core.common.util.UtilMath;
|
|||||||
import mineplex.core.common.util.UtilPlayer;
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
import net.minecraft.server.v1_7_R4.EntityCreature;
|
import net.minecraft.server.v1_8_R3.EntityCreature;
|
||||||
import net.minecraft.server.v1_7_R4.Navigation;
|
import net.minecraft.server.v1_8_R3.NavigationAbstract;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftCreature;
|
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftCreature;
|
||||||
import org.bukkit.entity.Horse.Variant;
|
import org.bukkit.entity.Horse.Variant;
|
||||||
import org.bukkit.entity.Horse;
|
import org.bukkit.entity.Horse;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -65,7 +65,7 @@ public class HorseMount extends Mount<Horse>
|
|||||||
|
|
||||||
//Move
|
//Move
|
||||||
EntityCreature ec = ((CraftCreature)horse).getHandle();
|
EntityCreature ec = ((CraftCreature)horse).getHandle();
|
||||||
Navigation nav = ec.getNavigation();
|
NavigationAbstract nav = ec.getNavigation();
|
||||||
|
|
||||||
Location target = player.getLocation().add(UtilAlg.getTrajectory(player, horse).multiply(2));
|
Location target = player.getLocation().add(UtilAlg.getTrajectory(player, horse).multiply(2));
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ import mineplex.core.updater.event.UpdateEvent;
|
|||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftMinecart;
|
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftMinecart;
|
||||||
import org.bukkit.entity.Minecart;
|
import org.bukkit.entity.Minecart;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user