Merge remote-tracking branch 'origin/master' into mrsomeone12_SmallFixes
Conflicts: Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEnt.java Plugins/Mineplex.Core/src/mineplex/core/mount/types/MountCart.java
This commit is contained in:
commit
3b89d65a09
BIN
Art/Halloween Horror.jpg
Normal file
BIN
Art/Halloween Horror.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 356 KiB |
BIN
Art/MS SMoke.psd
Normal file
BIN
Art/MS SMoke.psd
Normal file
Binary file not shown.
BIN
Art/Pumpkin.png
Normal file
BIN
Art/Pumpkin.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 692 KiB |
BIN
Art/Spooky Sale.png
Normal file
BIN
Art/Spooky Sale.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 176 KiB |
BIN
Art/Treasure/4Qq2m6x.png
Normal file
BIN
Art/Treasure/4Qq2m6x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 169 KiB |
BIN
Art/Treasure/canc.jpg
Normal file
BIN
Art/Treasure/canc.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 119 KiB |
BIN
Art/Treasure/xxiJkbb.png
Normal file
BIN
Art/Treasure/xxiJkbb.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 182 KiB |
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
|
||||
|
47
Patches/Bukkit-Patches/0031-EntityDismountEvent.patch
Normal file
47
Patches/Bukkit-Patches/0031-EntityDismountEvent.patch
Normal file
@ -0,0 +1,47 @@
|
||||
From c6e51ae8ffc31d0fc059d33ca159df31c2b7a83e Mon Sep 17 00:00:00 2001
|
||||
From: libraryaddict <libraryaddict115@yahoo.co.nz>
|
||||
Date: Sun, 22 Nov 2015 14:37:11 +1300
|
||||
Subject: [PATCH] EntityDismountEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/spigotmc/event/entity/EntityDismountEvent.java b/src/main/java/org/spigotmc/event/entity/EntityDismountEvent.java
|
||||
index 24d4942..02943d6 100644
|
||||
--- a/src/main/java/org/spigotmc/event/entity/EntityDismountEvent.java
|
||||
+++ b/src/main/java/org/spigotmc/event/entity/EntityDismountEvent.java
|
||||
@@ -2,13 +2,14 @@ package org.spigotmc.event.entity;
|
||||
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.entity.EntityEvent;
|
||||
|
||||
/**
|
||||
* Called when an entity stops riding another entity.
|
||||
*
|
||||
*/
|
||||
-public class EntityDismountEvent extends EntityEvent
|
||||
+public class EntityDismountEvent extends EntityEvent implements Cancellable
|
||||
{
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
@@ -36,4 +37,17 @@ public class EntityDismountEvent extends EntityEvent
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled()
|
||||
+ {
|
||||
+ return cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel)
|
||||
+ {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+
|
||||
}
|
||||
--
|
||||
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
|
||||
|
@ -0,0 +1,159 @@
|
||||
From bc86c3b02f2efa4c1194fc908e8d1ee8723f62c5 Mon Sep 17 00:00:00 2001
|
||||
From: libraryaddict <libraryaddict115@yahoo.co.nz>
|
||||
Date: Sun, 22 Nov 2015 14:41:11 +1300
|
||||
Subject: [PATCH] EntityDismountEvent & teleport crash fix
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index 81ca499..7165579 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -23,6 +23,8 @@ import org.bukkit.event.painting.PaintingBreakByEntityEvent;
|
||||
import org.bukkit.event.vehicle.VehicleBlockCollisionEvent;
|
||||
import org.bukkit.event.vehicle.VehicleEnterEvent;
|
||||
import org.bukkit.event.vehicle.VehicleExitEvent;
|
||||
+import org.spigotmc.event.entity.EntityDismountEvent;
|
||||
+import org.spigotmc.event.entity.EntityMountEvent;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
import org.bukkit.craftbukkit.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.entity.CraftPlayer;
|
||||
@@ -1591,7 +1593,12 @@ public abstract class Entity implements ICommandListener {
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
- pluginManager.callEvent( new org.spigotmc.event.entity.EntityDismountEvent( this.getBukkitEntity(), this.vehicle.getBukkitEntity() ) ); // Spigot
|
||||
+ EntityDismountEvent event = new org.spigotmc.event.entity.EntityDismountEvent(this.getBukkitEntity(), this.vehicle.getBukkitEntity());
|
||||
+ pluginManager.callEvent(event); // Spigot
|
||||
+
|
||||
+ if (event.isCancelled() || vehicle != originalVehicle) {
|
||||
+ return;
|
||||
+ } // Spigot
|
||||
this.setPositionRotation(this.vehicle.locX, this.vehicle.getBoundingBox().b + (double) this.vehicle.length, this.vehicle.locZ, this.yaw, this.pitch);
|
||||
this.vehicle.passenger = null;
|
||||
}
|
||||
@@ -1599,44 +1606,45 @@ public abstract class Entity implements ICommandListener {
|
||||
this.vehicle = null;
|
||||
} else {
|
||||
// CraftBukkit start
|
||||
- if ((this.bukkitEntity instanceof LivingEntity) && (entity.getBukkitEntity() instanceof Vehicle) && entity.world.isChunkLoaded((int) entity.locX >> 4, (int) entity.locZ >> 4, true)) {
|
||||
+ if (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;
|
||||
+ EntityDismountEvent exitEvent1 = null;
|
||||
if (this.vehicle != null) {
|
||||
- exitEvent = new VehicleExitEvent((Vehicle) this.vehicle.getBukkitEntity(), (LivingEntity) this.bukkitEntity);
|
||||
+ if ((this.bukkitEntity instanceof LivingEntity) && (entity.getBukkitEntity() instanceof Vehicle))
|
||||
+ exitEvent = new VehicleExitEvent((Vehicle) this.vehicle.getBukkitEntity(), (LivingEntity) this.bukkitEntity);
|
||||
pluginManager.callEvent(exitEvent);
|
||||
|
||||
if (exitEvent.isCancelled() || this.vehicle != originalVehicle || (this.vehicle != null && this.vehicle.passenger != originalPassenger)) {
|
||||
return;
|
||||
}
|
||||
+
|
||||
+ exitEvent1 = new EntityDismountEvent(this.vehicle.getBukkitEntity(), this.bukkitEntity);
|
||||
+
|
||||
+ pluginManager.callEvent(exitEvent1);
|
||||
+
|
||||
+ if (exitEvent1.isCancelled() || this.vehicle != originalVehicle || (this.vehicle != null && this.vehicle.passenger != originalPassenger)) {
|
||||
+ return;
|
||||
+ }
|
||||
}
|
||||
|
||||
- VehicleEnterEvent event = new VehicleEnterEvent((Vehicle) entity.getBukkitEntity(), this.bukkitEntity);
|
||||
- pluginManager.callEvent(event);
|
||||
+ if ((this.bukkitEntity instanceof LivingEntity) && (entity.getBukkitEntity() instanceof Vehicle)) {
|
||||
+ VehicleEnterEvent event = new VehicleEnterEvent((Vehicle) entity.getBukkitEntity(), this.bukkitEntity);
|
||||
+ pluginManager.callEvent(event);
|
||||
|
||||
- // If a plugin messes with the vehicle or the vehicle's passenger
|
||||
- if (event.isCancelled() || this.vehicle != originalVehicle || (this.vehicle != null && this.vehicle.passenger != originalPassenger)) {
|
||||
- // If we only cancelled the enterevent then we need to put the player in a decent position.
|
||||
- if (exitEvent != null && this.vehicle == originalVehicle && this.vehicle != null && this.vehicle.passenger == originalPassenger) {
|
||||
- this.setPositionRotation(this.vehicle.locX, this.vehicle.getBoundingBox().b + (double) this.vehicle.length, this.vehicle.locZ, this.yaw, this.pitch);
|
||||
- this.vehicle.passenger = null;
|
||||
- this.vehicle = null;
|
||||
+ // If a plugin messes with the vehicle or the vehicle's passenger
|
||||
+ if (event.isCancelled() || this.vehicle != originalVehicle || (this.vehicle != null && this.vehicle.passenger != originalPassenger)) {
|
||||
+ // If we only cancelled the enterevent then we need to put the player in a decent position.
|
||||
+ if (exitEvent != null && this.vehicle == originalVehicle && this.vehicle != null && this.vehicle.passenger == originalPassenger) {
|
||||
+ this.setPositionRotation(this.vehicle.locX, this.vehicle.getBoundingBox().b + (double) this.vehicle.length, this.vehicle.locZ, this.yaw, this.pitch);
|
||||
+ this.vehicle.passenger = null;
|
||||
+ this.vehicle = null;
|
||||
+ }
|
||||
+ return;
|
||||
}
|
||||
- return;
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
- // Spigot Start
|
||||
- if ( entity.world.isChunkLoaded( (int) entity.locX >> 4, (int) entity.locZ >> 4, true ) )
|
||||
- {
|
||||
- org.spigotmc.event.entity.EntityMountEvent event = new org.spigotmc.event.entity.EntityMountEvent( this.getBukkitEntity(), entity.getBukkitEntity() );
|
||||
- pluginManager.callEvent( event );
|
||||
- if ( event.isCancelled() )
|
||||
- {
|
||||
- return;
|
||||
- }
|
||||
- }
|
||||
- // Spigot End
|
||||
|
||||
if (this.vehicle != null) {
|
||||
this.vehicle.passenger = null;
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
index b861dbe..96b3905 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
@@ -21,6 +21,7 @@ import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageModifier;
|
||||
import org.bukkit.event.entity.EntityRegainHealthEvent;
|
||||
import org.bukkit.event.vehicle.VehicleExitEvent;
|
||||
+import org.spigotmc.event.entity.EntityDismountEvent;
|
||||
// CraftBukkit end
|
||||
|
||||
import org.bukkit.craftbukkit.SpigotTimings; // Spigot
|
||||
@@ -1725,8 +1726,15 @@ public abstract class EntityLiving extends Entity {
|
||||
return;
|
||||
}
|
||||
}
|
||||
+
|
||||
+ EntityDismountEvent event = new EntityDismountEvent(this.vehicle.getBukkitEntity(), (LivingEntity) this.bukkitEntity);
|
||||
+ getBukkitEntity().getServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (event.isCancelled() || vehicle != originalVehicle) {
|
||||
+ return;
|
||||
+ }
|
||||
// CraftBukkit end
|
||||
-
|
||||
+
|
||||
if (!this.world.isClientSide) {
|
||||
this.q(this.vehicle);
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
index efbf1a8..dbc7b54 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.bukkit.craftbukkit.entity;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
+import com.google.common.primitives.Doubles;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
@@ -234,6 +235,12 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
// If this entity is riding another entity, we must dismount before teleporting.
|
||||
entity.mount(null);
|
||||
|
||||
+ if (!Doubles.isFinite(location.getX()) || !Doubles.isFinite(location.getY()) || !Doubles.isFinite(location.getZ()))
|
||||
+ {
|
||||
+ Thread.dumpStack();
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
// Spigot start
|
||||
if (!location.getWorld().equals(getWorld())) {
|
||||
entity.teleportTo(location, cause.equals(TeleportCause.NETHER_PORTAL));
|
||||
--
|
||||
1.9.5.msysgit.0
|
||||
|
18
Plugins/.idea/dataSources.xml
Normal file
18
Plugins/.idea/dataSources.xml
Normal file
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="DataSourceManagerImpl" format="xml" hash="4268976312">
|
||||
<data-source source="LOCAL" name="Mineplex" uuid="14dfc55d-5343-47c4-ab24-76a055b8059e">
|
||||
<driver-ref>mysql</driver-ref>
|
||||
<synchronize>true</synchronize>
|
||||
<jdbc-driver>com.mysql.jdbc.Driver</jdbc-driver>
|
||||
<jdbc-url>jdbc:mysql://db.mineplex.com:3306</jdbc-url>
|
||||
<driver-properties>
|
||||
<property name="zeroDateTimeBehavior" value="convertToNull" />
|
||||
<property name="tinyInt1isBit" value="false" />
|
||||
<property name="characterEncoding" value="utf8" />
|
||||
<property name="characterSetResults" value="utf8" />
|
||||
<property name="yearIsDateType" value="false" />
|
||||
</driver-properties>
|
||||
</data-source>
|
||||
</component>
|
||||
</project>
|
@ -1,4 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" />
|
||||
<component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false">
|
||||
<file url="PROJECT" charset="UTF-8" />
|
||||
</component>
|
||||
</project>
|
@ -11,6 +11,9 @@
|
||||
<fileset dir="../Mineplex.Database/bin">
|
||||
<include name="**/*.class"/>
|
||||
</fileset>
|
||||
<fileset dir="../Mineplex.PlayerCache/bin">
|
||||
<include name="**/*.class"/>
|
||||
</fileset>
|
||||
|
||||
<fileset dir="../Mineplex.EnjinTranslator/bin">
|
||||
<include name="**/*.class"/>
|
||||
|
@ -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,207 +0,0 @@
|
||||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by Fernflower decompiler)
|
||||
//
|
||||
|
||||
package net.minecraft.server.v1_7_R4;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Calendar;
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.bukkit.craftbukkit.v1_7_R4.scoreboard.CraftScoreboard;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.util.CraftChatMessage;
|
||||
import org.bukkit.scoreboard.Team;
|
||||
import net.minecraft.util.com.mojang.authlib.GameProfile;
|
||||
import net.minecraft.util.com.mojang.authlib.properties.Property;
|
||||
import net.minecraft.util.com.mojang.authlib.properties.PropertyMap;
|
||||
|
||||
public class PacketPlayOutPlayerInfo extends Packet {
|
||||
|
||||
public static final String NOTCH_SKIN = "eyJ0aW1lc3RhbXAiOjE0Mjc4MjgyMzMwNDUsInByb2ZpbGVJZCI6IjA2OWE3OWY0NDRlOTQ3MjZhNWJlZmNhOTBlMzhhYWY1IiwicHJvZmlsZU5hbWUiOiJOb3RjaCIsImlzUHVibGljIjp0cnVlLCJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYTExNmU2OWE4NDVlMjI3ZjdjYTFmZGRlOGMzNTdjOGM4MjFlYmQ0YmE2MTkzODJlYTRhMWY4N2Q0YWU5NCJ9LCJDQVBFIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvM2Y2ODhlMGU2OTliM2Q5ZmU0NDhiNWJiNTBhM2EyODhmOWM1ODk3NjJiM2RhZTgzMDg4NDIxMjJkY2I4MSJ9fX0=";
|
||||
public static final String NOTCH_SIGNATURE = "WrBmNqkpkjh6VJY26jOOMNS6oSOPi0MTm9WWc0t4EMUHchUbTd6/1sT2O2zz2s7xwmCeUxuIhvRREa+1bIPzIIbXJLjhxiBWMdTJbQhv6zBb1U2SZb7eb5cYrFTD6rvxy0rOarScxCBdeOXpr1coxrvN8a6VkgLhc/dGhFx0ZmORxELBLFiCNi+4WE//MI+KioAq84Gdf0ltT9ZLWdlHNFV2ynBgcx2MfNTA2lrpdKEUVOYD7xhPoOdHa5d1hzdDxbYPGDgM0FzYjzNUlBx8SLvHEpyBB7XyOsIGnfqrS0ltIDTq82wgLrEwDRncuQN18w6IiQbNK06MZBDyNnIp79mmUYvRj+Zl0dPBrZok2q2uQ08hZ87ufU3jhjY39kr+iEaPYMvfWaBxt3ALjopsZRCGSlEukMzITjeYxhfVKuQ0fhWKRfwWn/Jv2de2h+i+t7nulvN3MV3rJVrS6OXsx87p/vm9biU7Hs07T8VSGONfkxXmsgYEtY6m2egU5pmqFnsKM0MwwnZJ7Sxz2EjiPikoGzJzpv4ncj3rhelIKJKjDk9jSAz7nPzc8/UdOiTrfy4ezr3jFVAVatiKr+kS/HNXHWiCFdufhpG4DVCrSkwkFBJw030pJ6ICVhpuYq5yOswQB5QOp0JDWc2Rdth7SVmvxthSCL9G2ksfm+v7sKw=";
|
||||
|
||||
|
||||
public static final int ADD_PLAYER = 0;
|
||||
public static final int UPDATE_GAMEMODE = 1;
|
||||
public static final int UPDATE_LATENCY = 2;
|
||||
public static final int UPDATE_DISPLAY_NAME = 3;
|
||||
public static final int REMOVE_PLAYER = 4;
|
||||
public int action;
|
||||
public GameProfile player;
|
||||
public int gamemode;
|
||||
public int ping;
|
||||
public String username;
|
||||
public String _tabName;
|
||||
|
||||
public PacketPlayOutPlayerInfo() {
|
||||
}
|
||||
|
||||
public static PacketPlayOutPlayerInfo addPlayer(EntityPlayer player) {
|
||||
PacketPlayOutPlayerInfo packet = new PacketPlayOutPlayerInfo();
|
||||
packet.action = 0;
|
||||
packet.username = player.listName;
|
||||
packet.player = player.getProfile();
|
||||
packet.ping = player.ping;
|
||||
packet.gamemode = player.playerInteractManager.getGameMode().getId();
|
||||
|
||||
packet._tabName = getFormattedName(player);
|
||||
return packet;
|
||||
}
|
||||
|
||||
public static PacketPlayOutPlayerInfo updatePing(EntityPlayer player) {
|
||||
PacketPlayOutPlayerInfo packet = new PacketPlayOutPlayerInfo();
|
||||
packet.action = 2;
|
||||
packet.username = player.listName;
|
||||
packet.player = player.getProfile();
|
||||
packet.ping = player.ping;
|
||||
return packet;
|
||||
}
|
||||
|
||||
public static PacketPlayOutPlayerInfo updateGamemode(EntityPlayer player) {
|
||||
PacketPlayOutPlayerInfo packet = new PacketPlayOutPlayerInfo();
|
||||
packet.action = 1;
|
||||
packet.username = player.listName;
|
||||
packet.player = player.getProfile();
|
||||
packet.gamemode = player.playerInteractManager.getGameMode().getId();
|
||||
return packet;
|
||||
}
|
||||
|
||||
public static PacketPlayOutPlayerInfo updateDisplayName(EntityPlayer player) {
|
||||
return updateDisplayName(player, getFormattedName(player));
|
||||
}
|
||||
|
||||
public static PacketPlayOutPlayerInfo updateDisplayName(EntityPlayer player, String displayName)
|
||||
{
|
||||
PacketPlayOutPlayerInfo packet = new PacketPlayOutPlayerInfo();
|
||||
packet.action = 3;
|
||||
packet.username = player.listName;
|
||||
packet.player = player.getProfile();
|
||||
packet._tabName = displayName;
|
||||
return packet;
|
||||
}
|
||||
|
||||
public static PacketPlayOutPlayerInfo removePlayer(EntityPlayer player) {
|
||||
PacketPlayOutPlayerInfo packet = new PacketPlayOutPlayerInfo();
|
||||
packet.action = 4;
|
||||
packet.username = player.listName;
|
||||
packet.player = player.getProfile();
|
||||
return packet;
|
||||
}
|
||||
|
||||
public void a(PacketDataSerializer packetdataserializer) throws IOException {
|
||||
}
|
||||
|
||||
public void b(PacketDataSerializer packetdataserializer) throws IOException {
|
||||
if(packetdataserializer.version >= 20) {
|
||||
|
||||
Calendar c = Calendar.getInstance();
|
||||
|
||||
packetdataserializer.b(this.action);
|
||||
packetdataserializer.b(1);
|
||||
packetdataserializer.writeUUID(this.player.getId());
|
||||
switch(this.action) {
|
||||
case 0:
|
||||
packetdataserializer.a(this.player.getName());
|
||||
PropertyMap properties = this.player.getProperties();
|
||||
|
||||
// April Fools
|
||||
if (isAprilFools() && properties.size() == 0)
|
||||
{
|
||||
// add texture if no textures exist
|
||||
properties.put("textures", new Property("textures", NOTCH_SKIN, NOTCH_SIGNATURE));
|
||||
|
||||
}
|
||||
|
||||
packetdataserializer.b(properties.size());
|
||||
Iterator var3 = properties.values().iterator();
|
||||
|
||||
while(var3.hasNext()) {
|
||||
Property property = (Property)var3.next();
|
||||
|
||||
// April Fools
|
||||
if (isAprilFools() && property.getName().equalsIgnoreCase("textures"))
|
||||
{
|
||||
System.out.println("Applying notch texture for : " + property.getName());
|
||||
System.out.println("Skin: " + property.getValue());
|
||||
System.out.println("Signature: " + property.getSignature());
|
||||
packetdataserializer.a(property.getName());
|
||||
packetdataserializer.a(NOTCH_SKIN);
|
||||
packetdataserializer.writeBoolean(true);
|
||||
packetdataserializer.a(NOTCH_SIGNATURE);
|
||||
}
|
||||
else
|
||||
{
|
||||
packetdataserializer.a(property.getName());
|
||||
packetdataserializer.a(property.getValue());
|
||||
|
||||
packetdataserializer.writeBoolean(property.hasSignature());
|
||||
if(property.hasSignature()) {
|
||||
packetdataserializer.a(property.getSignature());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
packetdataserializer.b(this.gamemode);
|
||||
packetdataserializer.b(this.ping);
|
||||
packetdataserializer.writeBoolean(this.username != null);
|
||||
if(this.username != null) {
|
||||
// packetdataserializer.a(ChatSerializer.a(CraftChatMessage.fromString(this.username)[0]));
|
||||
packetdataserializer.a(ChatSerializer.a(CraftChatMessage.fromString(this._tabName)[0]));
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
packetdataserializer.b(this.gamemode);
|
||||
break;
|
||||
case 2:
|
||||
packetdataserializer.b(this.ping);
|
||||
break;
|
||||
case 3:
|
||||
packetdataserializer.writeBoolean(this.username != null);
|
||||
if(this.username != null) {
|
||||
// packetdataserializer.a(ChatSerializer.a(CraftChatMessage.fromString(this.username)[0]));
|
||||
packetdataserializer.a(ChatSerializer.a(CraftChatMessage.fromString(this._tabName)[0]));
|
||||
}
|
||||
case 4:
|
||||
}
|
||||
} else {
|
||||
packetdataserializer.a(this.username);
|
||||
packetdataserializer.writeBoolean(this.action != 4);
|
||||
packetdataserializer.writeShort(this.ping);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void a(PacketPlayOutListener packetplayoutlistener) {
|
||||
packetplayoutlistener.a(this);
|
||||
}
|
||||
|
||||
public void handle(PacketListener packetlistener) {
|
||||
this.a((PacketPlayOutListener)((PacketPlayOutListener)packetlistener));
|
||||
}
|
||||
|
||||
private static String getFormattedName(EntityPlayer player)
|
||||
{
|
||||
String name = player.getName();
|
||||
|
||||
if (isAprilFools()) name = "Notch";
|
||||
|
||||
CraftScoreboard scoreboard = player.getBukkitEntity().getScoreboard();
|
||||
if (scoreboard != null)
|
||||
{
|
||||
Team team = scoreboard.getPlayerTeam(player.getBukkitEntity());
|
||||
if (team != null)
|
||||
name = team.getPrefix() + name + team.getSuffix();
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
public static boolean isAprilFools()
|
||||
{
|
||||
Calendar c = Calendar.getInstance();
|
||||
|
||||
// return true;
|
||||
return c.get(Calendar.MONTH) == Calendar.APRIL && c.get(Calendar.DAY_OF_MONTH) == 1;
|
||||
}
|
||||
}
|
@ -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.
@ -81,7 +81,7 @@ public class LobbyBalancer implements Listener, Runnable
|
||||
InetSocketAddress socketAddress = new InetSocketAddress(server.getPublicAddress(), server.getPort());
|
||||
_plugin.getProxy().getServers().put(server.getName(), _plugin.getProxy().constructServerInfo(server.getName(), socketAddress, "LobbyBalancer", false));
|
||||
|
||||
if (server.getName().toUpperCase().contains("LOBBY"))
|
||||
if (server.getName().toUpperCase().startsWith("LOBBY"))
|
||||
{
|
||||
if (server.getMotd() == null || !server.getMotd().contains("Restarting"))
|
||||
{
|
||||
|
@ -55,12 +55,12 @@ public class MotdManager implements Listener, Runnable
|
||||
|
||||
//String motdLine = "§f§l◄ §c§lMaintenance§f§l ►";
|
||||
//String motdLine = "§f§l◄ §a§lCarl the Creeper§f§l ►";
|
||||
String motdLine = " §b§l◄§f§lNEW GAME§b§l► §f§l◄§b§lEVOLUTION§f§l► §b§l◄§f§lNEW GAME§b§l►";
|
||||
//String motdLine = " §f§l◄ §a§lCarl the Creeper§f§l ▬ §c§l75% OFF SALE§f§l ►";
|
||||
// String motdLine = " §2§l§n M O N S T E R M A Z E B E T A §f";
|
||||
String motdLine = " §f§l◄ §b§lNew Game§f§l ▬ §3§lChampions CTF§f§l ►";
|
||||
//String motdLine = " §d§lRank Sale §a§l40% Off");
|
||||
//String motdLine = " §f§l◄§c§lMAINTENANCE§f§l►");
|
||||
|
||||
updateMainMotd(" §b§l§m §8§l§m[ §r §9§lMineplex§r §f§lGames§r §8§l§m ]§b§l§m §r", motdLine);
|
||||
updateMainMotd(" §f§l§m §8§l§m[ §r §6§lMineplex§r §f§lGames§r §8§l§m ]§f§l§m §r", motdLine);
|
||||
System.out.println("Updated Bungee MOTD");
|
||||
}
|
||||
}
|
||||
|
@ -38,9 +38,8 @@ public class PlayerTracker implements Listener, Runnable
|
||||
_plugin.getProxy().getPluginManager().registerListener(_plugin, this);
|
||||
_plugin.getProxy().getScheduler().schedule(_plugin, this, 1L, 1L, TimeUnit.MINUTES);
|
||||
|
||||
Region region = !new File("eu.dat").exists() ? Region.US : Region.EU;
|
||||
_repository = new RedisDataRepository<PlayerStatus>(ServerManager.getMasterConnection(), ServerManager.getSlaveConnection(),
|
||||
region, PlayerStatus.class, "playerStatus");
|
||||
Region.currentRegion(), PlayerStatus.class, "playerStatus");
|
||||
|
||||
ServerCommandManager.getInstance().registerCommandType("PlayerJoinCommand", mineplex.serverdata.commands.PlayerJoinCommand.class, new PlayerJoinHandler(this));
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
package mineplex.core.common;
|
||||
|
||||
import net.minecraft.server.v1_7_R4.Entity;
|
||||
import net.minecraft.server.v1_7_R4.NBTTagCompound;
|
||||
import net.minecraft.server.v1_7_R4.World;
|
||||
import net.minecraft.server.v1_8_R3.Entity;
|
||||
import net.minecraft.server.v1_8_R3.NBTTagCompound;
|
||||
import net.minecraft.server.v1_8_R3.World;
|
||||
|
||||
public class DummyEntity extends Entity
|
||||
{
|
||||
@ -12,17 +12,20 @@ public class DummyEntity extends Entity
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void c()
|
||||
protected void h()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void a(NBTTagCompound nbttagcompound)
|
||||
protected void a(NBTTagCompound nbtTagCompound)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void b(NBTTagCompound nbttagcompound)
|
||||
protected void b(NBTTagCompound nbtTagCompound)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
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 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.UtilServer;
|
||||
|
||||
@ -119,25 +119,12 @@ public class JsonMessage
|
||||
*/
|
||||
public void send(MessageType messageType, Player... players)
|
||||
{
|
||||
send(messageType, false, players);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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());
|
||||
PacketPlayOutChat chatPacket = new PacketPlayOutChat(IChatBaseComponent.ChatSerializer.a(toString()));
|
||||
chatPacket.b = messageType.getId();
|
||||
|
||||
for (Player player : players)
|
||||
{
|
||||
if (defaultToChat || messageType != MessageType.ABOVE_HOTBAR || UtilPlayer.is1_8(player))
|
||||
((CraftPlayer) player).getHandle().playerConnection.sendPacket(chatPacket);
|
||||
UtilPlayer.sendPacket(player, chatPacket);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -28,6 +28,23 @@ public class C
|
||||
public static String cWhite = "" + ChatColor.WHITE;
|
||||
public static String cYellow = "" + ChatColor.YELLOW;
|
||||
|
||||
public static String cAquaB = "" + ChatColor.AQUA + "" + ChatColor.BOLD;
|
||||
public static String cBlackB = "" + ChatColor.BLACK + "" + ChatColor.BOLD;
|
||||
public static String cBlueB = "" + ChatColor.BLUE + "" + ChatColor.BOLD;
|
||||
public static String cDAquaB = "" + ChatColor.DARK_AQUA + "" + ChatColor.BOLD;
|
||||
public static String cDBlueB = "" + ChatColor.DARK_BLUE + "" + ChatColor.BOLD;
|
||||
public static String cDGrayB = "" + ChatColor.DARK_GRAY + "" + ChatColor.BOLD;
|
||||
public static String cDGreenB = "" + ChatColor.DARK_GREEN + "" + ChatColor.BOLD;
|
||||
public static String cDPurpleB = "" + ChatColor.DARK_PURPLE + "" + ChatColor.BOLD;
|
||||
public static String cDRedB = "" + ChatColor.DARK_RED + "" + ChatColor.BOLD;
|
||||
public static String cGoldB = "" + ChatColor.GOLD + "" + ChatColor.BOLD;
|
||||
public static String cGrayB = "" + ChatColor.GRAY + "" + ChatColor.BOLD;
|
||||
public static String cGreenB = "" + ChatColor.GREEN + "" + ChatColor.BOLD;
|
||||
public static String cPurpleB = "" + ChatColor.LIGHT_PURPLE + "" + ChatColor.BOLD;
|
||||
public static String cRedB = "" + ChatColor.RED + "" + ChatColor.BOLD;
|
||||
public static String cWhiteB = "" + ChatColor.WHITE + "" + ChatColor.BOLD;
|
||||
public static String cYellowB = "" + ChatColor.YELLOW + "" + ChatColor.BOLD;
|
||||
|
||||
public static String mHead = "" + ChatColor.BLUE;
|
||||
public static String mBody = "" + ChatColor.GRAY;
|
||||
public static String mChat = "" + ChatColor.WHITE;
|
||||
|
@ -2,7 +2,7 @@ package mineplex.core.common.util;
|
||||
|
||||
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;
|
||||
|
||||
public class InventoryUtil
|
||||
|
@ -1,48 +1,41 @@
|
||||
package mineplex.core.common.util;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
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.Chunk;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.CraftChunk;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.CraftChunk;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
|
||||
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.Player;
|
||||
import org.bukkit.event.world.WorldUnloadEvent;
|
||||
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 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++)
|
||||
{
|
||||
@ -54,7 +47,7 @@ public class MapUtil
|
||||
int bY = y & 0xFF;
|
||||
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());
|
||||
}
|
||||
@ -63,7 +56,7 @@ public class MapUtil
|
||||
}
|
||||
|
||||
c.initLighting();
|
||||
}
|
||||
}*/
|
||||
|
||||
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)
|
||||
{
|
||||
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);
|
||||
((CraftWorld) world).getHandle().notify(x, y, z);
|
||||
//c.a(x & 0xF, y, z & 0xF, Block.getById(id), data);
|
||||
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)
|
||||
@ -152,7 +147,7 @@ public class MapUtil
|
||||
Block.getById(id), data))
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
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);
|
||||
}
|
||||
@ -184,8 +181,8 @@ public class MapUtil
|
||||
Player player)
|
||||
{
|
||||
// System.out.println("Sending MultiBlockChunk " + x + ", " + z);
|
||||
((CraftPlayer) player).getHandle().playerConnection.sendPacket(new PacketPlayOutMultiBlockChange(dirtyCount,
|
||||
dirtyBlocks, ((CraftWorld) world).getHandle().getChunkAt(x, z)));
|
||||
UtilPlayer.sendPacket(player, new PacketPlayOutMultiBlockChange(dirtyCount, dirtyBlocks, ((CraftWorld) world).getHandle()
|
||||
.getChunkAt(x, z)));
|
||||
}
|
||||
|
||||
public static void UnloadWorld(JavaPlugin plugin, World world)
|
||||
@ -216,7 +213,7 @@ public class MapUtil
|
||||
|
||||
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();
|
||||
|
||||
for (Entity entity : world.getEntities())
|
||||
@ -226,7 +223,7 @@ public class MapUtil
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
@ -251,23 +248,7 @@ public class MapUtil
|
||||
System.out.println("Error removing world from bukkit master list: " + ex.getMessage());
|
||||
}
|
||||
|
||||
MinecraftServer ms = null;
|
||||
|
||||
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());
|
||||
}
|
||||
MinecraftServer ms = server.getServer();
|
||||
|
||||
ms.worlds.remove(ms.worlds.indexOf(craftWorld.getHandle()));
|
||||
}
|
||||
@ -303,4 +284,9 @@ public class MapUtil
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static BlockPosition getBlockPos(int x, int y, int z)
|
||||
{
|
||||
return new BlockPosition(x, y, z);
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ import java.util.Set;
|
||||
public class NautHashMap<KeyType, ValueType>
|
||||
{
|
||||
private HashMap<KeyType, ValueType> _wrappedHashMap = new HashMap<KeyType, ValueType>();
|
||||
|
||||
|
||||
public boolean containsKey(KeyType key)
|
||||
{
|
||||
return _wrappedHashMap.containsKey(key);
|
||||
|
@ -6,8 +6,8 @@ import java.util.Scanner;
|
||||
import java.util.UUID;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import net.minecraft.util.com.mojang.authlib.GameProfile;
|
||||
import net.minecraft.util.com.mojang.authlib.properties.Property;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.authlib.properties.Property;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
|
@ -0,0 +1,38 @@
|
||||
package mineplex.core.common.util;
|
||||
|
||||
import org.bukkit.Location;
|
||||
|
||||
public class RadarData
|
||||
{
|
||||
public Location Loc;
|
||||
public String Text;
|
||||
|
||||
private double _bearing = 0;
|
||||
|
||||
public RadarData(Location loc, String text)
|
||||
{
|
||||
Loc = loc;
|
||||
Text = text;
|
||||
}
|
||||
|
||||
public void print()
|
||||
{
|
||||
System.out.println(Text + ": " + _bearing);
|
||||
}
|
||||
|
||||
public void setBearing(double d)
|
||||
{
|
||||
while (d < -180)
|
||||
d += 360;
|
||||
|
||||
while (d > 180)
|
||||
d -= 360;
|
||||
|
||||
_bearing = d;
|
||||
}
|
||||
|
||||
public double getBearing()
|
||||
{
|
||||
return _bearing;
|
||||
}
|
||||
}
|
@ -423,4 +423,20 @@ public class UtilAlg
|
||||
|
||||
return UtilAlg.findClosest(near, corners);
|
||||
}
|
||||
|
||||
public static boolean isSimilar(Location a, Location b)
|
||||
{
|
||||
return a.getWorld() == b.getWorld() && a.getX() == b.getX() && a.getY() == b.getY() && a.getZ() == b.getZ();
|
||||
}
|
||||
|
||||
public static int randomMidpoint(int min, int max)
|
||||
{
|
||||
int variance = max - min;
|
||||
|
||||
int value = UtilMath.r(variance);
|
||||
|
||||
value += min;
|
||||
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
@ -4,16 +4,17 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
||||
import net.minecraft.server.v1_7_R4.Blocks;
|
||||
import net.minecraft.server.v1_7_R4.MathHelper;
|
||||
import net.minecraft.server.v1_7_R4.WorldServer;
|
||||
import net.minecraft.server.v1_8_R3.BlockPosition;
|
||||
import net.minecraft.server.v1_8_R3.Blocks;
|
||||
import net.minecraft.server.v1_8_R3.MathHelper;
|
||||
import net.minecraft.server.v1_8_R3.WorldServer;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
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;
|
||||
|
||||
public class UtilBlock
|
||||
@ -52,7 +53,7 @@ public class UtilBlock
|
||||
*/
|
||||
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>();
|
||||
/**
|
||||
@ -61,188 +62,225 @@ public class UtilBlock
|
||||
public static HashSet<Byte> blockAirFoliageSet = new HashSet<Byte>();
|
||||
|
||||
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);
|
||||
|
||||
|
||||
blockPassSet.add((byte)0);
|
||||
blockPassSet.add((byte)6);
|
||||
blockPassSet.add((byte)8);
|
||||
blockPassSet.add((byte)9);
|
||||
blockPassSet.add((byte)10);
|
||||
blockPassSet.add((byte)11);
|
||||
blockPassSet.add((byte)26);
|
||||
blockPassSet.add((byte)27);
|
||||
blockPassSet.add((byte)28);
|
||||
blockPassSet.add((byte)30);
|
||||
blockPassSet.add((byte)31);
|
||||
blockPassSet.add((byte)32);
|
||||
blockPassSet.add((byte)37);
|
||||
blockPassSet.add((byte)38);
|
||||
blockPassSet.add((byte)39);
|
||||
blockPassSet.add((byte)40);
|
||||
blockPassSet.add((byte)50);
|
||||
blockPassSet.add((byte)51);
|
||||
blockPassSet.add((byte)55);
|
||||
blockPassSet.add((byte)59);
|
||||
blockPassSet.add((byte)63);
|
||||
blockPassSet.add((byte)64);
|
||||
blockPassSet.add((byte)65);
|
||||
blockPassSet.add((byte)66);
|
||||
blockPassSet.add((byte)68);
|
||||
blockPassSet.add((byte)69);
|
||||
blockPassSet.add((byte)70);
|
||||
blockPassSet.add((byte)71);
|
||||
blockPassSet.add((byte)72);
|
||||
blockPassSet.add((byte)75);
|
||||
blockPassSet.add((byte)76);
|
||||
blockPassSet.add((byte)77);
|
||||
blockPassSet.add((byte)78);
|
||||
blockPassSet.add((byte)83);
|
||||
blockPassSet.add((byte)90);
|
||||
blockPassSet.add((byte)92);
|
||||
blockPassSet.add((byte)93);
|
||||
blockPassSet.add((byte)94);
|
||||
blockPassSet.add((byte)96);
|
||||
blockPassSet.add((byte)101);
|
||||
blockPassSet.add((byte)102);
|
||||
blockPassSet.add((byte)104);
|
||||
blockPassSet.add((byte)105);
|
||||
blockPassSet.add((byte)106);
|
||||
blockPassSet.add((byte)107);
|
||||
blockPassSet.add((byte)111);
|
||||
blockPassSet.add((byte)115);
|
||||
blockPassSet.add((byte)116);
|
||||
blockPassSet.add((byte)117);
|
||||
blockPassSet.add((byte)118);
|
||||
blockPassSet.add((byte)119);
|
||||
blockPassSet.add((byte)120);
|
||||
blockPassSet.add((byte)171);
|
||||
|
||||
fullSolid.add((byte)1); //
|
||||
fullSolid.add((byte)2); //
|
||||
fullSolid.add((byte)3); //
|
||||
fullSolid.add((byte)4); //
|
||||
fullSolid.add((byte)5); //
|
||||
fullSolid.add((byte)7); //
|
||||
fullSolid.add((byte)12); //
|
||||
fullSolid.add((byte)13); //
|
||||
fullSolid.add((byte)14); //
|
||||
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
|
||||
blockUseSet.add((byte)26); //Bed
|
||||
blockUseSet.add((byte)33); //Piston
|
||||
blockUseSet.add((byte)47); //Bookcase
|
||||
blockUseSet.add((byte)54); //Chest
|
||||
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
|
||||
blockUseSet.add((byte)185); //Fences/Gates
|
||||
blockUseSet.add((byte)186); //Fences/Gates
|
||||
blockUseSet.add((byte)187); //Fences/Gates
|
||||
blockUseSet.add((byte)188); //Fences/Gates
|
||||
blockUseSet.add((byte)189); //Fences/Gates
|
||||
blockUseSet.add((byte)190); //Fences/Gates
|
||||
blockUseSet.add((byte)191); //Fences/Gates
|
||||
blockUseSet.add((byte)192); //Fences/Gates
|
||||
|
||||
blockUseSet.add((byte)193); //Wood Doors
|
||||
blockUseSet.add((byte)194); //Wood Doors
|
||||
blockUseSet.add((byte)195); //Wood Doors
|
||||
blockUseSet.add((byte)196); //Wood Doors
|
||||
blockUseSet.add((byte)197); //Wood Doors
|
||||
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) Material.AIR.getId());
|
||||
blockPassSet.add((byte) Material.SAPLING.getId());
|
||||
blockPassSet.add((byte) Material.WATER.getId());
|
||||
blockPassSet.add((byte) Material.STATIONARY_WATER.getId());
|
||||
blockPassSet.add((byte) Material.LAVA.getId());
|
||||
blockPassSet.add((byte) Material.STATIONARY_LAVA.getId());
|
||||
blockPassSet.add((byte) Material.BED_BLOCK.getId());
|
||||
blockPassSet.add((byte) Material.POWERED_RAIL.getId());
|
||||
blockPassSet.add((byte) Material.DETECTOR_RAIL.getId());
|
||||
blockPassSet.add((byte) Material.WEB.getId());
|
||||
blockPassSet.add((byte) Material.LONG_GRASS.getId());
|
||||
blockPassSet.add((byte) Material.DEAD_BUSH.getId());
|
||||
blockPassSet.add((byte) Material.YELLOW_FLOWER.getId());
|
||||
blockPassSet.add((byte) Material.RED_ROSE.getId());
|
||||
blockPassSet.add((byte) Material.BROWN_MUSHROOM.getId());
|
||||
blockPassSet.add((byte) Material.RED_MUSHROOM.getId());
|
||||
blockPassSet.add((byte) Material.TORCH.getId());
|
||||
blockPassSet.add((byte) Material.FIRE.getId());
|
||||
blockPassSet.add((byte) Material.REDSTONE_WIRE.getId());
|
||||
blockPassSet.add((byte) Material.CROPS.getId());
|
||||
blockPassSet.add((byte) Material.SIGN_POST.getId());
|
||||
blockPassSet.add((byte) Material.WOODEN_DOOR.getId());
|
||||
blockPassSet.add((byte) Material.LADDER.getId());
|
||||
blockPassSet.add((byte) Material.RAILS.getId());
|
||||
blockPassSet.add((byte) Material.WALL_SIGN.getId());
|
||||
blockPassSet.add((byte) Material.LEVER.getId());
|
||||
blockPassSet.add((byte) Material.STONE_PLATE.getId());
|
||||
blockPassSet.add((byte) Material.IRON_DOOR_BLOCK.getId());
|
||||
blockPassSet.add((byte) Material.WOOD_PLATE.getId());
|
||||
blockPassSet.add((byte) Material.REDSTONE_TORCH_OFF.getId());
|
||||
blockPassSet.add((byte) Material.REDSTONE_TORCH_ON.getId());
|
||||
blockPassSet.add((byte) Material.STONE_BUTTON.getId());
|
||||
blockPassSet.add((byte) Material.SNOW.getId());
|
||||
blockPassSet.add((byte) Material.SUGAR_CANE_BLOCK.getId());
|
||||
blockPassSet.add((byte) Material.FENCE.getId());
|
||||
blockPassSet.add((byte) Material.PORTAL.getId());
|
||||
blockPassSet.add((byte) Material.CAKE_BLOCK.getId());
|
||||
blockPassSet.add((byte) Material.DIODE_BLOCK_OFF.getId());
|
||||
blockPassSet.add((byte) Material.DIODE_BLOCK_ON.getId());
|
||||
blockPassSet.add((byte) Material.TRAP_DOOR.getId());
|
||||
blockPassSet.add((byte) Material.IRON_FENCE.getId());
|
||||
blockPassSet.add((byte) Material.THIN_GLASS.getId());
|
||||
blockPassSet.add((byte) Material.PUMPKIN_STEM.getId());
|
||||
blockPassSet.add((byte) Material.MELON_STEM.getId());
|
||||
blockPassSet.add((byte) Material.VINE.getId());
|
||||
blockPassSet.add((byte) Material.FENCE_GATE.getId());
|
||||
blockPassSet.add((byte) Material.WATER_LILY.getId());
|
||||
blockPassSet.add((byte) Material.NETHER_WARTS.getId());
|
||||
blockPassSet.add((byte) Material.ENCHANTMENT_TABLE.getId());
|
||||
blockPassSet.add((byte) Material.BREWING_STAND.getId());
|
||||
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());
|
||||
|
||||
blockPassSet.add((byte) Material.BIRCH_FENCE_GATE.getId());
|
||||
blockPassSet.add((byte) Material.JUNGLE_FENCE_GATE.getId());
|
||||
blockPassSet.add((byte) Material.DARK_OAK_FENCE_GATE.getId());
|
||||
blockPassSet.add((byte) Material.ACACIA_FENCE_GATE.getId());
|
||||
blockPassSet.add((byte) Material.SPRUCE_FENCE.getId());
|
||||
blockPassSet.add((byte) Material.BIRCH_FENCE.getId());
|
||||
blockPassSet.add((byte) Material.JUNGLE_FENCE.getId());
|
||||
blockPassSet.add((byte) Material.DARK_OAK_FENCE.getId());
|
||||
blockPassSet.add((byte) Material.ACACIA_FENCE.getId());
|
||||
|
||||
blockPassSet.add((byte) Material.SPRUCE_DOOR.getId());
|
||||
blockPassSet.add((byte) Material.BIRCH_DOOR.getId());
|
||||
blockPassSet.add((byte) Material.JUNGLE_DOOR.getId());
|
||||
blockPassSet.add((byte) Material.ACACIA_DOOR.getId());
|
||||
blockPassSet.add((byte) Material.DARK_OAK_DOOR.getId());
|
||||
|
||||
fullSolid.add((byte) Material.STONE.getId());
|
||||
fullSolid.add((byte) Material.GRASS.getId());
|
||||
fullSolid.add((byte) Material.DIRT.getId());
|
||||
fullSolid.add((byte) Material.COBBLESTONE.getId());
|
||||
fullSolid.add((byte) Material.WOOD.getId());
|
||||
fullSolid.add((byte) Material.BEDROCK.getId());
|
||||
fullSolid.add((byte) Material.SAND.getId());
|
||||
fullSolid.add((byte) Material.GRAVEL.getId());
|
||||
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) Material.DISPENSER.getId());
|
||||
blockUseSet.add((byte) Material.BED_BLOCK.getId());
|
||||
blockUseSet.add((byte) Material.PISTON_BASE.getId());
|
||||
blockUseSet.add((byte) Material.BOOKSHELF.getId());
|
||||
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)
|
||||
@ -451,8 +489,9 @@ public class UtilBlock
|
||||
|
||||
if (block.getType() != Material.AIR)
|
||||
{
|
||||
float f3 = (damageBlocksEqually ? Blocks.DIRT : world.getType(block.getX(), block.getY(),
|
||||
block.getZ())).a((net.minecraft.server.v1_7_R4.Entity) null);
|
||||
Blocks.DIRT.a((net.minecraft.server.v1_8_R3.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;
|
||||
}
|
||||
@ -516,6 +555,11 @@ public class UtilBlock
|
||||
return false;
|
||||
}
|
||||
public static ArrayList<Block> getInBoundingBox(Location a, Location b)
|
||||
{
|
||||
return getInBoundingBox(a, b, true);
|
||||
}
|
||||
|
||||
public static ArrayList<Block> getInBoundingBox(Location a, Location b, boolean ignoreAir)
|
||||
{
|
||||
ArrayList<Block> blocks = new ArrayList<Block>();
|
||||
|
||||
@ -525,10 +569,59 @@ public class UtilBlock
|
||||
{
|
||||
Block block = a.getWorld().getBlockAt(x,y,z);
|
||||
|
||||
if (block.getType() != Material.AIR)
|
||||
blocks.add(block);
|
||||
if(ignoreAir)
|
||||
{
|
||||
if (block.getType() != Material.AIR)
|
||||
blocks.add(block);
|
||||
}
|
||||
else blocks.add(block);
|
||||
}
|
||||
|
||||
return blocks;
|
||||
}
|
||||
|
||||
public static int getStepSoundId(Block block)
|
||||
{
|
||||
if (block.getTypeId() != 35 && block.getTypeId() != 159 && block.getTypeId() != 160)
|
||||
return block.getTypeId();
|
||||
|
||||
switch (block.getData())
|
||||
{
|
||||
case 0:
|
||||
return block.getTypeId();
|
||||
case 1:
|
||||
return 172;
|
||||
case 2:
|
||||
return 87;
|
||||
case 3:
|
||||
return 79;
|
||||
case 4:
|
||||
return 41;
|
||||
case 5:
|
||||
return 133;
|
||||
case 6:
|
||||
return 45;
|
||||
case 7:
|
||||
return 16;
|
||||
case 8:
|
||||
return 13;
|
||||
case 9:
|
||||
return 56;
|
||||
case 10:
|
||||
return 110;
|
||||
case 11:
|
||||
return 22;
|
||||
case 12:
|
||||
return 3;
|
||||
case 13:
|
||||
return 31;
|
||||
case 14:
|
||||
return 152;
|
||||
case 15:
|
||||
return 173;
|
||||
|
||||
default:
|
||||
return block.getTypeId();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,22 +5,23 @@ import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.server.v1_7_R4.AxisAlignedBB;
|
||||
import net.minecraft.server.v1_7_R4.EntityBat;
|
||||
import net.minecraft.server.v1_7_R4.EntityCreature;
|
||||
import net.minecraft.server.v1_7_R4.EntityEnderDragon;
|
||||
import net.minecraft.server.v1_7_R4.EntityHuman;
|
||||
import net.minecraft.server.v1_7_R4.EntityInsentient;
|
||||
import net.minecraft.server.v1_7_R4.EntityLiving;
|
||||
import net.minecraft.server.v1_7_R4.EntityTrackerEntry;
|
||||
import net.minecraft.server.v1_7_R4.Navigation;
|
||||
import net.minecraft.server.v1_7_R4.PacketPlayOutEntityHeadRotation;
|
||||
import net.minecraft.server.v1_7_R4.PathfinderGoal;
|
||||
import net.minecraft.server.v1_7_R4.PathfinderGoalLookAtPlayer;
|
||||
import net.minecraft.server.v1_7_R4.PathfinderGoalMoveTowardsRestriction;
|
||||
import net.minecraft.server.v1_7_R4.PathfinderGoalRandomLookaround;
|
||||
import net.minecraft.server.v1_7_R4.PathfinderGoalSelector;
|
||||
import net.minecraft.server.v1_7_R4.WorldServer;
|
||||
import net.minecraft.server.v1_8_R3.AxisAlignedBB;
|
||||
import net.minecraft.server.v1_8_R3.EntityBat;
|
||||
import net.minecraft.server.v1_8_R3.EntityCreature;
|
||||
import net.minecraft.server.v1_8_R3.EntityEnderDragon;
|
||||
import net.minecraft.server.v1_8_R3.EntityHuman;
|
||||
import net.minecraft.server.v1_8_R3.EntityInsentient;
|
||||
import net.minecraft.server.v1_8_R3.EntityLiving;
|
||||
import net.minecraft.server.v1_8_R3.EntityTrackerEntry;
|
||||
import net.minecraft.server.v1_8_R3.NavigationAbstract;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutEntity;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityHeadRotation;
|
||||
import net.minecraft.server.v1_8_R3.PathfinderGoal;
|
||||
import net.minecraft.server.v1_8_R3.PathfinderGoalLookAtPlayer;
|
||||
import net.minecraft.server.v1_8_R3.PathfinderGoalMoveTowardsRestriction;
|
||||
import net.minecraft.server.v1_8_R3.PathfinderGoalRandomLookaround;
|
||||
import net.minecraft.server.v1_8_R3.PathfinderGoalSelector;
|
||||
import net.minecraft.server.v1_8_R3.WorldServer;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
@ -28,10 +29,10 @@ import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftCreature;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftLivingEntity;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftCreature;
|
||||
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.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
@ -60,31 +61,29 @@ public class UtilEnt
|
||||
|
||||
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)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
public static void Leash(LivingEntity leashed, Entity holder, boolean pull, boolean breakable)
|
||||
{
|
||||
if (((CraftEntity)leashed).getHandle() instanceof EntityInsentient)
|
||||
{
|
||||
EntityInsentient creature = (EntityInsentient)((CraftEntity)leashed).getHandle();
|
||||
|
||||
creature.PullWhileLeashed = pull;
|
||||
creature.BreakLeash = breakable;
|
||||
}
|
||||
|
||||
leashed.setLeashHolder(holder);
|
||||
|
||||
if (!(((CraftLivingEntity)leashed).getHandle() instanceof EntityInsentient))
|
||||
return;
|
||||
|
||||
((EntityInsentient)((CraftLivingEntity)leashed).getHandle()).setPullWhileLeashed(pull);
|
||||
((EntityInsentient)((CraftLivingEntity)leashed).getHandle()).setShouldBreakLeash(breakable);
|
||||
}
|
||||
|
||||
public static void addLookAtPlayerAI(Entity entity, float dist)
|
||||
@ -132,7 +131,7 @@ public class UtilEnt
|
||||
{
|
||||
Vegetate(entity, false);
|
||||
}
|
||||
|
||||
|
||||
public static void Vegetate(Entity entity, boolean mute)
|
||||
{
|
||||
try
|
||||
@ -167,7 +166,7 @@ public class UtilEnt
|
||||
|
||||
if (_bsRestrictionGoal == null)
|
||||
{
|
||||
_bsRestrictionGoal = EntityCreature.class.getDeclaredField("bs");
|
||||
_bsRestrictionGoal = EntityCreature.class.getDeclaredField("c");
|
||||
_bsRestrictionGoal.setAccessible(true);
|
||||
}
|
||||
|
||||
@ -178,10 +177,10 @@ public class UtilEnt
|
||||
{
|
||||
EntityInsentient creature = (EntityInsentient)((CraftEntity)entity).getHandle();
|
||||
|
||||
creature.Vegetated = true;
|
||||
creature.Silent = mute;
|
||||
|
||||
((List)_pathfinderBList.get(((PathfinderGoalSelector)_goalSelector.get(creature)))).clear();
|
||||
creature.setVegetated(true);
|
||||
creature.setSilent(mute);
|
||||
|
||||
((List) _pathfinderBList.get(((PathfinderGoalSelector)_goalSelector.get(creature)))).clear();
|
||||
((List)_pathfinderCList.get(((PathfinderGoalSelector)_goalSelector.get(creature)))).clear();
|
||||
|
||||
((List)_pathfinderBList.get(((PathfinderGoalSelector)_targetSelector.get(creature)))).clear();
|
||||
@ -190,14 +189,14 @@ public class UtilEnt
|
||||
|
||||
if (((CraftEntity)entity).getHandle() instanceof EntityBat)
|
||||
{
|
||||
((EntityBat)((CraftEntity)entity).getHandle()).Vegetated = true;
|
||||
((EntityBat)((CraftEntity)entity).getHandle()).setVegetated(true);
|
||||
}
|
||||
|
||||
if (((CraftEntity)entity).getHandle() instanceof EntityEnderDragon)
|
||||
{
|
||||
EntityEnderDragon creature = (EntityEnderDragon)((CraftEntity)entity).getHandle();
|
||||
|
||||
creature.Vegetated = true;
|
||||
creature.setVegetated(true);
|
||||
}
|
||||
}
|
||||
catch (IllegalArgumentException e)
|
||||
@ -217,7 +216,7 @@ public class UtilEnt
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void removeGoalSelectors(Entity entity)
|
||||
{
|
||||
try
|
||||
@ -291,6 +290,8 @@ public class UtilEnt
|
||||
creatureMap.put("WitherSkull", EntityType.WITHER_SKULL);
|
||||
creatureMap.put("Wolf", EntityType.WOLF);
|
||||
creatureMap.put("Zombie", EntityType.ZOMBIE);
|
||||
creatureMap.put("Guardian", EntityType.GUARDIAN);
|
||||
creatureMap.put("Rabbit", EntityType.RABBIT);
|
||||
|
||||
creatureMap.put("Item", EntityType.DROPPED_ITEM);
|
||||
}
|
||||
@ -435,10 +436,45 @@ public class UtilEnt
|
||||
|
||||
LivingEntity ent = (LivingEntity)cur;
|
||||
|
||||
//Feet
|
||||
double offset = UtilMath.offset(loc, ent.getLocation());
|
||||
|
||||
if (offset < dR)
|
||||
{
|
||||
ents.put(ent, 1 - (offset/dR));
|
||||
continue;
|
||||
}
|
||||
|
||||
//Eyes
|
||||
offset = UtilMath.offset(loc, ent.getEyeLocation());
|
||||
|
||||
if (offset < dR)
|
||||
{
|
||||
ents.put(ent, 1 - (offset/dR));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
return ents;
|
||||
}
|
||||
|
||||
public static HashMap<Entity, Double> getAllInRadius(Location loc, double dR)
|
||||
{
|
||||
HashMap<Entity, Double> ents = new HashMap<Entity, Double>();
|
||||
|
||||
for (Entity cur : loc.getWorld().getEntities())
|
||||
{
|
||||
if (UtilPlayer.isSpectator(cur))
|
||||
continue;
|
||||
|
||||
//Loc
|
||||
double offset = UtilMath.offset(loc, cur.getLocation());
|
||||
|
||||
if (offset < dR)
|
||||
{
|
||||
ents.put(cur, 1 - (offset/dR));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
return ents;
|
||||
@ -467,7 +503,7 @@ public class UtilEnt
|
||||
}
|
||||
else if (UtilMath.offset2d(loc, player.getLocation()) < 0.6 * mult)
|
||||
{
|
||||
if (loc.getY() > player.getLocation().getY() && loc.getY() < player.getEyeLocation().getY())
|
||||
if (loc.getY() >= player.getLocation().getY() - 0.2*mult && loc.getY() <= player.getEyeLocation().getY() + 0.2*mult)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -501,7 +537,7 @@ public class UtilEnt
|
||||
return ent.isOnGround();
|
||||
}
|
||||
|
||||
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_2 = new Location(ent.getWorld(), box.d, ent.getLocation().getY()-0.1, box.f);
|
||||
|
||||
@ -608,24 +644,57 @@ public class UtilEnt
|
||||
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)
|
||||
{
|
||||
if (!(ent instanceof LivingEntity))
|
||||
return false;
|
||||
|
||||
EntityLiving ec = ((CraftLivingEntity) ent).getHandle();
|
||||
Location loc = ent.getLocation();
|
||||
|
||||
ec.setPositionRotation(loc.getX(), loc.getY(), loc.getZ(), yaw, pitch);
|
||||
ec.al = true;
|
||||
ec.yaw = yaw;
|
||||
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;
|
||||
}
|
||||
|
||||
public static boolean CreatureLook(Entity ent, float yaw)
|
||||
{
|
||||
return CreatureLook(ent, 0, yaw);
|
||||
}
|
||||
|
||||
public static void CreatureMove(Entity ent, Location target, float speed)
|
||||
{
|
||||
if (!(ent instanceof Creature))
|
||||
@ -633,9 +702,9 @@ public class UtilEnt
|
||||
|
||||
if (UtilMath.offset(ent.getLocation(), target) < 0.1)
|
||||
return;
|
||||
|
||||
|
||||
EntityCreature ec = ((CraftCreature)ent).getHandle();
|
||||
Navigation nav = ec.getNavigation();
|
||||
NavigationAbstract nav = ec.getNavigation();
|
||||
|
||||
if (UtilMath.offset(ent.getLocation(), target) > 16)
|
||||
{
|
||||
@ -687,7 +756,7 @@ public class UtilEnt
|
||||
{
|
||||
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);
|
||||
int entityId = field.getInt(null);
|
||||
if (modifynumber) {
|
||||
|
@ -1,14 +1,14 @@
|
||||
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.FireworkEffect;
|
||||
import org.bukkit.FireworkEffect.Type;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftFirework;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftFirework;
|
||||
import org.bukkit.entity.Firework;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.meta.FireworkMeta;
|
||||
@ -18,9 +18,9 @@ public class UtilFirework
|
||||
{
|
||||
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.setPower(1);
|
||||
data.addEffect(fe);
|
||||
@ -35,9 +35,9 @@ public class UtilFirework
|
||||
{
|
||||
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.setPower(power);
|
||||
data.addEffect(fe);
|
||||
@ -59,7 +59,6 @@ public class UtilFirework
|
||||
public void detonateFirework(Firework firework)
|
||||
{
|
||||
((CraftWorld)firework.getWorld()).getHandle().broadcastEntityEffect(((CraftEntity)firework).getHandle(), (byte)17);
|
||||
|
||||
firework.remove();
|
||||
}
|
||||
|
||||
@ -85,9 +84,12 @@ public class UtilFirework
|
||||
firework.setFireworkMeta(data);
|
||||
|
||||
((CraftFirework) firework).getHandle().expectedLifespan = 1;
|
||||
|
||||
PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(firework.getEntityId());
|
||||
|
||||
|
||||
PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(new int[]
|
||||
{
|
||||
firework.getEntityId()
|
||||
});
|
||||
|
||||
for (Player viewing : UtilServer.getPlayers())
|
||||
{
|
||||
if (player == viewing)
|
||||
|
@ -12,6 +12,7 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.InventoryAction;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.inventory.InventoryType;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
@ -154,18 +155,25 @@ public class UtilInv
|
||||
PlayerInventory inv = player.getInventory();
|
||||
|
||||
inv.clear();
|
||||
inv.setArmorContents(new ItemStack[4]);
|
||||
player.setItemOnCursor(new ItemStack(Material.AIR));
|
||||
|
||||
inv.setArmorContents(new ItemStack[4]);
|
||||
player.setItemOnCursor(new ItemStack(Material.AIR));
|
||||
|
||||
Inventory openInventory = player.getOpenInventory().getTopInventory();
|
||||
|
||||
if (openInventory.getHolder() == player)
|
||||
{
|
||||
openInventory.clear();
|
||||
}
|
||||
|
||||
player.saveData();
|
||||
}
|
||||
|
||||
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>();
|
||||
PlayerInventory inv = player.getInventory();
|
||||
@ -197,6 +205,22 @@ public class UtilInv
|
||||
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;
|
||||
}
|
||||
|
||||
@ -352,5 +376,24 @@ public class UtilInv
|
||||
Update(player);
|
||||
}
|
||||
|
||||
public static int getAmount(Player player, Material mat)
|
||||
{
|
||||
return getAmount(player, mat, true);
|
||||
}
|
||||
|
||||
public static int getAmount(Player player, Material mat, boolean includeArmorAndCursorAndCrafting)
|
||||
{
|
||||
int amount = 0;
|
||||
|
||||
for (ItemStack item : getItems(player, includeArmorAndCursorAndCrafting, includeArmorAndCursorAndCrafting,
|
||||
includeArmorAndCursorAndCrafting))
|
||||
{
|
||||
if (item.getType() == mat)
|
||||
{
|
||||
amount += item.getAmount();
|
||||
}
|
||||
}
|
||||
|
||||
return amount;
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,8 @@ package mineplex.core.common.util;
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
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.Material;
|
||||
@ -13,30 +14,26 @@ public class UtilParticle
|
||||
{
|
||||
public enum ViewDist
|
||||
{
|
||||
SHORT(8),
|
||||
NORMAL(24),
|
||||
LONG(48),
|
||||
LONGER(96),
|
||||
MAX(256);
|
||||
|
||||
SHORT(8), NORMAL(24), LONG(48), LONGER(96), MAX(256);
|
||||
|
||||
private int _dist;
|
||||
|
||||
|
||||
ViewDist(int dist)
|
||||
{
|
||||
_dist = dist;
|
||||
}
|
||||
|
||||
|
||||
public int getDist()
|
||||
{
|
||||
return _dist;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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
|
||||
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
|
||||
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
|
||||
public String getParticle(Material type, int data)
|
||||
@ -93,66 +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),
|
||||
|
||||
LAVA("lava", "Lava Debris", Material.LAVA, (byte) 0),
|
||||
SMOKE(EnumParticle.SMOKE_NORMAL, "smoke", "Smoke", Material.INK_SACK, (byte) 0),
|
||||
|
||||
MAGIC_CRIT("magicCrit", "Teal Magic", Material.INK_SACK, (byte) 6),
|
||||
LAVA(EnumParticle.LAVA, "lava", "Lava Debris", Material.LAVA, (byte) 0),
|
||||
|
||||
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
|
||||
*/
|
||||
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
|
||||
*/
|
||||
MOB_SPELL_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),
|
||||
MOB_SPELL_AMBIENT(EnumParticle.SPELL_MOB_AMBIENT, "mobSpellAmbient", "Transparent Black Swirls", Material
|
||||
.getMaterial(2266), (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
|
||||
* To do certain colors, use "no / 24F" for the random X value, 1 for speed. 0 for count.
|
||||
*/
|
||||
NOTE(EnumParticle.NOTE, "note", "Musical Note", Material.JUKEBOX, (byte) 0),
|
||||
|
||||
PORTAL(EnumParticle.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
|
||||
*/
|
||||
RED_DUST("reddust", "Red Smoke", Material.INK_SACK, (byte) 1),
|
||||
RED_DUST(EnumParticle.REDSTONE, "reddust", "Red Smoke", Material.INK_SACK, (byte) 1),
|
||||
|
||||
SLIME("slime", "Slime Particles", Material.SLIME_BALL, (byte) 0),
|
||||
SLIME(EnumParticle.SLIME, "slime", "Slime Particles", Material.SLIME_BALL, (byte) 0),
|
||||
|
||||
SNOW_SHOVEL("snowshovel", "Snow Puffs", Material.SNOW_BALL, (byte) 0),
|
||||
SNOW_SHOVEL(EnumParticle.SNOW_SHOVEL, "snowshovel", "Snow Puffs", Material.SNOW_BALL, (byte) 0),
|
||||
|
||||
SNOWBALL_POOF("snowballpoof"),
|
||||
SNOWBALL_POOF(EnumParticle.SNOWBALL, "snowballpoof"),
|
||||
|
||||
SPELL("spell", "White Swirls", Material.getMaterial(2264), (byte) 0),
|
||||
SPELL(EnumParticle.SPELL, "spell", "White Swirls", Material.getMaterial(2264), (byte) 0),
|
||||
|
||||
SPLASH("splash"),
|
||||
SPLASH(EnumParticle.WATER_SPLASH, "splash"),
|
||||
|
||||
SUSPEND("suspended"),
|
||||
SUSPEND(EnumParticle.SUSPENDED, "suspended"),
|
||||
|
||||
TOWN_AURA("townaura", "Black Specks", Material.COAL, (byte) 0),
|
||||
TOWN_AURA(EnumParticle.TOWN_AURA, "townaura", "Black Specks", Material.COAL, (byte) 0),
|
||||
|
||||
WITCH_MAGIC("witchMagic", "Purple Magic", Material.INK_SACK, (byte) 13);
|
||||
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;
|
||||
private boolean _friendlyData;
|
||||
private String _friendlyName;
|
||||
private Material _material;
|
||||
private byte _data;
|
||||
|
||||
ParticleType(String particleName)
|
||||
ParticleType(EnumParticle particle, String particleName)
|
||||
{
|
||||
this.particleName = particleName;
|
||||
_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.particle = particle;
|
||||
_friendlyData = true;
|
||||
_friendlyName = friendlyName;
|
||||
_material = material;
|
||||
@ -173,9 +188,9 @@ public class UtilParticle
|
||||
{
|
||||
if (_friendlyName == null)
|
||||
{
|
||||
return toString();
|
||||
return toString();
|
||||
}
|
||||
|
||||
|
||||
return _friendlyName;
|
||||
}
|
||||
|
||||
@ -203,28 +218,48 @@ public class UtilParticle
|
||||
private static PacketPlayOutWorldParticles getPacket(String particleName, Location location, float offsetX, float offsetY,
|
||||
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;
|
||||
}
|
||||
|
||||
public static void PlayParticle(ParticleType type,Location location, float offsetX, float offsetY, float offsetZ,
|
||||
float speed, int count, ViewDist dist, Player... players)
|
||||
public static void PlayParticle(ParticleType type, Location location, float offsetX, float offsetY, float offsetZ,
|
||||
float speed, int count, ViewDist dist, Player... 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,
|
||||
float speed, int count, ViewDist dist, Player... players)
|
||||
public static void PlayParticle(String particle, Location location, float offsetX, float offsetY, float offsetZ, float speed,
|
||||
int count, ViewDist dist, Player... players)
|
||||
{
|
||||
PacketPlayOutWorldParticles packet = getPacket(particle, location, offsetX, offsetY, offsetZ, speed, count, true);
|
||||
|
||||
for (Player player : players)
|
||||
{
|
||||
//Out of range for player
|
||||
// Out of range for player
|
||||
if (UtilMath.offset(player.getLocation(), location) > dist.getDist())
|
||||
continue;
|
||||
|
||||
|
||||
UtilPlayer.sendPacket(player, packet);
|
||||
}
|
||||
}
|
||||
|
@ -6,16 +6,16 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import net.minecraft.server.v1_7_R4.EntityPlayer;
|
||||
import net.minecraft.server.v1_7_R4.Packet;
|
||||
import net.minecraft.server.v1_7_R4.PlayerConnection;
|
||||
import net.minecraft.server.v1_8_R3.EntityPlayer;
|
||||
import net.minecraft.server.v1_8_R3.Packet;
|
||||
import net.minecraft.server.v1_8_R3.PlayerConnection;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.event.CraftEventFactory;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.event.CraftEventFactory;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -590,17 +590,15 @@ public class UtilPlayer
|
||||
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 sendPacket(Player player, Packet... packets)
|
||||
{
|
||||
PlayerConnection connection = ((CraftPlayer) player).getHandle().playerConnection;
|
||||
|
||||
for (Packet packet : packets)
|
||||
{
|
||||
if (packet == null)
|
||||
continue;
|
||||
|
||||
connection.sendPacket(packet);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,114 @@
|
||||
package mineplex.core.common.util;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class UtilRadar
|
||||
{
|
||||
public static void displayRadar(Player player, List<RadarData> dataList)
|
||||
{
|
||||
displayRadar(player, dataList, true);
|
||||
}
|
||||
|
||||
public static void displayRadar(Player player, List<RadarData> dataList, boolean bossBar)
|
||||
{
|
||||
int radarChars = 59;
|
||||
int radarSpaces = radarChars;
|
||||
|
||||
//get bearings for each element
|
||||
for (RadarData data : dataList)
|
||||
{
|
||||
double pYaw = UtilAlg.GetYaw(player.getLocation().getDirection());
|
||||
double relYaw = UtilAlg.GetYaw(UtilAlg.getTrajectory(player.getLocation(), data.Loc));
|
||||
|
||||
data.setBearing(relYaw - pYaw);
|
||||
|
||||
radarSpaces -= ChatColor.stripColor(data.Text).length();
|
||||
}
|
||||
|
||||
//sort
|
||||
sortScores(dataList);
|
||||
|
||||
//draw
|
||||
String text = C.cPurple + C.Bold + "Radar [" + ChatColor.RESET;
|
||||
int radarSpacesDrawn = 0;
|
||||
int radarCharsDrawn = 0;
|
||||
|
||||
for (RadarData data : dataList)
|
||||
{
|
||||
//behind to left
|
||||
if (data.getBearing() < -90)
|
||||
{
|
||||
text += ChatColor.RESET + data.Text;
|
||||
radarCharsDrawn += ChatColor.stripColor(data.Text).length();
|
||||
}
|
||||
//behind to right
|
||||
else if (data.getBearing() > 90)
|
||||
{
|
||||
//finish spaces
|
||||
while (radarSpacesDrawn < radarSpaces)
|
||||
{
|
||||
text += " ";
|
||||
radarSpacesDrawn++;
|
||||
radarCharsDrawn++;
|
||||
}
|
||||
|
||||
text += ChatColor.RESET + data.Text;
|
||||
radarCharsDrawn += ChatColor.stripColor(data.Text).length();
|
||||
}
|
||||
//in front
|
||||
else
|
||||
{
|
||||
double percent = (data.getBearing() + 90D) / 180D;
|
||||
|
||||
while (percent >= (double)radarCharsDrawn/(double)radarChars && radarSpacesDrawn<radarSpaces)
|
||||
{
|
||||
text += " ";
|
||||
radarSpacesDrawn++;
|
||||
radarCharsDrawn++;
|
||||
}
|
||||
|
||||
text += ChatColor.RESET + data.Text;
|
||||
radarCharsDrawn += ChatColor.stripColor(data.Text).length();
|
||||
}
|
||||
}
|
||||
|
||||
//finish spaces (only needed if nothing was on right)
|
||||
while (radarSpacesDrawn < radarSpaces)
|
||||
{
|
||||
text += " ";
|
||||
radarSpacesDrawn++;
|
||||
}
|
||||
|
||||
text += C.cPurple + C.Bold + "] Radar";
|
||||
|
||||
UtilTextTop.display(text, player);
|
||||
|
||||
if(bossBar)
|
||||
{
|
||||
UtilTextTop.display(text, player);
|
||||
}
|
||||
else
|
||||
{
|
||||
UtilTextBottom.display(text, player);
|
||||
}
|
||||
}
|
||||
|
||||
private static void sortScores(List<RadarData> dataList)
|
||||
{
|
||||
for (int i=0 ; i<dataList.size() ; i++)
|
||||
{
|
||||
for (int j=dataList.size()-1 ; j>0 ; j--)
|
||||
{
|
||||
if (dataList.get(j).getBearing() < dataList.get(j-1).getBearing())
|
||||
{
|
||||
RadarData temp = dataList.get(j);
|
||||
dataList.set(j, dataList.get(j-1));
|
||||
dataList.set(j-1, temp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,192 +1,193 @@
|
||||
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.Map;
|
||||
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
|
||||
{
|
||||
private static final int PROTOCOL_VERSION = 47;
|
||||
|
||||
public static void broadcastHeader(String header)
|
||||
{
|
||||
broadcastHeaderAndFooter(header, null);
|
||||
}
|
||||
public static void broadcastHeader(String header)
|
||||
{
|
||||
broadcastHeaderAndFooter(header, null);
|
||||
}
|
||||
|
||||
|
||||
public static void broadcastFooter(String footer)
|
||||
{
|
||||
broadcastHeaderAndFooter(null, footer);
|
||||
}
|
||||
public static void broadcastFooter(String footer)
|
||||
{
|
||||
broadcastHeaderAndFooter(null, footer);
|
||||
}
|
||||
|
||||
|
||||
public static void broadcastHeaderAndFooter(String header, String footer)
|
||||
{
|
||||
for (Player player : Bukkit.getOnlinePlayers())
|
||||
doHeaderAndFooter(player, header, footer);
|
||||
}
|
||||
|
||||
public static void setHeaderAndFooter(Player player, String header, String footer)
|
||||
{
|
||||
doHeaderAndFooter(player, header, footer);
|
||||
}
|
||||
public static void broadcastHeaderAndFooter(String header, String footer)
|
||||
{
|
||||
for (Player player : Bukkit.getOnlinePlayers())
|
||||
doHeaderAndFooter(player, header, footer);
|
||||
}
|
||||
|
||||
public static void setHeader(Player p, String header)
|
||||
{
|
||||
doHeaderAndFooter(p, header, null);
|
||||
}
|
||||
public static void setHeaderAndFooter(Player player, String header, String footer)
|
||||
{
|
||||
doHeaderAndFooter(player, header, footer);
|
||||
}
|
||||
|
||||
public static void setHeader(Player p, String header)
|
||||
{
|
||||
doHeaderAndFooter(p, header, null);
|
||||
}
|
||||
|
||||
|
||||
public static void setFooter(Player p, String footer)
|
||||
{
|
||||
doHeaderAndFooter(p, null, footer);
|
||||
}
|
||||
public static void setFooter(Player p, String footer)
|
||||
{
|
||||
doHeaderAndFooter(p, null, footer);
|
||||
}
|
||||
|
||||
|
||||
public static void doHeaderAndFooter(Player p, String rawHeader, String rawFooter)
|
||||
{
|
||||
CraftPlayer player = (CraftPlayer) p;
|
||||
if (player.getHandle().playerConnection.networkManager.getVersion() != PROTOCOL_VERSION) return;
|
||||
IChatBaseComponent header = ChatSerializer.a(TextConverter.convert(rawHeader));
|
||||
IChatBaseComponent footer = ChatSerializer.a(TextConverter.convert(rawFooter));
|
||||
if (header == null || footer == null)
|
||||
{
|
||||
TabTitleCache titleCache = TabTitleCache.getTabTitle(p.getUniqueId());
|
||||
if (titleCache != null)
|
||||
{
|
||||
if (header == null)
|
||||
{
|
||||
String headerString = titleCache.getHeader();
|
||||
if (headerString != null)
|
||||
{
|
||||
rawHeader = headerString;
|
||||
header = ChatSerializer.a(TextConverter.convert(headerString));
|
||||
}
|
||||
}
|
||||
if (footer == null)
|
||||
{
|
||||
String footerString = titleCache.getFooter();
|
||||
if (footerString != null)
|
||||
{
|
||||
rawHeader = footerString;
|
||||
header = ChatSerializer.a(TextConverter.convert(footerString));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
TabTitleCache.addTabTitle(p.getUniqueId(), new TabTitleCache(rawHeader, rawFooter));
|
||||
ProtocolInjector.PacketTabHeader packet = new ProtocolInjector.PacketTabHeader(header, footer);
|
||||
player.getHandle().playerConnection.sendPacket(packet);
|
||||
}
|
||||
|
||||
private static class TextConverter
|
||||
{
|
||||
public static String convert(String text)
|
||||
{
|
||||
if (text == null || text.length() == 0)
|
||||
{
|
||||
return "\"\"";
|
||||
}
|
||||
|
||||
char c;
|
||||
int i;
|
||||
int len = text.length();
|
||||
StringBuilder sb = new StringBuilder(len + 4);
|
||||
String t;
|
||||
sb.append('"');
|
||||
|
||||
for (i = 0; i < len; i += 1)
|
||||
{
|
||||
c = text.charAt(i);
|
||||
switch (c)
|
||||
{
|
||||
case '\\':
|
||||
case '"':
|
||||
sb.append('\\');
|
||||
sb.append(c);
|
||||
break;
|
||||
case '/':
|
||||
sb.append('\\');
|
||||
sb.append(c);
|
||||
break;
|
||||
case '\b':
|
||||
sb.append("\\b");
|
||||
break;
|
||||
case '\t':
|
||||
sb.append("\\t");
|
||||
break;
|
||||
case '\n':
|
||||
sb.append("\\n");
|
||||
break;
|
||||
case '\f':
|
||||
sb.append("\\f");
|
||||
break;
|
||||
case '\r':
|
||||
sb.append("\\r");
|
||||
break;
|
||||
default:
|
||||
if (c < ' ')
|
||||
{
|
||||
t = "000" + Integer.toHexString(c);
|
||||
sb.append("\\u").append(t.substring(t.length() - 4));
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.append(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
sb.append('"');
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static String setPlayerName(Player player, String text)
|
||||
{
|
||||
return text.replaceAll("(?i)\\{PLAYER\\}", player.getName());
|
||||
}
|
||||
}
|
||||
|
||||
private static class TabTitleCache
|
||||
{
|
||||
final private static Map<UUID, TabTitleCache> playerTabTitles = new HashMap<>();
|
||||
private String header;
|
||||
private String footer;
|
||||
|
||||
public TabTitleCache(String header, String footer)
|
||||
{
|
||||
this.header = header;
|
||||
this.footer = footer;
|
||||
}
|
||||
|
||||
public static TabTitleCache getTabTitle(UUID uuid)
|
||||
{
|
||||
return playerTabTitles.get(uuid);
|
||||
}
|
||||
|
||||
public static void addTabTitle(UUID uuid, TabTitleCache titleCache)
|
||||
{
|
||||
playerTabTitles.put(uuid, titleCache);
|
||||
}
|
||||
|
||||
public static void removeTabTitle(UUID uuid)
|
||||
{
|
||||
playerTabTitles.remove(uuid);
|
||||
}
|
||||
|
||||
public String getHeader()
|
||||
{
|
||||
return header;
|
||||
}
|
||||
|
||||
public String getFooter()
|
||||
{
|
||||
return footer;
|
||||
}
|
||||
}
|
||||
public static void doHeaderAndFooter(Player p, String rawHeader, String rawFooter)
|
||||
{
|
||||
IChatBaseComponent header = IChatBaseComponent.ChatSerializer.a(TextConverter.convert(rawHeader));
|
||||
IChatBaseComponent footer = IChatBaseComponent.ChatSerializer.a(TextConverter.convert(rawFooter));
|
||||
if (header == null || footer == null)
|
||||
{
|
||||
TabTitleCache titleCache = TabTitleCache.getTabTitle(p.getUniqueId());
|
||||
if (titleCache != null)
|
||||
{
|
||||
if (header == null)
|
||||
{
|
||||
String headerString = titleCache.getHeader();
|
||||
if (headerString != null)
|
||||
{
|
||||
rawHeader = headerString;
|
||||
header = IChatBaseComponent.ChatSerializer.a(TextConverter.convert(headerString));
|
||||
}
|
||||
}
|
||||
if (footer == null)
|
||||
{
|
||||
String footerString = titleCache.getFooter();
|
||||
if (footerString != null)
|
||||
{
|
||||
rawHeader = footerString;
|
||||
header = IChatBaseComponent.ChatSerializer.a(TextConverter.convert(footerString));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TabTitleCache.addTabTitle(p.getUniqueId(), new TabTitleCache(rawHeader, rawFooter));
|
||||
PacketPlayOutPlayerListHeaderFooter packet = new PacketPlayOutPlayerListHeaderFooter();
|
||||
packet.a = header;
|
||||
packet.b = footer;
|
||||
UtilPlayer.sendPacket(p, packet);
|
||||
}
|
||||
|
||||
private static class TextConverter
|
||||
{
|
||||
public static String convert(String text)
|
||||
{
|
||||
if (text == null || text.length() == 0)
|
||||
{
|
||||
return "\"\"";
|
||||
}
|
||||
|
||||
char c;
|
||||
int i;
|
||||
int len = text.length();
|
||||
StringBuilder sb = new StringBuilder(len + 4);
|
||||
String t;
|
||||
sb.append('"');
|
||||
|
||||
for (i = 0; i < len; i += 1)
|
||||
{
|
||||
c = text.charAt(i);
|
||||
switch (c)
|
||||
{
|
||||
case '\\':
|
||||
case '"':
|
||||
sb.append('\\');
|
||||
sb.append(c);
|
||||
break;
|
||||
case '/':
|
||||
sb.append('\\');
|
||||
sb.append(c);
|
||||
break;
|
||||
case '\b':
|
||||
sb.append("\\b");
|
||||
break;
|
||||
case '\t':
|
||||
sb.append("\\t");
|
||||
break;
|
||||
case '\n':
|
||||
sb.append("\\n");
|
||||
break;
|
||||
case '\f':
|
||||
sb.append("\\f");
|
||||
break;
|
||||
case '\r':
|
||||
sb.append("\\r");
|
||||
break;
|
||||
default:
|
||||
if (c < ' ')
|
||||
{
|
||||
t = "000" + Integer.toHexString(c);
|
||||
sb.append("\\u").append(t.substring(t.length() - 4));
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.append(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
sb.append('"');
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static String setPlayerName(Player player, String text)
|
||||
{
|
||||
return text.replaceAll("(?i)\\{PLAYER\\}", player.getName());
|
||||
}
|
||||
}
|
||||
|
||||
private static class TabTitleCache
|
||||
{
|
||||
final private static Map<UUID, TabTitleCache> playerTabTitles = new HashMap<>();
|
||||
private String header;
|
||||
private String footer;
|
||||
|
||||
public TabTitleCache(String header, String footer)
|
||||
{
|
||||
this.header = header;
|
||||
this.footer = footer;
|
||||
}
|
||||
|
||||
public static TabTitleCache getTabTitle(UUID uuid)
|
||||
{
|
||||
return playerTabTitles.get(uuid);
|
||||
}
|
||||
|
||||
public static void addTabTitle(UUID uuid, TabTitleCache titleCache)
|
||||
{
|
||||
playerTabTitles.put(uuid, titleCache);
|
||||
}
|
||||
|
||||
public static void removeTabTitle(UUID uuid)
|
||||
{
|
||||
playerTabTitles.remove(uuid);
|
||||
}
|
||||
|
||||
public String getHeader()
|
||||
{
|
||||
return header;
|
||||
}
|
||||
|
||||
public String getFooter()
|
||||
{
|
||||
return footer;
|
||||
}
|
||||
}
|
||||
}
|
@ -14,15 +14,6 @@ public class UtilTextBottom
|
||||
|
||||
//1.8
|
||||
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)
|
||||
@ -59,21 +50,7 @@ public class UtilTextBottom
|
||||
|
||||
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;
|
||||
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import net.minecraft.server.v1_7_R4.ChatMessage;
|
||||
|
||||
import org.spigotmc.ProtocolInjector.PacketTitle;
|
||||
import org.spigotmc.ProtocolInjector.PacketTitle.Action;
|
||||
import net.minecraft.server.v1_8_R3.ChatMessage;
|
||||
import net.minecraft.server.v1_8_R3.Packet;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutTitle;
|
||||
|
||||
/**
|
||||
* Created by Shaun on 9/5/2014.
|
||||
@ -52,7 +51,7 @@ public class UtilTextMiddle
|
||||
text = "";
|
||||
|
||||
ChatMessage message = new ChatMessage(text);
|
||||
PacketTitle packet = new PacketTitle(Action.TITLE, message);
|
||||
PacketPlayOutTitle packet = new PacketPlayOutTitle(PacketPlayOutTitle.EnumTitleAction.TITLE, message);
|
||||
sendPacket(packet, players);
|
||||
}
|
||||
|
||||
@ -67,7 +66,7 @@ public class UtilTextMiddle
|
||||
text = "";
|
||||
|
||||
ChatMessage message = new ChatMessage(text);
|
||||
PacketTitle packet = new PacketTitle(Action.SUBTITLE, message);
|
||||
PacketPlayOutTitle packet = new PacketPlayOutTitle(PacketPlayOutTitle.EnumTitleAction.SUBTITLE, message);
|
||||
sendPacket(packet, players);
|
||||
}
|
||||
|
||||
@ -78,7 +77,7 @@ public class UtilTextMiddle
|
||||
*/
|
||||
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);
|
||||
}
|
||||
|
||||
@ -87,7 +86,7 @@ public class UtilTextMiddle
|
||||
*/
|
||||
public static void clear(Player... players)
|
||||
{
|
||||
PacketTitle packet = new PacketTitle(Action.CLEAR);
|
||||
PacketPlayOutTitle packet = new PacketPlayOutTitle(PacketPlayOutTitle.EnumTitleAction.CLEAR, null);
|
||||
sendPacket(packet, players);
|
||||
}
|
||||
|
||||
@ -98,18 +97,15 @@ public class UtilTextMiddle
|
||||
*/
|
||||
public static void reset(Player... players)
|
||||
{
|
||||
PacketTitle packet = new PacketTitle(Action.RESET);
|
||||
PacketPlayOutTitle packet = new PacketPlayOutTitle(PacketPlayOutTitle.EnumTitleAction.RESET, null);
|
||||
sendPacket(packet, players);
|
||||
}
|
||||
|
||||
private static void sendPacket(PacketTitle packet, Player... players)
|
||||
private static void sendPacket(Packet packet, Player... players)
|
||||
{
|
||||
for (Player player : players)
|
||||
{
|
||||
if (UtilPlayer.is1_8(player))
|
||||
{
|
||||
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
|
||||
}
|
||||
UtilPlayer.sendPacket(player, packet);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,16 +1,16 @@
|
||||
package mineplex.core.common.util;
|
||||
|
||||
import mineplex.core.common.DummyEntity;
|
||||
import net.minecraft.server.v1_7_R4.DataWatcher;
|
||||
import net.minecraft.server.v1_7_R4.MathHelper;
|
||||
import net.minecraft.server.v1_7_R4.PacketPlayOutEntityDestroy;
|
||||
import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntityLiving;
|
||||
import net.minecraft.server.v1_8_R3.DataWatcher;
|
||||
import net.minecraft.server.v1_8_R3.MathHelper;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
||||
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;
|
||||
|
||||
@ -38,23 +38,19 @@ public class UtilTextTop
|
||||
deleteOld(player);
|
||||
|
||||
healthPercent = Math.min(1, healthPercent);
|
||||
boolean halfHealth = UtilPlayer.is1_8(player);
|
||||
|
||||
//Display Dragon
|
||||
{
|
||||
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)
|
||||
if (UtilPlayer.is1_8(player))
|
||||
{
|
||||
Location loc = player.getEyeLocation().add(player.getLocation().getDirection().multiply(24));
|
||||
|
||||
((CraftPlayer)player).getHandle().playerConnection.sendPacket(getWitherPacket(text, healthPercent, halfHealth, loc));
|
||||
}
|
||||
Location loc = player.getEyeLocation().add(player.getLocation().getDirection().multiply(24));
|
||||
|
||||
UtilPlayer.sendPacket(player, getWitherPacket(text, healthPercent, loc));
|
||||
|
||||
//Remove
|
||||
Bukkit.getServer().getScheduler().runTaskLater(Bukkit.getPluginManager().getPlugins()[0], new Runnable()
|
||||
@ -68,19 +64,22 @@ public class UtilTextTop
|
||||
|
||||
private static void deleteOld(Player player)
|
||||
{
|
||||
//Delete Dragon (All Clients)
|
||||
PacketPlayOutEntityDestroy destroyDragonPacket = new PacketPlayOutEntityDestroy(EntityDragonId);
|
||||
((CraftPlayer)player).getHandle().playerConnection.sendPacket(destroyDragonPacket);
|
||||
|
||||
//Delete Wither (1.8+ Only)
|
||||
if (UtilPlayer.is1_8(player))
|
||||
{
|
||||
PacketPlayOutEntityDestroy destroyWitherPacket = new PacketPlayOutEntityDestroy(EntityWitherId);
|
||||
((CraftPlayer)player).getHandle().playerConnection.sendPacket(destroyWitherPacket);
|
||||
}
|
||||
// Delete Dragon (All Clients)
|
||||
PacketPlayOutEntityDestroy destroyDragonPacket = new PacketPlayOutEntityDestroy(new int[]
|
||||
{
|
||||
EntityDragonId
|
||||
});
|
||||
UtilPlayer.sendPacket(player, destroyDragonPacket);
|
||||
|
||||
// Delete Wither (1.8+ Only)
|
||||
PacketPlayOutEntityDestroy destroyWitherPacket = new PacketPlayOutEntityDestroy(new int[]
|
||||
{
|
||||
EntityWitherId
|
||||
});
|
||||
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();
|
||||
|
||||
@ -108,7 +107,7 @@ public class UtilTextTop
|
||||
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();
|
||||
|
||||
@ -143,13 +142,11 @@ public class UtilTextTop
|
||||
watcher.a(0, (Byte) (byte) 0); //Flags, 0x20 = invisible
|
||||
watcher.a(6, (Float) (float) health);
|
||||
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(11, (Byte) (byte) 0); //Show name, 1 = show, 0 = don't show
|
||||
watcher.a(16, (Integer) (int) health); //Health
|
||||
watcher.a(20, (Integer) (int) 881); //Inv
|
||||
|
||||
int i1 = watcher.getInt(0);
|
||||
int i1 = watcher.getByte(0);
|
||||
watcher.watch(0, Byte.valueOf((byte)(i1 | 1 << 5)));
|
||||
|
||||
return watcher;
|
||||
|
@ -29,6 +29,19 @@ public class UtilTime
|
||||
return sdf.format(cal.getTime());
|
||||
}
|
||||
|
||||
public static String getDayOfMonthSuffix(final int n)
|
||||
{
|
||||
if (n >= 11 && n <= 13) {
|
||||
return "th";
|
||||
}
|
||||
switch (n % 10) {
|
||||
case 1: return "st";
|
||||
case 2: return "nd";
|
||||
case 3: return "rd";
|
||||
default: return "th";
|
||||
}
|
||||
}
|
||||
|
||||
public enum TimeUnit
|
||||
{
|
||||
FIT,
|
||||
|
@ -2,133 +2,148 @@ package mineplex.core.common.util;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import net.minecraft.server.v1_7_R4.ConvertProgressUpdater;
|
||||
import net.minecraft.server.v1_7_R4.Convertable;
|
||||
import net.minecraft.server.v1_7_R4.EntityTracker;
|
||||
import net.minecraft.server.v1_7_R4.EnumDifficulty;
|
||||
import net.minecraft.server.v1_7_R4.EnumGamemode;
|
||||
import net.minecraft.server.v1_7_R4.IWorldAccess;
|
||||
import net.minecraft.server.v1_7_R4.ServerNBTManager;
|
||||
import net.minecraft.server.v1_7_R4.WorldLoaderServer;
|
||||
import net.minecraft.server.v1_7_R4.WorldManager;
|
||||
import net.minecraft.server.v1_7_R4.WorldServer;
|
||||
import net.minecraft.server.v1_7_R4.WorldSettings;
|
||||
import net.minecraft.server.v1_7_R4.WorldType;
|
||||
|
||||
import net.minecraft.server.v1_8_R3.Convertable;
|
||||
import net.minecraft.server.v1_8_R3.EntityTracker;
|
||||
import net.minecraft.server.v1_8_R3.EnumDifficulty;
|
||||
import net.minecraft.server.v1_8_R3.IDataManager;
|
||||
import net.minecraft.server.v1_8_R3.IProgressUpdate;
|
||||
import net.minecraft.server.v1_8_R3.MinecraftServer;
|
||||
import net.minecraft.server.v1_8_R3.ServerNBTManager;
|
||||
import net.minecraft.server.v1_8_R3.WorldData;
|
||||
import net.minecraft.server.v1_8_R3.WorldLoaderServer;
|
||||
import net.minecraft.server.v1_8_R3.WorldManager;
|
||||
import net.minecraft.server.v1_8_R3.WorldServer;
|
||||
import net.minecraft.server.v1_8_R3.WorldSettings;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
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.WorldLoadEvent;
|
||||
import org.bukkit.generator.ChunkGenerator;
|
||||
|
||||
public class WorldUtil
|
||||
public class WorldUtil
|
||||
{
|
||||
public static World LoadWorld(WorldCreator creator)
|
||||
{
|
||||
CraftServer server = (CraftServer)Bukkit.getServer();
|
||||
if (creator == null)
|
||||
{
|
||||
throw new IllegalArgumentException("Creator may not be null");
|
||||
}
|
||||
CraftServer server = (CraftServer) Bukkit.getServer();
|
||||
if (creator == null)
|
||||
{
|
||||
throw new IllegalArgumentException("Creator may not be null");
|
||||
}
|
||||
|
||||
String name = creator.name();
|
||||
System.out.println("Loading world '" + name + "'");
|
||||
ChunkGenerator generator = creator.generator();
|
||||
File folder = new File(server.getWorldContainer(), name);
|
||||
World world = server.getWorld(name);
|
||||
WorldType type = WorldType.getType(creator.type().getName());
|
||||
boolean generateStructures = creator.generateStructures();
|
||||
String name = creator.name();
|
||||
ChunkGenerator generator = creator.generator();
|
||||
File folder = new File(server.getWorldContainer(), name);
|
||||
World world = server.getWorld(name);
|
||||
net.minecraft.server.v1_8_R3.WorldType type = net.minecraft.server.v1_8_R3.WorldType.getType(creator.type().getName());
|
||||
boolean generateStructures = creator.generateStructures();
|
||||
|
||||
if (world != null)
|
||||
{
|
||||
return world;
|
||||
}
|
||||
if (world != null)
|
||||
{
|
||||
return world;
|
||||
}
|
||||
|
||||
if ((folder.exists()) && (!folder.isDirectory()))
|
||||
{
|
||||
throw new IllegalArgumentException("File exists with the name '" + name + "' and isn't a folder");
|
||||
}
|
||||
if ((folder.exists()) && (!folder.isDirectory()))
|
||||
{
|
||||
throw new IllegalArgumentException("File exists with the name '" + name + "' and isn't a folder");
|
||||
}
|
||||
|
||||
if (generator == null)
|
||||
{
|
||||
generator = server.getGenerator(name);
|
||||
}
|
||||
if (generator == null)
|
||||
{
|
||||
generator = server.getGenerator(name);
|
||||
}
|
||||
|
||||
Convertable converter = new WorldLoaderServer(server.getWorldContainer());
|
||||
if (converter.isConvertable(name))
|
||||
{
|
||||
server.getLogger().info("Converting world '" + name + "'");
|
||||
converter.convert(name, new ConvertProgressUpdater(server.getServer()));
|
||||
}
|
||||
Convertable converter = new WorldLoaderServer(server.getWorldContainer());
|
||||
if (converter.isConvertable(name))
|
||||
{
|
||||
server.getLogger().info("Converting world '" + name + "'");
|
||||
converter.convert(name, new IProgressUpdate()
|
||||
{
|
||||
private long b = System.currentTimeMillis();
|
||||
|
||||
int dimension = server.getWorlds().size() + 1;
|
||||
boolean used = false;
|
||||
do
|
||||
{
|
||||
for (WorldServer worldServer : server.getServer().worlds)
|
||||
{
|
||||
used = worldServer.dimension == dimension;
|
||||
if (used)
|
||||
{
|
||||
dimension++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} while(used);
|
||||
boolean hardcore = false;
|
||||
public void a(String s)
|
||||
{
|
||||
}
|
||||
|
||||
System.out.println("Loaded world with dimension : " + dimension);
|
||||
|
||||
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);
|
||||
|
||||
boolean containsWorld = false;
|
||||
for (World otherWorld : server.getWorlds())
|
||||
{
|
||||
if (otherWorld.getName().equalsIgnoreCase(name.toLowerCase()))
|
||||
{
|
||||
containsWorld = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!containsWorld)
|
||||
return null;
|
||||
public void a(int i)
|
||||
{
|
||||
if (System.currentTimeMillis() - this.b >= 1000L)
|
||||
{
|
||||
this.b = System.currentTimeMillis();
|
||||
MinecraftServer.LOGGER.info("Converting... " + i + "%");
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println("Created world with dimension : " + dimension);
|
||||
|
||||
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);
|
||||
public void c(String s)
|
||||
{
|
||||
}
|
||||
});
|
||||
}
|
||||
int dimension = 10 + server.getServer().worlds.size();
|
||||
boolean used = false;
|
||||
do
|
||||
for (WorldServer s : server.getServer().worlds)
|
||||
{
|
||||
used = s.dimension == dimension;
|
||||
if (used)
|
||||
{
|
||||
dimension++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
while (used);
|
||||
boolean hardcore = false;
|
||||
|
||||
/*
|
||||
for (WorldServer worlder : server.getServer().worlds)
|
||||
{
|
||||
System.out.println(worlder.getWorldData().getName() + " with dimension: " + worlder.dimension);
|
||||
}
|
||||
*/
|
||||
|
||||
if (generator != null)
|
||||
{
|
||||
internal.getWorld().getPopulators().addAll(generator.getDefaultPopulators(internal.getWorld()));
|
||||
}
|
||||
Object sdm = new ServerNBTManager(server.getWorldContainer(), name, true);
|
||||
WorldData worlddata = ((IDataManager) sdm).getWorldData();
|
||||
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();
|
||||
|
||||
server.getPluginManager().callEvent(new WorldInitEvent(internal.getWorld()));
|
||||
server.getPluginManager().callEvent(new WorldLoadEvent(internal.getWorld()));
|
||||
|
||||
/*
|
||||
for (WorldServer worlder : server.getServer().worlds)
|
||||
{
|
||||
System.out.println(worlder.getWorldData().getName() + " with dimension: " + worlder.dimension);
|
||||
}
|
||||
*/
|
||||
|
||||
return internal.getWorld();
|
||||
boolean containsWorld = false;
|
||||
for (World otherWorld : server.getWorlds())
|
||||
{
|
||||
if (otherWorld.getName().equalsIgnoreCase(name.toLowerCase()))
|
||||
{
|
||||
containsWorld = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!containsWorld)
|
||||
return null;
|
||||
|
||||
internal.scoreboard = server.getScoreboardManager().getMainScoreboard().getHandle();
|
||||
|
||||
internal.tracker = new EntityTracker(internal);
|
||||
internal.addIWorldAccess(new WorldManager(server.getServer(), internal));
|
||||
internal.worldData.setDifficulty(EnumDifficulty.EASY);
|
||||
internal.setSpawnFlags(true, true);
|
||||
server.getServer().worlds.add(internal);
|
||||
|
||||
if (generator != null)
|
||||
{
|
||||
internal.getWorld().getPopulators().addAll(generator.getDefaultPopulators(internal.getWorld()));
|
||||
}
|
||||
|
||||
server.getPluginManager().callEvent(new WorldInitEvent(internal.getWorld()));
|
||||
server.getPluginManager().callEvent(new WorldLoadEvent(internal.getWorld()));
|
||||
|
||||
/*
|
||||
for (WorldServer worlder : server.getServer().worlds)
|
||||
{
|
||||
System.out.println(worlder.getWorldData().getName() + " with dimension: " + worlder.dimension);
|
||||
}
|
||||
*/
|
||||
|
||||
return internal.getWorld();
|
||||
}
|
||||
}
|
||||
|
@ -174,7 +174,15 @@ public class ZipUtil
|
||||
int size;
|
||||
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);
|
||||
|
||||
while ((size = zipInputStream.read(buffer, 0, buffer.length)) != -1)
|
||||
|
@ -12,8 +12,8 @@
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Database"/>
|
||||
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/jooq-3.5.2.jar"/>
|
||||
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/craftbukkit.jar"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Core.Common"/>
|
||||
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/NoCheatPlus.jar"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.PlayerCache"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Core.Common"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
@ -1,6 +1,5 @@
|
||||
package mineplex.core;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
@ -9,28 +8,31 @@ import java.util.UUID;
|
||||
|
||||
import mineplex.core.common.DummyEntity;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.event.CustomTagEvent;
|
||||
import mineplex.core.packethandler.IPacketHandler;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.packethandler.PacketHandler;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.packethandler.PacketVerifier;
|
||||
import mineplex.core.packethandler.PacketInfo;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import net.minecraft.server.v1_7_R4.DataWatcher;
|
||||
import net.minecraft.server.v1_7_R4.EnumEntitySize;
|
||||
import net.minecraft.server.v1_7_R4.MathHelper;
|
||||
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.PacketPlayOutSpawnEntity;
|
||||
import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntityLiving;
|
||||
import net.minecraft.server.v1_7_R4.WatchableObject;
|
||||
import net.minecraft.server.v1_8_R3.DataWatcher;
|
||||
import net.minecraft.server.v1_8_R3.DataWatcher.WatchableObject;
|
||||
import net.minecraft.server.v1_8_R3.MathHelper;
|
||||
import net.minecraft.server.v1_8_R3.Packet;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayInUseEntity;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayInUseEntity.EnumEntityUseAction;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutAttachEntity;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityMetadata;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntity;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving;
|
||||
|
||||
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.event.EventHandler;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
@ -49,234 +51,263 @@ 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, 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<Integer> _ignoreSkulls = new HashSet<Integer>();
|
||||
|
||||
|
||||
private NautHashMap<UUID, Long> _exemptTimeMap = new NautHashMap<UUID, Long>();
|
||||
private NautHashMap<UUID, NautHashMap<CheckType, Long>> _doubleStrike = new NautHashMap<UUID, NautHashMap<CheckType, Long>>();
|
||||
|
||||
private Field _destroyId;
|
||||
|
||||
|
||||
public CustomTagFix(JavaPlugin plugin, PacketHandler packetHandler)
|
||||
{
|
||||
super("Custom Tag Fix", plugin);
|
||||
|
||||
packetHandler.addPacketHandler(this);
|
||||
|
||||
try
|
||||
{
|
||||
_destroyId = PacketPlayOutEntityDestroy.class.getDeclaredField("a");
|
||||
_destroyId.setAccessible(true);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
System.out.println("Field exception in CustomTagFix : ");
|
||||
exception.printStackTrace();
|
||||
}
|
||||
|
||||
packetHandler.addPacketHandler(this, true, PacketPlayOutAttachEntity.class, PacketPlayOutEntityDestroy.class,
|
||||
PacketPlayOutEntityMetadata.class, PacketPlayOutSpawnEntity.class, PacketPlayOutSpawnEntityLiving.class,
|
||||
PacketPlayInUseEntity.class);
|
||||
|
||||
NCPHookManager.addHook(CheckType.MOVING_SURVIVALFLY, this);
|
||||
NCPHookManager.addHook(CheckType.MOVING_PASSABLE, this);
|
||||
NCPHookManager.addHook(CheckType.ALL, this);
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void playerQuit(PlayerQuitEvent event)
|
||||
{
|
||||
_entityMap.remove(event.getPlayer().getName());
|
||||
_entityNameMap.remove(event.getPlayer().getName());
|
||||
_entityVehicleMap.remove(event.getPlayer().getName());
|
||||
_loggedIn.remove(event.getPlayer());
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void ncpExempt(final PlayerToggleFlightEvent event)
|
||||
{
|
||||
long ignoreTime = System.currentTimeMillis() + 1500;
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
NCPExemptionManager.exemptPermanently(event.getPlayer());
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
_exemptTimeMap.put(event.getPlayer().getUniqueId(), ignoreTime);
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void ncpExemptVelocity(final PlayerVelocityEvent event)
|
||||
{
|
||||
long ignoreTime = System.currentTimeMillis() + (long)(event.getVelocity().length() * 2000);
|
||||
long ignoreTime = System.currentTimeMillis() + (long) (event.getVelocity().length() * 2000);
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
_exemptTimeMap.put(event.getPlayer().getUniqueId(), ignoreTime);
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void unexempt(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
return;
|
||||
|
||||
|
||||
for (Iterator<Entry<UUID, Long>> iterator = _exemptTimeMap.entrySet().iterator(); iterator.hasNext();)
|
||||
{
|
||||
final Entry<UUID, Long> entry = iterator.next();
|
||||
|
||||
|
||||
if (System.currentTimeMillis() > entry.getValue())
|
||||
{
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
|
||||
for (Iterator<Entry<CheckType, Long>> innerIterator = entry.getValue().entrySet().iterator(); innerIterator.hasNext();)
|
||||
{
|
||||
final Entry<CheckType, Long> entry2 = innerIterator.next();
|
||||
|
||||
|
||||
if (System.currentTimeMillis() > entry2.getValue())
|
||||
{
|
||||
innerIterator.remove();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (entry.getValue() == null || entry.getValue().size() == 0)
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void cleanMap(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.SEC)
|
||||
return;
|
||||
|
||||
|
||||
for (Iterator<String> iterator = _loggedIn.iterator(); iterator.hasNext();)
|
||||
{
|
||||
String player = iterator.next();
|
||||
|
||||
|
||||
if (Bukkit.getPlayerExact(player) == null)
|
||||
{
|
||||
iterator.remove();
|
||||
_entityMap.remove(player);
|
||||
_entityNameMap.remove(player);
|
||||
_entityVehicleMap.remove(player);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (Bukkit.getServer().getOnlinePlayers().size() < _loggedIn.size())
|
||||
{
|
||||
System.out.println("PROBLEM - _loggedIn TOOOOOO BIIIIIGGGGG.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void handle(PacketInfo packetInfo)
|
||||
{
|
||||
if (packetInfo.isCancelled())
|
||||
return;
|
||||
|
||||
|
||||
Packet packet = packetInfo.getPacket();
|
||||
Player owner = packetInfo.getPlayer();
|
||||
PacketVerifier verifier = packetInfo.getVerifier();
|
||||
|
||||
if (owner.isOnline() && UtilPlayer.is1_8(owner))
|
||||
if (owner.isOnline())
|
||||
{
|
||||
if (owner.isOnline() && !_entityMap.containsKey(owner.getName()))
|
||||
{
|
||||
_entityMap.put(owner.getName(), new NautHashMap<Integer, Integer>());
|
||||
_entityNameMap.put(owner.getName(), new NautHashMap<Integer, String>());
|
||||
_entityVehicleMap.put(owner.getName(), new NautHashMap<Integer, Integer>());
|
||||
_loggedIn.add(owner.getName());
|
||||
}
|
||||
|
||||
|
||||
if (packet instanceof PacketPlayOutSpawnEntityLiving)
|
||||
{
|
||||
PacketPlayOutSpawnEntityLiving spawnPacket = (PacketPlayOutSpawnEntityLiving)packet;
|
||||
PacketPlayOutSpawnEntityLiving spawnPacket = (PacketPlayOutSpawnEntityLiving) packet;
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
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 && ((Byte)watchable.b()) == 1)
|
||||
if (watchable.a() == 3 && watchable.b() instanceof Byte && ((Byte) watchable.b()) == 1)
|
||||
{
|
||||
final String entityName = spawnPacket.l.getString(10);
|
||||
|
||||
if (entityName.isEmpty())
|
||||
{
|
||||
_entityNameMap.get(owner.getName()).remove(spawnPacket.a);
|
||||
return;
|
||||
}
|
||||
|
||||
if (_entityMap.get(owner.getName()).containsKey(spawnPacket.a))
|
||||
{
|
||||
verifier.bypassProcess(new PacketPlayOutEntityDestroy(_entityMap.get(owner.getName()).get(spawnPacket.a)));
|
||||
UtilPlayer.sendPacket(owner, new PacketPlayOutEntityDestroy(new int[]
|
||||
{
|
||||
_entityMap.get(owner.getName()).get(spawnPacket.a)
|
||||
}));
|
||||
|
||||
_entityNameMap.get(owner.getName()).remove(spawnPacket.a);
|
||||
_entityMap.get(owner.getName()).remove(spawnPacket.a);
|
||||
}
|
||||
|
||||
|
||||
final String entityName = spawnPacket.l.getString(2);
|
||||
|
||||
if (entityName.isEmpty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int newId = UtilEnt.getNewEntityId();
|
||||
sendProtocolPackets(owner, spawnPacket.a, newId, entityName, verifier);
|
||||
_entityMap.get(owner.getName()).put(spawnPacket.a, newId);
|
||||
|
||||
_entityNameMap.get(owner.getName()).put(spawnPacket.a, entityName);
|
||||
|
||||
_entityMap.get(owner.getName()).put(spawnPacket.a, newId);
|
||||
|
||||
sendProtocolPackets(owner, spawnPacket.a, newId, entityName, verifier, true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (packet instanceof PacketPlayOutEntityMetadata)
|
||||
{
|
||||
PacketPlayOutEntityMetadata metaPacket = (PacketPlayOutEntityMetadata)packet;
|
||||
|
||||
if (!_entityMap.get(owner.getName()).containsKey(metaPacket.a) && metaPacket.a != 777777 && !_ignoreSkulls.contains(metaPacket.a))
|
||||
PacketPlayOutEntityMetadata metaPacket = (PacketPlayOutEntityMetadata) packet;
|
||||
|
||||
if (metaPacket.a != 777777 && !_ignoreSkulls.contains(metaPacket.a))
|
||||
{
|
||||
String entityName = "";
|
||||
boolean nameShowing = false;
|
||||
|
||||
for (WatchableObject watchable : (List<WatchableObject>)metaPacket.b)
|
||||
boolean isDisplaying = _entityMap.get(owner.getName()).containsKey(metaPacket.a);
|
||||
String currentName = _entityNameMap.get(owner.getName()).get(metaPacket.a);
|
||||
|
||||
if (currentName == null)
|
||||
{
|
||||
if ((watchable.a() == 11 || watchable.a() == 3) && watchable.b() instanceof Byte && ((Byte)watchable.b()) == 1)
|
||||
currentName = "";
|
||||
}
|
||||
|
||||
String newName = currentName;
|
||||
boolean newDisplay = isDisplaying;
|
||||
|
||||
for (WatchableObject watchable : (List<WatchableObject>) metaPacket.b)
|
||||
{
|
||||
if (watchable.a() == 3 && watchable.b() instanceof Byte)
|
||||
{
|
||||
nameShowing = true;
|
||||
newDisplay = ((Byte) watchable.b()) == 1;
|
||||
}
|
||||
if ((watchable.a() == 10 || watchable.a() == 2) && watchable.b() instanceof String)
|
||||
|
||||
if (watchable.a() == 2 && watchable.b() instanceof String)
|
||||
{
|
||||
entityName = (String)watchable.b();
|
||||
newName = (String) watchable.b();
|
||||
}
|
||||
}
|
||||
|
||||
if (nameShowing && !entityName.isEmpty())
|
||||
|
||||
// If the name has changed and the name should be showing, or the name display status has changed.
|
||||
if ((!newName.equals(currentName) && newDisplay) || newDisplay != isDisplaying)
|
||||
{
|
||||
int newId = UtilEnt.getNewEntityId();
|
||||
sendProtocolPackets(owner, metaPacket.a, newId, entityName, verifier);
|
||||
_entityMap.get(owner.getName()).put(metaPacket.a, newId);
|
||||
_entityNameMap.get(owner.getName()).put(metaPacket.a, entityName);
|
||||
}
|
||||
else if (!entityName.isEmpty())
|
||||
{
|
||||
_entityNameMap.get(owner.getName()).remove(metaPacket.a);
|
||||
// If name is still being displayed
|
||||
if (newDisplay)
|
||||
{
|
||||
int newId;
|
||||
|
||||
if (isDisplaying) // Sending metadata
|
||||
{
|
||||
newId = _entityMap.get(owner.getName()).get(metaPacket.a);
|
||||
}
|
||||
else
|
||||
// Spawning new entity
|
||||
{
|
||||
newId = UtilEnt.getNewEntityId();
|
||||
_entityMap.get(owner.getName()).put(metaPacket.a, newId);
|
||||
}
|
||||
|
||||
sendProtocolPackets(owner, metaPacket.a, newId, newName, verifier, !isDisplaying);
|
||||
|
||||
_entityNameMap.get(owner.getName()).put(metaPacket.a, newName);
|
||||
}
|
||||
else
|
||||
{ // Lets delete it
|
||||
int id = _entityMap.get(owner.getName()).get(metaPacket.a);
|
||||
|
||||
UtilPlayer.sendPacket(owner, new PacketPlayOutEntityDestroy(new int[]
|
||||
{
|
||||
id
|
||||
}));
|
||||
|
||||
_entityMap.get(owner.getName()).remove(metaPacket.a);
|
||||
_entityNameMap.get(owner.getName()).remove(metaPacket.a);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -284,13 +315,15 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
|
||||
{
|
||||
try
|
||||
{
|
||||
for (int id : (int[])_destroyId.get(packet))
|
||||
for (int id : ((PacketPlayOutEntityDestroy) packet).a)
|
||||
{
|
||||
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);
|
||||
_entityVehicleMap.get(owner.getName()).remove(id);
|
||||
_entityNameMap.get(owner.getName()).remove(id);
|
||||
}
|
||||
}
|
||||
@ -299,155 +332,40 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
|
||||
{
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
else if (packet instanceof PacketPlayOutSpawnEntity)
|
||||
{
|
||||
PacketPlayOutSpawnEntity spawnPacket = (PacketPlayOutSpawnEntity) packet;
|
||||
if (spawnPacket.j == 66 && spawnPacket.a != 777777)
|
||||
{
|
||||
_ignoreSkulls.add(spawnPacket.a);
|
||||
}
|
||||
}
|
||||
/*
|
||||
else if (packet instanceof PacketPlayOutAttachEntity)
|
||||
else if (packet instanceof PacketPlayOutSpawnEntity)
|
||||
{
|
||||
PacketPlayOutAttachEntity attachPacket = (PacketPlayOutAttachEntity)packet;
|
||||
|
||||
/* TODO dynamic attach handling?
|
||||
if (attachPacket.c == -1)
|
||||
PacketPlayOutSpawnEntity spawnPacket = (PacketPlayOutSpawnEntity) packet;
|
||||
if (spawnPacket.j == 66 && spawnPacket.a != 777777)
|
||||
{
|
||||
if (_entityVehicleMap.get(owner).containsKey(attachPacket.b) && _entityNameMap.get(owner).containsKey(_entityVehicleMap.get(owner).get(attachPacket.b)))
|
||||
{
|
||||
int newId = UtilEnt.getNewEntityId();
|
||||
sendProtocolPackets(owner, _entityVehicleMap.get(owner).get(attachPacket.b), newId, _entityNameMap.get(owner).get(_entityVehicleMap.get(owner).get(attachPacket.b)), verifier);
|
||||
_entityMap.get(owner).put(attachPacket.b, newId);
|
||||
_entityVehicleMap.get(owner).remove(attachPacket.b);
|
||||
|
||||
packetInfo.setCancelled(true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_entityVehicleMap.get(owner).put(attachPacket.b, attachPacket.c);
|
||||
}
|
||||
|
||||
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);
|
||||
_ignoreSkulls.add(spawnPacket.a);
|
||||
}
|
||||
}
|
||||
else if (packet instanceof PacketPlayInUseEntity)
|
||||
{
|
||||
PacketPlayInUseEntity usePacket = (PacketPlayInUseEntity) packet;
|
||||
|
||||
for (Entry<Integer, Integer> entry : _entityMap.get(owner.getName()).entrySet())
|
||||
{
|
||||
if (entry.getValue() == usePacket.a)
|
||||
{
|
||||
PacketPlayInUseEntity newPacket = new PacketPlayInUseEntity();
|
||||
newPacket.a = entry.getKey();
|
||||
newPacket.action = usePacket.action == EnumEntityUseAction.ATTACK ? EnumEntityUseAction.ATTACK
|
||||
: EnumEntityUseAction.INTERACT;
|
||||
|
||||
{
|
||||
((CraftPlayer) owner).getHandle().playerConnection.a(newPacket);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
private void sendProtocolPackets(final Player owner, final int entityId, final int newEntityId, String entityName, final PacketVerifier packetList)
|
||||
|
||||
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);
|
||||
_plugin.getServer().getPluginManager().callEvent(event);
|
||||
@ -457,107 +375,102 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
final PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving();
|
||||
packet.a = newEntityId;
|
||||
packet.b = (byte) 30;
|
||||
packet.c = (int)EnumEntitySize.SIZE_2.a(100);
|
||||
packet.d = (int)MathHelper.floor(64 * 32.0D);
|
||||
packet.e = (int)EnumEntitySize.SIZE_2.a(100);
|
||||
packet.i = (byte) ((int) (0 * 256.0F / 360.0F));
|
||||
packet.j = (byte) ((int) (0 * 256.0F / 360.0F));
|
||||
packet.k = (byte) ((int) (0 * 256.0F / 360.0F));
|
||||
final DataWatcher watcher = new DataWatcher(new DummyEntity(((CraftWorld) owner.getWorld()).getHandle()));
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
packet.f = (int)(var4 * 8000.0D);
|
||||
packet.g = (int)(var6 * 8000.0D);
|
||||
packet.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(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(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(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));
|
||||
|
||||
watcher.watch(2, finalEntityName);
|
||||
watcher.watch(3, Byte.valueOf((byte)1));
|
||||
|
||||
packet.l = watcher;
|
||||
|
||||
packetList.bypassProcess(packet);
|
||||
|
||||
PacketPlayOutAttachEntity vehiclePacket = new PacketPlayOutAttachEntity();
|
||||
vehiclePacket.a = 0;
|
||||
vehiclePacket.b = packet.a;
|
||||
vehiclePacket.c = entityId;
|
||||
|
||||
packetList.bypassProcess(vehiclePacket);
|
||||
|
||||
/* 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();
|
||||
}
|
||||
watcher.a(10, Byte.valueOf((byte) 0));
|
||||
|
||||
vehiclePacket.c = packet.a;
|
||||
// Set invisible
|
||||
int i1 = watcher.getByte(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));
|
||||
|
||||
watcher.watch(2, finalEntityName);
|
||||
watcher.watch(3, Byte.valueOf((byte) 1));
|
||||
|
||||
if (newPacket)
|
||||
{
|
||||
final PacketPlayOutSpawnEntityLiving spawnPacket = new PacketPlayOutSpawnEntityLiving();
|
||||
spawnPacket.a = newEntityId;
|
||||
spawnPacket.b = (byte) 30;
|
||||
spawnPacket.c = (int) MathHelper.floor(100 * 32);
|
||||
spawnPacket.d = (int) MathHelper.floor(64 * 32.0D);
|
||||
spawnPacket.e = (int) MathHelper.floor(100 * 32);
|
||||
spawnPacket.i = (byte) ((int) (0 * 256.0F / 360.0F));
|
||||
spawnPacket.j = (byte) ((int) (0 * 256.0F / 360.0F));
|
||||
spawnPacket.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;
|
||||
}
|
||||
|
||||
spawnPacket.f = (int) (var4 * 8000.0D);
|
||||
spawnPacket.g = (int) (var6 * 8000.0D);
|
||||
spawnPacket.h = (int) (var8 * 8000.0D);
|
||||
|
||||
spawnPacket.l = watcher;
|
||||
|
||||
UtilPlayer.sendPacket(owner, spawnPacket);
|
||||
|
||||
PacketPlayOutAttachEntity vehiclePacket = new PacketPlayOutAttachEntity();
|
||||
vehiclePacket.a = 0;
|
||||
vehiclePacket.b = spawnPacket.a;
|
||||
vehiclePacket.c = entityId;
|
||||
|
||||
UtilPlayer.sendPacket(owner, vehiclePacket);
|
||||
}
|
||||
else
|
||||
{
|
||||
PacketPlayOutEntityMetadata entityMetadata = new PacketPlayOutEntityMetadata();
|
||||
entityMetadata.a = newEntityId;
|
||||
entityMetadata.b = watcher.c();
|
||||
|
||||
packetList.bypassProcess(entityMetadata);
|
||||
}
|
||||
*/
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -578,28 +491,28 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
|
||||
public boolean onCheckFailure(CheckType checkType, Player player, IViolationInfo violationInfo)
|
||||
{
|
||||
boolean failure = false;
|
||||
|
||||
|
||||
if (checkType == CheckType.MOVING_SURVIVALFLY || checkType == CheckType.MOVING_PASSABLE)
|
||||
{
|
||||
{
|
||||
failure = _exemptTimeMap.containsKey(player.getUniqueId());
|
||||
|
||||
|
||||
if (failure)
|
||||
MovingData.getData(player).clearFlyData();
|
||||
}
|
||||
|
||||
|
||||
// This is the second strike system.
|
||||
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;
|
||||
|
||||
if (!_doubleStrike.containsKey(player.getUniqueId()))
|
||||
_doubleStrike.put(player.getUniqueId(), new NautHashMap<CheckType, Long>());
|
||||
|
||||
|
||||
_doubleStrike.get(player.getUniqueId()).put(checkType.getParent(), System.currentTimeMillis() + 5000);
|
||||
}
|
||||
|
||||
|
||||
return failure;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -107,6 +107,11 @@ public abstract class MiniPlugin implements Listener
|
||||
{
|
||||
_plugin.getServer().getScheduler().runTaskAsynchronously(_plugin, runnable);
|
||||
}
|
||||
|
||||
public void runAsync(Runnable runnable, long time)
|
||||
{
|
||||
_plugin.getServer().getScheduler().runTaskLaterAsynchronously(_plugin, runnable, time);
|
||||
}
|
||||
|
||||
public void runSync(Runnable runnable)
|
||||
{
|
||||
|
@ -0,0 +1,160 @@
|
||||
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.EntityPlayer;
|
||||
import net.minecraft.server.v1_8_R3.MathHelper;
|
||||
import net.minecraft.server.v1_8_R3.MovingObjectPosition;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayInUseEntity;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayInUseEntity.EnumEntityUseAction;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving;
|
||||
import net.minecraft.server.v1_8_R3.Vec3D;
|
||||
import net.minecraft.server.v1_8_R3.WorldSettings.EnumGamemode;
|
||||
|
||||
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.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>>();
|
||||
|
||||
public PacketsInteractionFix(JavaPlugin plugin, PacketHandler packetHandler)
|
||||
{
|
||||
super("Packets Interaction Fix", plugin);
|
||||
|
||||
packetHandler.addPacketHandler(this, true, PacketPlayOutSpawnEntityLiving.class, PacketPlayOutEntityDestroy.class,
|
||||
PacketPlayInUseEntity.class);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onQuit(PlayerQuitEvent event)
|
||||
{
|
||||
_armorStands.remove(event.getPlayer().getName());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void removeDeadNames(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.SEC)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Iterator<String> itel = _armorStands.keySet().iterator();
|
||||
|
||||
while (itel.hasNext())
|
||||
{
|
||||
String name = itel.next();
|
||||
|
||||
Player player = Bukkit.getPlayerExact(name);
|
||||
|
||||
if (player != null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
itel.remove();
|
||||
}
|
||||
}
|
||||
|
||||
@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 (packet.action == EnumEntityUseAction.ATTACK)
|
||||
{
|
||||
EntityPlayer nmsPlayer = ((CraftPlayer) packetInfo.getPlayer()).getHandle();
|
||||
|
||||
float f1 = nmsPlayer.pitch;
|
||||
float f2 = nmsPlayer.yaw;
|
||||
double d0 = nmsPlayer.locX;
|
||||
double d1 = nmsPlayer.locY + nmsPlayer.getHeadHeight();
|
||||
double d2 = nmsPlayer.locZ;
|
||||
Vec3D vec3d = new Vec3D(d0, d1, d2);
|
||||
|
||||
float f3 = MathHelper.cos(-f2 * 0.01745329F - 3.141593F);
|
||||
float f4 = MathHelper.sin(-f2 * 0.01745329F - 3.141593F);
|
||||
float f5 = -MathHelper.cos(-f1 * 0.01745329F);
|
||||
float f6 = MathHelper.sin(-f1 * 0.01745329F);
|
||||
float f7 = f4 * f5;
|
||||
float f8 = f3 * f5;
|
||||
nmsPlayer.playerInteractManager.getGameMode();
|
||||
double d3 = nmsPlayer.playerInteractManager.getGameMode() == EnumGamemode.CREATIVE ? 5 : 4.5;
|
||||
Vec3D vec3d1 = vec3d.add(f7 * d3, f6 * d3, f8 * d3);
|
||||
MovingObjectPosition movingobjectposition = nmsPlayer.world.rayTrace(vec3d, vec3d1, false);
|
||||
|
||||
if (movingobjectposition != null && movingobjectposition.type == MovingObjectPosition.EnumMovingObjectType.BLOCK)
|
||||
{
|
||||
CraftEventFactory.callPlayerInteractEvent(nmsPlayer, Action.LEFT_CLICK_AIR,
|
||||
nmsPlayer.inventory.getItemInHand());
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (!list.contains(packet.a))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
CraftEventFactory.callPlayerInteractEvent(((CraftPlayer) player).getHandle(), Action.RIGHT_CLICK_AIR,
|
||||
((CraftPlayer) player).getHandle().inventory.getItemInHand());
|
||||
}
|
||||
}
|
||||
}
|
@ -1,54 +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;
|
||||
|
||||
PacketPlayOutPlayerInfo packet = PacketPlayOutPlayerInfo.updateDisplayName(((CraftPlayer) player).getHandle());
|
||||
|
||||
if (UtilPlayer.is1_8(player))
|
||||
{
|
||||
UtilPlayer.sendPacket(player, packet);
|
||||
}
|
||||
|
||||
for (Player other : UtilServer.getPlayers())
|
||||
{
|
||||
if (other.equals(player) || !other.canSee(player))
|
||||
continue;
|
||||
|
||||
if (UtilPlayer.is1_8(other))
|
||||
UtilPlayer.sendPacket(other, packet);
|
||||
}
|
||||
}
|
||||
}, 20L);
|
||||
*/
|
||||
}
|
||||
}
|
@ -1,8 +1,12 @@
|
||||
package mineplex.core.account;
|
||||
|
||||
import mineplex.core.account.event.OnlineRankUpdateEvent;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.serverdata.Utility;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class CoreClient
|
||||
@ -12,8 +16,9 @@ public class CoreClient
|
||||
private String _name;
|
||||
private String _disguisedAs;
|
||||
private Player _player;
|
||||
private Rank _rank;
|
||||
private Rank _rank, _lastRank;
|
||||
private Rank _disguisedRank;
|
||||
private Rank _tempRank, _lastTemp;
|
||||
private boolean _disguised;
|
||||
|
||||
public CoreClient(Player player)
|
||||
@ -58,18 +63,59 @@ public class CoreClient
|
||||
{
|
||||
_accountId = accountId;
|
||||
}
|
||||
|
||||
|
||||
public Rank GetRank()
|
||||
{
|
||||
return GetRank(false);
|
||||
}
|
||||
|
||||
public Rank GetRank(boolean bypass)
|
||||
{
|
||||
if (_rank == null)
|
||||
_rank = Rank.ALL;
|
||||
|
||||
return _rank;
|
||||
if (bypass || _tempRank == null)
|
||||
return _rank;
|
||||
else
|
||||
return _tempRank;
|
||||
}
|
||||
|
||||
public void SetRank(Rank rank)
|
||||
public Rank GetLastRank(boolean temp)
|
||||
{
|
||||
_rank = rank;
|
||||
if (temp)
|
||||
{
|
||||
if ((_lastTemp == null) && (_tempRank == null))
|
||||
{
|
||||
return _rank;
|
||||
}
|
||||
else if (_lastTemp == null)
|
||||
{
|
||||
return _tempRank;
|
||||
}
|
||||
return _lastTemp;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_lastRank == null) return _rank;
|
||||
return _lastRank;
|
||||
}
|
||||
}
|
||||
|
||||
public void SetRank(Rank rank, boolean temp)
|
||||
{
|
||||
if (temp)
|
||||
{
|
||||
if (_lastTemp == null) _lastTemp = rank;
|
||||
else _lastTemp = _tempRank;
|
||||
_lastRank = _rank;
|
||||
_tempRank = rank;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_rank != null) _lastRank = _rank;
|
||||
else _lastRank = rank;
|
||||
_rank = rank;
|
||||
}
|
||||
}
|
||||
|
||||
public long getNetworkSessionLoginTime()
|
||||
@ -111,4 +157,16 @@ public class CoreClient
|
||||
{
|
||||
_networkSessionLoginTime = loginTime;
|
||||
}
|
||||
|
||||
public void resetTemp()
|
||||
{
|
||||
if (_tempRank != null)
|
||||
{
|
||||
OnlineRankUpdateEvent event = new OnlineRankUpdateEvent(_player, _tempRank, _rank, true);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
_lastTemp = _tempRank;
|
||||
_tempRank = null;
|
||||
UtilPlayer.message(_player, C.cGold + "Your test rank has been reset!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,9 @@ import java.util.Map.Entry;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.account.command.TestRank;
|
||||
import mineplex.core.account.command.UpdateRank;
|
||||
import mineplex.core.account.event.ClientUnloadEvent;
|
||||
import mineplex.core.account.event.ClientWebResponseEvent;
|
||||
@ -27,7 +29,6 @@ import mineplex.playerCache.PlayerInfo;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.craftbukkit.libs.com.google.gson.Gson;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
@ -74,6 +75,7 @@ public class CoreClientManager extends MiniPlugin
|
||||
public void addCommands()
|
||||
{
|
||||
addCommand(new UpdateRank(this));
|
||||
addCommand(new TestRank(this));
|
||||
}
|
||||
|
||||
public CoreClient Add(String name)
|
||||
@ -245,7 +247,7 @@ public class CoreClientManager extends MiniPlugin
|
||||
token = gson.fromJson(response, ClientToken.class);
|
||||
|
||||
CoreClient client = Add(playerName);
|
||||
client.SetRank(Rank.valueOf(token.Rank));
|
||||
client.SetRank(Rank.valueOf(token.Rank), false);
|
||||
client.setAccountId(_repository.login(_loginProcessors, _querylessLoginProcessors, uuid.toString(), client.GetPlayerName()));
|
||||
|
||||
// JSON sql response
|
||||
@ -305,7 +307,7 @@ public class CoreClientManager extends MiniPlugin
|
||||
|
||||
token = gson.fromJson(response, ClientToken.class);
|
||||
|
||||
client.SetRank(Rank.valueOf(token.Rank));
|
||||
client.SetRank(Rank.valueOf(token.Rank), false);
|
||||
|
||||
// _repository.updateMysqlRank(uuid.toString(), token.Rank, token.RankPerm, new Timestamp(Date.parse(token.RankExpire)).toString());
|
||||
|
||||
@ -418,12 +420,31 @@ public class CoreClientManager extends MiniPlugin
|
||||
{
|
||||
CoreClient client = Get(name);
|
||||
|
||||
client.SetRank(newRank);
|
||||
client.SetRank(newRank, false);
|
||||
}
|
||||
}
|
||||
}, name, uuid, rank, perm);
|
||||
}
|
||||
|
||||
public void SaveRank(final Callback<Rank> callback, final String name, final UUID uuid, Rank rank, boolean perm)
|
||||
{
|
||||
_repository.saveRank(new Callback<Rank>()
|
||||
{
|
||||
public void run(Rank newRank)
|
||||
{
|
||||
if (_plugin.getServer().getPlayer(name) != null)
|
||||
{
|
||||
CoreClient client = Get(name);
|
||||
|
||||
client.SetRank(newRank, false);
|
||||
}
|
||||
|
||||
if (callback != null)
|
||||
callback.run(newRank);
|
||||
}
|
||||
}, name, uuid, rank, perm);
|
||||
}
|
||||
|
||||
public void checkPlayerNameExact(final Callback<Boolean> callback, final String playerName)
|
||||
{
|
||||
_repository.matchPlayerName(new Callback<List<String>>()
|
||||
|
@ -0,0 +1,77 @@
|
||||
package mineplex.core.account.command;
|
||||
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.account.event.OnlineRankUpdateEvent;
|
||||
import mineplex.core.command.CommandBase;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class TestRank extends CommandBase<CoreClientManager>
|
||||
{
|
||||
public TestRank(CoreClientManager plugin)
|
||||
{
|
||||
super(plugin, Rank.ALL, "testRank");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Execute(final Player caller, String[] args)
|
||||
{
|
||||
if (!Plugin.Get(caller).GetRank(true).has(Rank.JNR_DEV))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Permissions", "This requires Permission Rank [" + Rank.JNR_DEV.getTag(false, true) + C.cGray + "]."));
|
||||
return;
|
||||
}
|
||||
|
||||
boolean testServer = Plugin.getPlugin().getConfig().getString("serverstatus.group").equalsIgnoreCase("Testing");
|
||||
|
||||
if (!testServer)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), F.elem("This command can only be used on test servers!")));
|
||||
return;
|
||||
}
|
||||
|
||||
if (args == null)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), "/" + AliasUsed + " MODERATOR"));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (args.length == 0)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), "Rank argument missing."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("RESET"))
|
||||
{
|
||||
Plugin.Get(caller).resetTemp();
|
||||
}
|
||||
else
|
||||
{
|
||||
Rank tempRank = null;
|
||||
|
||||
try
|
||||
{
|
||||
tempRank = Rank.valueOf(args[0].toUpperCase());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), ChatColor.RED + "" + ChatColor.BOLD + "Invalid rank!"));
|
||||
return;
|
||||
}
|
||||
|
||||
Plugin.Get(caller).SetRank(tempRank, true);
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), "Your rank has been set to " + tempRank.getTag(false, false) + C.cGray + "!"));
|
||||
UtilPlayer.message(caller, F.main("NOTICE", "This is only to be used for testing purposes. Misuse of this command will result in a demotion."));
|
||||
OnlineRankUpdateEvent event = new OnlineRankUpdateEvent(caller, Plugin.Get(caller).GetRank(true), Plugin.Get(caller).GetRank(), true);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -4,35 +4,30 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.account.event.OnlineRankUpdateEvent;
|
||||
import mineplex.core.command.CommandBase;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UUIDFetcher;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class UpdateRank extends CommandBase<CoreClientManager>
|
||||
{
|
||||
public UpdateRank(CoreClientManager plugin)
|
||||
{
|
||||
super(plugin, Rank.ADMIN, new Rank[] {Rank.JNR_DEV /*On test servers only*/}, "updateRank");
|
||||
super(plugin, Rank.ADMIN, "updateRank");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Execute(final Player caller, String[] args)
|
||||
{
|
||||
boolean testServer = Plugin.getPlugin().getConfig().getString("serverstatus.group").equalsIgnoreCase("Testing");
|
||||
|
||||
if (Plugin.Get(caller).GetRank() == Rank.JNR_DEV && !testServer)
|
||||
{
|
||||
F.main(Plugin.getName(), F.elem(Rank.JNR_DEV.getTag(true, true)) + "s are only permitted to set ranks on test servers!");
|
||||
return;
|
||||
}
|
||||
|
||||
{
|
||||
if (args == null)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), "/" + AliasUsed + " joeschmo MODERATOR"));
|
||||
@ -60,66 +55,70 @@ public class UpdateRank extends CommandBase<CoreClientManager>
|
||||
|
||||
final Rank rank = tempRank;
|
||||
|
||||
if (rank == Rank.ADMIN || rank == Rank.YOUTUBE || rank == Rank.TWITCH || rank == Rank.MODERATOR || rank == Rank.JNR_DEV || rank == Rank.HELPER || rank == Rank.ALL || rank == Rank.MAPDEV || rank == Rank.SNR_MODERATOR)
|
||||
Plugin.getRepository().matchPlayerName(new Callback<List<String>>()
|
||||
{
|
||||
if (!testServer && rank.has(Rank.ADMIN) && !Plugin.hasRank(caller, Rank.LT))
|
||||
public void run(List<String> matches)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), ChatColor.RED + "" + ChatColor.BOLD + "Insufficient privileges!"));
|
||||
return;
|
||||
}
|
||||
|
||||
Plugin.getRepository().matchPlayerName(new Callback<List<String>>()
|
||||
{
|
||||
public void run(List<String> matches)
|
||||
boolean matchedExact = false;
|
||||
|
||||
for (String match : matches)
|
||||
{
|
||||
boolean matchedExact = false;
|
||||
|
||||
for (String match : matches)
|
||||
if (match.equalsIgnoreCase(playerName))
|
||||
{
|
||||
if (match.equalsIgnoreCase(playerName))
|
||||
{
|
||||
matchedExact = true;
|
||||
}
|
||||
matchedExact = true;
|
||||
}
|
||||
|
||||
if (matchedExact)
|
||||
{
|
||||
for (Iterator<String> matchIterator = matches.iterator(); matchIterator.hasNext();)
|
||||
{
|
||||
if (!matchIterator.next().equalsIgnoreCase(playerName))
|
||||
{
|
||||
matchIterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
UtilPlayer.searchOffline(matches, new Callback<String>()
|
||||
{
|
||||
public void run(final String target)
|
||||
{
|
||||
if (target == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
UUID uuid = Plugin.loadUUIDFromDB(playerName);
|
||||
|
||||
if (uuid == null)
|
||||
uuid = UUIDFetcher.getUUIDOf(playerName);
|
||||
|
||||
Plugin.getRepository().saveRank(new Callback<Rank>()
|
||||
{
|
||||
public void run(Rank rank)
|
||||
{
|
||||
caller.sendMessage(F.main(Plugin.getName(), target + "'s rank has been updated to " + rank.Name + "!"));
|
||||
}
|
||||
}, target, uuid, rank, true);
|
||||
|
||||
}
|
||||
}, caller, playerName, true);
|
||||
}
|
||||
}, playerName);
|
||||
}
|
||||
|
||||
if (matchedExact)
|
||||
{
|
||||
for (Iterator<String> matchIterator = matches.iterator(); matchIterator.hasNext();)
|
||||
{
|
||||
if (!matchIterator.next().equalsIgnoreCase(playerName))
|
||||
{
|
||||
matchIterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (UtilPlayer.isOnline(playerName))
|
||||
{
|
||||
Player p = UtilServer.getServer().getPlayer(playerName);
|
||||
if (Plugin.Get(p).GetRank() != Plugin.Get(p).GetRank(true))
|
||||
Plugin.Get(p).resetTemp();
|
||||
|
||||
OnlineRankUpdateEvent event = new OnlineRankUpdateEvent(caller, Plugin.Get(caller).GetRank(), rank, true);
|
||||
Plugin.Get(p).SetRank(rank, false);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
|
||||
UtilPlayer.message(p, F.main(Plugin.getName(), "Your rank has been updated to " + rank.Name + "!"));
|
||||
}
|
||||
|
||||
UtilPlayer.searchOffline(matches, new Callback<String>()
|
||||
{
|
||||
public void run(final String target)
|
||||
{
|
||||
if (target == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
UUID uuid = Plugin.loadUUIDFromDB(playerName);
|
||||
|
||||
if (uuid == null)
|
||||
uuid = UUIDFetcher.getUUIDOf(playerName);
|
||||
|
||||
Plugin.getRepository().saveRank(new Callback<Rank>()
|
||||
{
|
||||
public void run(Rank rank)
|
||||
{
|
||||
caller.sendMessage(F.main(Plugin.getName(), target + "'s rank has been updated to " + rank.Name + "!"));
|
||||
}
|
||||
}, target, uuid, rank, true);
|
||||
|
||||
}
|
||||
}, caller, playerName, true);
|
||||
}
|
||||
}, playerName);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
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.HandlerList;
|
||||
|
||||
|
@ -0,0 +1,55 @@
|
||||
package mineplex.core.account.event;
|
||||
|
||||
import mineplex.core.common.Rank;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
public class OnlineRankUpdateEvent extends Event
|
||||
{
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
private Player _player;
|
||||
private Rank _from, _to;
|
||||
private boolean _temp;
|
||||
|
||||
public OnlineRankUpdateEvent(Player player, Rank from, Rank to, boolean temp)
|
||||
{
|
||||
_player = player;
|
||||
_from = from;
|
||||
_to = to;
|
||||
_temp = temp;
|
||||
}
|
||||
|
||||
public Player getPlayer()
|
||||
{
|
||||
return _player;
|
||||
}
|
||||
|
||||
public Rank getFrom()
|
||||
{
|
||||
return _from;
|
||||
}
|
||||
|
||||
public Rank getTo()
|
||||
{
|
||||
return _to;
|
||||
}
|
||||
|
||||
public boolean isTemporary()
|
||||
{
|
||||
return _temp;
|
||||
}
|
||||
|
||||
public HandlerList getHandlers()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
}
|
@ -11,7 +11,7 @@ import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
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 mineplex.core.account.ILoginProcessor;
|
||||
@ -209,7 +209,7 @@ public class AccountRepository extends RepositoryBase
|
||||
{
|
||||
public void run(final Rank response)
|
||||
{
|
||||
if (rank == Rank.ULTRA || rank == Rank.HERO || rank == Rank.LEGEND)
|
||||
if (rank == Rank.ULTRA || rank == Rank.HERO || rank == Rank.LEGEND || rank == Rank.TITAN)
|
||||
{
|
||||
if (perm)
|
||||
executeUpdate(UPDATE_ACCOUNT_RANK_DONOR_PERM, new ColumnVarChar("rank", 100, rank.toString()), new ColumnVarChar("donorRank", 100, rank.toString()), new ColumnVarChar("uuid", 100, uuid.toString()));
|
||||
@ -229,7 +229,8 @@ public class AccountRepository extends RepositoryBase
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
callback.run(response);
|
||||
if (callback != null)
|
||||
callback.run(response);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -15,6 +15,13 @@ public enum Achievement
|
||||
new String[]{"+1 for every Gem earned in any game."},
|
||||
new int[]{10000, 15000, 20000, 25000, 30000, 35000, 40000, 45000, 50000, 55000, 60000, 65000},
|
||||
AchievementCategory.GLOBAL),
|
||||
|
||||
GLOBAL_PUMPKIN_SMASHER_2015("2015 Pumpkin Smasher", 4000,
|
||||
new String[]{"Global.Halloween Pumpkins 2015"},
|
||||
new String[]{"Smash 200 Flaming Pumpkins,",
|
||||
"during Halloween 2015!"},
|
||||
new int[]{200},
|
||||
AchievementCategory.HOLIDAY),
|
||||
|
||||
//Bridges
|
||||
BRIDGES_WINS("Bridge Champion", 600,
|
||||
@ -270,8 +277,8 @@ public enum Achievement
|
||||
|
||||
//Champions
|
||||
CHAMPIONS_WINS("Champion", 600,
|
||||
new String[]{"Champions Domination.Wins", "Champions TDM.Wins"},
|
||||
new String[]{"Win 80 games of Dominate or TDM"},
|
||||
new String[]{"Champions Domination.Wins", "Champions TDM.Wins", "Champions CTF.Wins"},
|
||||
new String[]{"Win 80 games of Dominate, TDM, or CTF"},
|
||||
new int[]{80},
|
||||
AchievementCategory.CHAMPIONS),
|
||||
|
||||
@ -288,28 +295,46 @@ public enum Achievement
|
||||
AchievementCategory.CHAMPIONS),
|
||||
|
||||
CHAMPIONS_ASSASSINATION("Assassination", 1000,
|
||||
new String[]{"Champions Domination.Assassination", "Champions TDM.Assassination"},
|
||||
new String[]{"Champions Domination.Assassination", "Champions TDM.Assassination", "Champions CTF.Assassination"},
|
||||
new String[]{"Kill 40 players with Backstab without", "taking any damage from them"},
|
||||
new int[]{40},
|
||||
AchievementCategory.CHAMPIONS),
|
||||
|
||||
CHAMPIONS_MASS_ELECTROCUTION("Mass Electrocution", 1200,
|
||||
new String[]{"Champions Domination.MassElectrocution", "Champions TDM.MassElectrocution"},
|
||||
new String[]{"Champions Domination.MassElectrocution", "Champions TDM.MassElectrocution", "Champions CTF.MassElectrocution"},
|
||||
new String[]{"Hit 4 enemies with a Lightning Orb"},
|
||||
new int[]{1},
|
||||
AchievementCategory.CHAMPIONS),
|
||||
|
||||
CHAMPIONS_THE_LONGEST_SHOT("The Longest Shot", 1200,
|
||||
new String[]{"Champions Domination.TheLongestShot", "Champions TDM.TheLongestShot"},
|
||||
new String[]{"Champions Domination.TheLongestShot", "Champions TDM.TheLongestShot", "Champions CTF.TheLongestShot"},
|
||||
new String[]{"Kill someone using Longshot who", "is over 64 Blocks away from you"},
|
||||
new int[]{1},
|
||||
AchievementCategory.CHAMPIONS),
|
||||
|
||||
CHAMPIONS_EARTHQUAKE("Earthquake", 1200,
|
||||
new String[]{"Champions Domination.Earthquake", "Champions TDM.Earthquake"},
|
||||
new String[]{"Champions Domination.Earthquake", "Champions TDM.Earthquake", "Champions CTF.Earthquake"},
|
||||
new String[]{"Launch 5 enemies using Seismic Slam"},
|
||||
new int[]{1},
|
||||
AchievementCategory.CHAMPIONS),
|
||||
|
||||
CHAMPIONS_CAPTURES("Sticky Fingers", 2500,
|
||||
new String[]{"Champions CTF.Captures"},
|
||||
new String[]{"Capture the Enemy Flag 20 times"},
|
||||
new int[]{20},
|
||||
AchievementCategory.CHAMPIONS),
|
||||
|
||||
CHAMPIONS_CLUTCH("Clutch", 600,
|
||||
new String[]{"Champions CTF.Clutch"},
|
||||
new String[]{"Kill the Enemy Flag Carrier in Sudden Death"},
|
||||
new int[]{1},
|
||||
AchievementCategory.CHAMPIONS),
|
||||
|
||||
CHAMPIONS_SPECIAL_WIN("Champion of Champions", 3000,
|
||||
new String[]{"Champions CTF.SpecialWin"},
|
||||
new String[]{"Win the game with 5 more captures than the other team"},
|
||||
new int[]{1},
|
||||
AchievementCategory.CHAMPIONS),
|
||||
|
||||
//Paintball
|
||||
SUPER_PAINTBALL_WINS("Paintball King", 600,
|
||||
@ -708,7 +733,43 @@ public enum Achievement
|
||||
new String[]{"Evolution.EvolveKill"},
|
||||
new String[]{"Kill 25 people while they", "Are trying to evolve"},
|
||||
new int[]{25},
|
||||
AchievementCategory.EVOLUTION)
|
||||
AchievementCategory.EVOLUTION),
|
||||
|
||||
MONSTER_MAZE_WINS("Maze Master", 1200,
|
||||
new String[]{"Monster Maze.Wins"},
|
||||
new String[]{"Win 40 games of Monster Maze"},
|
||||
new int[]{40},
|
||||
AchievementCategory.MONSTER_MAZE),
|
||||
|
||||
MONSTER_MAZE_HARD_MODE("Hard Mode", 1000,
|
||||
new String[]{"Monster Maze.Hard Mode"},
|
||||
new String[]{"Win a game without using", "any kit abilities"},
|
||||
new int[]{1},
|
||||
AchievementCategory.MONSTER_MAZE),
|
||||
|
||||
MONSTER_MAZE_NINJA("Ninja", 1200,
|
||||
new String[]{"Monster Maze.Ninja"},
|
||||
new String[]{"Win a game without", "touching a monster"},
|
||||
new int[]{1},
|
||||
AchievementCategory.MONSTER_MAZE),
|
||||
|
||||
MONSTER_MAZE_SPEEDSTER("Speedy McGee", 1000,
|
||||
new String[]{"Monster Maze.Speed"},
|
||||
new String[]{"Be the first to the", "Safe Pad 50 times"},
|
||||
new int[]{50},
|
||||
AchievementCategory.MONSTER_MAZE),
|
||||
|
||||
MONSTER_MAZE_SURVIVAL("Die Already!", 1200,
|
||||
new String[]{"Monster Maze.ToughCompetition"},
|
||||
new String[]{"Survive past the 10th Safe Pad"},
|
||||
new int[]{1},
|
||||
AchievementCategory.MONSTER_MAZE),
|
||||
|
||||
MONSTER_MAZE_PILOT("Pilot", 800, //TODO
|
||||
new String[]{"Monster Maze.Pilot"},
|
||||
new String[]{"Get hit by a monster and", "land on the Safe Pad"},
|
||||
new int[]{1},
|
||||
AchievementCategory.MONSTER_MAZE),
|
||||
|
||||
;
|
||||
|
||||
|
@ -20,6 +20,10 @@ public enum AchievementCategory
|
||||
new StatDisplay[] { StatDisplay.GEMS_EARNED, null, new StatDisplay("Games Played", "GamesPlayed"), StatDisplay.TIME_IN_GAME, null,
|
||||
new StatDisplay("Daily Rewards", "DailyReward"), new StatDisplay("Times Voted", "DailyVote"), null, new StatDisplay("Chests Opened", "Treasure.Old", "Treasure.Ancient", "Treasure.Mythical") },
|
||||
Material.EMERALD, 0, GameCategory.GLOBAL, "None"),
|
||||
|
||||
HOLIDAY("Holiday Achievements", null,
|
||||
new StatDisplay[] {},
|
||||
Material.PUMPKIN_PIE, 0, GameCategory.HOLIDAY, "None"),
|
||||
|
||||
BRIDGES("The Bridges", null,
|
||||
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
|
||||
@ -74,8 +78,8 @@ public enum AchievementCategory
|
||||
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.GEMS_EARNED },
|
||||
Material.BOOK_AND_QUILL, 0, GameCategory.CLASSICS, "Extra Tools Kit"),
|
||||
|
||||
CHAMPIONS("Champions", new String[] {"Champions Domination", "Champions TDM"},
|
||||
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
|
||||
CHAMPIONS("Champions", new String[] {"Champions Domination", "Champions TDM", "Champions CTF"},
|
||||
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED, new StatDisplay("Flags Captured", "Captures") },
|
||||
Material.BEACON, 0, GameCategory.CHAMPIONS, "Extra Class Skills"),
|
||||
|
||||
MASTER_BUILDERS("Master Builders", null,
|
||||
@ -141,7 +145,13 @@ public enum AchievementCategory
|
||||
|
||||
EVOLUTION("Evolution", null,
|
||||
new StatDisplay[] {StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED},
|
||||
Material.MONSTER_EGG, 0, GameCategory.ARCADE, "Harvester Kit");
|
||||
Material.MONSTER_EGG, 0, GameCategory.ARCADE, "Harvester Kit"),
|
||||
|
||||
MONSTER_MAZE("Monster Maze", null,
|
||||
new StatDisplay[] {StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED},
|
||||
Material.ROTTEN_FLESH, 0, GameCategory.ARCADE, "SoonTM"),
|
||||
|
||||
;
|
||||
|
||||
private String _name;
|
||||
private String[] _statsToPull;
|
||||
@ -257,6 +267,6 @@ public enum AchievementCategory
|
||||
|
||||
public enum GameCategory
|
||||
{
|
||||
GLOBAL, SURVIVAL, CLASSICS, CHAMPIONS, ARCADE
|
||||
GLOBAL, HOLIDAY, SURVIVAL, CLASSICS, CHAMPIONS, ARCADE
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,12 @@ public class AchievementMainPage extends ShopPageBase<AchievementManager, Achiev
|
||||
|
||||
public AchievementMainPage(AchievementManager plugin, StatsManager statsManager, AchievementShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player, Player target)
|
||||
{
|
||||
super(plugin, shop, clientManager, donationManager, name, player, 9 * 4);
|
||||
this(plugin, statsManager, shop, clientManager, donationManager, name, 9 * 4, player, target);
|
||||
}
|
||||
|
||||
public AchievementMainPage(AchievementManager plugin, StatsManager statsManager, AchievementShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, int size, Player player, Player target)
|
||||
{
|
||||
super(plugin, shop, clientManager, donationManager, name, player, size);
|
||||
|
||||
_target = target;
|
||||
_statsManager = statsManager;
|
||||
@ -41,7 +46,7 @@ public class AchievementMainPage extends ShopPageBase<AchievementManager, Achiev
|
||||
protected void buildPage()
|
||||
{
|
||||
ArrayList<Integer> pageLayout = new ItemLayout(
|
||||
"XXXXOXXXX",
|
||||
"XXXXOXXXO",
|
||||
"OXOXOXOXO",
|
||||
"OXOXOXOXO",
|
||||
"XXOXOXOXX").getItemSlots();
|
||||
|
@ -23,7 +23,9 @@ public class ArcadeMainPage extends AchievementMainPage
|
||||
{
|
||||
public ArcadeMainPage(AchievementManager plugin, StatsManager statsManager, AchievementShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player, Player target)
|
||||
{
|
||||
super(plugin, statsManager, shop, clientManager, donationManager, name, player, target);
|
||||
super(plugin, statsManager, shop, clientManager, donationManager, name, 9 * 5, player, target);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -6,7 +6,7 @@ import java.sql.SQLException;
|
||||
|
||||
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;
|
||||
|
||||
public class AntiHackRepository
|
||||
|
@ -27,11 +27,11 @@ public class BenefitManager extends MiniDbClientPlugin<BenefitData>
|
||||
{
|
||||
super("Benefit Manager", plugin, clientManager);
|
||||
|
||||
_repository = new BenefitManagerRepository(plugin);
|
||||
_repository = new BenefitManagerRepository(plugin);
|
||||
|
||||
//_benefits.add(new Christmas2014(plugin, _repository, inventoryManager));
|
||||
//_benefits.add(new Thanksgiving2014(plugin, _repository, inventoryManager));
|
||||
//_benefits.add(new Players40k(this, _repository, inventoryManager));
|
||||
//_benefits.add(new Players43k(this, _repository, inventoryManager));
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
|
@ -15,6 +15,7 @@ public class BenefitManagerRepository extends RepositoryBase
|
||||
private static String CREATE_BENEFIT_TABLE = "CREATE TABLE IF NOT EXISTS rankBenefits (id INT NOT NULL AUTO_INCREMENT, accountId INT, benefit VARCHAR(100), PRIMARY KEY (id), FOREIGN KEY (accountId) REFERENCES accounts(id));";
|
||||
|
||||
private static String INSERT_BENEFIT = "INSERT INTO rankBenefits (accountId, benefit) VALUES (?, ?);";
|
||||
private static String DELETE_BENEFIT = "DELETE FROM rankBenefits WHERE accountId = ? AND benefit = ?;";
|
||||
|
||||
public BenefitManagerRepository(JavaPlugin plugin)
|
||||
{
|
||||
@ -24,7 +25,7 @@ public class BenefitManagerRepository extends RepositoryBase
|
||||
@Override
|
||||
protected void initialize()
|
||||
{
|
||||
executeUpdate(CREATE_BENEFIT_TABLE);
|
||||
//executeUpdate(CREATE_BENEFIT_TABLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -50,4 +51,9 @@ public class BenefitManagerRepository extends RepositoryBase
|
||||
|
||||
return playerBenefit;
|
||||
}
|
||||
|
||||
public void removeBenefit(int accountId, String benefit)
|
||||
{
|
||||
executeUpdate(DELETE_BENEFIT, new ColumnInt("accountId", accountId), new ColumnVarChar("benefit", 100, benefit));
|
||||
}
|
||||
}
|
||||
|
@ -45,6 +45,11 @@ public abstract class BenefitBase
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected void removeBenefit(final Player player)
|
||||
{
|
||||
_repository.removeBenefit(_plugin.getClientManager().Get(player).getAccountId(), _name);
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
|
@ -38,6 +38,6 @@ public class Christmas2014 extends BenefitBase
|
||||
UtilPlayer.message(player, C.cPurple + C.Strike + "=============================================");
|
||||
}
|
||||
}
|
||||
}, player, "Treasure", "Treasure Key", 2);
|
||||
}, player, "Treasure Key", 2);
|
||||
}
|
||||
}
|
||||
|
@ -40,6 +40,6 @@ public class Players40k extends BenefitBase
|
||||
UtilPlayer.message(player, C.cGold + C.Strike + "=============================================");
|
||||
}
|
||||
}
|
||||
}, player, "Treasure", "Ancient Chest", 1);
|
||||
}, player, "Ancient Chest", 1);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,49 @@
|
||||
package mineplex.core.benefit.benefits;
|
||||
|
||||
import mineplex.core.benefit.BenefitManager;
|
||||
import mineplex.core.benefit.BenefitManagerRepository;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.inventory.InventoryManager;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public class Players43k extends BenefitBase
|
||||
{
|
||||
private InventoryManager _inventoryManager;
|
||||
|
||||
public Players43k(BenefitManager plugin, BenefitManagerRepository repository, InventoryManager inventoryManager)
|
||||
{
|
||||
super(plugin, "Players43k", repository);
|
||||
|
||||
_inventoryManager = inventoryManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void rewardPlayer(final Player player)
|
||||
{
|
||||
_inventoryManager.addItemToInventory(new Callback<Boolean>()
|
||||
{
|
||||
public void run(Boolean success)
|
||||
{
|
||||
if (success)
|
||||
{
|
||||
UtilPlayer.message(player, C.cGold + C.Strike + "=============================================");
|
||||
UtilPlayer.message(player, "");
|
||||
UtilPlayer.message(player, "To celebrate hitting 43,000 players online,");
|
||||
UtilPlayer.message(player, "everyone receives a prize! You're awesome!");
|
||||
UtilPlayer.message(player, "");
|
||||
UtilPlayer.message(player, "You received 3 Ancient Chests!");
|
||||
UtilPlayer.message(player, "");
|
||||
UtilPlayer.message(player, C.cGold + C.Strike + "=============================================");
|
||||
}
|
||||
else
|
||||
{
|
||||
removeBenefit(player);
|
||||
}
|
||||
}
|
||||
}, player, "Ancient Chest", 3);
|
||||
}
|
||||
}
|
@ -38,6 +38,6 @@ public class Thanksgiving2014 extends BenefitBase
|
||||
UtilPlayer.message(player, C.cPurple + C.Strike + "=============================================");
|
||||
}
|
||||
}
|
||||
}, player, "Treasure", "Treasure Key", 1);
|
||||
}, player, "Treasure Key", 1);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,9 @@
|
||||
package mineplex.core.blockrestore;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
|
||||
@ -18,6 +22,8 @@ public class BlockRestoreData
|
||||
|
||||
protected long _meltDelay = 0;
|
||||
protected long _meltLast = 0;
|
||||
|
||||
protected HashMap<Location, Byte> _pad = new HashMap<Location, Byte>();
|
||||
|
||||
public BlockRestoreData(Block block, int toID, byte toData, int fromID, byte fromData, long expireDelay, long meltDelay)
|
||||
{
|
||||
@ -136,6 +142,11 @@ public class BlockRestoreData
|
||||
{
|
||||
if (_toID == 78 && _toData == (byte)7)
|
||||
_block.setTypeIdAndData(80, (byte)0, true);
|
||||
else if (_toID == 8 || _toID == 9 || _toID == 79)
|
||||
{
|
||||
handleLilypad(false);
|
||||
_block.setTypeIdAndData(_toID, _toData, true);
|
||||
}
|
||||
else
|
||||
_block.setTypeIdAndData(_toID, _toData, true);
|
||||
}
|
||||
@ -143,6 +154,7 @@ public class BlockRestoreData
|
||||
public void restore()
|
||||
{
|
||||
_block.setTypeIdAndData(_fromID, _fromData, true);
|
||||
handleLilypad(true);
|
||||
}
|
||||
|
||||
public void setFromId(int i)
|
||||
@ -154,4 +166,24 @@ public class BlockRestoreData
|
||||
{
|
||||
_fromData = i;
|
||||
}
|
||||
|
||||
private void handleLilypad(boolean restore)
|
||||
{
|
||||
if (restore)
|
||||
{
|
||||
for (Location l : _pad.keySet())
|
||||
{
|
||||
l.getBlock().setType(Material.WATER_LILY);
|
||||
l.getBlock().setData(_pad.get(l));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_block.getRelative(BlockFace.UP, 1).getType() == Material.WATER_LILY)
|
||||
{
|
||||
_pad.put(_block.getRelative(BlockFace.UP, 1).getLocation(), _block.getRelative(BlockFace.UP, 1).getData());
|
||||
_block.getRelative(BlockFace.UP, 1).setType(Material.AIR);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -32,6 +32,7 @@ import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
import mineplex.core.database.DBPool;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.giveaway.GiveawayManager;
|
||||
import mineplex.core.hologram.Hologram;
|
||||
import mineplex.core.hologram.HologramManager;
|
||||
import mineplex.core.inventory.InventoryManager;
|
||||
@ -41,6 +42,7 @@ import mineplex.core.pet.PetManager;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.reward.RewardManager;
|
||||
import mineplex.core.stats.StatsManager;
|
||||
import mineplex.core.status.ServerStatusManager;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.database.Tables;
|
||||
@ -60,7 +62,7 @@ import org.jooq.SQLDialect;
|
||||
import org.jooq.impl.DSL;
|
||||
import org.bukkit.Bukkit;
|
||||
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.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@ -70,8 +72,8 @@ import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import net.minecraft.server.v1_7_R4.DataWatcher;
|
||||
import net.minecraft.server.v1_7_R4.PacketPlayOutEntityMetadata;
|
||||
import net.minecraft.server.v1_8_R3.DataWatcher;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityMetadata;
|
||||
|
||||
public class BonusManager extends MiniClientPlugin<BonusClientData> implements ILoginProcessor
|
||||
{
|
||||
@ -164,7 +166,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
updateOffSet();
|
||||
}
|
||||
|
||||
public BonusManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, PollManager pollManager, NpcManager npcManager, HologramManager hologramManager, StatsManager statsManager, InventoryManager inventoryManager, PetManager petManager)
|
||||
public BonusManager(JavaPlugin plugin, CoreClientManager clientManager, ServerStatusManager statusManager, DonationManager donationManager, PollManager pollManager, NpcManager npcManager, HologramManager hologramManager, StatsManager statsManager, InventoryManager inventoryManager, PetManager petManager, GiveawayManager giveawayManager)
|
||||
{
|
||||
super("Bonus", plugin);
|
||||
_repository = new BonusRepository(plugin, this, donationManager);
|
||||
@ -173,7 +175,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
_npcManager = npcManager;
|
||||
_hologramManager = hologramManager;
|
||||
|
||||
_rewardManager = new RewardManager(clientManager, donationManager, inventoryManager, petManager, statsManager,
|
||||
_rewardManager = new RewardManager(clientManager, statusManager, donationManager, inventoryManager, petManager, statsManager, giveawayManager,
|
||||
100, 250,
|
||||
500, 1000,
|
||||
4000, 6000,
|
||||
@ -403,7 +405,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
if (!_enabled)
|
||||
return;
|
||||
|
||||
((CraftEntity)_carlNpc.getEntity()).getHandle().getDataWatcher().watch(16, -1);
|
||||
((CraftEntity)_carlNpc.getEntity()).getHandle().getDataWatcher().watch(16, (byte) -1);
|
||||
}
|
||||
|
||||
public void IncreaseSize(Entity player)
|
||||
@ -411,7 +413,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
if (!_enabled)
|
||||
return;
|
||||
|
||||
((CraftEntity)_carlNpc.getEntity()).getHandle().getDataWatcher().watch(16, 1);
|
||||
((CraftEntity)_carlNpc.getEntity()).getHandle().getDataWatcher().watch(16, (byte) 1);
|
||||
}
|
||||
|
||||
// DAILY BONUS
|
||||
@ -890,7 +892,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
|
||||
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.setHologramTarget(Hologram.HologramTarget.WHITELIST);
|
||||
hologram.addPlayer(player);
|
||||
|
@ -435,7 +435,7 @@ public class BonusRepository extends RepositoryBase
|
||||
@Override
|
||||
protected void initialize()
|
||||
{
|
||||
executeUpdate(CREATE_BONUS_TABLE);
|
||||
//executeUpdate(CREATE_BONUS_TABLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -3,6 +3,7 @@ package mineplex.core.bonuses.gui;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.gui.DisplayItem;
|
||||
@ -109,7 +110,14 @@ public class SpinGui extends SimpleGui
|
||||
}
|
||||
}
|
||||
|
||||
_rewardData = _reward.giveReward("Carls Spinner", getPlayer());
|
||||
_reward.giveReward(RewardType.SpinnerReal, getPlayer(), new Callback<RewardData>()
|
||||
{
|
||||
@Override
|
||||
public void run(RewardData data)
|
||||
{
|
||||
_rewardData = data;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void tick()
|
||||
|
@ -2,6 +2,9 @@ package mineplex.core.bonuses.gui.buttons;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import mineplex.core.bonuses.BonusAmount;
|
||||
import mineplex.core.bonuses.BonusClientData;
|
||||
import mineplex.core.bonuses.BonusManager;
|
||||
import mineplex.core.common.jsonchat.ClickEvent;
|
||||
import mineplex.core.common.jsonchat.JsonMessage;
|
||||
import mineplex.core.common.util.C;
|
||||
@ -11,10 +14,6 @@ import mineplex.core.common.util.UtilTime.TimeUnit;
|
||||
import mineplex.core.gui.GuiItem;
|
||||
import mineplex.core.gui.ItemRefresher;
|
||||
import mineplex.core.shop.item.ShopItem;
|
||||
import mineplex.core.bonuses.BonusAmount;
|
||||
import mineplex.core.bonuses.BonusClientData;
|
||||
import mineplex.core.bonuses.BonusManager;
|
||||
import mineplex.core.bonuses.StreakRecord;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
@ -72,15 +71,15 @@ public class VoteButton implements GuiItem, Listener {
|
||||
|
||||
getPlayer().playSound(getPlayer().getLocation(), Sound.NOTE_PLING, 1, 1.6f);
|
||||
|
||||
UtilPlayer.message(getPlayer(), "----------------------------------------------------");
|
||||
UtilPlayer.message(getPlayer(), C.cGold + C.Bold + C.Strike + "=============================================");
|
||||
UtilPlayer.message(getPlayer(), "");
|
||||
|
||||
new JsonMessage("Click to Open in Web Browser").click(ClickEvent.OPEN_URL, _url).sendToPlayer(getPlayer());
|
||||
new JsonMessage(C.cGreen + _url).click(ClickEvent.OPEN_URL, _url).sendToPlayer(getPlayer());
|
||||
new JsonMessage(" " + C.Bold + "Click to Open in Web Browser").click(ClickEvent.OPEN_URL, _url).sendToPlayer(getPlayer());
|
||||
new JsonMessage( " " + C.cGreen + C.Line + _url).click(ClickEvent.OPEN_URL, _url).sendToPlayer(getPlayer());
|
||||
UtilPlayer.message(getPlayer(), "");
|
||||
UtilPlayer.message(getPlayer(), "Please be patient, votes may take a few minutes to register.");
|
||||
UtilPlayer.message(getPlayer(), " Please be patient. Votes may take a few minutes to register.");
|
||||
UtilPlayer.message(getPlayer(), "");
|
||||
UtilPlayer.message(getPlayer(), "----------------------------------------------------");
|
||||
UtilPlayer.message(getPlayer(), C.cGold + C.Bold + C.Strike + "=============================================");
|
||||
|
||||
getPlayer().closeInventory();
|
||||
|
||||
|
@ -5,6 +5,8 @@ import java.util.List;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
@ -42,6 +44,10 @@ public class BotSpamManager extends MiniPlugin
|
||||
// Ignore messages sent to staff members
|
||||
if (_clientManager.hasRank(recipient, Rank.HELPER))
|
||||
return;
|
||||
|
||||
// Ignore messages sent by staff members
|
||||
if (_clientManager.hasRank(event.getSender(), Rank.HELPER))
|
||||
return;
|
||||
|
||||
for (SpamText spamText : _spam)
|
||||
{
|
||||
@ -53,6 +59,31 @@ public class BotSpamManager extends MiniPlugin
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onChat(final AsyncPlayerChatEvent event)
|
||||
{
|
||||
// Ignore messages sent by staff members
|
||||
if (_clientManager.hasRank(event.getPlayer(), Rank.HELPER))
|
||||
return;
|
||||
|
||||
for (final SpamText spamText : _spam)
|
||||
{
|
||||
if (spamText.isEnabled() && spamText.isSpam(event.getMessage()))
|
||||
{
|
||||
runSync(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
punishBot(event.getPlayer(), spamText);
|
||||
}
|
||||
});
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void punishBot(Player player, final SpamText botText)
|
||||
{
|
||||
|
@ -23,6 +23,7 @@ public class SpamText
|
||||
|
||||
public boolean isSpam(String message)
|
||||
{
|
||||
//System.out.println(message.toLowerCase() + " vs " + _text.toLowerCase() + " == " + message.toLowerCase().contains(_text.toLowerCase()));
|
||||
return message.toLowerCase().contains(_text.toLowerCase());
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,7 @@ public class BotSpamAddCommand extends CommandBase<BotSpamManager>
|
||||
{
|
||||
public BotSpamAddCommand(BotSpamManager plugin)
|
||||
{
|
||||
super(plugin, Rank.DEVELOPER, "add");
|
||||
super(plugin, Rank.ADMIN, "add");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -12,7 +12,7 @@ public class BotSpamCommand extends MultiCommandBase<BotSpamManager>
|
||||
{
|
||||
public BotSpamCommand(BotSpamManager plugin)
|
||||
{
|
||||
super(plugin, Rank.DEVELOPER, "botban", "botspam");
|
||||
super(plugin, Rank.ADMIN, "botban", "botspam");
|
||||
|
||||
AddCommand(new BotSpamAddCommand(Plugin));
|
||||
AddCommand(new BotSpamEnableCommand(Plugin));
|
||||
|
@ -13,7 +13,7 @@ public class BotSpamDisableCommand extends CommandBase<BotSpamManager>
|
||||
{
|
||||
public BotSpamDisableCommand(BotSpamManager plugin)
|
||||
{
|
||||
super(plugin, Rank.DEVELOPER, "disable");
|
||||
super(plugin, Rank.ADMIN, "disable");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -13,7 +13,7 @@ public class BotSpamEnableCommand extends CommandBase<BotSpamManager>
|
||||
{
|
||||
public BotSpamEnableCommand(BotSpamManager plugin)
|
||||
{
|
||||
super(plugin, Rank.DEVELOPER, "enable");
|
||||
super(plugin, Rank.ADMIN, "enable");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user