Merge develop into clans/beta

This commit is contained in:
Shaun Bennett 2016-03-08 12:09:04 -06:00
commit 890a3f4bc9
356 changed files with 16007 additions and 3861 deletions

View File

@ -0,0 +1,22 @@
From b3604650ac6e2813f9e1b4d54862ce79c37e001e Mon Sep 17 00:00:00 2001
From: md_5 <git@md-5.net>
Date: Mon, 15 Feb 2016 09:39:33 +1100
Subject: [PATCH] Update groupId
diff --git a/pom.xml b/pom.xml
index cb142f2..378fd01 100644
--- a/pom.xml
+++ b/pom.xml
@@ -9,7 +9,7 @@
<version>9</version>
</parent>
- <groupId>org.spigotmc</groupId>
+ <groupId>com.mineplex</groupId>
<artifactId>spigot-api</artifactId>
<version>1.8.8-R0.1-SNAPSHOT</version>
<packaging>jar</packaging>
--
2.5.0

View File

@ -1,4 +1,4 @@
From f037882f13b3ea9d0a0137260e365a4332a8e751 Mon Sep 17 00:00:00 2001
From 41b16c2e04b2bc8ada5d0ed363e4ea5e6b466ee1 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
@ -30,5 +30,5 @@ index 48e2508..fb623ae 100644
+ public void setGhost(boolean ghost);
}
--
1.9.5.msysgit.0
2.5.0

View File

@ -1,4 +1,4 @@
From c6e51ae8ffc31d0fc059d33ca159df31c2b7a83e Mon Sep 17 00:00:00 2001
From 1bb1629f460d9c8ababad25722bebd0fedf2b269 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
@ -43,5 +43,5 @@ index 24d4942..02943d6 100644
+
}
--
1.9.5.msysgit.0
2.5.0

View File

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

View File

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

View File

@ -0,0 +1,31 @@
From 409122f500f205b8a9b0fdec56900d83cee9f1ba Mon Sep 17 00:00:00 2001
From: md_5 <git@md-5.net>
Date: Mon, 15 Feb 2016 09:56:14 +1100
Subject: [PATCH] Update groupId
diff --git a/pom.xml b/pom.xml
index 91627ff..c1d1fb7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,7 +1,7 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
- <groupId>org.spigotmc</groupId>
+ <groupId>com.mineplex</groupId>
<artifactId>spigot</artifactId>
<packaging>jar</packaging>
<version>1.8.8-R0.1-SNAPSHOT</version>
@@ -34,7 +34,7 @@
<version>3.0.3</version>
</dependency>
<dependency>
- <groupId>org.spigotmc</groupId>
+ <groupId>com.mineplex</groupId>
<artifactId>spigot-api</artifactId>
<version>${project.version}</version>
<type>jar</type>
--
2.5.0

View File

@ -1,4 +1,4 @@
From b9014b76bbb262a39ce2d70cbe831ceb07acf68d Mon Sep 17 00:00:00 2001
From 687c7ed26e1733b8ed688243cd6df91c45db148a Mon Sep 17 00:00:00 2001
From: libraryaddict <libraryaddict115@yahoo.co.nz>
Date: Fri, 23 Oct 2015 21:14:50 +1300
Subject: [PATCH] Modify packets to public
@ -2033,5 +2033,5 @@ index 0000000..4c2705b
+}
\ No newline at end of file
--
1.9.5.msysgit.0
2.5.0

View File

@ -1,4 +1,4 @@
From 9f12f0f7abe2a94fe4a724a7c17245b9c0f33a70 Mon Sep 17 00:00:00 2001
From ca990c7ca61006f0933d0e117f1003822b887667 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
@ -677,7 +677,7 @@ index a8a327d..b7647bc 100644
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
index f643b29..f75b0b1 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 {
@ -699,7 +699,7 @@ index 3c852fd..b861dbe 100644
public EntityLiving(World world) {
super(world);
this.initAttributes();
@@ -1783,7 +1795,7 @@ public abstract class EntityLiving extends Entity {
@@ -1784,7 +1796,7 @@ public abstract class EntityLiving extends Entity {
}
public boolean ad() {
@ -800,5 +800,5 @@ index 5317cff..60e8584 100644
return Math.min(Math.max(0, getHandle().getHealth()), getMaxHealth());
}
--
1.9.5.msysgit.0
2.5.0

View File

@ -1,4 +1,4 @@
From 71c20f9d0c8bfa388f6bf0ba1a7b765a83e9de2a Mon Sep 17 00:00:00 2001
From c8c2e86ef3ac3baf774afacf5fe2fab0b39a39a6 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
@ -231,5 +231,5 @@ index 975d666..a55bd6c 100644
/*
* If it's a new world, the first few chunks are generated inside
--
1.9.5.msysgit.0
2.5.0

View File

@ -1,4 +1,4 @@
From 47c08a6099856faf0049c0b0cdde495a8ae4166e Mon Sep 17 00:00:00 2001
From 04418c14f74d251cebe99e4bc6315d619b0a4440 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
@ -349,5 +349,5 @@ index 5740e49..5edef3e 100644
public void a(PacketPlayInWindowClick packetplayinwindowclick) {
--
1.9.5.msysgit.0
2.5.0

View File

@ -0,0 +1,70 @@
From 413c649570b54e6d7a50da7aa888cfb20018f523 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/CraftInventoryCustom.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java
index e99b8cc..428836c 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java
@@ -32,7 +32,7 @@ public class CraftInventoryCustom extends CraftInventory {
super(new MinecraftInventory(owner, size, title));
}
- static class MinecraftInventory implements IInventory {
+ public static class MinecraftInventory implements IInventory {
private final ItemStack[] items;
private int maxStack = MAX_STACK;
private final List<HumanEntity> viewers;
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;
--
2.5.0

View File

@ -1,4 +1,4 @@
From 088fc9372c061edac80ee5cce669382ebed0b1e3 Mon Sep 17 00:00:00 2001
From 7772a2a9b83ee223c01ac2003ba32a1b95a7c0cd 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
@ -273,5 +273,5 @@ index 29082aa..e979f69 100644
}
--
1.9.5.msysgit.0
2.5.0

View File

@ -1,4 +1,4 @@
From 9aded83bc47bf6ba8076fc2ed03ebbe480df1296 Mon Sep 17 00:00:00 2001
From 969a70f201e6eda7d990e11e292e0dacc35f8ddf 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
@ -601,5 +601,5 @@ index 0000000..c14caf2
+ public PathfinderGoalRandomStroll goalRandomStroll;
+}
--
1.9.5.msysgit.0
2.5.0

View File

@ -1,4 +1,4 @@
From d3b44ea22080f4d15bf45b74b46b989b29f7b039 Mon Sep 17 00:00:00 2001
From a48503259a76ca5b9fec3bd7ec06e0e5c1d3f8e1 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
@ -39,5 +39,5 @@ index cb9ba53..8660762 100644
double d0 = entity.locX - this.locX;
double d1 = entity.locZ - this.locZ;
--
1.9.5.msysgit.0
2.5.0

View File

@ -1,4 +1,4 @@
From a793ae3653b54c211b2c40147e031449d3e1cf72 Mon Sep 17 00:00:00 2001
From bafc21b97584c9207f29804520942285752d6b53 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
@ -95,7 +95,7 @@ index b7647bc..c2ef000 100644
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
index f75b0b1..e384c2c 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 {
@ -135,5 +135,5 @@ index b861dbe..4de7e4c 100644
} else if (!this.bM()) {
this.motX *= 0.98D;
--
1.9.5.msysgit.0
2.5.0

View File

@ -1,4 +1,4 @@
From afb13529d05ad4adb0afa8cf8430e942d3e65e90 Mon Sep 17 00:00:00 2001
From 5e1591dec2adb9001c9c3aafd0908d95eadff484 Mon Sep 17 00:00:00 2001
From: libraryaddict <libraryaddict115@yahoo.co.nz>
Date: Sun, 8 Nov 2015 17:57:05 +1300
Subject: [PATCH] Modifications to cb
@ -104,7 +104,7 @@ index c2ef000..b7647bc 100644
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 4de7e4c..b861dbe 100644
index e384c2c..f75b0b1 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -113,18 +113,6 @@ public abstract class EntityLiving extends Entity {
@ -1614,5 +1614,5 @@ index 0000000..fdf0e10
+ }
+}
--
1.9.5.msysgit.0
2.5.0

View File

@ -1,4 +1,4 @@
From cddf775b575f0db92e478c858283869ac0b9bdc2 Mon Sep 17 00:00:00 2001
From d57744e41ed408a6f924665509bb03fac0590cfa 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
@ -115,5 +115,5 @@ index 0000000..1536600
+
+}
--
1.9.5.msysgit.0
2.5.0

View File

@ -1,4 +1,4 @@
From e81762b9aa4f28474b2ccd06ae6ad5b7c840e1ba Mon Sep 17 00:00:00 2001
From c6967f167cb74718389c7d87a0e4847d2824e855 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
@ -18,5 +18,5 @@ index 1536600..f86cf48 100644
public boolean apply(Object obj)
--
1.9.5.msysgit.0
2.5.0

View File

@ -1,4 +1,4 @@
From 5dac54f90504022449cbd5ea23e5306f17523fe2 Mon Sep 17 00:00:00 2001
From 9eb0754b8eaed3dd60355206dd53c6b4dacab361 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
@ -18,5 +18,5 @@ index f86cf48..b4d70ad 100644
public boolean apply(Object obj)
--
1.9.5.msysgit.0
2.5.0

View File

@ -1,4 +1,4 @@
From ea74383b4c0f5160f0d890d9377bd0d72e31db0c Mon Sep 17 00:00:00 2001
From d37159de8e6c19ed8e232666661572cc399dc82a 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
@ -60,5 +60,5 @@ index 60e8584..746961e 100644
public boolean isGhost()
--
1.9.5.msysgit.0
2.5.0

View File

@ -1,4 +1,4 @@
From 896df3218cf190a29901619e762b5399517dbfbd Mon Sep 17 00:00:00 2001
From c881d98fee52e719e60a5c8f5eeb9497357dd597 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
@ -33,5 +33,5 @@ index 1d29ae7..55e2afd 100644
SpigotTimings.processQueueTimer.startTiming(); // Spigot
while (!processQueue.isEmpty()) {
--
1.9.5.msysgit.0
2.5.0

View File

@ -1,37 +1,27 @@
From bc86c3b02f2efa4c1194fc908e8d1ee8723f62c5 Mon Sep 17 00:00:00 2001
From b0eb73047d9e8e06c2822142dc8c443efa9eda2e 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
index 81ca499..2a4f819 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 {
@@ -1591,7 +1591,11 @@ 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());
+ org.spigotmc.event.entity.EntityDismountEvent event = new org.spigotmc.event.entity.EntityDismountEvent( this.getBukkitEntity(), this.vehicle.getBukkitEntity() ); // Spigot
+ 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 {
@@ -1599,44 +1603,44 @@ public abstract class Entity implements ICommandListener {
this.vehicle = null;
} else {
// CraftBukkit start
@ -39,24 +29,25 @@ index 81ca499..7165579 100644
+ 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;
+ org.spigotmc.event.entity.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))
- pluginManager.callEvent(exitEvent);
+ if ((this.bukkitEntity instanceof LivingEntity) && (entity.getBukkitEntity() instanceof Vehicle)) {
+ exitEvent = new VehicleExitEvent((Vehicle) this.vehicle.getBukkitEntity(), (LivingEntity) this.bukkitEntity);
pluginManager.callEvent(exitEvent);
+ pluginManager.callEvent(exitEvent);
+
+ if (exitEvent.isCancelled() || this.vehicle != originalVehicle || (this.vehicle != null && this.vehicle.passenger != originalPassenger)) {
+ return;
+ }
+ }
+ exitEvent1 = new org.spigotmc.event.entity.EntityDismountEvent(this.vehicle.getBukkitEntity(), this.bukkitEntity);
+ pluginManager.callEvent(exitEvent1);
if (exitEvent.isCancelled() || this.vehicle != originalVehicle || (this.vehicle != null && this.vehicle.passenger != originalPassenger)) {
- if (exitEvent.isCancelled() || this.vehicle != originalVehicle || (this.vehicle != null && this.vehicle.passenger != originalPassenger)) {
+ if (exitEvent1.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);
@ -101,36 +92,25 @@ index 81ca499..7165579 100644
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
index f75b0b1..19fc521 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 {
@@ -1725,6 +1725,13 @@ public abstract class EntityLiving extends Entity {
return;
}
}
+
+ EntityDismountEvent event = new EntityDismountEvent(this.vehicle.getBukkitEntity(), (LivingEntity) this.bukkitEntity);
+ org.spigotmc.event.entity.EntityDismountEvent event = new org.spigotmc.event.entity.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);
}
org.bukkit.Bukkit.getPluginManager().callEvent( new org.spigotmc.event.entity.EntityDismountEvent( this.getBukkitEntity(), this.vehicle.getBukkitEntity() ) ); // Spigot
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
index efbf1a8..ad53590 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 @@
@ -141,19 +121,17 @@ index efbf1a8..dbc7b54 100644
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 {
@@ -233,6 +234,10 @@ 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()))
+ {
+ 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
2.5.0

View File

@ -1,11 +1,11 @@
From 3b4526267e3bd53d9e70578ec1c7a8cd13038e73 Mon Sep 17 00:00:00 2001
From 6514e2834135adf7d133d11bbcad9377544d73f0 Mon Sep 17 00:00:00 2001
From: libraryaddict <libraryaddict115@yahoo.co.nz>
Date: Fri, 27 Nov 2015 22:26:34 +1300
Subject: [PATCH] Server freezing, fix fake yaw/pitch
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 7165579..4f366da 100644
index 2a4f819..721d0e6 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -5,6 +5,7 @@ import java.util.List;
@ -16,7 +16,7 @@ index 7165579..4f366da 100644
// CraftBukkit start
import org.bukkit.Bukkit;
@@ -153,6 +154,12 @@ public abstract class Entity implements ICommandListener {
@@ -151,6 +152,12 @@ public abstract class Entity implements ICommandListener {
public void setFakeHead(boolean fakeHead)
{
_fakeHead = fakeHead;
@ -29,7 +29,7 @@ index 7165579..4f366da 100644
}
public boolean isSilent()
@@ -1024,9 +1031,18 @@ public abstract class Entity implements ICommandListener {
@@ -1022,9 +1029,18 @@ public abstract class Entity implements ICommandListener {
this.lastX = this.locX = d0;
this.lastY = this.locY = d1;
this.lastZ = this.locZ = d2;
@ -64,5 +64,5 @@ index 5edef3e..d3b1586 100644
} else {
WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension);
--
1.9.5.msysgit.0
2.5.0

View File

@ -0,0 +1,26 @@
From 22472882d2708e0eb4e35f0d31978b70d2c4b4f5 Mon Sep 17 00:00:00 2001
From: libraryaddict <libraryaddict115@yahoo.co.nz>
Date: Tue, 12 Jan 2016 19:56:07 +1300
Subject: [PATCH] Sound and vehicle fixes
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftSound.java b/src/main/java/org/bukkit/craftbukkit/CraftSound.java
index 0cc8f9b..dd07600 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftSound.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftSound.java
@@ -14,9 +14,9 @@ public class CraftSound {
set(AMBIENCE_RAIN, "ambient.weather.rain");
set(AMBIENCE_THUNDER, "ambient.weather.thunder");
// Damage
- set(HURT_FLESH, "game.neutral.hurt");
- set(FALL_BIG, "game.neutral.hurt.fall.big");
- set(FALL_SMALL, "game.neutral.hurt.fall.small");
+ set(HURT_FLESH, "game.player.hurt");
+ set(FALL_BIG, "game.player.hurt.fall.big");
+ set(FALL_SMALL, "game.player.hurt.fall.small");
// Dig Sounds
set(DIG_WOOL, "dig.cloth");
set(DIG_GRASS, "dig.grass");
--
2.5.0

View File

@ -1,4 +1,4 @@
From 3d0c2e6b1409ca0c42b7aafbffae4b517d7db48c Mon Sep 17 00:00:00 2001
From 1e687cfb7b343f9c2a2e3cfdef346a896be747bb Mon Sep 17 00:00:00 2001
From: libraryaddict <libraryaddict115@yahoo.co.nz>
Date: Fri, 29 Jan 2016 16:59:00 +1300
Subject: [PATCH] md_5's player interaction for specs patch
@ -27,5 +27,5 @@ index d3b1586..6fd49b3 100644
// Arm swing animation
PlayerAnimationEvent event = new PlayerAnimationEvent(this.getPlayer());
--
1.9.5.msysgit.0
2.5.0

View File

@ -1,4 +1,4 @@
From c0e8d43f419d7f489cd0ae348618f897e95b0402 Mon Sep 17 00:00:00 2001
From 125596ec9aee25d141781b4010eac881c7b36eb5 Mon Sep 17 00:00:00 2001
From: libraryaddict <libraryaddict115@yahoo.co.nz>
Date: Fri, 29 Jan 2016 16:59:12 +1300
Subject: [PATCH] Fix enderman teleporting when vegetated
@ -21,5 +21,5 @@ index a250062..5ad2d07 100644
double d4 = this.locY;
double d5 = this.locZ;
--
1.9.5.msysgit.0
2.5.0

View File

@ -0,0 +1,327 @@
From 742d6b5d828128519f06f7c6f5e188847263e609 Mon Sep 17 00:00:00 2001
From: md_5 <git@md-5.net>
Date: Sun, 7 Feb 2016 20:28:54 +1100
Subject: [PATCH] Implement Sentry for exception monitoring.
diff --git a/pom.xml b/pom.xml
index c1d1fb7..ceb3ec2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -29,6 +29,12 @@
<dependencies>
<dependency>
+ <groupId>net.kencochrane.raven</groupId>
+ <artifactId>raven-log4j2</artifactId>
+ <version>6.0.0</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
<groupId>net.sf.trove4j</groupId>
<artifactId>trove4j</artifactId>
<version>3.0.3</version>
@@ -202,6 +208,20 @@
<goal>shade</goal>
</goals>
<configuration>
+ <filters>
+ <filter>
+ <artifact>*:*</artifact>
+ <excludes>
+ <exclude>META-INF/org/apache/logging/log4j/core/config/plugins/</exclude>
+ </excludes>
+ </filter>
+ <filter>
+ <artifact>*:minecraft-server</artifact>
+ <excludes>
+ <exclude>org/apache/logging/log4j/</exclude>
+ </excludes>
+ </filter>
+ </filters>
<relocations>
<relocation>
<pattern>joptsimple</pattern>
diff --git a/src/main/java/org/apache/logging/log4j/core/appender/ConsoleAppender.java b/src/main/java/org/apache/logging/log4j/core/appender/ConsoleAppender.java
deleted file mode 100644
index 341eaa3..0000000
--- a/src/main/java/org/apache/logging/log4j/core/appender/ConsoleAppender.java
+++ /dev/null
@@ -1,245 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache license, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the license for the specific language governing permissions and
- * limitations under the license.
- */
-package org.apache.logging.log4j.core.appender;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.PrintStream;
-import java.io.Serializable;
-import java.io.UnsupportedEncodingException;
-import java.lang.reflect.Constructor;
-import java.nio.charset.Charset;
-
-import org.apache.logging.log4j.core.Filter;
-import org.apache.logging.log4j.core.Layout;
-import org.apache.logging.log4j.core.config.plugins.Plugin;
-import org.apache.logging.log4j.core.config.plugins.PluginAttribute;
-import org.apache.logging.log4j.core.config.plugins.PluginElement;
-import org.apache.logging.log4j.core.config.plugins.PluginFactory;
-import org.apache.logging.log4j.core.helpers.Booleans;
-import org.apache.logging.log4j.core.helpers.Loader;
-import org.apache.logging.log4j.core.layout.PatternLayout;
-import org.apache.logging.log4j.util.PropertiesUtil;
-
-/**
- * ConsoleAppender appends log events to <code>System.out</code> or
- * <code>System.err</code> using a layout specified by the user. The
- * default target is <code>System.out</code>.
- * @doubt accessing System.out or .err as a byte stream instead of a writer
- * bypasses the JVM's knowledge of the proper encoding. (RG) Encoding
- * is handled within the Layout. Typically, a Layout will generate a String
- * and then call getBytes which may use a configured encoding or the system
- * default. OTOH, a Writer cannot print byte streams.
- */
-@Plugin(name = "Console", category = "Core", elementType = "appender", printObject = true)
-public final class ConsoleAppender extends AbstractOutputStreamAppender {
-
- private static final String JANSI_CLASS = "org.fusesource.jansi.WindowsAnsiOutputStream";
- private static ConsoleManagerFactory factory = new ConsoleManagerFactory();
-
- /**
- * Enumeration of console destinations.
- */
- public enum Target {
- /** Standard output. */
- SYSTEM_OUT,
- /** Standard error output. */
- SYSTEM_ERR
- }
-
- private ConsoleAppender(final String name, final Layout<? extends Serializable> layout, final Filter filter,
- final OutputStreamManager manager,
- final boolean ignoreExceptions) {
- super(name, layout, filter, ignoreExceptions, true, manager);
- }
-
- /**
- * Create a Console Appender.
- * @param layout The layout to use (required).
- * @param filter The Filter or null.
- * @param t The target ("SYSTEM_OUT" or "SYSTEM_ERR"). The default is "SYSTEM_OUT".
- * @param follow If true will follow changes to the underlying output stream.
- * @param name The name of the Appender (required).
- * @param ignore If {@code "true"} (default) exceptions encountered when appending events are logged; otherwise
- * they are propagated to the caller.
- * @return The ConsoleAppender.
- */
- @PluginFactory
- public static ConsoleAppender createAppender(
- @PluginElement("Layout") Layout<? extends Serializable> layout,
- @PluginElement("Filters") final Filter filter,
- @PluginAttribute("target") final String t,
- @PluginAttribute("name") final String name,
- @PluginAttribute("follow") final String follow,
- @PluginAttribute("ignoreExceptions") final String ignore) {
- if (name == null) {
- LOGGER.error("No name provided for ConsoleAppender");
- return null;
- }
- if (layout == null) {
- layout = PatternLayout.createLayout(null, null, null, null, null);
- }
- final boolean isFollow = Boolean.parseBoolean(follow);
- final boolean ignoreExceptions = Booleans.parseBoolean(ignore, true);
- final Target target = t == null ? Target.SYSTEM_OUT : Target.valueOf(t);
- return new ConsoleAppender(name, layout, filter, getManager(isFollow, target, layout), ignoreExceptions);
- }
-
- private static OutputStreamManager getManager(final boolean follow, final Target target, final Layout<? extends Serializable> layout) {
- final String type = target.name();
- final OutputStream os = getOutputStream(follow, target);
- return OutputStreamManager.getManager(target.name() + "." + follow, new FactoryData(os, type, layout), factory);
- }
-
- private static OutputStream getOutputStream(final boolean follow, final Target target) {
- final String enc = Charset.defaultCharset().name();
- PrintStream printStream = null;
- try {
- printStream = target == Target.SYSTEM_OUT ?
- follow ? new PrintStream(new SystemOutStream(), true, enc) : System.out :
- follow ? new PrintStream(new SystemErrStream(), true, enc) : System.err;
- } catch (final UnsupportedEncodingException ex) { // should never happen
- throw new IllegalStateException("Unsupported default encoding " + enc, ex);
- }
- final PropertiesUtil propsUtil = PropertiesUtil.getProperties();
- if (!propsUtil.getStringProperty("os.name").startsWith("Windows") ||
- propsUtil.getBooleanProperty("log4j.skipJansi")) {
- return printStream;
- }
- try {
- final ClassLoader loader = Loader.getClassLoader();
- // We type the parameter as a wildcard to avoid a hard reference to Jansi.
- final Class<?> clazz = loader.loadClass(JANSI_CLASS);
- final Constructor<?> constructor = clazz.getConstructor(OutputStream.class);
- return (OutputStream) constructor.newInstance(printStream);
- } catch (final ClassNotFoundException cnfe) {
- LOGGER.debug("Jansi is not installed, cannot find {}", JANSI_CLASS);
- } catch (final NoSuchMethodException nsme) {
- LOGGER.warn("{} is missing the proper constructor", JANSI_CLASS);
- } catch (final Throwable ex) { // CraftBukkit - Exception -> Throwable
- LOGGER.warn("Unable to instantiate {}", JANSI_CLASS);
- }
- return printStream;
- }
-
- /**
- * An implementation of OutputStream that redirects to the current System.err.
- */
- private static class SystemErrStream extends OutputStream {
- public SystemErrStream() {
- }
-
- @Override
- public void close() {
- // do not close sys err!
- }
-
- @Override
- public void flush() {
- System.err.flush();
- }
-
- @Override
- public void write(final byte[] b) throws IOException {
- System.err.write(b);
- }
-
- @Override
- public void write(final byte[] b, final int off, final int len)
- throws IOException {
- System.err.write(b, off, len);
- }
-
- @Override
- public void write(final int b) {
- System.err.write(b);
- }
- }
-
- /**
- * An implementation of OutputStream that redirects to the current System.out.
- */
- private static class SystemOutStream extends OutputStream {
- public SystemOutStream() {
- }
-
- @Override
- public void close() {
- // do not close sys out!
- }
-
- @Override
- public void flush() {
- System.out.flush();
- }
-
- @Override
- public void write(final byte[] b) throws IOException {
- System.out.write(b);
- }
-
- @Override
- public void write(final byte[] b, final int off, final int len)
- throws IOException {
- System.out.write(b, off, len);
- }
-
- @Override
- public void write(final int b) throws IOException {
- System.out.write(b);
- }
- }
-
- /**
- * Data to pass to factory method.
- */
- private static class FactoryData {
- private final OutputStream os;
- private final String type;
- private final Layout<? extends Serializable> layout;
-
- /**
- * Constructor.
- * @param os The OutputStream.
- * @param type The name of the target.
- * @param layout A Serializable layout
- */
- public FactoryData(final OutputStream os, final String type, final Layout<? extends Serializable> layout) {
- this.os = os;
- this.type = type;
- this.layout = layout;
- }
- }
-
- /**
- * Factory to create the Appender.
- */
- private static class ConsoleManagerFactory implements ManagerFactory<OutputStreamManager, FactoryData> {
-
- /**
- * Create an OutputStreamManager.
- * @param name The name of the entity to manage.
- * @param data The data required to create the entity.
- * @return The OutputStreamManager
- */
- @Override
- public OutputStreamManager createManager(final String name, final FactoryData data) {
- return new OutputStreamManager(data.os, data.type, data.layout);
- }
- }
-
-}
diff --git a/src/main/resources/log4j2.xml b/src/main/resources/log4j2.xml
index f37d1c2..b9d8704 100644
--- a/src/main/resources/log4j2.xml
+++ b/src/main/resources/log4j2.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<Configuration status="WARN" packages="com.mojang.util">
+<Configuration status="WARN" packages="com.mojang.util,net.kencochrane.raven.log4j2">
<Appenders>
<Console name="WINDOWS_COMPAT" target="SYSTEM_OUT"></Console>
<Queue name="TerminalConsole">
@@ -12,6 +12,9 @@
<OnStartupTriggeringPolicy />
</Policies>
</RollingRandomAccessFile>
+ <Raven name="Sentry">
+ <dsn>https://9dbb188a495a4145998c3478534c7052:89fefe0909f34090a6a7ad9397a31bd7@app.getsentry.com/66319</dsn>
+ </Raven>
</Appenders>
<Loggers>
<Root level="info">
@@ -21,6 +24,7 @@
<AppenderRef ref="WINDOWS_COMPAT" level="info"/>
<AppenderRef ref="File"/>
<AppenderRef ref="TerminalConsole" level="info"/>
+ <AppenderRef ref="Sentry" level="error"/>
</Root>
</Loggers>
</Configuration>
--
2.5.0

View File

@ -1,428 +0,0 @@
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

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -1,47 +0,0 @@
From 2522a926e6cc670f4f10657ea5494b5ffe81eb37 Mon Sep 17 00:00:00 2001
From: libraryaddict <libraryaddict115@yahoo.co.nz>
Date: Tue, 12 Jan 2016 19:56:07 +1300
Subject: [PATCH] Sound and vehicle fixes
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 4f366da..fc9cce0 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -1628,11 +1628,13 @@ public abstract class Entity implements ICommandListener {
EntityDismountEvent exitEvent1 = null;
if (this.vehicle != null) {
if ((this.bukkitEntity instanceof LivingEntity) && (entity.getBukkitEntity() instanceof Vehicle))
+ {
exitEvent = new VehicleExitEvent((Vehicle) this.vehicle.getBukkitEntity(), (LivingEntity) this.bukkitEntity);
- pluginManager.callEvent(exitEvent);
+ pluginManager.callEvent(exitEvent);
- if (exitEvent.isCancelled() || this.vehicle != originalVehicle || (this.vehicle != null && this.vehicle.passenger != originalPassenger)) {
- return;
+ if (exitEvent.isCancelled() || this.vehicle != originalVehicle || (this.vehicle != null && this.vehicle.passenger != originalPassenger)) {
+ return;
+ }
}
exitEvent1 = new EntityDismountEvent(this.vehicle.getBukkitEntity(), this.bukkitEntity);
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftSound.java b/src/main/java/org/bukkit/craftbukkit/CraftSound.java
index 0cc8f9b..dd07600 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftSound.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftSound.java
@@ -14,9 +14,9 @@ public class CraftSound {
set(AMBIENCE_RAIN, "ambient.weather.rain");
set(AMBIENCE_THUNDER, "ambient.weather.thunder");
// Damage
- set(HURT_FLESH, "game.neutral.hurt");
- set(FALL_BIG, "game.neutral.hurt.fall.big");
- set(FALL_SMALL, "game.neutral.hurt.fall.small");
+ set(HURT_FLESH, "game.player.hurt");
+ set(FALL_BIG, "game.player.hurt.fall.big");
+ set(FALL_SMALL, "game.player.hurt.fall.small");
// Dig Sounds
set(DIG_WOOL, "dig.cloth");
set(DIG_GRASS, "dig.grass");
--
1.9.5.msysgit.0

View File

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

View File

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

View File

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

View File

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

View File

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>mineplex-parent</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>

View File

@ -1,2 +0,0 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8

View File

@ -1,4 +0,0 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1

View File

@ -1,20 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>

View File

@ -1,23 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>mineplex-bungee-mineplexer</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>

View File

@ -1,3 +0,0 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8
encoding/src=UTF-8

View File

@ -1,5 +0,0 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.8

View File

@ -1,4 +0,0 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1

View File

@ -28,6 +28,10 @@
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
</dependency>
<dependency>
<groupId>net.kencochrane.raven</groupId>
<artifactId>raven</artifactId>
</dependency>
<dependency>
<groupId>net.md-5</groupId>
<artifactId>bungeecord-proxy</artifactId>

View File

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

View File

@ -10,14 +10,13 @@ import java.util.UUID;
import mineplex.bungee.playerStats.data.IpInfo;
import mineplex.cache.player.PlayerInfo;
import mineplex.serverdata.database.DBPool;
import mineplex.serverdata.database.RepositoryBase;
public class PlayerStatsRepository
import javax.sql.DataSource;
public class PlayerStatsRepository extends RepositoryBase
{
private Connection _connection = null;
private String _connectionString = "jdbc:mysql://sqlstats.mineplex.com:3306/PlayerStats?autoReconnect=true&failOverReadOnly=false&maxReconnects=10&allowMultiQueries=true";
private String _userName = "root";
private String _password = "tAbechAk3wR7tuTh";
private static String INSERT_PLAYERINFO = "INSERT INTO playerInfo (uuid, name, version) VALUES (?, ?, ?);";
private static String SELECT_PLAYERINFO = "SELECT id, name, version FROM playerInfo WHERE uuid = ?;";
private static String UPDATE_PLAYERINFO = "UPDATE playerInfo SET name = ?, version = ? WHERE id = ?;";
@ -30,34 +29,33 @@ public class PlayerStatsRepository
+ "INSERT IGNORE INTO playerLoginSessions (playerInfoId, loginTime) values(?, now());";
private static String UPDATE_LOGINSESSION = "UPDATE playerLoginSessions SET timeInGame = TIME_TO_SEC(TIMEDIFF(now(), loginTime)) / 60 WHERE id = ?;";
public PlayerStatsRepository()
{
super(DBPool.getPlayerStats());
}
@Override
public void initialize()
{
try
{
if (_connection == null || _connection.isClosed())
_connection = DriverManager.getConnection(_connectionString, _userName, _password);
}
catch (Exception exception)
{
exception.printStackTrace();
}
System.out.println("Initialized PlayerStats.");
}
@Override
protected void update()
{
}
public PlayerInfo getPlayer(UUID uuid, String name, int version)
{
PlayerInfo playerInfo = null;
PreparedStatement preparedStatement = null;
ResultSet resultSet = null;
try
try(Connection connection = getConnection())
{
if (_connection == null || _connection.isClosed())
_connection = DriverManager.getConnection(_connectionString, _userName, _password);
preparedStatement = _connection.prepareStatement(SELECT_PLAYERINFO);
preparedStatement = connection.prepareStatement(SELECT_PLAYERINFO);
preparedStatement.setString(1, uuid.toString());
@ -73,7 +71,7 @@ public class PlayerStatsRepository
if (playerInfo == null)
{
preparedStatement = _connection.prepareStatement(INSERT_PLAYERINFO, Statement.RETURN_GENERATED_KEYS);
preparedStatement = connection.prepareStatement(INSERT_PLAYERINFO, Statement.RETURN_GENERATED_KEYS);
preparedStatement.setString(1, uuid.toString());
preparedStatement.setString(2, name);
preparedStatement.setInt(3, version);
@ -96,7 +94,7 @@ public class PlayerStatsRepository
}
else if (!playerInfo.getName().equalsIgnoreCase(name) || playerInfo.getVersion() != version)
{
preparedStatement = _connection.prepareStatement(UPDATE_PLAYERINFO);
preparedStatement = connection.prepareStatement(UPDATE_PLAYERINFO);
preparedStatement.setString(1, name);
preparedStatement.setInt(2, version);
preparedStatement.setInt(3, playerInfo.getId());
@ -145,12 +143,9 @@ public class PlayerStatsRepository
PreparedStatement preparedStatement = null;
ResultSet resultSet = null;
try
try(Connection connection = getConnection())
{
if (_connection == null || _connection.isClosed())
_connection = DriverManager.getConnection(_connectionString, _userName, _password);
preparedStatement = _connection.prepareStatement(SELECT_IPINFO);
preparedStatement = connection.prepareStatement(SELECT_IPINFO);
preparedStatement.setString(1, ipAddress);
resultSet = preparedStatement.executeQuery();
@ -167,7 +162,7 @@ public class PlayerStatsRepository
if (ipInfo == null)
{
preparedStatement = _connection.prepareStatement(INSERT_IPINFO, Statement.RETURN_GENERATED_KEYS);
preparedStatement = connection.prepareStatement(INSERT_IPINFO, Statement.RETURN_GENERATED_KEYS);
preparedStatement.setString(1, ipAddress);
preparedStatement.executeUpdate();
@ -228,12 +223,9 @@ public class PlayerStatsRepository
Statement statement = null;
ResultSet resultSet= null;
try
try(Connection connection = getConnection())
{
if (_connection == null || _connection.isClosed())
_connection = DriverManager.getConnection(_connectionString, _userName, _password);
statement = _connection.createStatement();
statement = connection.createStatement();
String queryString = UPDATE_PLAYERSTATS;
queryString = queryString.replaceFirst("\\?", playerId + "");
@ -286,12 +278,9 @@ public class PlayerStatsRepository
{
PreparedStatement preparedStatement = null;
try
try(Connection connection = getConnection())
{
if (_connection == null || _connection.isClosed())
_connection = DriverManager.getConnection(_connectionString, _userName, _password);
preparedStatement = _connection.prepareStatement(UPDATE_LOGINSESSION);
preparedStatement = connection.prepareStatement(UPDATE_LOGINSESSION);
preparedStatement.setInt(1, loginSessionId);
preparedStatement.executeUpdate();

View File

@ -1,20 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>

View File

@ -1,23 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>mineplex-bungeerotator</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>

View File

@ -1,3 +0,0 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8
encoding/src=UTF-8

View File

@ -1,5 +0,0 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.8

View File

@ -1,4 +0,0 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1

View File

@ -1,50 +1,43 @@
package mineplex.bungee;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import mineplex.serverdata.database.DBPool;
import mineplex.serverdata.database.RepositoryBase;
import java.sql.*;
import java.util.ArrayList;
import java.util.List;
public class PlayerStatsRepository
public class PlayerStatsRepository extends RepositoryBase
{
private Connection _connection = null;
private String _connectionString = "jdbc:mysql://sqlstats.mineplex.com:3306/PlayerStats?autoReconnect=true&failOverReadOnly=false&maxReconnects=10&allowMultiQueries=true";
private String _userName = "root";
private String _password = "tAbechAk3wR7tuTh";
private static String SELECT_IPINFO = "SELECT id, ipAddress FROM ipInfo WHERE regionName IS NULL LIMIT 1000;";
private static String UPDATE_IPINFO = "UPDATE ipInfo SET countryCode = ?, countryName = ?, regionCode = ?, regionName = ?, city = ?, zipCode = ?, timeZone = ?, latitude = ?, longitude = ?, metroCode = ? WHERE id = ?;";
public void initialize()
public PlayerStatsRepository()
{
try
{
if (_connection == null || _connection.isClosed())
_connection = DriverManager.getConnection(_connectionString, _userName, _password);
}
catch (Exception exception)
{
exception.printStackTrace();
}
System.out.println("Initialized PlayerStats.");
super(DBPool.getPlayerStats());
}
@Override
protected void initialize()
{
}
@Override
protected void update()
{
}
public List<IpInfo> getIpAddresses()
{
List<IpInfo> ipinfos = new ArrayList<IpInfo>(1000);
PreparedStatement preparedStatement = null;
ResultSet resultSet = null;
try
try(Connection connection = getConnection())
{
if (_connection == null || _connection.isClosed())
_connection = DriverManager.getConnection(_connectionString, _userName, _password);
preparedStatement = _connection.prepareStatement(SELECT_IPINFO);
preparedStatement = connection.prepareStatement(SELECT_IPINFO);
resultSet = preparedStatement.executeQuery();
@ -98,12 +91,9 @@ public class PlayerStatsRepository
{
PreparedStatement preparedStatement = null;
try
try(Connection connection = getConnection())
{
if (_connection == null || _connection.isClosed())
_connection = DriverManager.getConnection(_connectionString, _userName, _password);
preparedStatement = _connection.prepareStatement(UPDATE_IPINFO);
preparedStatement = connection.prepareStatement(UPDATE_IPINFO);
for (IpInfo ipInfo : ips)
{

View File

@ -1,20 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>

View File

@ -1,23 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>mineplex-cache</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>

View File

@ -1,3 +0,0 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8
encoding/src=UTF-8

View File

@ -1,5 +0,0 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.8

View File

@ -1,4 +0,0 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1

View File

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

View File

@ -1,20 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>

View File

@ -1,23 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>mineplex-core-common</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>

View File

@ -1,3 +0,0 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8
encoding/src=UTF-8

View File

@ -1,5 +0,0 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.8

View File

@ -1,4 +0,0 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1

View File

@ -28,6 +28,10 @@ public class SkinData
public final static SkinData PRESENT = new SkinData("eyJ0aW1lc3RhbXAiOjE0NTAwMTk3MDIxNjIsInByb2ZpbGVJZCI6ImE5ZDBjMDcyYmYxOTQwYTFhMTkzNjhkMDlkNTAwMjZlIiwicHJvZmlsZU5hbWUiOiJTcGlyaXR1c1NhbmN0dXMiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlL2U2YzRkZWQwNTdjMjhiMTU0NjVkYzQzNmFmODIyYTNkZTY4NzgyZTZjMzgyOGMzMmFhYWE4ZjRiOTIzOWVjIn19fQ==","rJNlxTqHHmOoWwbXdMQLcj0P9w/PIr/hWKXH0nbhm/S2CFo/zfefffZlnQmpKCgn1Y8tXvcRwLGQ4CLpm9m2ZrKprSWRhrnOtZWYabrhExQESEammS3TY81VoNt+4On0pAGBippz/bRfWLuDne2rDbhuljnqvxjROmxpky7gRCU06VMlm2WLFC5XYJkiAaOXBqzpiHMMRPNnCvtcbtpILKi/Luj302eyN8nRKjHHbbiDmttwvlshxZ8UxJHvALtM506IUHba10Q6QX2zCeDAU5/WYRKa6e19r8plROcgGbKYFSq8JW5cWuWT3/rveZM6FnU6ABn9DWsCyfQ5wr2jdBd+xaevGTAScRHA5J493GqL1bBZYKj9yhQFtxJHCAf0++raAVPCZgyPtwTth4TAQisn8gnhM5R+txnW6xK+oflLy0dwEN1YdPLN/h7yuDnyjSMDe9RZT2NKMjok2C6Kux4WBI0KFXKC5Gqwa3Htku4v3WEOWMaVoWOtchQ9BzpQ/etD0ylmzjALQLB+HtndEEm1Jd3tmob42X4hBE8hCce7C3EtGINB33dlx4CK1xBqyGTJEqi69DJRzVL99u98+7kJ1Db9+MaPOfI4B2RY3XbvnSYwecandY//A3bb19FGSdl299ZXbp4zpm8fivzeB1rUAhhmtaA3Iwu/nEQNMkU=");
public final static SkinData RUDOLPH = new SkinData("eyJ0aW1lc3RhbXAiOjE0NTAwMTk1NjgxODIsInByb2ZpbGVJZCI6ImE5ZDBjMDcyYmYxOTQwYTFhMTkzNjhkMDlkNTAwMjZlIiwicHJvZmlsZU5hbWUiOiJTcGlyaXR1c1NhbmN0dXMiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlL2IzZjdlMjhiNTJkZjJjZjhlZWM2NDk2ZmM0NWFlMGQ2NTM0Njc5OGIxYWRjNzM3ZDcxYzBmOTRlNDIyMSJ9fX0=","uUBOTe63CL+qRvtsb2g4AjB2YzxE3N6AUqIsTv8n0jYyPsuXpuOmZPSMEdgDVONywEJ1L4XRx05sjnGu56A8vuXmGI/uHQWuMZzbOSjiFfT3DkEm8zEl5AWpH9dz/t8nZ1WYUIwy0pN5VrZqIr1DAkF6AMh/Qy+FGDw1GG9ReRr80eJ0JiRskpkCpCZIGGjrgwNKAM8JOuNZ4gCQOTRC3etrcfls3qmUMFcVlhuB4bydxSR01i2w0A4b5KpufsJjLKw4InWn2+m/druo8hl9sYuusTeItW0MQmZqCAqXCc9YBnRPQ0hDXFgnPxOh3RwGWiZvL4MnWUVmLwZWh/Fk9QmyVbd7zVao0lxS8YNsKtP8j5B+hs4l9qNohhf0A07bt4oPeTtd5fQeOU5N87fUGuUAcpC4gP9U5WpVY5FFPBvLvGbXdV5jpuAQz4lLSoo1grsP9baR2IBvdN/0awjQWoPJfGOttegubkBHwz3LNcVqvZLtX/M13IDHZa6zQZEX0wsnMX60LeWgBWfTON1l2cSgaPTerHFS2EifJ2LvTBife3s9/4XR6Zth3FLFqxI3MSlqT2hVFRPLke6rBqfqPoWOj2MCykQ70IAwb3oTHcJDJ86V2DdNaU2bZ8V4TjaP+nRobsLJOImoPYEPq23MP36X8gbXEIjmuu8S5xRlrrc=");
public final static SkinData THE_GRINCH = new SkinData("eyJ0aW1lc3RhbXAiOjE0NTAwMTYxNDMwMDQsInByb2ZpbGVJZCI6ImE5ZDBjMDcyYmYxOTQwYTFhMTkzNjhkMDlkNTAwMjZlIiwicHJvZmlsZU5hbWUiOiJTcGlyaXR1c1NhbmN0dXMiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzg4ZWRlOTI3ZDQzOWVmMzliMzFhYzFkYzJhODM5NGZlNzlhY2U4NDMyNzBjYmUxMjg2ZGM3NTE3ZjMxYTk2In19fQ==","ELo594vTzPq9ZmPYOtVr4kim/k19gzmoxEIK1ehS87gwgag5HcgM+P1FMnHIyrmSvTVaMh0NxwXmNS+JETFL7OrmgRYNpkxkkO4VBA0pfSn3dA9ujnXpDnDiWEPxKdMgQspIOOI0Z3esNt3pj8qIj6dWPtGwtso48tjHl2o/kazfa82yvGORlFhGkeEJKQMno/Buc12C0foQw39XI8GjvlSkFN2eH4Fp16RLu8/hf7SqJQC3L1KacvzMW1d8BWEIgACCJDni29+YqxflSqSyYrV4Z+D66S0jYvUUL/vM4/q/p/YWX/vs/FtMtHQTj4PCpAmMNTgfkahuhb6rCvKHukbjA+WhUdwyxSqXU5YnpXCu1M2dzZgiXjIi+fnyn4CmXKindWCQtSwu+mCA2ILv/6vEHoYJgdlz+DXyRkFx+DH4Sl74HBCOXTOq5AGjq5h3LYfsre+UjCCUv8VgxbVprOyj35So7K0m+6faCFVSt35T3RgicDQfdiWUrW7kmHQVvJpvaq9Vu+63F/0X93cwqwaR0buMirxRx7qkFrRunSI4T+9fsN02t1fAieeu80lBSv83wr7BFneSsLsdVAND9xttTb6fClg7anr8/XVEVIkylB4B+ZcWQbH61XP1nn7oFP2VBg1h6XuuLp8FGSgYf/LW+54/KZci/MnanqQE6QQ=");
public final static SkinData TEDDY_BEAR = new SkinData("eyJ0aW1lc3RhbXAiOjE0NTUxMDkzOTE4MjYsInByb2ZpbGVJZCI6ImE5ZDBjMDcyYmYxOTQwYTFhMTkzNjhkMDlkNTAwMjZlIiwicHJvZmlsZU5hbWUiOiJTcGlyaXR1c1NhbmN0dXMiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzQ0OTU4ZDdjNjlhZTQ4NGM2NWYzMTM0N2NkY2M5MmM2OWY1NDA2ODA1YjUzNjUyYTc1YThlZDc5OWRmNyJ9fX0=", "sNTRV9jTjLszUmyaqyEG7N8d5RM1jbwMSXi34S2EkVmIjWsowfSMnHRQqqgZfxcyqBM5I7MljtB84IeQWu4rqhyFrM9blWvtowjijFIOgKCs97q2sswv9iauU6ohvgTpgN5B0Q16MJmMIgZU8d8TATtEaIzq2eg6Ve1AJlNnW4huGNsoNfm8WdVU1tZmsYAwtVP/ryvhyj7mHyVF27m0Sm4fZRf/lHH5gEJYB4JHSAoEhjPIQOdkgRMJRrWGOfhhiGs3kEWmsRGfIPFo2ZJfcu+TFV2rd4Q+A1LmY8kimnzdKX3InXeKbk8qzcgqGNro4XFnSiHo1d6/B+N0JeYOTITYRQ6u24rNSUh5ezbG01iikVFCfrgb7UR6utoLK15F4/fmhpex+BJpmyZoXAqk08tZws/5wsIWQ1okrGcbBKWEHhw2ekUc82US21/W53vd657UBg7FuqM4FhkAqmsYPvYLMpNYxxmDJaI8uJyU7cnGFYyBaFlqUxfJUfcFTwWo10JO3yp5FjqeCQa7rFvfpsqw3w2mBpJmlZ5HRjfS5pmhk0QiY0TRfwZfFemkuZYnNbO82qLUm+6zTm0fbC90Swt8nNr/42ajzEoUjnL6VsERIXS5/fPwjftbQAC60ujy8yo66Sp3sSAALNg5zjM+Uizkq2f9Axc+kind22hp10M=");
public final static SkinData COMPANION_CUBE = new SkinData("eyJ0aW1lc3RhbXAiOjE0NTUxMDk5NjI0NjEsInByb2ZpbGVJZCI6ImE5ZDBjMDcyYmYxOTQwYTFhMTkzNjhkMDlkNTAwMjZlIiwicHJvZmlsZU5hbWUiOiJTcGlyaXR1c1NhbmN0dXMiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlL2MyMTVkYmRhNTY1ZjVjYjhlYjEyZjU1NWY1ZTNkYTBlYTVmNTUxOTg5MWNjNWM1ZDY3NmZkODJjNjIifX19", "vaAQbhnhnTOs64ToFWLg7o4JmqkIl07HWJ6l7xibfISaOcU4BvYBxsfGvmoxlVdsUeCunAJ8/05qVLl5zZYd8Dt+To6JSY0RlqV8piRaaj3FztYWV2ZvG3YZxPxiD3HRJTAQnDobSuxHyPa1e3khjAFp9xJo4q1oqQ28oI2WDuoT+IHqxwkKVbGzO7UD5lzz5chjQC46E8SxddNKp9aqwbbccrkHYT4gteoonOXu4MFxZniJN12LqUCb6+G15rU8MijlBkWx0xE5NMUloeTGuJZItbHun9fysLk/+HE5xJOKYtpZNMuWX+DB/O5ds9dXrOoSAg+Vn0QU4CZbwcxzLii5ILOfEEBtePuEAgzROri+iCKp59CqlEMBrCsd3Um0MCdbuOfvkXGBHBz+bqX7VJY1ujlSdMefmbJtHAkDANnsaaVb+eli9Dk6139041sptsLytD+EfJzaitX6crBwKZ2WDx2P6LHo8B+iSOzOJxjf/08zlXqFw1vsk62IN6lisuZ89QyZw23RvOx3obLAGYs1GxAlMl9qQdpXcmuE1+lPR3g8gZ0BfnTeYwflC2wbR1tuwGG98lyUGCvGLyqNKAQTN87XV4IFQWR81mi1c5CcasoWhKf9D9nAik9aK7A915fEE5IvpeuUdZseDxDVVN5dBIs5q2PIHFAS0rDsDBc=");
public final static SkinData LOVESTRUCK = new SkinData("eyJ0aW1lc3RhbXAiOjE0NTUxMTAyNDMyNjUsInByb2ZpbGVJZCI6ImE5ZDBjMDcyYmYxOTQwYTFhMTkzNjhkMDlkNTAwMjZlIiwicHJvZmlsZU5hbWUiOiJTcGlyaXR1c1NhbmN0dXMiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzczMTY5YWQwZTUyYjM1N2NiZGYxZDU0NGVkNGNmOWJmOTI4YmI0ZWNlMDhlY2YyY2M0YmYyYTlmMjJhODI4MmQifX19", "LL4RiSKQoTZamRQ4QG6izpvhgFu5gAqW4eZxcWAihk7GkhyxifpJpBTOzKrj5hH9fCUfYkkijVWUYTEcVSVRWhocp2HXW59TbKfxOeMvHU5vTMwgpwm6PnUfwuTsRPSLC7WMnEreI3cjOxPVmXbTniOSd+o8j4oOIgwFS+VLPiYLh5Jl16i5I/9ekafl3/x41NISKWl62geqO2jPWehlk+r3soiRJsxaKw20T61GSNLu19iA96Rz2T2tUHB4opm8hbLgoiNL2g1affTjq3cZPLHH4JWF3vPhqLB5uw6xb55vFLM/PP0YiEMIi7YZOfRGeaPp7uXbXgHeew+7PG9UDVMfqbwANQY4ndECijZoei54+xX3MDXkMhQsc5S+FLnGH6e4d008v81eEOyzJUPkKbGxLCBgTUb1s4IHwomCr30twPlo1IuFBOY1qeVvZUfAfPJsREuj5q/oCAoYFgupmb3ClWECnwwaH/T4wdHjfSBHoZQdLzcgDOAl0b5EXxWmYBECqk/WA4TrYIDVGdwkqjI0RkPLUoxTj6135KO+F7P7PwhU9WBGeW8hHq918DBL0fjQVHjrzvolTqwmw6nySSePnPOxFX/iwtHWzpBa9V6kUNNN+V7OGTgRr0H/yUxB+oq1F8UBqyqT4YpqxXCSD36derF/Xt5IdpTbEbGBpm0=");
public final static SkinData SECRET_PACKAGE = new SkinData("eyJ0aW1lc3RhbXAiOjE0NTUxMTAzNzE3OTIsInByb2ZpbGVJZCI6ImE5ZDBjMDcyYmYxOTQwYTFhMTkzNjhkMDlkNTAwMjZlIiwicHJvZmlsZU5hbWUiOiJTcGlyaXR1c1NhbmN0dXMiLCJzaWduYXR1cmVSZXF1aXJlZCI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlL2QyNWI5YTRjOWRhOThkZTliZmIwZDNjOWI1M2MzMjJhMjgxN2IyMTMxOTQzY2E1YWM2NTBjZThmMzEzZjdhIn19fQ==", "Wb5T0Zhp1RVt78V/i8dYrwZCNT0xZIRe3LvL0bngH498f8Jrl43KHgTi4f299zE9giVynkTogGhJ8inq/xqFCRctl7Nn9L3LVu78uQwt+fs+o+kw/Qc+lggFSjEIc+fc13AZndpec0Df46Kh/OGD7NXbtbLb6TE/0dU2RwQlvZrZ/QHYJb8OJ6aUcnHvAZim8NUtG/nlZtSClepHVSuKdNnfzoF9rFVFA/x4jTr6mZYPZ33YgQd2oTAPk+qE3iN+0InjZQNs2YLoKFmFrgzn+tGvNApC0siF0HEZGQCFIwJOtnBsasGoxujIrln/ZdOil+5ac4VWInXr8lKgY0Q3Ocy8/0cJl+E/XqB+ztG29zhB8B1zdHBfJr+MgeSIqBCPx4SCtY6r7gnMlQYG+uVx5NP3S5aJW/cEfDyXmpCykIcBPzeErnKC0SiAqXkCVNjWJpX6qRWvWMXqS69w6ht6qHvEY2GxlZUb5AP+JgFlsl3hJDms6EPvM4zNL0Ko4oWIBzwYRQXiemrP9TGgyo0aL1RcQ0JgBFO2hSo37PK0YL3tUPgteJXzm21wu0TiZLkLCWSgMUfYfvVnhTa+xzod0xvfujpN6Y1DUTdcf8WS8TRYw2JigSkWrRW0fXPBCtTtQN5jiwM5/HrTpNLzg03J6SpfZ+rr8Rhq0S/8beQOMas=");
private Property _skinProperty;

View File

@ -274,6 +274,25 @@ public class UtilAlg
return vec;
}
public static Entity findClosest(Entity mid, ArrayList<Entity> locs)
{
Entity bestLoc = null;
double bestDist = 0;
for (Entity loc : locs)
{
double dist = UtilMath.offset(mid, loc);
if (bestLoc == null || dist < bestDist)
{
bestLoc = loc;
bestDist = dist;
}
}
return bestLoc;
}
public static Location findClosest(Location mid, ArrayList<Location> locs)
{

View File

@ -171,6 +171,7 @@ public class UtilBlock
blockPassSet.add((byte) Material.STAINED_GLASS_PANE.getId());
blockPassSet.add((byte) Material.IRON_TRAPDOOR.getId());
blockPassSet.add((byte) Material.DAYLIGHT_DETECTOR_INVERTED.getId());
blockPassSet.add((byte) Material.BARRIER.getId());
blockPassSet.add((byte) Material.BIRCH_FENCE_GATE.getId());
blockPassSet.add((byte) Material.JUNGLE_FENCE_GATE.getId());
@ -1418,6 +1419,11 @@ public class UtilBlock
case ANVIL:
itemStack.setDurability((short) (itemStack.getDurability() / 4));
break;
case QUARTZ_BLOCK:
if (itemStack.getDurability() == 4 || itemStack.getDurability() == 3)
itemStack.setDurability((short) 2);
break;
}
return itemStacks;

View File

@ -634,10 +634,7 @@ public class UtilEnt
//Fences/Walls
Material beneath = player.getLocation().add(x, -1.5, z).getBlock().getType();
if (player.getLocation().getY() % 0.5 == 0 &&
(beneath == Material.FENCE ||
beneath == Material.FENCE_GATE ||
beneath == Material.NETHER_FENCE ||
beneath == Material.COBBLE_WALL))
(beneath.toString().contains("FENCE") || beneath == Material.COBBLE_WALL))
return true;
}
}

View File

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

View File

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

View File

@ -1,20 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>

View File

@ -1,23 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>mineplex-core</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>

View File

@ -1,3 +0,0 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8
encoding/src=UTF-8

View File

@ -1,5 +0,0 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.8

View File

@ -1,4 +0,0 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1

View File

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

View File

@ -10,6 +10,7 @@ import java.util.LinkedList;
import java.util.List;
import java.util.UUID;
import mineplex.core.database.MinecraftRepository;
import org.bukkit.Bukkit;
import com.google.gson.reflect.TypeToken;
import org.bukkit.plugin.java.JavaPlugin;
@ -21,16 +22,16 @@ import mineplex.core.account.repository.token.RankUpdateToken;
import mineplex.core.common.Rank;
import mineplex.core.common.util.Callback;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.database.DBPool;
import mineplex.core.database.DatabaseRunnable;
import mineplex.core.database.RepositoryBase;
import mineplex.core.database.ResultSetCallable;
import mineplex.core.database.column.ColumnBoolean;
import mineplex.core.database.column.ColumnTimestamp;
import mineplex.core.database.column.ColumnVarChar;
import mineplex.serverdata.database.DBPool;
import mineplex.serverdata.database.DatabaseRunnable;
import mineplex.serverdata.database.RepositoryBase;
import mineplex.serverdata.database.ResultSetCallable;
import mineplex.serverdata.database.column.ColumnBoolean;
import mineplex.serverdata.database.column.ColumnTimestamp;
import mineplex.serverdata.database.column.ColumnVarChar;
import mineplex.core.server.remotecall.JsonWebCall;
public class AccountRepository extends RepositoryBase
public class AccountRepository extends MinecraftRepository
{
private static String CREATE_ACCOUNT_TABLE = "CREATE TABLE IF NOT EXISTS accounts (id INT NOT NULL AUTO_INCREMENT, uuid VARCHAR(100), name VARCHAR(40), gems INT, rank VARCHAR(40), rankPerm BOOL, rankExpire LONG, lastLogin LONG, totalPlayTime LONG, PRIMARY KEY (id), UNIQUE INDEX uuidIndex (uuid), UNIQUE INDEX nameIndex (name), INDEX rankIndex (rank));";
private static String ACCOUNT_LOGIN_NEW = "INSERT INTO accounts (uuid, name, lastLogin) values(?, ?, now());";
@ -234,7 +235,7 @@ public class AccountRepository extends RepositoryBase
executeUpdate(UPDATE_ACCOUNT_RANK, new ColumnVarChar("rank", 100, rank.toString()), new ColumnVarChar("uuid", 100, uuid.toString()));
}
Bukkit.getServer().getScheduler().runTask(Plugin, new Runnable()
Bukkit.getServer().getScheduler().runTask(getPlugin(), new Runnable()
{
@Override
public void run()

View File

@ -29,7 +29,21 @@ public enum Achievement
"during Christmas 2015!"},
new int[]{200},
AchievementCategory.HOLIDAY),
GLOBAL_GIFT_GIVER_2016("2016 Gift Giver", 0,
new String[]{"Global.Valentines2016.GiftsGiven"},
new String[]{"Give 3 Valentines Gifts",
"during Valentines 2016!"},
new int[]{3},
AchievementCategory.HOLIDAY),
GLOBAL_GIFT_GETTER_2016("2016 People Love Me", 2000,
new String[]{"Global.Valentines2016.GiftsReceived"},
new String[]{"Receive 10 Gifts",
"during Valentines 2016!"},
new int[]{10},
AchievementCategory.HOLIDAY),
//Bridges
BRIDGES_WINS("Bridge Champion", 600,
new String[]{"The Bridges.Wins"},

View File

@ -199,7 +199,7 @@ public class AchievementManager extends MiniPlugin
level = Math.max(level, 50 + get(sender, Achievement.GLOBAL_GEM_HUNTER).getLevel());
if (sender.getName().equalsIgnoreCase("Phinary"))
level = -level;
level = 0;
return level;
}

View File

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

View File

@ -4,7 +4,7 @@ import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import mineplex.core.database.DBPool;
import mineplex.serverdata.database.DBPool;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.entity.Player;
@ -33,7 +33,7 @@ public class AntiHackRepository
{
PreparedStatement preparedStatement = null;
try (Connection connection = DBPool.getStats().getConnection())
try (Connection connection = DBPool.getMineplexStats().getConnection())
{
preparedStatement = connection.prepareStatement(UPDATE_PLAYER_OFFENSES);

View File

@ -3,14 +3,15 @@ package mineplex.core.benefit;
import java.sql.ResultSet;
import java.sql.SQLException;
import mineplex.core.database.DBPool;
import mineplex.core.database.RepositoryBase;
import mineplex.core.database.column.ColumnInt;
import mineplex.core.database.column.ColumnVarChar;
import mineplex.core.database.MinecraftRepository;
import mineplex.serverdata.database.DBPool;
import mineplex.serverdata.database.RepositoryBase;
import mineplex.serverdata.database.column.ColumnInt;
import mineplex.serverdata.database.column.ColumnVarChar;
import org.bukkit.plugin.java.JavaPlugin;
public class BenefitManagerRepository extends RepositoryBase
public class BenefitManagerRepository extends MinecraftRepository
{
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));";

View File

@ -7,8 +7,6 @@ import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Queue;
import java.util.TimeZone;
@ -17,7 +15,6 @@ import mineplex.core.MiniClientPlugin;
import mineplex.core.account.CoreClient;
import mineplex.core.account.CoreClientManager;
import mineplex.core.account.ILoginProcessor;
import mineplex.core.account.IQuerylessLoginProcessor;
import mineplex.core.account.event.ClientUnloadEvent;
import mineplex.core.bonuses.redis.VoteHandler;
import mineplex.core.bonuses.redis.VotifierCommand;
@ -30,10 +27,10 @@ import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.database.DBPool;
import mineplex.serverdata.database.DBPool;
import mineplex.core.donation.DonationManager;
import mineplex.core.donation.GiveDonorData;
import mineplex.core.facebook.FacebookManager;
import mineplex.core.giveaway.GiveawayManager;
import mineplex.core.hologram.Hologram;
import mineplex.core.hologram.HologramManager;
import mineplex.core.inventory.InventoryManager;
@ -59,7 +56,6 @@ import mineplex.core.bonuses.gui.SpinGui;
import mineplex.core.poll.PollManager;
import mineplex.serverdata.commands.ServerCommandManager;
import org.jooq.DSLContext;
import org.jooq.SQLDialect;
import org.jooq.impl.DSL;
import org.bukkit.Bukkit;
@ -68,13 +64,15 @@ import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.event.player.PlayerInteractAtEntityEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.plugin.java.JavaPlugin;
import net.minecraft.server.v1_8_R3.DataWatcher;
import net.minecraft.server.v1_8_R3.EntityCreeper;
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityMetadata;
public class BonusManager extends MiniClientPlugin<BonusClientData> implements ILoginProcessor
@ -170,7 +168,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
updateOffSet();
}
public BonusManager(JavaPlugin plugin, CoreClientManager clientManager, ServerStatusManager statusManager, DonationManager donationManager, PollManager pollManager, NpcManager npcManager, HologramManager hologramManager, StatsManager statsManager, InventoryManager inventoryManager, PetManager petManager, GiveawayManager giveawayManager, FacebookManager facebookManager)
public BonusManager(JavaPlugin plugin, CoreClientManager clientManager, ServerStatusManager statusManager, DonationManager donationManager, PollManager pollManager, NpcManager npcManager, HologramManager hologramManager, StatsManager statsManager, InventoryManager inventoryManager, PetManager petManager, FacebookManager facebookManager)
{
super("Bonus", plugin);
_repository = new BonusRepository(plugin, this, donationManager);
@ -180,7 +178,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
_hologramManager = hologramManager;
_inventoryManager = inventoryManager;
_rewardManager = new RewardManager(clientManager, statusManager, donationManager, inventoryManager, petManager, statsManager, giveawayManager,
_rewardManager = new RewardManager(clientManager, statusManager, donationManager, inventoryManager, petManager, statsManager,
100, 250,
500, 1000,
4000, 6000,
@ -411,7 +409,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
if (!_enabled)
return;
((CraftEntity)_carlNpc.getEntity()).getHandle().getDataWatcher().watch(16, (byte) -1);
((CraftEntity)_carlNpc.getEntity()).getHandle().getDataWatcher().watch(16, (byte) -1, EntityCreeper.META_FUSE_STATE, -1);
}
public void IncreaseSize(Entity player)
@ -419,7 +417,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
if (!_enabled)
return;
((CraftEntity)_carlNpc.getEntity()).getHandle().getDataWatcher().watch(16, (byte) 1);
((CraftEntity)_carlNpc.getEntity()).getHandle().getDataWatcher().watch(16, (byte) 1, EntityCreeper.META_FUSE_STATE, 1);
}
// DAILY BONUS
@ -755,7 +753,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
if (gems > 0)
{
UtilPlayer.message(player, F.main("Carl", "Rewarded " + F.elem(gems + " Gems")));
_gemQueue.add(new GiveDonorData(player.getName(), coreClient.getAccountId(), player.getUniqueId(), gems));
_gemQueue.add(new GiveDonorData(null, player.getName(), "Treasure", player.getUniqueId(), coreClient.getAccountId(), gems));
}
if (gold > 0)
@ -780,7 +778,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
if (coins > 0)
{
UtilPlayer.message(player, F.main("Carl", "Rewarded " + F.elem(coins + " Treasure Shards")));
_coinQueue.add(new GiveDonorData(player.getName(), coreClient.getAccountId(), player.getUniqueId(), coins));
_coinQueue.add(new GiveDonorData(null, player.getName(), "Treasure", player.getUniqueId(), coreClient.getAccountId(), coins));
}
if (tickets > 0)
@ -821,8 +819,8 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
}
}
@EventHandler
public void openGui(PlayerInteractEntityEvent event)
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void openGui(PlayerInteractAtEntityEvent event)
{
if (!_enabled)
return;
@ -851,7 +849,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
}
}
}
public static long getNextVoteTime(long time) {
Calendar calendar = Calendar.getInstance();
@ -942,9 +940,9 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
{
// Charged
DataWatcher watcher = new DataWatcher(null);
watcher.a(0, (byte) 0);
watcher.a(1, (short) 300);
watcher.a(17, (byte) 1);
watcher.a(0, (byte) 0, EntityCreeper.META_ENTITYDATA, (byte) 0);
watcher.a(1, (short) 300, EntityCreeper.META_AIR, 0);
watcher.a(17, (byte) 1, EntityCreeper.META_POWERED, true);
PacketPlayOutEntityMetadata packet = new PacketPlayOutEntityMetadata();
packet.a = _carlNpc.getEntity().getEntityId();
packet.b = watcher.c();
@ -961,7 +959,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
{
// Charged
DataWatcher watcher = new DataWatcher(null);
watcher.a(17, (byte) 0);
watcher.a(17, (byte) 0, EntityCreeper.META_POWERED, false);
PacketPlayOutEntityMetadata packet = new PacketPlayOutEntityMetadata();
packet.a = _carlNpc.getEntity().getEntityId();
packet.b = watcher.c();

View File

@ -10,9 +10,10 @@ import java.sql.Types;
import mineplex.core.common.Pair;
import mineplex.core.common.util.Callback;
import mineplex.core.database.DBPool;
import mineplex.core.database.RepositoryBase;
import mineplex.core.database.ResultSetCallable;
import mineplex.core.database.MinecraftRepository;
import mineplex.serverdata.database.DBPool;
import mineplex.serverdata.database.RepositoryBase;
import mineplex.serverdata.database.ResultSetCallable;
import mineplex.core.donation.DonationManager;
import mineplex.core.recharge.Recharge;
import mineplex.database.Tables;
@ -28,7 +29,7 @@ import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.java.JavaPlugin;
public class BonusRepository extends RepositoryBase
public class BonusRepository extends MinecraftRepository
{
private static String CREATE_BONUS_TABLE = "CREATE TABLE IF NOT EXISTS bonus (accountId INT NOT NULL AUTO_INCREMENT, dailytime TIMESTAMP NULL DEFAULT NULL, ranktime DATE NULL DEFAULT NULL, PRIMARY KEY (accountId), FOREIGN KEY (accountId) REFERENCES accounts(id));";
private BonusManager _manager;

View File

@ -1,50 +0,0 @@
package mineplex.core.bonuses;
import java.util.UUID;
public class GiveDonorData
{
private String _playerName;
private int _accountId;
private UUID _uuid;
private int _giveAmount;
private int _attempts;
public GiveDonorData(String playerName, int accountId, UUID uuid, int giveAmount)
{
_playerName = playerName;
_accountId = accountId;
_uuid = uuid;
_giveAmount = giveAmount;
}
public String getPlayerName()
{
return _playerName;
}
public int getAccountId()
{
return _accountId;
}
public UUID getUuid()
{
return _uuid;
}
public int getGiveAmount()
{
return _giveAmount;
}
public int getAttempts()
{
return _attempts;
}
public void incrementAttempts()
{
_attempts++;
}
}

View File

@ -4,16 +4,17 @@ import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import mineplex.core.database.MinecraftRepository;
import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.database.DBPool;
import mineplex.core.database.RepositoryBase;
import mineplex.serverdata.database.DBPool;
import mineplex.serverdata.database.RepositoryBase;
import mineplex.core.botspam.SpamText;
import mineplex.core.database.ResultSetCallable;
import mineplex.core.database.column.ColumnInt;
import mineplex.core.database.column.ColumnVarChar;
import mineplex.serverdata.database.ResultSetCallable;
import mineplex.serverdata.database.column.ColumnInt;
import mineplex.serverdata.database.column.ColumnVarChar;
public class BotSpamRepository extends RepositoryBase
public class BotSpamRepository extends MinecraftRepository
{
private static final String GET_SPAM_TEXT = "SELECT * FROM botSpam";
private static final String ADD_SPAM_TEXT = "INSERT INTO botSpam (text, createdBy, enabledBy) VALUES (?, ?, ?)";

View File

@ -55,7 +55,7 @@ public class Chat extends MiniPlugin
private AchievementManager _achievements;
private String[] _hackusations = {"hack", "hax", "hacker", "hacking", "cheat", "cheater", "cheating", "forcefield", "flyhack", "flyhacking", "autoclick", "aimbot"};
private String _filterUrl = "https://10.33.53.5:8003/content/item/moderate";
private String _filterUrl = "https://chat.mineplex.com:8003/content/item/moderate";
private String _appId = "34018d65-466d-4a91-8e92-29ca49f022c4";
private String _apiKey = "oUywMpwZcIzZO5AWnfDx";
private String _serverName;
@ -243,7 +243,10 @@ public class Chat extends MiniPlugin
event.setMessage(getFilteredMessage(event.getPlayer(), event.getMessage()));
}
}
/**
* This should only be called from an async thread!
*/
public String getFilteredMessage(Player player, String originalMessage)
{
final String playerName = player.getUniqueId().toString();
@ -273,7 +276,7 @@ public class Chat extends MiniPlugin
*/
String filteredMsg = "";
filteredMsg = ((JSONObject) JSONValue.parse(response)).get("content").toString();
if (filteredMsg.contains("parts"))
{

View File

@ -4,7 +4,6 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
@ -57,8 +56,8 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
slot++;
if (slot == 26)
slot = 28;
if (slot == 26 || slot == 35)
slot += 2;
}
addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), new IButton()
@ -86,16 +85,16 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
if (gadget.getSet() != null)
{
itemLore.add(C.cBlack);
itemLore.add(C.cWhite + gadget.getSet().getName() + " Set;");
itemLore.add(C.cWhite + gadget.getSet().getName() + " Set");
//Elements
for (Gadget cur : gadget.getSet().getGadgets())
itemLore.add(" "+ (cur.ownsGadget(getPlayer()) ? C.cDGreen + '▪' : C.cDRed + '▪' ) + (cur.IsActive(getPlayer()) ? C.cGreen : C.cGray) + cur.GetName());
itemLore.add(" "+ (cur.ownsGadget(getPlayer()) ? C.cDGreen : C.cDRed) + "" + (cur.IsActive(getPlayer()) ? C.cGreen : C.cGray) + cur.GetName());
itemLore.add(C.cBlack);
//Bonus
itemLore.add(C.cWhite + gadget.getSet().getName() + " Set Bonus;");
itemLore.add(C.cWhite + gadget.getSet().getName() + " Set Bonus");
for (String bonus : gadget.getSet().getBonus())
itemLore.add(" " + (gadget.getSet().isActive(getPlayer()) ? C.cGreen : C.cGray) + bonus);
}
@ -127,6 +126,17 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Easter Holiday Treasure");
}
else if (gadget.GetCost(CurrencyType.Coins) == -6)
{
itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Valentines Gifts");
}
else if (gadget.GetCost(CurrencyType.Coins) == -7)
{
itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Purchased from shop.mineplex.com");
}
//Rank Unlocks
else if (gadget.GetCost(CurrencyType.Coins) == -10)
{
@ -180,11 +190,11 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
itemLore.add(C.cBlack);
itemLore.add(C.cGreen + "Left-Click to Enable");
addButton(slot, new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false), new ActivateGadgetButton(gadget, this));
addButton(slot, new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false).hideInfo(), new ActivateGadgetButton(gadget, this));
}
else
{
addButton(slot, new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false), new ActivateGadgetButton(gadget, this));
addButton(slot, new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false).hideInfo(), new ActivateGadgetButton(gadget, this));
}
return;
@ -206,7 +216,7 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
im.setLore(itemLore);
item.setItemMeta(im);
addButton(slot, new ShopItem(item, false, false), new DeactivateGadgetButton(gadget, this));
addButton(slot, new ShopItem(item, false, false).hideInfo(), new DeactivateGadgetButton(gadget, this));
}
else
{
@ -215,7 +225,7 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
im.setLore(itemLore);
item.setItemMeta(im);
addButton(slot, new ShopItem(item, false, false), new ActivateGadgetButton(gadget, this));
addButton(slot, new ShopItem(item, false, false).hideInfo(), new ActivateGadgetButton(gadget, this));
}
}
else
@ -231,18 +241,18 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
itemLore.add(C.cBlack);
itemLore.add(C.cGreen + "Click to Purchase");
addButton(slot, new ShopItem(Material.INK_SACK, (byte) 8, gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false), new GadgetButton(gadget, this));
addButton(slot, new ShopItem(Material.INK_SACK, (byte) 8, gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false).hideInfo(), new GadgetButton(gadget, this));
}
else if (gadget.GetCost(CurrencyType.Coins) > 0)
{
itemLore.add(C.cBlack);
itemLore.add(C.cRed + "Not enough Treasure Shards.");
setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false));
setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false).hideInfo());
}
else
{
setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false));
setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false).hideInfo());
}
}
@ -257,14 +267,14 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
itemLore.add(C.cBlack);
itemLore.add(C.cGreen + "Click to Disable");
addButton(slot, new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false), new DeactivateGadgetButton(gadget, this));
addButton(slot, new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false).hideInfo(), new DeactivateGadgetButton(gadget, this));
}
else
{
itemLore.add(C.cBlack);
itemLore.add(C.cGreen + "Click to Enable");
addButton(slot, new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false), new ActivateGadgetButton(gadget, this));
addButton(slot, new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false).hideInfo(), new ActivateGadgetButton(gadget, this));
}
}
else
@ -280,18 +290,18 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
itemLore.add(C.cBlack);
itemLore.add(C.cGreen + "Click to Purchase");
addButton(slot, new ShopItem(Material.INK_SACK, (byte) 8, gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false), new GadgetButton(gadget, this));
addButton(slot, new ShopItem(Material.INK_SACK, (byte) 8, gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false).hideInfo(), new GadgetButton(gadget, this));
}
else if (gadget.GetCost(CurrencyType.Coins) > 0)
{
itemLore.add(C.cBlack);
itemLore.add(C.cRed + "Not enough Treasure Shards.");
setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false));
setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false).hideInfo());
}
else
{
setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false));
setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false).hideInfo());
}
}
}

View File

@ -87,6 +87,11 @@ public class MountPage extends ShopPageBase<CosmeticManager, CosmeticShop>
itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Easter Holiday Treasure");
}
else if (mount.GetCost(CurrencyType.Coins) == -6)
{
itemLore.add(C.cBlack);
itemLore.add(C.cBlue + "Found in Valentines Holiday Treasure");
}
//Rank Unlocks
else if (mount.GetCost(CurrencyType.Coins) == -10)
{
@ -110,7 +115,6 @@ public class MountPage extends ShopPageBase<CosmeticManager, CosmeticShop>
}
}
if (getDonationManager().Get(getPlayer().getName()).OwnsUnknownPackage(mount.GetName()))
{
if (mount.GetActive().containsKey(getPlayer()))
@ -141,18 +145,18 @@ public class MountPage extends ShopPageBase<CosmeticManager, CosmeticShop>
itemLore.add(C.cBlack);
itemLore.add(C.cGreen + "Click to Purchase");
addButton(slot, new ShopItem(mount.GetDisplayMaterial(), mount.GetDisplayData(), mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false), new MountButton(mount, this));
addButton(slot, new ShopItem(Material.INK_SACK, (byte) 7, mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false), new MountButton(mount, this));
}
else if (mount.GetCost(CurrencyType.Coins) > 0)
{
itemLore.add(C.cBlack);
itemLore.add(C.cRed + "Not enough Treasure Shards.");
setItem(slot, new ShopItem(mount.GetDisplayMaterial(), mount.GetDisplayData(), mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false));
setItem(slot, new ShopItem(Material.INK_SACK, (byte) 7, mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false));
}
else
{
setItem(slot, new ShopItem(mount.GetDisplayMaterial(), mount.GetDisplayData(), mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false));
setItem(slot, new ShopItem(Material.INK_SACK, (byte) 7, mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false));
}
}

View File

@ -5,24 +5,24 @@ import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Map;
import org.bukkit.entity.Player;
import mineplex.core.database.MinecraftRepository;
import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.account.CoreClientManager;
import mineplex.core.customdata.CustomData;
import mineplex.core.customdata.CustomDataManager;
import mineplex.core.customdata.PlayerCustomData;
import mineplex.core.database.DBPool;
import mineplex.core.database.RepositoryBase;
import mineplex.core.database.ResultSetCallable;
import mineplex.core.database.column.ColumnInt;
import mineplex.core.database.column.ColumnVarChar;
import mineplex.serverdata.database.DBPool;
import mineplex.serverdata.database.RepositoryBase;
import mineplex.serverdata.database.ResultSetCallable;
import mineplex.serverdata.database.column.ColumnInt;
import mineplex.serverdata.database.column.ColumnVarChar;
/**
* Created by William (WilliamTiger).
* 16/12/15
*/
public class CustomDataRepository extends RepositoryBase
public class CustomDataRepository extends MinecraftRepository
{
private static final String SELECT_KEYS = "SELECT id, name FROM customData;";
private static final String INSERT_KEY = "INSERT INTO customData (name) VALUES (?);";

View File

@ -0,0 +1,112 @@
package mineplex.core.database;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Iterator;
import javax.sql.DataSource;
import mineplex.core.common.util.NautHashMap;
import mineplex.serverdata.database.DBPool;
import mineplex.serverdata.database.DatabaseRunnable;
import mineplex.serverdata.database.RepositoryBase;
import mineplex.serverdata.database.column.Column;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import org.jooq.DSLContext;
import org.jooq.SQLDialect;
import org.jooq.impl.DSL;
import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.plugin.java.JavaPlugin;
public abstract class MinecraftRepository extends RepositoryBase implements Listener
{
// Queue for failed processes
private static Object _queueLock = new Object();
private NautHashMap<DatabaseRunnable, String> _failedQueue = new NautHashMap<DatabaseRunnable, String>();
protected JavaPlugin _plugin; // Plugin responsible for this repository
/**
* Constructor
* @param plugin - the {@link JavaPlugin} module responsible for this repository.
* @param dataSource - the {@link DataSource} responsible for providing the connection pool to this repository.
*/
public MinecraftRepository(JavaPlugin plugin, DataSource dataSource)
{
super(dataSource);
_plugin = plugin;
plugin.getServer().getPluginManager().registerEvents(this, plugin);
}
protected DSLContext jooq()
{
return DSL.using(DBPool.getAccount(), SQLDialect.MYSQL);
}
protected void handleDatabaseCall(final DatabaseRunnable databaseRunnable, final String errorMessage)
{
Thread asyncThread = new Thread(new Runnable()
{
public void run()
{
try
{
databaseRunnable.run();
}
catch (Exception exception)
{
processFailedDatabaseCall(databaseRunnable, exception.getMessage(), errorMessage);
}
}
});
asyncThread.start();
}
protected void processFailedDatabaseCall(DatabaseRunnable databaseRunnable, String errorPreMessage, String runnableMessage)
{
if (databaseRunnable.getFailedCounts() < 4)
{
databaseRunnable.incrementFailCount();
synchronized (_queueLock)
{
_failedQueue.put(databaseRunnable, runnableMessage);
}
}
}
@EventHandler
public void processDatabaseQueue(UpdateEvent event)
{
if (event.getType() != UpdateType.MIN_01)
return;
processFailedQueue();
}
private void processFailedQueue()
{
synchronized (_queueLock)
{
for (Iterator<DatabaseRunnable> runnablesIterator = _failedQueue.keySet().iterator(); runnablesIterator.hasNext();)
{
DatabaseRunnable databaseRunnable = runnablesIterator.next();
handleDatabaseCall(databaseRunnable, _failedQueue.get(databaseRunnable));
}
}
}
public JavaPlugin getPlugin()
{
return _plugin;
}
}

View File

@ -1,9 +0,0 @@
package mineplex.core.database;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.database.column.Column;
public class Row
{
public NautHashMap<String, Column<?>> Columns = new NautHashMap<String, Column<?>>();
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

Some files were not shown because too many files have changed in this diff Show More