Merge branch 'master' into thanos-mineware

This commit is contained in:
Thanos paravantis 2016-03-02 18:47:30 +02:00
commit 9a4f4dbd7c
210 changed files with 5696 additions and 1910 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> From: libraryaddict <libraryaddict115@yahoo.co.nz>
Date: Fri, 23 Oct 2015 21:23:18 +1300 Date: Fri, 23 Oct 2015 21:23:18 +1300
Subject: [PATCH] LivingEntity changes Subject: [PATCH] LivingEntity changes
@ -30,5 +30,5 @@ index 48e2508..fb623ae 100644
+ public void setGhost(boolean ghost); + 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> From: libraryaddict <libraryaddict115@yahoo.co.nz>
Date: Sun, 22 Nov 2015 14:37:11 +1300 Date: Sun, 22 Nov 2015 14:37:11 +1300
Subject: [PATCH] EntityDismountEvent Subject: [PATCH] EntityDismountEvent
@ -43,5 +43,5 @@ index 24d4942..02943d6 100644
+ +
} }
-- --
1.9.5.msysgit.0 2.5.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> From: libraryaddict <libraryaddict115@yahoo.co.nz>
Date: Fri, 23 Oct 2015 21:14:50 +1300 Date: Fri, 23 Oct 2015 21:14:50 +1300
Subject: [PATCH] Modify packets to public Subject: [PATCH] Modify packets to public
@ -2033,5 +2033,5 @@ index 0000000..4c2705b
+} +}
\ No newline at end of file \ 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> From: libraryaddict <libraryaddict115@yahoo.co.nz>
Date: Fri, 23 Oct 2015 21:16:07 +1300 Date: Fri, 23 Oct 2015 21:16:07 +1300
Subject: [PATCH] Modifiy entity Subject: [PATCH] Modifiy entity
@ -677,7 +677,7 @@ index a8a327d..b7647bc 100644
this.bp = null; this.bp = null;
if (!this.world.isClientSide && flag1) { 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 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 --- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/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 { @@ -101,6 +101,18 @@ public abstract class EntityLiving extends Entity {
@ -699,7 +699,7 @@ index 3c852fd..b861dbe 100644
public EntityLiving(World world) { public EntityLiving(World world) {
super(world); super(world);
this.initAttributes(); 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() { public boolean ad() {
@ -800,5 +800,5 @@ index 5317cff..60e8584 100644
return Math.min(Math.max(0, getHandle().getHealth()), getMaxHealth()); 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> From: libraryaddict <libraryaddict115@yahoo.co.nz>
Date: Fri, 23 Oct 2015 21:21:32 +1300 Date: Fri, 23 Oct 2015 21:21:32 +1300
Subject: [PATCH] Chunk changes 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 * 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> From: libraryaddict <libraryaddict115@yahoo.co.nz>
Date: Fri, 23 Oct 2015 21:22:05 +1300 Date: Fri, 23 Oct 2015 21:22:05 +1300
Subject: [PATCH] Packet listener changes Subject: [PATCH] Packet listener changes
@ -349,5 +349,5 @@ index 5740e49..5edef3e 100644
public void a(PacketPlayInWindowClick packetplayinwindowclick) { 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> From: libraryaddict <libraryaddict115@yahoo.co.nz>
Date: Fri, 23 Oct 2015 21:23:00 +1300 Date: Fri, 23 Oct 2015 21:23:00 +1300
Subject: [PATCH] Misc changes 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> From: libraryaddict <libraryaddict115@yahoo.co.nz>
Date: Wed, 28 Oct 2015 09:00:24 +1300 Date: Wed, 28 Oct 2015 09:00:24 +1300
Subject: [PATCH] EntityGuardian is now vegetateable Subject: [PATCH] EntityGuardian is now vegetateable
@ -601,5 +601,5 @@ index 0000000..c14caf2
+ public PathfinderGoalRandomStroll goalRandomStroll; + 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> From: libraryaddict <libraryaddict115@yahoo.co.nz>
Date: Fri, 30 Oct 2015 20:02:58 +1300 Date: Fri, 30 Oct 2015 20:02:58 +1300
Subject: [PATCH] Controller look vegetateHead, Entity collide changes Subject: [PATCH] Controller look vegetateHead, Entity collide changes
@ -39,5 +39,5 @@ index cb9ba53..8660762 100644
double d0 = entity.locX - this.locX; double d0 = entity.locX - this.locX;
double d1 = entity.locZ - this.locZ; 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> From: libraryaddict <libraryaddict115@yahoo.co.nz>
Date: Tue, 3 Nov 2015 21:21:02 +1300 Date: Tue, 3 Nov 2015 21:21:02 +1300
Subject: [PATCH] Vegetate head ai Subject: [PATCH] Vegetate head ai
@ -95,7 +95,7 @@ index b7647bc..c2ef000 100644
this.yaw = this.b(this.yaw, f2, f); 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 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 --- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/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 { @@ -113,6 +113,18 @@ public abstract class EntityLiving extends Entity {
@ -135,5 +135,5 @@ index b861dbe..4de7e4c 100644
} else if (!this.bM()) { } else if (!this.bM()) {
this.motX *= 0.98D; 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> From: libraryaddict <libraryaddict115@yahoo.co.nz>
Date: Sun, 8 Nov 2015 17:57:05 +1300 Date: Sun, 8 Nov 2015 17:57:05 +1300
Subject: [PATCH] Modifications to cb Subject: [PATCH] Modifications to cb
@ -104,7 +104,7 @@ index c2ef000..b7647bc 100644
this.yaw = this.b(this.yaw, f2, f); 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 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 --- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/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 { @@ -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> From: libraryaddict <libraryaddict115@yahoo.co.nz>
Date: Mon, 9 Nov 2015 00:07:26 +1300 Date: Mon, 9 Nov 2015 00:07:26 +1300
Subject: [PATCH] Add IEntitySelector, have isGhost() return the same as 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> From: libraryaddict <libraryaddict115@yahoo.co.nz>
Date: Mon, 9 Nov 2015 00:13:21 +1300 Date: Mon, 9 Nov 2015 00:13:21 +1300
Subject: [PATCH] Add player spectator Subject: [PATCH] Add player spectator
@ -18,5 +18,5 @@ index 1536600..f86cf48 100644
public boolean apply(Object obj) 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> From: libraryaddict <libraryaddict115@yahoo.co.nz>
Date: Mon, 9 Nov 2015 02:41:31 +1300 Date: Mon, 9 Nov 2015 02:41:31 +1300
Subject: [PATCH] Fixed ai typo Subject: [PATCH] Fixed ai typo
@ -18,5 +18,5 @@ index f86cf48..b4d70ad 100644
public boolean apply(Object obj) 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> From: libraryaddict <libraryaddict115@yahoo.co.nz>
Date: Wed, 11 Nov 2015 00:21:54 +1300 Date: Wed, 11 Nov 2015 00:21:54 +1300
Subject: [PATCH] Fix casting bug Subject: [PATCH] Fix casting bug
@ -60,5 +60,5 @@ index 60e8584..746961e 100644
public boolean isGhost() 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> From: libraryaddict <libraryaddict115@yahoo.co.nz>
Date: Wed, 11 Nov 2015 11:43:17 +1300 Date: Wed, 11 Nov 2015 11:43:17 +1300
Subject: [PATCH] Fix schedulers Subject: [PATCH] Fix schedulers
@ -33,5 +33,5 @@ index 1d29ae7..55e2afd 100644
SpigotTimings.processQueueTimer.startTiming(); // Spigot SpigotTimings.processQueueTimer.startTiming(); // Spigot
while (!processQueue.isEmpty()) { 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> From: libraryaddict <libraryaddict115@yahoo.co.nz>
Date: Sun, 22 Nov 2015 14:41:11 +1300 Date: Sun, 22 Nov 2015 14:41:11 +1300
Subject: [PATCH] EntityDismountEvent & teleport crash fix 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 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 --- a/src/main/java/net/minecraft/server/Entity.java
+++ b/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; @@ -1591,7 +1591,11 @@ public abstract class Entity implements ICommandListener {
import org.bukkit.event.vehicle.VehicleBlockCollisionEvent;
import org.bukkit.event.vehicle.VehicleEnterEvent;
import org.bukkit.event.vehicle.VehicleExitEvent;
+import org.spigotmc.event.entity.EntityDismountEvent;
+import org.spigotmc.event.entity.EntityMountEvent;
import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.craftbukkit.entity.CraftEntity;
import org.bukkit.craftbukkit.entity.CraftPlayer;
@@ -1591,7 +1593,12 @@ public abstract class Entity implements ICommandListener {
} }
} }
// CraftBukkit end // CraftBukkit end
- pluginManager.callEvent( new org.spigotmc.event.entity.EntityDismountEvent( this.getBukkitEntity(), this.vehicle.getBukkitEntity() ) ); // Spigot - 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 + pluginManager.callEvent(event); // Spigot
+
+ if (event.isCancelled() || vehicle != originalVehicle) { + if (event.isCancelled() || vehicle != originalVehicle) {
+ return; + return;
+ } // Spigot + }
this.setPositionRotation(this.vehicle.locX, this.vehicle.getBoundingBox().b + (double) this.vehicle.length, this.vehicle.locZ, this.yaw, this.pitch); this.setPositionRotation(this.vehicle.locX, this.vehicle.getBoundingBox().b + (double) this.vehicle.length, this.vehicle.locZ, this.yaw, this.pitch);
this.vehicle.passenger = null; this.vehicle.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; this.vehicle = null;
} else { } else {
// CraftBukkit start // CraftBukkit start
@ -39,24 +29,25 @@ index 81ca499..7165579 100644
+ if (entity.world.isChunkLoaded((int) entity.locX >> 4, (int) entity.locZ >> 4, true)) { + if (entity.world.isChunkLoaded((int) entity.locX >> 4, (int) entity.locZ >> 4, true)) {
// It's possible to move from one vehicle to another. We need to check if they're already in a vehicle, and fire an exit event if they are. // 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; VehicleExitEvent exitEvent = null;
+ EntityDismountEvent exitEvent1 = null; + org.spigotmc.event.entity.EntityDismountEvent exitEvent1 = null;
if (this.vehicle != null) { if (this.vehicle != null) {
- exitEvent = new VehicleExitEvent((Vehicle) this.vehicle.getBukkitEntity(), (LivingEntity) this.bukkitEntity); - 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); + 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 EntityDismountEvent(this.vehicle.getBukkitEntity(), this.bukkitEntity); + if (exitEvent.isCancelled() || this.vehicle != originalVehicle || (this.vehicle != null && this.vehicle.passenger != originalPassenger)) {
+
+ pluginManager.callEvent(exitEvent1);
+
+ if (exitEvent1.isCancelled() || this.vehicle != originalVehicle || (this.vehicle != null && this.vehicle.passenger != originalPassenger)) {
+ return; + 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 (exitEvent1.isCancelled() || this.vehicle != originalVehicle || (this.vehicle != null && this.vehicle.passenger != originalPassenger)) {
return;
}
} }
- VehicleEnterEvent event = new VehicleEnterEvent((Vehicle) entity.getBukkitEntity(), this.bukkitEntity); - VehicleEnterEvent event = new VehicleEnterEvent((Vehicle) entity.getBukkitEntity(), this.bukkitEntity);
@ -101,36 +92,25 @@ index 81ca499..7165579 100644
if (this.vehicle != null) { if (this.vehicle != null) {
this.vehicle.passenger = 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 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 --- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/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; @@ -1725,6 +1725,13 @@ public abstract class EntityLiving extends Entity {
import org.bukkit.event.entity.EntityDamageEvent.DamageModifier;
import org.bukkit.event.entity.EntityRegainHealthEvent;
import org.bukkit.event.vehicle.VehicleExitEvent;
+import org.spigotmc.event.entity.EntityDismountEvent;
// CraftBukkit end
import org.bukkit.craftbukkit.SpigotTimings; // Spigot
@@ -1725,8 +1726,15 @@ public abstract class EntityLiving extends Entity {
return; 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); + getBukkitEntity().getServer().getPluginManager().callEvent(event);
+ +
+ if (event.isCancelled() || vehicle != originalVehicle) { + if (event.isCancelled() || vehicle != originalVehicle) {
+ return; + return;
+ } + }
// CraftBukkit end // CraftBukkit end
- org.bukkit.Bukkit.getPluginManager().callEvent( new org.spigotmc.event.entity.EntityDismountEvent( this.getBukkitEntity(), this.vehicle.getBukkitEntity() ) ); // Spigot
+
if (!this.world.isClientSide) {
this.q(this.vehicle);
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java 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 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -1,6 +1,7 @@ @@ -1,6 +1,7 @@
@ -141,19 +121,17 @@ index efbf1a8..dbc7b54 100644
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.List; 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. // If this entity is riding another entity, we must dismount before teleporting.
entity.mount(null); 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(); + Thread.dumpStack();
+ return false; + return false;
+ } + }
+
// Spigot start // Spigot start
if (!location.getWorld().equals(getWorld())) { 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> From: libraryaddict <libraryaddict115@yahoo.co.nz>
Date: Fri, 27 Nov 2015 22:26:34 +1300 Date: Fri, 27 Nov 2015 22:26:34 +1300
Subject: [PATCH] Server freezing, fix fake yaw/pitch 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 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 --- a/src/main/java/net/minecraft/server/Entity.java
+++ b/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; @@ -5,6 +5,7 @@ import java.util.List;
@ -16,7 +16,7 @@ index 7165579..4f366da 100644
// CraftBukkit start // CraftBukkit start
import org.bukkit.Bukkit; 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) public void setFakeHead(boolean fakeHead)
{ {
_fakeHead = fakeHead; _fakeHead = fakeHead;
@ -29,7 +29,7 @@ index 7165579..4f366da 100644
} }
public boolean isSilent() 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.lastX = this.locX = d0;
this.lastY = this.locY = d1; this.lastY = this.locY = d1;
this.lastZ = this.locZ = d2; this.lastZ = this.locZ = d2;
@ -64,5 +64,5 @@ index 5edef3e..d3b1586 100644
} else { } else {
WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); 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> From: libraryaddict <libraryaddict115@yahoo.co.nz>
Date: Fri, 29 Jan 2016 16:59:00 +1300 Date: Fri, 29 Jan 2016 16:59:00 +1300
Subject: [PATCH] md_5's player interaction for specs patch Subject: [PATCH] md_5's player interaction for specs patch
@ -27,5 +27,5 @@ index d3b1586..6fd49b3 100644
// Arm swing animation // Arm swing animation
PlayerAnimationEvent event = new PlayerAnimationEvent(this.getPlayer()); 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> From: libraryaddict <libraryaddict115@yahoo.co.nz>
Date: Fri, 29 Jan 2016 16:59:12 +1300 Date: Fri, 29 Jan 2016 16:59:12 +1300
Subject: [PATCH] Fix enderman teleporting when vegetated Subject: [PATCH] Fix enderman teleporting when vegetated
@ -21,5 +21,5 @@ index a250062..5ad2d07 100644
double d4 = this.locY; double d4 = this.locY;
double d5 = this.locZ; 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

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

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

View File

@ -1,18 +1,33 @@
package mineplex.bungee; package mineplex.bungee;
import java.util.logging.Handler;
import java.util.logging.Level;
import mineplex.bungee.lobbyBalancer.LobbyBalancer; import mineplex.bungee.lobbyBalancer.LobbyBalancer;
import mineplex.bungee.motd.MotdManager; import mineplex.bungee.motd.MotdManager;
import mineplex.bungee.playerCount.PlayerCount; import mineplex.bungee.playerCount.PlayerCount;
import mineplex.bungee.playerStats.PlayerStats; import mineplex.bungee.playerStats.PlayerStats;
import mineplex.bungee.playerTracker.PlayerTracker; 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; import net.md_5.bungee.api.plugin.Plugin;
public class Mineplexer extends Plugin public class Mineplexer extends Plugin
{ {
@Override @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 MotdManager(this);
new LobbyBalancer(this); new LobbyBalancer(this);
PlayerCount playerCount = new PlayerCount(this); PlayerCount playerCount = new PlayerCount(this);

View File

@ -10,14 +10,13 @@ import java.util.UUID;
import mineplex.bungee.playerStats.data.IpInfo; import mineplex.bungee.playerStats.data.IpInfo;
import mineplex.cache.player.PlayerInfo; 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 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 SELECT_PLAYERINFO = "SELECT id, name, version FROM playerInfo WHERE uuid = ?;";
private static String UPDATE_PLAYERINFO = "UPDATE playerInfo SET name = ?, version = ? WHERE id = ?;"; private static String UPDATE_PLAYERINFO = "UPDATE playerInfo SET name = ?, version = ? WHERE id = ?;";
@ -31,19 +30,21 @@ public class PlayerStatsRepository
private static String UPDATE_LOGINSESSION = "UPDATE playerLoginSessions SET timeInGame = TIME_TO_SEC(TIMEDIFF(now(), loginTime)) / 60 WHERE id = ?;"; private static String UPDATE_LOGINSESSION = "UPDATE playerLoginSessions SET timeInGame = TIME_TO_SEC(TIMEDIFF(now(), loginTime)) / 60 WHERE id = ?;";
public void initialize() public PlayerStatsRepository()
{ {
try super(DBPool.getPlayerStats());
{
if (_connection == null || _connection.isClosed())
_connection = DriverManager.getConnection(_connectionString, _userName, _password);
}
catch (Exception exception)
{
exception.printStackTrace();
} }
System.out.println("Initialized PlayerStats."); @Override
public void initialize()
{
}
@Override
protected void update()
{
} }
public PlayerInfo getPlayer(UUID uuid, String name, int version) public PlayerInfo getPlayer(UUID uuid, String name, int version)
@ -52,12 +53,9 @@ public class PlayerStatsRepository
PreparedStatement preparedStatement = null; PreparedStatement preparedStatement = null;
ResultSet resultSet = null; ResultSet resultSet = null;
try try(Connection connection = getConnection())
{ {
if (_connection == null || _connection.isClosed()) preparedStatement = connection.prepareStatement(SELECT_PLAYERINFO);
_connection = DriverManager.getConnection(_connectionString, _userName, _password);
preparedStatement = _connection.prepareStatement(SELECT_PLAYERINFO);
preparedStatement.setString(1, uuid.toString()); preparedStatement.setString(1, uuid.toString());
@ -73,7 +71,7 @@ public class PlayerStatsRepository
if (playerInfo == null) 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(1, uuid.toString());
preparedStatement.setString(2, name); preparedStatement.setString(2, name);
preparedStatement.setInt(3, version); preparedStatement.setInt(3, version);
@ -96,7 +94,7 @@ public class PlayerStatsRepository
} }
else if (!playerInfo.getName().equalsIgnoreCase(name) || playerInfo.getVersion() != version) else if (!playerInfo.getName().equalsIgnoreCase(name) || playerInfo.getVersion() != version)
{ {
preparedStatement = _connection.prepareStatement(UPDATE_PLAYERINFO); preparedStatement = connection.prepareStatement(UPDATE_PLAYERINFO);
preparedStatement.setString(1, name); preparedStatement.setString(1, name);
preparedStatement.setInt(2, version); preparedStatement.setInt(2, version);
preparedStatement.setInt(3, playerInfo.getId()); preparedStatement.setInt(3, playerInfo.getId());
@ -145,12 +143,9 @@ public class PlayerStatsRepository
PreparedStatement preparedStatement = null; PreparedStatement preparedStatement = null;
ResultSet resultSet = null; ResultSet resultSet = null;
try try(Connection connection = getConnection())
{ {
if (_connection == null || _connection.isClosed()) preparedStatement = connection.prepareStatement(SELECT_IPINFO);
_connection = DriverManager.getConnection(_connectionString, _userName, _password);
preparedStatement = _connection.prepareStatement(SELECT_IPINFO);
preparedStatement.setString(1, ipAddress); preparedStatement.setString(1, ipAddress);
resultSet = preparedStatement.executeQuery(); resultSet = preparedStatement.executeQuery();
@ -167,7 +162,7 @@ public class PlayerStatsRepository
if (ipInfo == null) 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.setString(1, ipAddress);
preparedStatement.executeUpdate(); preparedStatement.executeUpdate();
@ -228,12 +223,9 @@ public class PlayerStatsRepository
Statement statement = null; Statement statement = null;
ResultSet resultSet= null; ResultSet resultSet= null;
try try(Connection connection = getConnection())
{ {
if (_connection == null || _connection.isClosed()) statement = connection.createStatement();
_connection = DriverManager.getConnection(_connectionString, _userName, _password);
statement = _connection.createStatement();
String queryString = UPDATE_PLAYERSTATS; String queryString = UPDATE_PLAYERSTATS;
queryString = queryString.replaceFirst("\\?", playerId + ""); queryString = queryString.replaceFirst("\\?", playerId + "");
@ -286,12 +278,9 @@ public class PlayerStatsRepository
{ {
PreparedStatement preparedStatement = null; PreparedStatement preparedStatement = null;
try try(Connection connection = getConnection())
{ {
if (_connection == null || _connection.isClosed()) preparedStatement = connection.prepareStatement(UPDATE_LOGINSESSION);
_connection = DriverManager.getConnection(_connectionString, _userName, _password);
preparedStatement = _connection.prepareStatement(UPDATE_LOGINSESSION);
preparedStatement.setInt(1, loginSessionId); preparedStatement.setInt(1, loginSessionId);
preparedStatement.executeUpdate(); preparedStatement.executeUpdate();

View File

@ -1,36 +1,32 @@
package mineplex.bungee; package mineplex.bungee;
import java.sql.Connection; import mineplex.serverdata.database.DBPool;
import java.sql.DriverManager; import mineplex.serverdata.database.RepositoryBase;
import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.*;
import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; 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 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 = ?;"; 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 super(DBPool.getPlayerStats());
{
if (_connection == null || _connection.isClosed())
_connection = DriverManager.getConnection(_connectionString, _userName, _password);
}
catch (Exception exception)
{
exception.printStackTrace();
} }
System.out.println("Initialized PlayerStats."); @Override
protected void initialize()
{
}
@Override
protected void update()
{
} }
public List<IpInfo> getIpAddresses() public List<IpInfo> getIpAddresses()
@ -39,12 +35,9 @@ public class PlayerStatsRepository
PreparedStatement preparedStatement = null; PreparedStatement preparedStatement = null;
ResultSet resultSet = null; ResultSet resultSet = null;
try try(Connection connection = getConnection())
{ {
if (_connection == null || _connection.isClosed()) preparedStatement = connection.prepareStatement(SELECT_IPINFO);
_connection = DriverManager.getConnection(_connectionString, _userName, _password);
preparedStatement = _connection.prepareStatement(SELECT_IPINFO);
resultSet = preparedStatement.executeQuery(); resultSet = preparedStatement.executeQuery();
@ -98,12 +91,9 @@ public class PlayerStatsRepository
{ {
PreparedStatement preparedStatement = null; PreparedStatement preparedStatement = null;
try try(Connection connection = getConnection())
{ {
if (_connection == null || _connection.isClosed()) preparedStatement = connection.prepareStatement(UPDATE_IPINFO);
_connection = DriverManager.getConnection(_connectionString, _userName, _password);
preparedStatement = _connection.prepareStatement(UPDATE_IPINFO);
for (IpInfo ipInfo : ips) for (IpInfo ipInfo : ips)
{ {

View File

@ -47,7 +47,16 @@ public class PlayerCache
{ {
try try
{ {
return _repository.getElement(uuid.toString()); System.out.println("Getting PlayerCache for " + 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) catch (Exception exception)
{ {

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 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 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 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; private Property _skinProperty;

View File

@ -256,6 +256,25 @@ public class UtilAlg
return vec; 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) public static Location findClosest(Location mid, ArrayList<Location> locs)
{ {
Location bestLoc = null; Location bestLoc = null;

View File

@ -171,6 +171,7 @@ public class UtilBlock
blockPassSet.add((byte) Material.STAINED_GLASS_PANE.getId()); blockPassSet.add((byte) Material.STAINED_GLASS_PANE.getId());
blockPassSet.add((byte) Material.IRON_TRAPDOOR.getId()); blockPassSet.add((byte) Material.IRON_TRAPDOOR.getId());
blockPassSet.add((byte) Material.DAYLIGHT_DETECTOR_INVERTED.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.BIRCH_FENCE_GATE.getId());
blockPassSet.add((byte) Material.JUNGLE_FENCE_GATE.getId()); blockPassSet.add((byte) Material.JUNGLE_FENCE_GATE.getId());
@ -464,6 +465,11 @@ public class UtilBlock
return getHighest(world, x, z, null); return getHighest(world, x, z, null);
} }
public static Block getHighest(World world, Location location)
{
return getHighest(world, location.getBlockX(), location.getBlockZ(), null);
}
public static Block getHighest(World world, int x, int z, HashSet<Material> ignore) public static Block getHighest(World world, int x, int z, HashSet<Material> ignore)
{ {
Block block = world.getHighestBlockAt(x, z); Block block = world.getHighestBlockAt(x, z);
@ -1408,6 +1414,11 @@ public class UtilBlock
case ANVIL: case ANVIL:
itemStack.setDurability((short) (itemStack.getDurability() / 4)); itemStack.setDurability((short) (itemStack.getDurability() / 4));
break; break;
case QUARTZ_BLOCK:
if (itemStack.getDurability() == 4 || itemStack.getDurability() == 3)
itemStack.setDurability((short) 2);
break;
} }
return itemStacks; return itemStacks;

View File

@ -1,9 +1,9 @@
package mineplex.core.common.util; package mineplex.core.common.util;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -14,7 +14,7 @@ import org.bukkit.ChatColor;
import org.bukkit.GameMode; import org.bukkit.GameMode;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.block.Block;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; 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.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_8_R3.event.CraftEventFactory; 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.Inventory;
import org.bukkit.inventory.InventoryView; import org.bukkit.inventory.InventoryView;
import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffect;
import org.bukkit.util.BlockIterator;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import net.minecraft.server.v1_8_R3.EntityPlayer; import net.minecraft.server.v1_8_R3.EntityPlayer;
@ -755,4 +756,32 @@ public class UtilPlayer
looking.multiply(distance); looking.multiply(distance);
return player.getEyeLocation().clone().add(looking); 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,15 +1,19 @@
package mineplex.core.common.util; package mineplex.core.common.util;
import java.util.Collection; import java.util.Collection;
import java.util.List;
import java.util.function.Predicate;
import org.bukkit.Chunk; import org.bukkit.Chunk;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.World.Environment; import org.bukkit.World.Environment;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import com.google.common.collect.Lists;
public class UtilWorld public class UtilWorld
{ {
public static World getWorld(String world) public static World getWorld(String world)
@ -194,4 +198,15 @@ public class UtilWorld
return vec.toLocation(world); return vec.toLocation(world);
} }
private static List<Block> branch(Location origin)
{
return Lists.newArrayList(origin.getBlock(),
origin.getBlock().getRelative(BlockFace.DOWN),
origin.getBlock().getRelative(BlockFace.UP),
origin.getBlock().getRelative(BlockFace.NORTH),
origin.getBlock().getRelative(BlockFace.EAST),
origin.getBlock().getRelative(BlockFace.SOUTH),
origin.getBlock().getRelative(BlockFace.WEST));
}
} }

View File

@ -10,6 +10,7 @@ import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
import mineplex.core.database.MinecraftRepository;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import com.google.gson.reflect.TypeToken; import com.google.gson.reflect.TypeToken;
import org.bukkit.plugin.java.JavaPlugin; 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.Rank;
import mineplex.core.common.util.Callback; import mineplex.core.common.util.Callback;
import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.NautHashMap;
import mineplex.core.database.DBPool; import mineplex.serverdata.database.DBPool;
import mineplex.core.database.DatabaseRunnable; import mineplex.serverdata.database.DatabaseRunnable;
import mineplex.core.database.RepositoryBase; import mineplex.serverdata.database.RepositoryBase;
import mineplex.core.database.ResultSetCallable; import mineplex.serverdata.database.ResultSetCallable;
import mineplex.core.database.column.ColumnBoolean; import mineplex.serverdata.database.column.ColumnBoolean;
import mineplex.core.database.column.ColumnTimestamp; import mineplex.serverdata.database.column.ColumnTimestamp;
import mineplex.core.database.column.ColumnVarChar; import mineplex.serverdata.database.column.ColumnVarChar;
import mineplex.core.server.remotecall.JsonWebCall; 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 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());"; 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())); 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 @Override
public void run() public void run()

View File

@ -30,6 +30,20 @@ public enum Achievement
new int[]{200}, new int[]{200},
AchievementCategory.HOLIDAY), 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
BRIDGES_WINS("Bridge Champion", 600, BRIDGES_WINS("Bridge Champion", 600,
new String[]{"The Bridges.Wins"}, 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()); level = Math.max(level, 50 + get(sender, Achievement.GLOBAL_GEM_HUNTER).getLevel());
if (sender.getName().equalsIgnoreCase("Phinary")) if (sender.getName().equalsIgnoreCase("Phinary"))
level = -level; level = 0;
return level; return level;
} }

View File

@ -4,7 +4,7 @@ import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.SQLException; 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.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -33,7 +33,7 @@ public class AntiHackRepository
{ {
PreparedStatement preparedStatement = null; PreparedStatement preparedStatement = null;
try (Connection connection = DBPool.getStats().getConnection()) try (Connection connection = DBPool.getMineplexStats().getConnection())
{ {
preparedStatement = connection.prepareStatement(UPDATE_PLAYER_OFFENSES); preparedStatement = connection.prepareStatement(UPDATE_PLAYER_OFFENSES);

View File

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

@ -27,11 +27,10 @@ import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist; 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.DonationManager;
import mineplex.core.donation.GiveDonorData; import mineplex.core.donation.GiveDonorData;
import mineplex.core.facebook.FacebookManager; import mineplex.core.facebook.FacebookManager;
import mineplex.core.giveaway.GiveawayManager;
import mineplex.core.hologram.Hologram; import mineplex.core.hologram.Hologram;
import mineplex.core.hologram.HologramManager; import mineplex.core.hologram.HologramManager;
import mineplex.core.inventory.InventoryManager; import mineplex.core.inventory.InventoryManager;
@ -65,8 +64,9 @@ import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDamageByEntityEvent; 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.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
@ -167,7 +167,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
updateOffSet(); 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); super("Bonus", plugin);
_repository = new BonusRepository(plugin, this, donationManager); _repository = new BonusRepository(plugin, this, donationManager);
@ -177,7 +177,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
_hologramManager = hologramManager; _hologramManager = hologramManager;
_inventoryManager = inventoryManager; _inventoryManager = inventoryManager;
_rewardManager = new RewardManager(clientManager, statusManager, donationManager, inventoryManager, petManager, statsManager, giveawayManager, _rewardManager = new RewardManager(clientManager, statusManager, donationManager, inventoryManager, petManager, statsManager,
100, 250, 100, 250,
500, 1000, 500, 1000,
4000, 6000, 4000, 6000,
@ -818,8 +818,8 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
} }
} }
@EventHandler @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void openGui(PlayerInteractEntityEvent event) public void openGui(PlayerInteractAtEntityEvent event)
{ {
if (!_enabled) if (!_enabled)
return; return;

View File

@ -10,9 +10,10 @@ import java.sql.Types;
import mineplex.core.common.Pair; import mineplex.core.common.Pair;
import mineplex.core.common.util.Callback; import mineplex.core.common.util.Callback;
import mineplex.core.database.DBPool; import mineplex.core.database.MinecraftRepository;
import mineplex.core.database.RepositoryBase; import mineplex.serverdata.database.DBPool;
import mineplex.core.database.ResultSetCallable; import mineplex.serverdata.database.RepositoryBase;
import mineplex.serverdata.database.ResultSetCallable;
import mineplex.core.donation.DonationManager; import mineplex.core.donation.DonationManager;
import mineplex.core.recharge.Recharge; import mineplex.core.recharge.Recharge;
import mineplex.database.Tables; import mineplex.database.Tables;
@ -28,7 +29,7 @@ import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.java.JavaPlugin; 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 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; private BonusManager _manager;

View File

@ -4,16 +4,17 @@ import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import mineplex.core.database.MinecraftRepository;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.database.DBPool; import mineplex.serverdata.database.DBPool;
import mineplex.core.database.RepositoryBase; import mineplex.serverdata.database.RepositoryBase;
import mineplex.core.botspam.SpamText; import mineplex.core.botspam.SpamText;
import mineplex.core.database.ResultSetCallable; import mineplex.serverdata.database.ResultSetCallable;
import mineplex.core.database.column.ColumnInt; import mineplex.serverdata.database.column.ColumnInt;
import mineplex.core.database.column.ColumnVarChar; 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 GET_SPAM_TEXT = "SELECT * FROM botSpam";
private static final String ADD_SPAM_TEXT = "INSERT INTO botSpam (text, createdBy, enabledBy) VALUES (?, ?, ?)"; 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 AchievementManager _achievements;
private String[] _hackusations = {"hack", "hax", "hacker", "hacking", "cheat", "cheater", "cheating", "forcefield", "flyhack", "flyhacking", "autoclick", "aimbot"}; 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 _appId = "34018d65-466d-4a91-8e92-29ca49f022c4";
private String _apiKey = "oUywMpwZcIzZO5AWnfDx"; private String _apiKey = "oUywMpwZcIzZO5AWnfDx";
private String _serverName; private String _serverName;
@ -244,6 +244,9 @@ public class Chat extends MiniPlugin
} }
} }
/**
* This should only be called from an async thread!
*/
public String getFilteredMessage(Player player, String originalMessage) public String getFilteredMessage(Player player, String originalMessage)
{ {
final String playerName = player.getUniqueId().toString(); final String playerName = player.getUniqueId().toString();

View File

@ -4,7 +4,6 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType; import org.bukkit.event.inventory.ClickType;
@ -57,8 +56,8 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
slot++; slot++;
if (slot == 26) if (slot == 26 || slot == 35)
slot = 28; slot += 2;
} }
addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), new IButton() 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) if (gadget.getSet() != null)
{ {
itemLore.add(C.cBlack); itemLore.add(C.cBlack);
itemLore.add(C.cWhite + gadget.getSet().getName() + " Set;"); itemLore.add(C.cWhite + gadget.getSet().getName() + " Set");
//Elements //Elements
for (Gadget cur : gadget.getSet().getGadgets()) 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); itemLore.add(C.cBlack);
//Bonus //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()) for (String bonus : gadget.getSet().getBonus())
itemLore.add(" " + (gadget.getSet().isActive(getPlayer()) ? C.cGreen : C.cGray) + bonus); 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.cBlack);
itemLore.add(C.cBlue + "Found in Easter Holiday Treasure"); 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 //Rank Unlocks
else if (gadget.GetCost(CurrencyType.Coins) == -10) 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.cBlack);
itemLore.add(C.cGreen + "Left-Click to Enable"); 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 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; return;
@ -206,7 +216,7 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
im.setLore(itemLore); im.setLore(itemLore);
item.setItemMeta(im); 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 else
{ {
@ -215,7 +225,7 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
im.setLore(itemLore); im.setLore(itemLore);
item.setItemMeta(im); 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 else
@ -231,18 +241,18 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
itemLore.add(C.cBlack); itemLore.add(C.cBlack);
itemLore.add(C.cGreen + "Click to Purchase"); 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) else if (gadget.GetCost(CurrencyType.Coins) > 0)
{ {
itemLore.add(C.cBlack); itemLore.add(C.cBlack);
itemLore.add(C.cRed + "Not enough Treasure Shards."); 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 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.cBlack);
itemLore.add(C.cGreen + "Click to Disable"); 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 else
{ {
itemLore.add(C.cBlack); itemLore.add(C.cBlack);
itemLore.add(C.cGreen + "Click to Enable"); 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 else
@ -280,18 +290,18 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
itemLore.add(C.cBlack); itemLore.add(C.cBlack);
itemLore.add(C.cGreen + "Click to Purchase"); 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) else if (gadget.GetCost(CurrencyType.Coins) > 0)
{ {
itemLore.add(C.cBlack); itemLore.add(C.cBlack);
itemLore.add(C.cRed + "Not enough Treasure Shards."); 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 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.cBlack);
itemLore.add(C.cBlue + "Found in Easter Holiday Treasure"); 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 //Rank Unlocks
else if (mount.GetCost(CurrencyType.Coins) == -10) 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 (getDonationManager().Get(getPlayer().getName()).OwnsUnknownPackage(mount.GetName()))
{ {
if (mount.GetActive().containsKey(getPlayer())) if (mount.GetActive().containsKey(getPlayer()))
@ -141,18 +145,18 @@ public class MountPage extends ShopPageBase<CosmeticManager, CosmeticShop>
itemLore.add(C.cBlack); itemLore.add(C.cBlack);
itemLore.add(C.cGreen + "Click to Purchase"); 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) else if (mount.GetCost(CurrencyType.Coins) > 0)
{ {
itemLore.add(C.cBlack); itemLore.add(C.cBlack);
itemLore.add(C.cRed + "Not enough Treasure Shards."); 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 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.ArrayList;
import java.util.Map; import java.util.Map;
import org.bukkit.entity.Player; import mineplex.core.database.MinecraftRepository;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.account.CoreClientManager; import mineplex.core.account.CoreClientManager;
import mineplex.core.customdata.CustomData; import mineplex.core.customdata.CustomData;
import mineplex.core.customdata.CustomDataManager; import mineplex.core.customdata.CustomDataManager;
import mineplex.core.customdata.PlayerCustomData; import mineplex.core.customdata.PlayerCustomData;
import mineplex.core.database.DBPool; import mineplex.serverdata.database.DBPool;
import mineplex.core.database.RepositoryBase; import mineplex.serverdata.database.RepositoryBase;
import mineplex.core.database.ResultSetCallable; import mineplex.serverdata.database.ResultSetCallable;
import mineplex.core.database.column.ColumnInt; import mineplex.serverdata.database.column.ColumnInt;
import mineplex.core.database.column.ColumnVarChar; import mineplex.serverdata.database.column.ColumnVarChar;
/** /**
* Created by William (WilliamTiger). * Created by William (WilliamTiger).
* 16/12/15 * 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 SELECT_KEYS = "SELECT id, name FROM customData;";
private static final String INSERT_KEY = "INSERT INTO customData (name) VALUES (?);"; 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

@ -1,21 +1,18 @@
package mineplex.core.donation.repository; package mineplex.core.donation.repository;
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.sql.Types;
import mineplex.core.database.MinecraftRepository;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.common.CurrencyType; import mineplex.core.common.CurrencyType;
import mineplex.core.common.util.Callback; import mineplex.core.common.util.Callback;
import mineplex.core.database.DBPool; import mineplex.serverdata.database.DBPool;
import mineplex.core.database.DatabaseRunnable; import mineplex.serverdata.database.DatabaseRunnable;
import mineplex.core.database.RepositoryBase; import mineplex.serverdata.database.RepositoryBase;
import mineplex.core.database.column.ColumnInt; import mineplex.serverdata.database.column.ColumnInt;
import mineplex.core.database.column.ColumnVarChar;
import mineplex.core.donation.Donor; import mineplex.core.donation.Donor;
import mineplex.core.donation.repository.token.GemRewardToken; import mineplex.core.donation.repository.token.GemRewardToken;
import mineplex.core.donation.repository.token.PurchaseToken; import mineplex.core.donation.repository.token.PurchaseToken;
@ -24,7 +21,7 @@ import mineplex.core.server.remotecall.AsyncJsonWebCall;
import mineplex.core.server.remotecall.JsonWebCall; import mineplex.core.server.remotecall.JsonWebCall;
import mineplex.core.server.util.TransactionResponse; import mineplex.core.server.util.TransactionResponse;
public class DonationRepository extends RepositoryBase public class DonationRepository extends MinecraftRepository
{ {
private static String CREATE_COIN_TRANSACTION_TABLE = "CREATE TABLE IF NOT EXISTS accountCoinTransactions (id INT NOT NULL AUTO_INCREMENT, accountId INT, reason VARCHAR(100), coins INT, PRIMARY KEY (id), FOREIGN KEY (accountId) REFERENCES accounts(id));"; private static String CREATE_COIN_TRANSACTION_TABLE = "CREATE TABLE IF NOT EXISTS accountCoinTransactions (id INT NOT NULL AUTO_INCREMENT, accountId INT, reason VARCHAR(100), coins INT, PRIMARY KEY (id), FOREIGN KEY (accountId) REFERENCES accounts(id));";
private static String CREATE_GEM_TRANSACTION_TABLE = "CREATE TABLE IF NOT EXISTS accountGemTransactions (id INT NOT NULL AUTO_INCREMENT, accountId INT, reason VARCHAR(100), gems INT, PRIMARY KEY (id), FOREIGN KEY (accountId) REFERENCES accounts(id));"; private static String CREATE_GEM_TRANSACTION_TABLE = "CREATE TABLE IF NOT EXISTS accountGemTransactions (id INT NOT NULL AUTO_INCREMENT, accountId INT, reason VARCHAR(100), gems INT, PRIMARY KEY (id), FOREIGN KEY (accountId) REFERENCES accounts(id));";
@ -54,7 +51,7 @@ public class DonationRepository extends RepositoryBase
{ {
public void run(final TransactionResponse response) public void run(final TransactionResponse response)
{ {
Bukkit.getServer().getScheduler().runTask(Plugin, new Runnable() Bukkit.getServer().getScheduler().runTask(getPlugin(), new Runnable()
{ {
@Override @Override
public void run() public void run()
@ -100,7 +97,7 @@ public class DonationRepository extends RepositoryBase
} }
} }
Bukkit.getServer().getScheduler().runTask(Plugin, new Runnable() Bukkit.getServer().getScheduler().runTask(getPlugin(), new Runnable()
{ {
@Override @Override
public void run() public void run()
@ -131,7 +128,7 @@ public class DonationRepository extends RepositoryBase
{ {
public void run(final Boolean response) public void run(final Boolean response)
{ {
Bukkit.getServer().getScheduler().runTask(Plugin, new Runnable() Bukkit.getServer().getScheduler().runTask(getPlugin(), new Runnable()
{ {
@Override @Override
public void run() public void run()
@ -168,7 +165,7 @@ public class DonationRepository extends RepositoryBase
//executeUpdate(INSERT_COIN_TRANSACTION, new ColumnInt("id", accountId), new ColumnVarChar("reason", 100, "Rewarded by " + giver), new ColumnInt("coins", coins)); //executeUpdate(INSERT_COIN_TRANSACTION, new ColumnInt("id", accountId), new ColumnVarChar("reason", 100, "Rewarded by " + giver), new ColumnInt("coins", coins));
} }
Bukkit.getServer().getScheduler().runTask(Plugin, new Runnable() Bukkit.getServer().getScheduler().runTask(getPlugin(), new Runnable()
{ {
@Override @Override
public void run() public void run()

View File

@ -3,14 +3,15 @@ package mineplex.core.elo;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import mineplex.core.database.MinecraftRepository;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.database.DBPool; import mineplex.serverdata.database.DBPool;
import mineplex.core.database.RepositoryBase; import mineplex.serverdata.database.RepositoryBase;
import mineplex.core.database.column.ColumnInt; import mineplex.serverdata.database.column.ColumnInt;
import mineplex.core.database.column.ColumnVarChar; import mineplex.serverdata.database.column.ColumnVarChar;
public class EloRepository extends RepositoryBase public class EloRepository extends MinecraftRepository
{ {
private static String CREATE_ELO_TABLE = "CREATE TABLE IF NOT EXISTS eloRating (id INT NOT NULL AUTO_INCREMENT, uuid VARCHAR(256), gameType VARCHAR(256), elo INT, PRIMARY KEY (id), UNIQUE INDEX uuid_gameType_index (uuid, gameType));"; private static String CREATE_ELO_TABLE = "CREATE TABLE IF NOT EXISTS eloRating (id INT NOT NULL AUTO_INCREMENT, uuid VARCHAR(256), gameType VARCHAR(256), elo INT, PRIMARY KEY (id), UNIQUE INDEX uuid_gameType_index (uuid, gameType));";
private static String INSERT_ELO = "INSERT INTO eloRating (uuid, gameType, elo) VALUES (?, ?, ?) ON DUPLICATE KEY UPDATE elo=VALUES(elo);"; private static String INSERT_ELO = "INSERT INTO eloRating (uuid, gameType, elo) VALUES (?, ?, ?) ON DUPLICATE KEY UPDATE elo=VALUES(elo);";

View File

@ -241,7 +241,7 @@ public class Explosion extends MiniPlugin
} }
Block block = cur.getLocation().getBlock(); Block block = cur.getLocation().getBlock();
block.setTypeIdAndData(0, (byte)0, true); //block.setTypeIdAndData(0, (byte)0, true);
//Block Replace //Block Replace
if (_enableDebris) if (_enableDebris)

View File

@ -3,16 +3,17 @@ package mineplex.core.facebook;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import mineplex.core.database.MinecraftRepository;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.common.util.Callback; import mineplex.core.common.util.Callback;
import mineplex.core.database.DBPool; import mineplex.serverdata.database.DBPool;
import mineplex.core.database.RepositoryBase; import mineplex.serverdata.database.RepositoryBase;
import mineplex.core.database.ResultSetCallable; import mineplex.serverdata.database.ResultSetCallable;
import mineplex.core.database.column.ColumnInt; import mineplex.serverdata.database.column.ColumnInt;
import mineplex.core.database.column.ColumnVarChar; import mineplex.serverdata.database.column.ColumnVarChar;
public class FacebookRepository extends RepositoryBase public class FacebookRepository extends MinecraftRepository
{ {
private static final String GET_CODE = "SELECT code, activated FROM facebook WHERE code = ?"; private static final String GET_CODE = "SELECT code, activated FROM facebook WHERE code = ?";
private static final String ACTIVATE_CODE = "UPDATE facebook SET activated = 1, accountId = ?, activationTime = NOW() WHERE code = ?"; private static final String ACTIVATE_CODE = "UPDATE facebook SET activated = 1, accountId = ?, activationTime = NOW() WHERE code = ?";

View File

@ -5,18 +5,18 @@ import java.sql.SQLException;
import java.util.Collection; import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import mineplex.core.database.MinecraftRepository;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.NautHashMap;
import mineplex.core.database.DBPool; import mineplex.serverdata.database.DBPool;
import mineplex.core.database.RepositoryBase; import mineplex.serverdata.database.RepositoryBase;
import mineplex.core.database.ResultSetCallable; import mineplex.serverdata.database.ResultSetCallable;
import mineplex.core.database.column.ColumnVarChar; import mineplex.serverdata.database.column.ColumnVarChar;
import mineplex.core.friend.FriendStatusType; import mineplex.core.friend.FriendStatusType;
import mineplex.serverdata.Region; import mineplex.serverdata.Region;
import mineplex.serverdata.data.DataRepository; import mineplex.serverdata.data.DataRepository;
@ -24,7 +24,7 @@ import mineplex.serverdata.data.PlayerStatus;
import mineplex.serverdata.redis.RedisDataRepository; import mineplex.serverdata.redis.RedisDataRepository;
import mineplex.serverdata.servers.ServerManager; import mineplex.serverdata.servers.ServerManager;
public class FriendRepository extends RepositoryBase public class FriendRepository extends MinecraftRepository
{ {
private static String CREATE_FRIEND_TABLE = "CREATE TABLE IF NOT EXISTS accountFriend (id INT NOT NULL AUTO_INCREMENT, uuidSource VARCHAR(100), uuidTarget VARCHAR(100), status VARCHAR(100), PRIMARY KEY (id), UNIQUE INDEX uuidIndex (uuidSource, uuidTarget));"; private static String CREATE_FRIEND_TABLE = "CREATE TABLE IF NOT EXISTS accountFriend (id INT NOT NULL AUTO_INCREMENT, uuidSource VARCHAR(100), uuidTarget VARCHAR(100), status VARCHAR(100), PRIMARY KEY (id), UNIQUE INDEX uuidIndex (uuidSource, uuidTarget));";
private static String RETRIEVE_MULTIPLE_FRIEND_RECORDS = "SELECT uuidSource, tA.Name, status, tA.lastLogin, now() FROM accountFriend INNER Join accounts AS fA ON fA.uuid = uuidSource INNER JOIN accounts AS tA ON tA.uuid = uuidTarget WHERE uuidSource IN "; private static String RETRIEVE_MULTIPLE_FRIEND_RECORDS = "SELECT uuidSource, tA.Name, status, tA.lastLogin, now() FROM accountFriend INNER Join accounts AS fA ON fA.uuid = uuidSource INNER JOIN accounts AS tA ON tA.uuid = uuidTarget WHERE uuidSource IN ";

View File

@ -5,6 +5,11 @@ import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import mineplex.core.gadget.gadgets.hat.HatCompanion;
import mineplex.core.gadget.gadgets.hat.HatLovestruck;
import mineplex.core.gadget.gadgets.hat.HatSecretPackage;
import mineplex.core.gadget.gadgets.hat.HatTeddyBear;
import mineplex.core.gadget.gadgets.item.*;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
@ -32,16 +37,64 @@ import mineplex.core.disguise.DisguiseManager;
import mineplex.core.donation.DonationManager; import mineplex.core.donation.DonationManager;
import mineplex.core.gadget.event.GadgetCollideEntityEvent; import mineplex.core.gadget.event.GadgetCollideEntityEvent;
import mineplex.core.gadget.event.GadgetEnableEvent; import mineplex.core.gadget.event.GadgetEnableEvent;
import mineplex.core.gadget.gadgets.arrowtrail.*; import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailCandyCane;
import mineplex.core.gadget.gadgets.death.*; import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailFrostLord;
import mineplex.core.gadget.gadgets.doublejump.*; import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailHearts;
import mineplex.core.gadget.gadgets.hat.*; import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailTitan;
import mineplex.core.gadget.gadgets.item.*; import mineplex.core.gadget.gadgets.death.DeathCandyCane;
import mineplex.core.gadget.gadgets.morph.*; import mineplex.core.gadget.gadgets.death.DeathFrostLord;
import mineplex.core.gadget.gadgets.outfit.*; import mineplex.core.gadget.gadgets.death.DeathHearts;
import mineplex.core.gadget.gadgets.particle.*; import mineplex.core.gadget.gadgets.death.DeathTitan;
import mineplex.core.gadget.gadgets.doublejump.DoubleJumpCandyCane;
import mineplex.core.gadget.gadgets.doublejump.DoubleJumpFrostLord;
import mineplex.core.gadget.gadgets.doublejump.DoubleJumpHearts;
import mineplex.core.gadget.gadgets.doublejump.DoubleJumpTitan;
import mineplex.core.gadget.gadgets.hat.HatCoal;
import mineplex.core.gadget.gadgets.hat.HatGrinch;
import mineplex.core.gadget.gadgets.hat.HatPresent;
import mineplex.core.gadget.gadgets.hat.HatRudolph;
import mineplex.core.gadget.gadgets.hat.HatSanta;
import mineplex.core.gadget.gadgets.hat.HatSnowman;
import mineplex.core.gadget.gadgets.morph.MorphBat;
import mineplex.core.gadget.gadgets.morph.MorphBlaze;
import mineplex.core.gadget.gadgets.morph.MorphBlock;
import mineplex.core.gadget.gadgets.morph.MorphBunny;
import mineplex.core.gadget.gadgets.morph.MorphChicken;
import mineplex.core.gadget.gadgets.morph.MorphCow;
import mineplex.core.gadget.gadgets.morph.MorphCreeper;
import mineplex.core.gadget.gadgets.morph.MorphEnderman;
import mineplex.core.gadget.gadgets.morph.MorphPig;
import mineplex.core.gadget.gadgets.morph.MorphPumpkinKing;
import mineplex.core.gadget.gadgets.morph.MorphSlime;
import mineplex.core.gadget.gadgets.morph.MorphSnowman;
import mineplex.core.gadget.gadgets.morph.MorphTitan;
import mineplex.core.gadget.gadgets.morph.MorphVillager;
import mineplex.core.gadget.gadgets.morph.MorphWither;
import mineplex.core.gadget.gadgets.outfit.OutfitRaveSuitBoots;
import mineplex.core.gadget.gadgets.outfit.OutfitRaveSuitChestplate;
import mineplex.core.gadget.gadgets.outfit.OutfitRaveSuitHelmet;
import mineplex.core.gadget.gadgets.outfit.OutfitRaveSuitLeggings;
import mineplex.core.gadget.gadgets.outfit.OutfitSpaceSuitBoots;
import mineplex.core.gadget.gadgets.outfit.OutfitSpaceSuitChestplate;
import mineplex.core.gadget.gadgets.outfit.OutfitSpaceSuitHelmet;
import mineplex.core.gadget.gadgets.outfit.OutfitSpaceSuitLeggings;
import mineplex.core.gadget.gadgets.outfit.OutfitTeam;
import mineplex.core.gadget.gadgets.particle.ParticleCandyCane;
import mineplex.core.gadget.gadgets.particle.ParticleCoalFumes;
import mineplex.core.gadget.gadgets.particle.ParticleEnchant;
import mineplex.core.gadget.gadgets.particle.ParticleFairy;
import mineplex.core.gadget.gadgets.particle.ParticleFireRings;
import mineplex.core.gadget.gadgets.particle.ParticleFoot;
import mineplex.core.gadget.gadgets.particle.ParticleFrostLord;
import mineplex.core.gadget.gadgets.particle.ParticleGreen;
import mineplex.core.gadget.gadgets.particle.ParticleHeart;
import mineplex.core.gadget.gadgets.particle.ParticleHelix;
import mineplex.core.gadget.gadgets.particle.ParticleLegend;
import mineplex.core.gadget.gadgets.particle.ParticleRain;
import mineplex.core.gadget.gadgets.particle.ParticleTitan;
import mineplex.core.gadget.set.SetCandyCane; import mineplex.core.gadget.set.SetCandyCane;
import mineplex.core.gadget.set.SetFrostLord; import mineplex.core.gadget.set.SetFrostLord;
import mineplex.core.gadget.set.SetLove;
import mineplex.core.gadget.set.SetRaveSuit; import mineplex.core.gadget.set.SetRaveSuit;
import mineplex.core.gadget.set.SetSpaceSuit; import mineplex.core.gadget.set.SetSpaceSuit;
import mineplex.core.gadget.set.SetTitan; import mineplex.core.gadget.set.SetTitan;
@ -59,6 +112,7 @@ import mineplex.core.gadget.types.ParticleGadget;
import mineplex.core.inventory.InventoryManager; import mineplex.core.inventory.InventoryManager;
import mineplex.core.mount.MountManager; import mineplex.core.mount.MountManager;
import mineplex.core.mount.event.MountActivateEvent; import mineplex.core.mount.event.MountActivateEvent;
import mineplex.core.packethandler.PacketHandler;
import mineplex.core.pet.PetManager; import mineplex.core.pet.PetManager;
import mineplex.core.preferences.PreferencesManager; import mineplex.core.preferences.PreferencesManager;
import mineplex.core.projectile.ProjectileManager; import mineplex.core.projectile.ProjectileManager;
@ -75,6 +129,7 @@ public class GadgetManager extends MiniPlugin
private ProjectileManager _projectileManager; private ProjectileManager _projectileManager;
private AchievementManager _achievementManager; private AchievementManager _achievementManager;
private MountManager _mountManager; private MountManager _mountManager;
private PacketHandler _packetManager;
private NautHashMap<GadgetType, List<Gadget>> _gadgets; private NautHashMap<GadgetType, List<Gadget>> _gadgets;
@ -89,7 +144,8 @@ public class GadgetManager extends MiniPlugin
public GadgetManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager, public GadgetManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, InventoryManager inventoryManager,
MountManager mountManager, PetManager petManager, PreferencesManager preferencesManager, MountManager mountManager, PetManager petManager, PreferencesManager preferencesManager,
DisguiseManager disguiseManager, BlockRestore blockRestore, ProjectileManager projectileManager, AchievementManager achievementManager) DisguiseManager disguiseManager, BlockRestore blockRestore, ProjectileManager projectileManager, AchievementManager achievementManager,
PacketHandler packetHandler)
{ {
super("Gadget Manager", plugin); super("Gadget Manager", plugin);
@ -102,6 +158,7 @@ public class GadgetManager extends MiniPlugin
_blockRestore = blockRestore; _blockRestore = blockRestore;
_projectileManager = projectileManager; _projectileManager = projectileManager;
_achievementManager = achievementManager; _achievementManager = achievementManager;
_packetManager = packetHandler;
_mountManager = mountManager; _mountManager = mountManager;
CreateGadgets(); CreateGadgets();
@ -114,6 +171,7 @@ public class GadgetManager extends MiniPlugin
addSet(new SetFrostLord(this)); addSet(new SetFrostLord(this));
addSet(new SetCandyCane(this)); addSet(new SetCandyCane(this));
addSet(new SetTitan(this)); addSet(new SetTitan(this));
addSet(new SetLove(this));
//Costumes //Costumes
addSet(new SetRaveSuit(this)); addSet(new SetRaveSuit(this));
@ -139,6 +197,9 @@ public class GadgetManager extends MiniPlugin
addGadget(new ItemCoal(this)); addGadget(new ItemCoal(this));
addGadget(new ItemFreezeCannon(this)); addGadget(new ItemFreezeCannon(this));
addGadget(new ItemSnowball(this)); addGadget(new ItemSnowball(this));
addGadget(new ItemBow(this));
addGadget(new ItemLovePotion(this));
addGadget(new ItemFlowerGift(this));
// Costume // Costume
addGadget(new OutfitRaveSuitHelmet(this)); addGadget(new OutfitRaveSuitHelmet(this));
@ -192,16 +253,19 @@ public class GadgetManager extends MiniPlugin
addGadget(new ArrowTrailFrostLord(this)); addGadget(new ArrowTrailFrostLord(this));
addGadget(new ArrowTrailTitan(this)); addGadget(new ArrowTrailTitan(this));
addGadget(new ArrowTrailCandyCane(this)); addGadget(new ArrowTrailCandyCane(this));
addGadget(new ArrowTrailHearts(this));
// Death Effect // Death Effect
addGadget(new DeathFrostLord(this)); addGadget(new DeathFrostLord(this));
addGadget(new DeathTitan(this)); addGadget(new DeathTitan(this));
addGadget(new DeathCandyCane(this)); addGadget(new DeathCandyCane(this));
addGadget(new DeathHearts(this));
// Double Jump // Double Jump
addGadget(new DoubleJumpFrostLord(this)); addGadget(new DoubleJumpFrostLord(this));
addGadget(new DoubleJumpTitan(this)); addGadget(new DoubleJumpTitan(this));
addGadget(new DoubleJumpCandyCane(this)); addGadget(new DoubleJumpCandyCane(this));
addGadget(new DoubleJumpHearts(this));
// Hat // Hat
addGadget(new HatSanta(this)); addGadget(new HatSanta(this));
@ -210,6 +274,10 @@ public class GadgetManager extends MiniPlugin
addGadget(new HatCoal(this)); addGadget(new HatCoal(this));
addGadget(new HatRudolph(this)); addGadget(new HatRudolph(this));
addGadget(new HatGrinch(this)); addGadget(new HatGrinch(this));
addGadget(new HatLovestruck(this));
addGadget(new HatSecretPackage(this));
addGadget(new HatTeddyBear(this));
addGadget(new HatCompanion(this));
// Music // Music
addGadget(new MusicGadget(this, "13 Disc", new String[] {""}, -2, 2256, 178000)); addGadget(new MusicGadget(this, "13 Disc", new String[] {""}, -2, 2256, 178000));
@ -407,9 +475,9 @@ public class GadgetManager extends MiniPlugin
return _inventoryManager; return _inventoryManager;
} }
public boolean collideEvent(Gadget gadget, Player other) public boolean collideEvent(Player shooter, Gadget gadget, Player other)
{ {
GadgetCollideEntityEvent collideEvent = new GadgetCollideEntityEvent(gadget, other); GadgetCollideEntityEvent collideEvent = new GadgetCollideEntityEvent(shooter, gadget, other);
Bukkit.getServer().getPluginManager().callEvent(collideEvent); Bukkit.getServer().getPluginManager().callEvent(collideEvent);
@ -421,6 +489,11 @@ public class GadgetManager extends MiniPlugin
return _blockRestore; return _blockRestore;
} }
public PacketHandler getPacketManager()
{
return _packetManager;
}
@EventHandler @EventHandler
public void setMoving(PlayerMoveEvent event) public void setMoving(PlayerMoveEvent event)
{ {

View File

@ -1,22 +1,25 @@
package mineplex.core.gadget.event; package mineplex.core.gadget.event;
import mineplex.core.gadget.types.Gadget;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.Event; import org.bukkit.event.Event;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
import mineplex.core.gadget.types.Gadget;
public class GadgetCollideEntityEvent extends Event public class GadgetCollideEntityEvent extends Event
{ {
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
private Player _gadgetHolder;
private Gadget _gadget; private Gadget _gadget;
private Entity _other; private Entity _other;
private boolean _cancelled = false; private boolean _cancelled = false;
public GadgetCollideEntityEvent(Gadget gadget, Entity other) public GadgetCollideEntityEvent(Player player, Gadget gadget, Entity other)
{ {
_gadgetHolder = player;
_gadget = gadget; _gadget = gadget;
_other = other; _other = other;
} }
@ -31,6 +34,11 @@ public class GadgetCollideEntityEvent extends Event
return handlers; return handlers;
} }
public Player getPlayer()
{
return _gadgetHolder;
}
public Gadget getGadget() public Gadget getGadget()
{ {
return _gadget; return _gadget;

View File

@ -0,0 +1,42 @@
package mineplex.core.gadget.gadgets.arrowtrail;
import org.bukkit.Material;
import org.bukkit.entity.Arrow;
import mineplex.core.common.util.C;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilText;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.ArrowEffectGadget;
public class ArrowTrailHearts extends ArrowEffectGadget
{
/**
* Created by: Mysticate
* Timestamp: February 4, 2016
*/
public ArrowTrailHearts(GadgetManager manager)
{
super(manager, "Arrows of Cupid",
UtilText.splitLineToArray(C.cGray + "Tether your love to an arrow, then spear someone with it. Maybe they'll fall in love!", LineFormat.LORE),
-6,
Material.APPLE, (byte) 0);
}
@Override
public void doTrail(Arrow arrow)
{
UtilParticle.PlayParticleToAll(ParticleType.HEART, arrow.getLocation(), .1F, .1F, .1F, 0F, 1, ViewDist.LONGER);
}
@Override
public void doHitEffect(Arrow arrow)
{
UtilParticle.PlayParticleToAll(ParticleType.HEART, arrow.getLocation(), .5F, .5F, .5F, 0F, 4, ViewDist.LONGER);
}
}

View File

@ -0,0 +1,53 @@
package mineplex.core.gadget.gadgets.death;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import mineplex.core.blood.BloodEvent;
import mineplex.core.common.util.C;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilText;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.DeathEffectGadget;
public class DeathHearts extends DeathEffectGadget
{
/**
* Created by: Mysticate
* Timestamp: February 4, 2016
*/
public DeathHearts(GadgetManager manager)
{
super(manager, "Broken Hearted",
UtilText.splitLineToArray(C.cGray + "Nothing hurts more than having your heart broken. Apart from being killed, that is.", LineFormat.LORE),
-6, Material.APPLE, (byte) 0);
}
@EventHandler
public void onBlood(BloodEvent event)
{
if (IsActive(event.getPlayer()))
event.setItem(Material.AIR, (byte) 0);
}
@EventHandler(priority = EventPriority.MONITOR)
public void onParticles(BloodEvent event)
{
if (event.isCancelled())
return;
if (IsActive(event.getPlayer()))
{
Location loc = event.getLocation().clone().add(0, .5, 0);
UtilParticle.PlayParticleToAll(ParticleType.HEART, loc, 0F, 0F, 0F, 0F, 1, ViewDist.NORMAL);
}
}
}

View File

@ -0,0 +1,35 @@
package mineplex.core.gadget.gadgets.doublejump;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import mineplex.core.common.util.C;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilText;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.DoubleJumpEffectGadget;
public class DoubleJumpHearts extends DoubleJumpEffectGadget
{
/**
* Created by: Mysticate
* Timestamp: February 4, 2016
*/
public DoubleJumpHearts(GadgetManager manager)
{
super(manager, "Wings of Love",
UtilText.splitLineToArray(C.cGray + "Nothing hurts more than having your heart broken. Apart from being killed, that is.", LineFormat.LORE),
-6, Material.APPLE, (byte) 0);
}
@Override
public void doEffect(Player player)
{
UtilParticle.PlayParticleToAll(ParticleType.HEART, player.getLocation(), .5F, .5F, .5F, 0F, 4, ViewDist.LONGER);
}
}

View File

@ -0,0 +1,19 @@
package mineplex.core.gadget.gadgets.hat;
import mineplex.core.common.skin.SkinData;
import mineplex.core.common.util.C;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilText;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.HatGadget;
public class HatCompanion extends HatGadget
{
public HatCompanion(GadgetManager manager)
{
super(manager, "Companion",
UtilText.splitLineToArray(C.cGray + "The Enrichment Center reminds you that the Weighted Companion Cube will never threaten to stab you and, in fact, cannot speak", LineFormat.LORE),
-6,
SkinData.COMPANION_CUBE.getSkull());
}
}

View File

@ -0,0 +1,19 @@
package mineplex.core.gadget.gadgets.hat;
import mineplex.core.common.skin.SkinData;
import mineplex.core.common.util.C;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilText;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.HatGadget;
public class HatLovestruck extends HatGadget
{
public HatLovestruck(GadgetManager manager)
{
super(manager, "Lovestruck",
UtilText.splitLineToArray(C.cGray + "I think I'm in love... Wait a minute, did someone use a love potion on me?!", LineFormat.LORE),
-6,
SkinData.LOVESTRUCK.getSkull());
}
}

View File

@ -0,0 +1,19 @@
package mineplex.core.gadget.gadgets.hat;
import mineplex.core.common.skin.SkinData;
import mineplex.core.common.util.C;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilText;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.HatGadget;
public class HatSecretPackage extends HatGadget
{
public HatSecretPackage(GadgetManager manager)
{
super(manager, "Secret Package",
UtilText.splitLineToArray(C.cGray + "I hope Chiss is inside!", LineFormat.LORE),
-6,
SkinData.SECRET_PACKAGE.getSkull());
}
}

View File

@ -0,0 +1,19 @@
package mineplex.core.gadget.gadgets.hat;
import mineplex.core.common.skin.SkinData;
import mineplex.core.common.util.C;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilText;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.HatGadget;
public class HatTeddyBear extends HatGadget
{
public HatTeddyBear(GadgetManager manager)
{
super(manager, "Teddy Bear",
UtilText.splitLineToArray(C.cGray + "Aww, it's a cute teddy bear! What shall I name him?", LineFormat.LORE),
-6,
SkinData.TEDDY_BEAR.getSkull());
}
}

View File

@ -110,7 +110,7 @@ public class ItemBatGun extends ItemGadget
if (UtilEnt.hitBox(bat.getLocation(), other, 2, null)) if (UtilEnt.hitBox(bat.getLocation(), other, 2, null))
{ {
if (Manager.collideEvent(this, other)) if (Manager.collideEvent(cur, this, other))
continue; continue;
//Damage Event //Damage Event

View File

@ -0,0 +1,220 @@
package mineplex.core.gadget.gadgets.item;
import java.util.HashSet;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Creeper;
import org.bukkit.entity.Player;
import org.bukkit.entity.Snowball;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilText;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.gadgets.Ammo;
import mineplex.core.gadget.types.ItemGadget;
import mineplex.core.packethandler.IPacketHandler;
import mineplex.core.packethandler.PacketInfo;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntity;
public class ItemBow extends ItemGadget
{
/**
* Created by: Mysticate
* Timestamp: February 4, 2016
*/
private HashSet<Snowball> _arrows = new HashSet<Snowball>();
private boolean _spawning = false;
private String[] _responses = new String[]
{
"Do you feel the love?",
"Are you in love?",
"(I think they like you!)",
"Ahhh. Young love!",
"Maybe they'll bring you a rose!",
"You should go say Hi to them.",
"They look nice.",
"I love love!",
"Go get 'em, tiger!",
"Don't be TOO flirty, now.",
"That was one of my good arrows!",
"Do you believe in love at first sight?",
"Never gunna give you up, never gunna let you down.",
"I approve this message!",
};
private IPacketHandler _packetHandler = new IPacketHandler()
{
@Override
public void handle(PacketInfo packetInfo)
{
if (_spawning)
{
packetInfo.setCancelled(true);
return;
}
PacketPlayOutSpawnEntity packet = (PacketPlayOutSpawnEntity) packetInfo.getPacket();
for (Snowball arrow : _arrows)
{
if (arrow.getEntityId() == packet.a)
{
packetInfo.setCancelled(true);
return;
}
}
}
};
@SuppressWarnings("unchecked")
public ItemBow(GadgetManager manager)
{
super(manager, "Cupid's Arrows",
UtilText.splitLineToArray(C.cGray + "This symbol of love will live on with you forever! Mainly because we couldn't attach the cupid wings to it. I guess duct tape can't fix everything!", LineFormat.LORE),
-6, Material.BOW, (byte) 0, 1000, new Ammo("Cupid Arrow", "Cupid's Arrows", Material.ARROW, (byte) 0, UtilText.splitLineToArray(C.cGray + "Use these arrows to shoot love into people's hearts!", LineFormat.LORE), -6, 15));
Manager.getPacketManager().addPacketHandler(_packetHandler, PacketPlayOutSpawnEntity.class);
}
@Override
public void ActivateCustom(Player player)
{
_spawning = true;
Snowball arrow = player.launchProjectile(Snowball.class);
_spawning = false;
_arrows.add(arrow);
}
@EventHandler
public void onUpdate(UpdateEvent event)
{
if (event.getType() == UpdateType.TICK)
{
for (Snowball arrow : new HashSet<Snowball>(_arrows))
{
if (!arrow.isValid())
{
_arrows.remove(arrow);
continue;
}
UtilParticle.PlayParticleToAll(ParticleType.HEART, arrow.getLocation(), 0F, 0F, 0F, 0F, 1, ViewDist.LONGER);
}
}
}
@EventHandler
public void onHit(ProjectileHitEvent event)
{
if (!(event.getEntity() instanceof Snowball))
return;
Snowball arrow = (Snowball) event.getEntity();
if (!_arrows.contains(arrow))
return;
Bukkit.getScheduler().runTaskLater(Manager.getPlugin(), new Runnable()
{
@Override
public void run()
{
if (_arrows.remove(arrow))
{
arrow.remove();
UtilPlayer.message((Player) arrow.getShooter(), F.main(C.cRed + "Cupid", "You missed the shot!"));
}
}
}, 1);
}
@EventHandler
public void onDamage(EntityDamageByEntityEvent event)
{
if (!(event.getDamager() instanceof Snowball))
return;
Snowball arrow = (Snowball) event.getDamager();
if (!_arrows.contains(arrow))
return;
_arrows.remove(arrow);
arrow.remove();
Player shooter = (Player) arrow.getShooter();
if (event.getEntity() instanceof Creeper && event.getEntity().getCustomName().equalsIgnoreCase(C.cGreenB + "Carl the Creeper"))
{
UtilPlayer.message(shooter, F.main(C.cRed + "Cupid", "Nobody will ever replace Carla."));
return;
}
// Effects
if (event.getEntity() instanceof Player)
{
if (event.getEntity() == shooter)
{
UtilPlayer.message(shooter, F.main(C.cRed + "Cupid", "We've all been there."));
return;
}
UtilPlayer.message(shooter, F.main(C.cRed + "Cupid", "You hit " + F.name(UtilEnt.getName(event.getEntity())) + " with an arrow! I wonder how they're feeling..."));
((Player) event.getEntity()).addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 200, 40, false, false));
UtilPlayer.message(event.getEntity(), F.main(C.cRed + "Cupid", F.name(UtilEnt.getName(shooter)) + " hit you with an arrow! " + UtilMath.randomElement(_responses)));
}
UtilParticle.PlayParticleToAll(ParticleType.HEART, event.getEntity().getLocation(), .5F, .5F, .5F, 0F, 4, ViewDist.LONGER);
UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.WOOL, 14), event.getEntity().getLocation(), .5F, .5F, .5F, 0.0f, 5, ViewDist.NORMAL);
UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.WOOL, 6), event.getEntity().getLocation(), .5F, .5F, .5F, 0.0f, 5, ViewDist.NORMAL);
shooter.playSound(shooter.getLocation(), Sound.ORB_PICKUP, 0.5f, 0.5f);
// Entity damaged = event.getEntity();
// AxisAlignedBB bb = ((CraftEntity) damaged).getHandle().getBoundingBox();
//
// final Location loc = damaged.getLocation().clone();
// final AxisAlignedBB bounding = new AxisAlignedBB(bb.a, bb.b, bb.c, bb.d, bb.e, bb.f); // Clone it
//
// int i = 0;
// for (double rise = bounding.b ; rise < bounding.e ; rise += .2)
// {
// i++;
//
// final float y = (float) (rise - bounding.b);
// final float x = (float) (Math.sin(y) * 2);
// final float z = (float) (Math.cos(y) * 2);
//
// Bukkit.getScheduler().runTaskLater(Manager.getPlugin(), new Runnable()
// {
// @Override
// public void run()
// {
// UtilParticle.PlayParticleToAll(ParticleType.HEART, loc.clone().add(x, y, z), 0F, 0F, 0F, 0F, 1, ViewDist.LONGER);
// }
// }, i);
// }
}
}

View File

@ -69,7 +69,7 @@ public class ItemCoal extends ItemGadget
, -1, Material.COAL, (byte) 0, 1000, new Ammo("Coal", "1 Piece of Coal", Material.COAL, (byte) 0, new String[] , -1, Material.COAL, (byte) 0, 1000, new Ammo("Coal", "1 Piece of Coal", Material.COAL, (byte) 0, new String[]
{ {
C.cDGray + "Exclusive Coal!", C.cDGray + "Exclusive Coal!",
C.cDGray + "Earned by beeing naughty" C.cDGray + "Earned by being naughty"
} }
, -1, 1)); , -1, 1));
} }

View File

@ -68,7 +68,7 @@ public class ItemFleshHook extends ItemGadget implements IThrown
return; return;
if (target instanceof Player) if (target instanceof Player)
if (Manager.collideEvent(this, (Player) target)) if (Manager.collideEvent(player, this, (Player) target))
return; return;
//Pull //Pull

View File

@ -0,0 +1,115 @@
package mineplex.core.gadget.gadgets.item;
import mineplex.core.common.util.*;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.event.ItemGadgetOutOfAmmoEvent;
import mineplex.core.gadget.gadgets.Ammo;
import mineplex.core.gadget.types.ItemGadget;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.recharge.Recharge;
import mineplex.core.valentines.event.AttemptGiftEvent;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractAtEntityEvent;
import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.event.player.PlayerInteractEvent;
public class ItemFlowerGift extends ItemGadget
{
public ItemFlowerGift(GadgetManager manager)
{
super(manager,
"Valentines Gift",
UtilText.splitLineToArray(C.cGray + "Maybe if Sigils and Phinary used these they wouldn't be so alone", LineFormat.LORE),
-7,
Material.RED_ROSE,
(byte) 0,
6000,
new Ammo("Valentines Gift", "Valentines Gift", Material.RED_ROSE, (byte) 0, UtilText.splitLineToArray(C.cGray + "Maybe if Sigils and Phinary used these they wouldn't be so alone", LineFormat.LORE), -7, 10));
}
@Override
public void ActivateCustom(Player player)
{
}
@EventHandler(priority = EventPriority.LOWEST)
public void onInteract(PlayerInteractAtEntityEvent event)
{
Player player = event.getPlayer();
if (!IsActive(player))
return;
if (!UtilGear.isMat(player.getItemInHand(), GetDisplayMaterial()))
return;
if (!hasAmmo(player))
{
UtilPlayer.message(player, F.main("Gadget", "You do not have any " + GetName() + " left."));
ItemGadgetOutOfAmmoEvent ammoEvent = new ItemGadgetOutOfAmmoEvent(event.getPlayer(), this);
Bukkit.getServer().getPluginManager().callEvent(ammoEvent);
return;
}
//Recharge
if (!Recharge.Instance.use(player, GetName(), GetName(), _recharge, _recharge > 1000, true, false, true, "Cosmetics"))
{
UtilInv.Update(player);
return;
}
if (event.getRightClicked() instanceof Player)
{
Player to = ((Player) event.getRightClicked());
AttemptGiftEvent giftEvent = new AttemptGiftEvent(player, to);
Bukkit.getPluginManager().callEvent(giftEvent);
}
else
{
UtilPlayer.message(player, F.main("Gadget", "You used " + F.elem(GetName()) + " on " + F.name(event.getRightClicked().getName()) + ". It's not very effective..."));
}
event.setCancelled(true);
}
@Override
@EventHandler
public void Activate(PlayerInteractEvent event)
{
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK)
return;
if (!IsActive(event.getPlayer()))
return;
if (!UtilGear.isMat(event.getPlayer().getItemInHand(), GetDisplayMaterial()))
return;
//Recharge
if (!Recharge.Instance.use(event.getPlayer(), GetName(), GetName(), _recharge, false, true, false, true, "Cosmetics"))
return;
if (!hasAmmo(event.getPlayer()))
{
UtilPlayer.message(event.getPlayer(), F.main("Gadget", "You do not have any " + GetName() + " left."));
ItemGadgetOutOfAmmoEvent ammoEvent = new ItemGadgetOutOfAmmoEvent(event.getPlayer(), this);
Bukkit.getServer().getPluginManager().callEvent(ammoEvent);
return;
}
event.setCancelled(true);
// Logic is handled in onInteract (so we can cancel interact events on npc's)
UtilPlayer.message(event.getPlayer(), F.main("Gift", "Nothing happened... Maybe I should try giving this to someone?!"));
}
}

View File

@ -0,0 +1,191 @@
package mineplex.core.gadget.gadgets.item;
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.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilText;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.event.GadgetCollideEntityEvent;
import mineplex.core.gadget.event.ItemGadgetOutOfAmmoEvent;
import mineplex.core.gadget.gadgets.Ammo;
import mineplex.core.gadget.types.GadgetType;
import mineplex.core.gadget.types.ItemGadget;
import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.recharge.Recharge;
public class ItemLovePotion extends ItemGadget
{
private static final String[] DRINK_MESSAGES = {
"YUCK! This does not taste like it was meant for humans.",
"Gross! Why do I keep drinking this stuff... ",
"BAAAAA BAAAAAAAA. Weird, that made me feel a bit sheepish."
};
/**
* Created by: Mysticate
* Timestamp: February 6, 2016
*/
public ItemLovePotion(GadgetManager manager)
{
super(
manager,
"Love Potion",
UtilText.splitLineToArray(C.cGray + "It doesn't seem to affect humans..? What kind of love potion is this!?", LineFormat.LORE),
-6,
Material.POTION,
(byte) 8233,
20000,
new Ammo(
"Love Potion",
"Love Potion",
Material.POTION,
(byte) 8233,
UtilText.splitLineToArray(C.cGray + "It doesn't seem to affect humans..? What kind of love potion is this!?", LineFormat.LORE),
-6,
16)
);
}
@Override
public void ApplyItem(Player player, boolean inform)
{
Manager.removeGadgetType(player, GadgetType.Item);
_active.add(player);
List<String> itemLore = new ArrayList<String>();
itemLore.addAll(Arrays.asList(GetDescription()));
itemLore.add(C.cBlack);
itemLore.add(C.cWhite + "Your Ammo : " + Manager.getInventoryManager().Get(player).getItemCount(GetName()));
player.getInventory().setItem(Manager.getActiveItemSlot(), new ItemBuilder(GetDisplayMaterial(), GetDisplayData()).setTitle(F.item(Manager.getInventoryManager().Get(player).getItemCount(GetName()) + " " + GetName())).setHideInfo(true).build());
if (inform)
UtilPlayer.message(player, F.main("Gadget", "You equipped " + F.elem(GetName()) + "."));
}
@EventHandler
public void onInteract(PlayerInteractEntityEvent event)
{
Player player = event.getPlayer();
if (!UtilGear.isMat(event.getPlayer().getItemInHand(), GetDisplayMaterial()))
return;
if (!IsActive(player))
return;
if (!Recharge.Instance.use(player, "Interact Love Potion", 1000, false, false))
return;
event.setCancelled(true);
//Stock
if (!hasAmmo(player))
{
UtilPlayer.message(player, F.main("Gadget", "You do not have any " + GetName() + " left."));
ItemGadgetOutOfAmmoEvent ammoEvent = new ItemGadgetOutOfAmmoEvent(event.getPlayer(), this);
Bukkit.getServer().getPluginManager().callEvent(ammoEvent);
return;
}
if (!Recharge.Instance.usable(player, GetName()))
{
UtilInv.Update(player);
return;
}
GadgetCollideEntityEvent gadgetEvent = new GadgetCollideEntityEvent(player, this, event.getRightClicked());
gadgetEvent.setCancelled(true); // Pre cancel
Bukkit.getPluginManager().callEvent(gadgetEvent);
if (gadgetEvent.isCancelled())
return;
Recharge.Instance.use(player, GetName(), GetName(), _recharge, _recharge > 1000, true, false, true, "Cosmetics"); // Cooldown
Manager.getInventoryManager().addItemToInventory(player, GetName(), -1);
player.getInventory().setItem(Manager.getActiveItemSlot(), new ItemBuilder(GetDisplayMaterial(), GetDisplayData()).setTitle(F.item(Manager.getInventoryManager().Get(player).getItemCount(GetName()) + " " + GetName())).setHideInfo(true).build());
}
@EventHandler
public void Activate(PlayerInteractEvent event)
{
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK)
return;
if (UtilBlock.usable(event.getClickedBlock()))
return;
if (!UtilGear.isMat(event.getPlayer().getItemInHand(), this.GetDisplayMaterial()))
return;
Player player = event.getPlayer();
if (!IsActive(player))
return;
if (!Recharge.Instance.use(player, "Interact Love Potion", 500, false, false))
return;
event.setCancelled(true);
//Stock
if (!hasAmmo(player))
{
UtilPlayer.message(player, F.main("Gadget", "You do not have any " + GetName() + " left."));
ItemGadgetOutOfAmmoEvent ammoEvent = new ItemGadgetOutOfAmmoEvent(event.getPlayer(), this);
Bukkit.getServer().getPluginManager().callEvent(ammoEvent);
return;
}
//Recharge
if (!Recharge.Instance.use(player, GetName(), GetName(), _recharge, _recharge > 1000, true, false, true, "Cosmetics"))
{
UtilInv.Update(player);
return;
}
String message = UtilMath.randomElement(DRINK_MESSAGES);
UtilPlayer.message(player, F.main("Potion", message));
Manager.getInventoryManager().addItemToInventory(player, GetName(), -1);
player.getInventory().setItem(Manager.getActiveItemSlot(), new ItemBuilder(GetDisplayMaterial(), GetDisplayData()).setTitle(F.item(Manager.getInventoryManager().Get(player).getItemCount(GetName()) + " " + GetName())).setHideInfo(true).build());
ActivateCustom(event.getPlayer());
}
@Override
public void ActivateCustom(Player player)
{
player.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 400, 40, false, false));
}
}

View File

@ -1,7 +1,5 @@
package mineplex.core.gadget.gadgets.item; package mineplex.core.gadget.gadgets.item;
import java.util.HashSet;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -12,6 +10,7 @@ import org.bukkit.util.Vector;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.LineFormat; import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilText; import mineplex.core.common.util.UtilText;
import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.GadgetManager;
@ -22,7 +21,7 @@ import mineplex.core.gadget.types.ItemGadget;
public class ItemSnowball extends ItemGadget public class ItemSnowball extends ItemGadget
{ {
private HashSet<Snowball> _snowballs = new HashSet<>(); private NautHashMap<Snowball, Player> _snowballs = new NautHashMap<Snowball, Player>();
public ItemSnowball(GadgetManager manager) public ItemSnowball(GadgetManager manager)
{ {
@ -40,16 +39,21 @@ public class ItemSnowball extends ItemGadget
public void ActivateCustom(Player player) public void ActivateCustom(Player player)
{ {
Snowball ball = player.launchProjectile(Snowball.class); Snowball ball = player.launchProjectile(Snowball.class);
_snowballs.add(ball); _snowballs.put(ball, player);
ball.getWorld().playSound(ball.getLocation(), Sound.CHICKEN_EGG_POP, 1f, 0.3f); ball.getWorld().playSound(ball.getLocation(), Sound.CHICKEN_EGG_POP, 1f, 0.3f);
} }
@EventHandler @EventHandler
public void onHit(EntityDamageByEntityEvent event) public void onHit(EntityDamageByEntityEvent event)
{ {
if(!_snowballs.contains(event.getDamager())) return; if (!(event.getDamager() instanceof Snowball))
return;
GadgetCollideEntityEvent gevent = new GadgetCollideEntityEvent(this, event.getEntity()); Snowball ball = (Snowball) event.getDamager();
if(!_snowballs.containsKey(ball)) return;
GadgetCollideEntityEvent gevent = new GadgetCollideEntityEvent(_snowballs.remove(ball), this, event.getEntity());
if(gevent.isCancelled()) return; if(gevent.isCancelled()) return;

View File

@ -16,11 +16,11 @@ import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilText; import mineplex.core.common.util.UtilText;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.gadgets.Ammo; import mineplex.core.gadget.gadgets.Ammo;
import mineplex.core.gadget.types.ItemGadget; import mineplex.core.gadget.types.ItemGadget;
@ -29,7 +29,7 @@ import mineplex.core.updater.event.UpdateEvent;
public class ItemTNT extends ItemGadget public class ItemTNT extends ItemGadget
{ {
private HashSet<TNTPrimed> _tnt = new HashSet<TNTPrimed>(); private HashMap<TNTPrimed, Player> _tnt = new HashMap<TNTPrimed, Player>();
public ItemTNT(GadgetManager manager) public ItemTNT(GadgetManager manager)
{ {
@ -46,7 +46,7 @@ public class ItemTNT extends ItemGadget
TNTPrimed tnt = player.getWorld().spawn(player.getEyeLocation().add(player.getLocation().getDirection()), TNTPrimed.class); TNTPrimed tnt = player.getWorld().spawn(player.getEyeLocation().add(player.getLocation().getDirection()), TNTPrimed.class);
tnt.setYield(0.0F); // Added in order to prevent water from being evaporated. tnt.setYield(0.0F); // Added in order to prevent water from being evaporated.
UtilAction.velocity(tnt, player.getLocation().getDirection(), 0.6, false, 0, 0.2, 1, false); UtilAction.velocity(tnt, player.getLocation().getDirection(), 0.6, false, 0, 0.2, 1, false);
_tnt.add(tnt); _tnt.put(tnt, player);
//Inform //Inform
UtilPlayer.message(player, F.main("Skill", "You threw " + F.skill(GetName()) + ".")); UtilPlayer.message(player, F.main("Skill", "You threw " + F.skill(GetName()) + "."));
@ -58,13 +58,15 @@ public class ItemTNT extends ItemGadget
if (!(event.getEntity() instanceof TNTPrimed)) if (!(event.getEntity() instanceof TNTPrimed))
return; return;
if (!_tnt.remove(event.getEntity())) if (!_tnt.containsKey(event.getEntity()))
return; return;
Player killer = _tnt.get(event.getEntity());
HashMap<Player, Double> players = UtilPlayer.getInRadius(event.getLocation(), 8); HashMap<Player, Double> players = UtilPlayer.getInRadius(event.getLocation(), 8);
for (Player player : players.keySet()) for (Player player : players.keySet())
{ {
if (Manager.collideEvent(this, player)) if (Manager.collideEvent(killer, this, player))
continue; continue;
double mult = players.get(player); double mult = players.get(player);
@ -84,16 +86,12 @@ public class ItemTNT extends ItemGadget
if (event.getType() != UpdateType.FAST) if (event.getType() != UpdateType.FAST)
return; return;
Iterator<TNTPrimed> tntIterator = _tnt.iterator(); for (TNTPrimed tnt : new HashSet<TNTPrimed>(_tnt.keySet()))
while (tntIterator.hasNext())
{ {
TNTPrimed tnt = tntIterator.next();
if (!tnt.isValid() || tnt.getTicksLived() > 200) if (!tnt.isValid() || tnt.getTicksLived() > 200)
{ {
tnt.remove(); tnt.remove();
tntIterator.remove(); _tnt.remove(tnt);
} }
} }
} }

View File

@ -113,7 +113,7 @@ public class MorphCreeper extends MorphGadget
if (other.equals(player)) if (other.equals(player))
continue; continue;
if (Manager.collideEvent(this, other)) if (Manager.collideEvent(player, this, other))
continue; continue;
double mult = players.get(other); double mult = players.get(other);

View File

@ -135,7 +135,7 @@ public class MorphPig extends MorphGadget
if (UtilMath.offset(player, other) > range) if (UtilMath.offset(player, other) > range)
continue; continue;
if (Manager.collideEvent(this, other)) if (Manager.collideEvent(player, this, other))
continue; continue;
//Cooldown //Cooldown

View File

@ -143,7 +143,7 @@ public class MorphSnowman extends MorphGadget
if (!_snowball.containsKey(proj)) if (!_snowball.containsKey(proj))
return; return;
GadgetCollideEntityEvent gevent = new GadgetCollideEntityEvent(this, event.getEntity()); GadgetCollideEntityEvent gevent = new GadgetCollideEntityEvent(_snowball.remove(proj), this, event.getEntity());
if(gevent.isCancelled()) return; if(gevent.isCancelled()) return;

View File

@ -139,7 +139,7 @@ public class MorphTitan extends MorphGadget
for (Player ent : players.keySet()) for (Player ent : players.keySet())
{ {
if (ent instanceof Player) if (ent instanceof Player)
if (Manager.collideEvent(this, (Player)ent)) if (Manager.collideEvent(event.GetPlayer(), this, (Player)ent))
continue; continue;
double mult = players.get(ent); double mult = players.get(ent);

View File

@ -116,7 +116,7 @@ public class MorphVillager extends MorphGadget implements IThrown
return; return;
if (target instanceof Player) if (target instanceof Player)
if (Manager.collideEvent(this, (Player) target)) if (Manager.collideEvent((Player) data.GetThrower(), this, (Player) target))
return; return;
//Pull //Pull

View File

@ -128,7 +128,7 @@ public class MorphWither extends MorphGadget
HashMap<Player, Double> players = UtilPlayer.getInRadius(event.getLocation(), 6); HashMap<Player, Double> players = UtilPlayer.getInRadius(event.getLocation(), 6);
for (Player player : players.keySet()) for (Player player : players.keySet())
{ {
if (Manager.collideEvent(this, player)) if (Manager.collideEvent((Player) skull.getShooter(), this, player))
continue; continue;
double mult = players.get(player); double mult = players.get(player);

View File

@ -33,10 +33,10 @@ public class ParticleHeart extends ParticleGadget {
public ParticleHeart(GadgetManager manager) public ParticleHeart(GadgetManager manager)
{ {
super(manager, "I Heart You", super(manager, "Heartfelt Halo",
UtilText.splitLineToArray(C.cGray + "Show off how much you love Mineplex and everyone on it!", LineFormat.LORE), UtilText.splitLineToArray(C.cGray + "Share the love you feel in your heart with everybody near you!", LineFormat.LORE),
-2, -2,
Material.APPLE, (byte)0); Material.APPLE, (byte)0, "I Heart You");
} }
@EventHandler @EventHandler

View File

@ -0,0 +1,25 @@
package mineplex.core.gadget.set;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailHearts;
import mineplex.core.gadget.gadgets.death.DeathHearts;
import mineplex.core.gadget.gadgets.doublejump.DoubleJumpHearts;
import mineplex.core.gadget.gadgets.particle.ParticleHeart;
import mineplex.core.gadget.types.GadgetSet;
public class SetLove extends GadgetSet
{
/**
* Created by: Mysticate
* Timestamp: February 4, 2016
*/
public SetLove(GadgetManager manager)
{
super(manager, "Lovely!", "Coming Soon",
manager.getGadget(ArrowTrailHearts.class),
manager.getGadget(DeathHearts.class),
manager.getGadget(DoubleJumpHearts.class),
manager.getGadget(ParticleHeart.class));
}
}

View File

@ -68,13 +68,15 @@ public enum GameDisplay
Lobbers("Bomb Lobbers", Material.FIREBALL, (byte) 0, GameCategory.ARCADE, 54), Lobbers("Bomb Lobbers", Material.FIREBALL, (byte) 0, GameCategory.ARCADE, 54),
SpeedBuilders("Speed Builders", Material.QUARTZ_BLOCK, (byte) 0, GameCategory.CLASSICS, 60),
ChampionsCTF("Champions CTF", "Champions", Material.BANNER, DyeColor.RED.getDyeData(), GameCategory.CHAMPIONS, 56), ChampionsCTF("Champions CTF", "Champions", Material.BANNER, DyeColor.RED.getDyeData(), GameCategory.CHAMPIONS, 56),
BouncyBalls("Bouncy Balls", Material.SLIME_BALL, (byte)0, GameCategory.ARCADE, 57), BouncyBalls("Bouncy Balls", Material.SLIME_BALL, (byte)0, GameCategory.ARCADE, 57),
Gladiators("Gladiators", Material.IRON_SWORD, (byte)0, GameCategory.ARCADE, 58), Gladiators("Gladiators", Material.IRON_SWORD, (byte)0, GameCategory.ARCADE, 58),
TypeWars("Type Wars", Material.NAME_TAG, (byte) 0, GameCategory.CLASSICS, 59), TypeWars("Type Wars", Material.NAME_TAG, (byte) 0, GameCategory.CLASSICS, 59),
SpeedBuilders("Speed Builders", Material.QUARTZ_BLOCK, (byte) 0, GameCategory.CLASSICS, 60),
Valentines("Valentines Vendetta", Material.LEATHER, (byte)0, GameCategory.EXTRA, 60),
Event("Mineplex Event", Material.CAKE, (byte)0, GameCategory.EVENT, 999); Event("Mineplex Event", Material.CAKE, (byte)0, GameCategory.EVENT, 999);
String _name; String _name;

View File

@ -8,17 +8,17 @@ import java.sql.Types;
import java.util.HashMap; import java.util.HashMap;
import java.util.UUID; import java.util.UUID;
import org.bukkit.Bukkit; import mineplex.core.database.MinecraftRepository;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.database.DBPool; import mineplex.serverdata.database.DBPool;
import mineplex.core.database.RepositoryBase; import mineplex.serverdata.database.RepositoryBase;
import mineplex.core.database.ResultSetCallable; import mineplex.serverdata.database.ResultSetCallable;
import mineplex.core.database.column.ColumnInt; import mineplex.serverdata.database.column.ColumnInt;
import mineplex.core.database.column.ColumnVarChar; import mineplex.serverdata.database.column.ColumnVarChar;
import mineplex.serverdata.Region; import mineplex.serverdata.Region;
public class GiveawayRepository extends RepositoryBase public class GiveawayRepository extends MinecraftRepository
{ {
private static final String INSERT_GIVEAWAY = "INSERT INTO Account.accountGiveaway (giveawayId, accountId, cooldownId, region, serverName, time, uuid) VALUES (?, ?, ?, ?, ?, now(), ?)"; private static final String INSERT_GIVEAWAY = "INSERT INTO Account.accountGiveaway (giveawayId, accountId, cooldownId, region, serverName, time, uuid) VALUES (?, ?, ?, ?, ?, now(), ?)";
private static final String LOAD_GIVEAWAY = "SELECT id, name, prettyName, header, message, max, notifyNetwork, notifyCooldown, canWinTwice FROM Account.giveaway WHERE enabled = TRUE"; private static final String LOAD_GIVEAWAY = "SELECT id, name, prettyName, header, message, max, notifyNetwork, notifyCooldown, canWinTwice FROM Account.giveaway WHERE enabled = TRUE";

View File

@ -12,7 +12,6 @@ import mineplex.core.common.Rank;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.donation.DonationManager; import mineplex.core.donation.DonationManager;
import mineplex.core.giveaway.GiveawayManager;
import mineplex.core.globalpacket.command.GlobalPacketCommand; import mineplex.core.globalpacket.command.GlobalPacketCommand;
// import mineplex.core.globalpacket.listeners.GlobalGiveCoins; // import mineplex.core.globalpacket.listeners.GlobalGiveCoins;
// import mineplex.core.globalpacket.listeners.GlobalGiveGems; // import mineplex.core.globalpacket.listeners.GlobalGiveGems;
@ -35,7 +34,7 @@ public class GlobalPacketManager extends MiniPlugin
private DonationManager _donationManager; private DonationManager _donationManager;
private RewardManager _rewardManager; private RewardManager _rewardManager;
public GlobalPacketManager(JavaPlugin plugin, CoreClientManager clientManager, ServerStatusManager statusManager, InventoryManager inventoryManager, DonationManager donationManager, PetManager petManager, StatsManager statsManager, GiveawayManager giveawayManager) public GlobalPacketManager(JavaPlugin plugin, CoreClientManager clientManager, ServerStatusManager statusManager, InventoryManager inventoryManager, DonationManager donationManager, PetManager petManager, StatsManager statsManager)
{ {
super("Global Packet Manager", plugin); super("Global Packet Manager", plugin);
@ -44,7 +43,7 @@ public class GlobalPacketManager extends MiniPlugin
_inventoryManager = inventoryManager; _inventoryManager = inventoryManager;
_donationManager = donationManager; _donationManager = donationManager;
_rewardManager = new RewardManager(clientManager, statusManager, donationManager, inventoryManager, petManager, statsManager, giveawayManager, _rewardManager = new RewardManager(clientManager, statusManager, donationManager, inventoryManager, petManager, statsManager,
100, 250, 100, 250,
500, 1000, 500, 1000,
1500, 2500, 1500, 2500,

View File

@ -3,14 +3,15 @@ package mineplex.core.ignore.data;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import mineplex.core.database.DBPool; import mineplex.core.database.MinecraftRepository;
import mineplex.core.database.RepositoryBase; import mineplex.serverdata.database.DBPool;
import mineplex.core.database.column.ColumnVarChar; import mineplex.serverdata.database.RepositoryBase;
import mineplex.serverdata.database.column.ColumnVarChar;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
public class IgnoreRepository extends RepositoryBase public class IgnoreRepository extends MinecraftRepository
{ {
private static String ADD_IGNORE_RECORD = "INSERT INTO accountIgnore (uuidIgnorer, uuidIgnored) SELECT fA.uuid AS uuidIgnorer, tA.uuid AS uuidIgnored FROM accounts as fA LEFT JOIN accounts AS tA ON tA.name = ? WHERE fA.name = ?;"; private static String ADD_IGNORE_RECORD = "INSERT INTO accountIgnore (uuidIgnorer, uuidIgnored) SELECT fA.uuid AS uuidIgnorer, tA.uuid AS uuidIgnored FROM accounts as fA LEFT JOIN accounts AS tA ON tA.name = ? WHERE fA.name = ?;";
private static String DELETE_IGNORE_RECORD = "DELETE aF FROM accountIgnore AS aF INNER JOIN accounts as fA ON aF.uuidIgnorer = fA.uuid INNER JOIN accounts AS tA ON aF.uuidIgnored = tA.uuid WHERE fA.name = ? AND tA.name = ?;"; private static String DELETE_IGNORE_RECORD = "DELETE aF FROM accountIgnore AS aF INNER JOIN accounts as fA ON aF.uuidIgnorer = fA.uuid INNER JOIN accounts AS tA ON aF.uuidIgnored = tA.uuid WHERE fA.name = ? AND tA.name = ?;";

View File

@ -103,6 +103,13 @@ public class InventoryManager extends MiniDbClientPlugin<ClientInventory>
{ {
System.out.println("Add item to Inventory FAILED for " + player.getName()); System.out.println("Add item to Inventory FAILED for " + player.getName());
} }
else
{
if (_items.containsKey(item))
{
Get(player).addItem(new ClientItem(_items.get(item), count));
}
}
if (callback != null) if (callback != null)
callback.run(success); callback.run(success);

View File

@ -5,18 +5,19 @@ import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import mineplex.core.database.MinecraftRepository;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.NautHashMap;
import mineplex.core.database.DBPool; import mineplex.serverdata.database.DBPool;
import mineplex.core.database.RepositoryBase; import mineplex.serverdata.database.RepositoryBase;
import mineplex.core.database.ResultSetCallable; import mineplex.serverdata.database.ResultSetCallable;
import mineplex.core.database.column.ColumnInt; import mineplex.serverdata.database.column.ColumnInt;
import mineplex.core.database.column.ColumnVarChar; import mineplex.serverdata.database.column.ColumnVarChar;
import mineplex.core.inventory.ClientInventory; import mineplex.core.inventory.ClientInventory;
import mineplex.core.inventory.ClientItem; import mineplex.core.inventory.ClientItem;
public class InventoryRepository extends RepositoryBase public class InventoryRepository extends MinecraftRepository
{ {
private static String CREATE_INVENTORY_TABLE = "CREATE TABLE IF NOT EXISTS items (id INT NOT NULL AUTO_INCREMENT, name VARCHAR(100), rarity INT, PRIMARY KEY (id), INDEX mameIndex (name));"; private static String CREATE_INVENTORY_TABLE = "CREATE TABLE IF NOT EXISTS items (id INT NOT NULL AUTO_INCREMENT, name VARCHAR(100), rarity INT, PRIMARY KEY (id), INDEX mameIndex (name));";
private static String CREATE_INVENTORY_RELATION_TABLE = "CREATE TABLE IF NOT EXISTS accountInventory (id INT NOT NULL AUTO_INCREMENT, accountId INT NOT NULL, itemId INT NOT NULL, count INT NOT NULL, PRIMARY KEY (id), FOREIGN KEY (accountId) REFERENCES accounts(id), FOREIGN KEY (itemId) REFERENCES items(id), UNIQUE INDEX accountItemIndex (accountId, itemId));"; private static String CREATE_INVENTORY_RELATION_TABLE = "CREATE TABLE IF NOT EXISTS accountInventory (id INT NOT NULL AUTO_INCREMENT, accountId INT NOT NULL, itemId INT NOT NULL, count INT NOT NULL, PRIMARY KEY (id), FOREIGN KEY (accountId) REFERENCES accounts(id), FOREIGN KEY (itemId) REFERENCES items(id), UNIQUE INDEX accountItemIndex (accountId, itemId));";

View File

@ -1,9 +1,10 @@
package mineplex.core.leaderboard; package mineplex.core.leaderboard;
import mineplex.core.database.DBPool; import mineplex.core.database.MinecraftRepository;
import mineplex.core.database.RepositoryBase; import mineplex.serverdata.database.DBPool;
import mineplex.core.database.column.ColumnInt; import mineplex.serverdata.database.RepositoryBase;
import mineplex.core.database.column.ColumnVarChar; import mineplex.serverdata.database.column.ColumnInt;
import mineplex.serverdata.database.column.ColumnVarChar;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
@ -15,7 +16,7 @@ import org.bukkit.plugin.java.JavaPlugin;
* @author MrTwiggy * @author MrTwiggy
* *
*/ */
public class StatEventsRepository extends RepositoryBase public class StatEventsRepository extends MinecraftRepository
{ {
// Insert or update stat events query // Insert or update stat events query

View File

@ -209,8 +209,6 @@ public class MessageManager extends MiniClientPlugin<ClientMessage>
} }
} }
message = _chat.getFilteredMessage(from, message);
// Inform // Inform
UtilPlayer.message(from, C.cGold + "§l" + from.getName() + " > " + to.getName() + C.cYellow + " §l" + message); UtilPlayer.message(from, C.cGold + "§l" + from.getName() + " > " + to.getName() + C.cYellow + " §l" + message);
@ -230,11 +228,6 @@ public class MessageManager extends MiniClientPlugin<ClientMessage>
UtilPlayer.message(from, C.cPurple + "Please be patient if she does not reply instantly."); UtilPlayer.message(from, C.cPurple + "Please be patient if she does not reply instantly.");
} }
/*if(to.getName().equals("ishh"))
{
UtilPlayer.message(from, C.cPurple + "Hi, my name is ishh. If I don't respond to your message, please be patient and try again later!");
}*/
// Log // Log
// Logger().logChat("Private Message", from, to.getName(), message); // Logger().logChat("Private Message", from, to.getName(), message);
@ -495,26 +488,16 @@ public class MessageManager extends MiniClientPlugin<ClientMessage>
final FriendStatus friendInfo = friend; final FriendStatus friendInfo = friend;
new BukkitRunnable() runAsync(new Runnable()
{
@Override
public void run()
{ {
final String newMessage = _chat.getFilteredMessage(sender, message); final String newMessage = _chat.getFilteredMessage(sender, message);
@Override runSync(() -> sendMessage(sender, target, newMessage, adminMessage, isReply, friendInfo));
public void run()
{
new BukkitRunnable()
{
@Override
public void run()
{
sendMessage(sender, target, newMessage, adminMessage, isReply, friendInfo);
} }
});
}.runTask(getPlugin());
}
}.runTaskAsynchronously(getPlugin());
} }
private void sendMessage(final Player sender, String target, String message, final boolean adminMessage, boolean isReply, private void sendMessage(final Player sender, String target, String message, final boolean adminMessage, boolean isReply,

View File

@ -32,6 +32,7 @@ import mineplex.core.mount.types.MountSlime;
import mineplex.core.mount.types.MountSpider; import mineplex.core.mount.types.MountSpider;
import mineplex.core.mount.types.MountTitan; import mineplex.core.mount.types.MountTitan;
import mineplex.core.mount.types.MountUndead; import mineplex.core.mount.types.MountUndead;
import mineplex.core.mount.types.MountValentinesSheep;
import mineplex.core.mount.types.MountZombie; import mineplex.core.mount.types.MountZombie;
public class MountManager extends MiniPlugin public class MountManager extends MiniPlugin
@ -70,6 +71,7 @@ public class MountManager extends MiniPlugin
_types.add(new MountZombie(this)); _types.add(new MountZombie(this));
_types.add(new MountTitan(this)); _types.add(new MountTitan(this));
_types.add(new MountBabyReindeer(this)); _types.add(new MountBabyReindeer(this));
_types.add(new MountValentinesSheep(this));
//_types.add(new MountSheep(this)); //_types.add(new MountSheep(this));
} }

View File

@ -36,7 +36,7 @@ public class MountBabyReindeer extends HorseMount
Material.GOLDEN_CARROT, (byte) 0, -3, Color.CREAMY, Style.WHITEFIELD, Variant.HORSE, 0, null); Material.GOLDEN_CARROT, (byte) 0, -3, Color.CREAMY, Style.WHITEFIELD, Variant.HORSE, 0, null);
} }
@EventHandler @Override
public void EnableCustom(Player player) { public void EnableCustom(Player player) {
super.EnableCustom(player); super.EnableCustom(player);
Horse horse = GetActive().get(player).getEntity(); Horse horse = GetActive().get(player).getEntity();

View File

@ -0,0 +1,97 @@
package mineplex.core.mount.types;
import org.bukkit.DyeColor;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Horse;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import mineplex.core.common.util.C;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilText;
import mineplex.core.disguise.disguises.DisguiseBase;
import mineplex.core.disguise.disguises.DisguiseSheep;
import mineplex.core.mount.HorseMount;
import mineplex.core.mount.MountManager;
import mineplex.core.mount.SingleEntityMountData;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
public class MountValentinesSheep extends HorseMount
{
/**
* Created by: Mysticate
* Timestamp: February 4, 2016
*/
public MountValentinesSheep(MountManager manager)
{
super(manager, "Loving Sheeples",
UtilText.splitLineToArray(C.cGray + "This symbol of love will live on with you forever! Mainly because we couldn't attach the cupid wings to it. I guess duct tape can't fix everything!", LineFormat.LORE),
Material.WOOL, (byte) 6, -1, Horse.Color.BLACK, Horse.Style.NONE, Horse.Variant.HORSE, 1.0, null);
}
@Override
public void EnableCustom(Player player)
{
super.EnableCustom(player);
Horse horse = GetActive().get(player).getEntity();
UtilEnt.silence(horse, true);
DisguiseSheep disguise = new DisguiseSheep(horse);
disguise.setColor(DyeColor.PINK);
Manager.getDisguiseManager().disguise(disguise);
}
@EventHandler
public void doAnimations(UpdateEvent event)
{
for (SingleEntityMountData<Horse> ent : GetActive().values())
{
if (!ent.getEntity().isValid())
continue;
if (event.getType() == UpdateType.FASTEST)
{
Location loc = ent.getEntity().getLocation().clone().add(0, .5, 0);
UtilParticle.PlayParticleToAll(ParticleType.HEART, loc, .5F, .4F, .5F, 0F, 1, ViewDist.NORMAL);
UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.WOOL, 14), loc, .5F, .4F, .5F, 0.0f, 1, ViewDist.NORMAL);
UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.WOOL, 6), loc, .5F, .4F, .5F, 0.0f, 1, ViewDist.NORMAL);
}
else if (event.getType() == UpdateType.FAST)
{
DisguiseBase disguise = Manager.getDisguiseManager().getDisguise(ent.getEntity());
if (disguise instanceof DisguiseSheep)
{
DisguiseSheep sheep = (DisguiseSheep) disguise;
if (sheep.getColor() == 6) // Pink
{
sheep.setColor(DyeColor.RED);
}
else if (sheep.getColor() == 14) // Red
{
sheep.setColor(DyeColor.MAGENTA);
}
else if (sheep.getColor() == 2) // Magenta
{
sheep.setColor(DyeColor.PINK);
}
Manager.getDisguiseManager().updateDisguise(sheep);
}
}
}
}
}

View File

@ -11,25 +11,12 @@ import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.UUID; import java.util.UUID;
import org.bukkit.Bukkit; import org.bukkit.*;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.World;
import org.bukkit.configuration.InvalidConfigurationException; import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftCreature; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftCreature;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftLivingEntity; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftLivingEntity;
import org.bukkit.entity.Ageable; import org.bukkit.entity.*;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Skeleton;
import org.bukkit.entity.Slime;
import org.bukkit.entity.Villager;
import org.bukkit.entity.Zombie;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityCombustEvent; import org.bukkit.event.entity.EntityCombustEvent;
@ -51,7 +38,7 @@ import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.creature.Creature; import mineplex.core.creature.Creature;
import mineplex.core.creature.event.CreatureKillEntitiesEvent; import mineplex.core.creature.event.CreatureKillEntitiesEvent;
import mineplex.core.database.DBPool; import mineplex.serverdata.database.DBPool;
import mineplex.core.npc.command.NpcCommand; import mineplex.core.npc.command.NpcCommand;
import mineplex.core.npc.event.NpcDamageByEntityEvent; import mineplex.core.npc.event.NpcDamageByEntityEvent;
import mineplex.core.npc.event.NpcInteractEntityEvent; import mineplex.core.npc.event.NpcInteractEntityEvent;
@ -236,7 +223,7 @@ public class NpcManager extends MiniPlugin
event.setCancelled(true); event.setCancelled(true);
} }
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onPlayerInteractEntity(PlayerInteractEntityEvent event) public void onPlayerInteractEntity(PlayerInteractEntityEvent event)
{ {
if (event.getRightClicked() instanceof LivingEntity) if (event.getRightClicked() instanceof LivingEntity)
@ -350,6 +337,8 @@ public class NpcManager extends MiniPlugin
((Skeleton) entity).setSkeletonType(Skeleton.SkeletonType.valueOf(npc.getDatabaseRecord().getEntityMeta().toUpperCase())); ((Skeleton) entity).setSkeletonType(Skeleton.SkeletonType.valueOf(npc.getDatabaseRecord().getEntityMeta().toUpperCase()));
if (entity instanceof Villager && npc.getDatabaseRecord().getEntityMeta() != null) if (entity instanceof Villager && npc.getDatabaseRecord().getEntityMeta() != null)
((Villager) entity).setProfession(Villager.Profession.valueOf(npc.getDatabaseRecord().getEntityMeta().toUpperCase())); ((Villager) entity).setProfession(Villager.Profession.valueOf(npc.getDatabaseRecord().getEntityMeta().toUpperCase()));
if (entity instanceof Sheep && npc.getDatabaseRecord().getEntityMeta() != null)
((Sheep) entity).setColor(DyeColor.valueOf(npc.getDatabaseRecord().getEntityMeta().toUpperCase()));
if (entity instanceof org.bukkit.entity.Creature) if (entity instanceof org.bukkit.entity.Creature)
((org.bukkit.entity.Creature) entity).setTarget(null); ((org.bukkit.entity.Creature) entity).setTarget(null);

View File

@ -2,21 +2,21 @@ package mineplex.core.pet.repository;
import java.util.List; import java.util.List;
import mineplex.core.database.MinecraftRepository;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import com.google.gson.reflect.TypeToken; import com.google.gson.reflect.TypeToken;
import mineplex.core.database.DBPool; import mineplex.serverdata.database.DBPool;
import mineplex.core.database.RepositoryBase; import mineplex.serverdata.database.RepositoryBase;
import mineplex.core.database.column.ColumnInt; import mineplex.serverdata.database.column.ColumnInt;
import mineplex.core.database.column.ColumnVarChar; import mineplex.serverdata.database.column.ColumnVarChar;
import mineplex.core.pet.repository.token.PetChangeToken; import mineplex.core.pet.repository.token.PetChangeToken;
import mineplex.core.pet.repository.token.PetExtraToken; import mineplex.core.pet.repository.token.PetExtraToken;
import mineplex.core.pet.repository.token.PetSalesToken;
import mineplex.core.server.remotecall.AsyncJsonWebCall; import mineplex.core.server.remotecall.AsyncJsonWebCall;
import mineplex.core.server.remotecall.JsonWebCall; import mineplex.core.server.remotecall.JsonWebCall;
public class PetRepository extends RepositoryBase public class PetRepository extends MinecraftRepository
{ {
private String _webAddress; private String _webAddress;
@ -31,7 +31,7 @@ public class PetRepository extends RepositoryBase
{ {
new AsyncJsonWebCall(_webAddress + "Pets/AddPet").Execute(token); new AsyncJsonWebCall(_webAddress + "Pets/AddPet").Execute(token);
Plugin.getServer().getScheduler().runTaskAsynchronously(Plugin, new Runnable() getPlugin().getServer().getScheduler().runTaskAsynchronously(getPlugin(), new Runnable()
{ {
public void run() public void run()
{ {
@ -49,7 +49,7 @@ public class PetRepository extends RepositoryBase
{ {
new AsyncJsonWebCall(_webAddress + "Pets/RemovePet").Execute(token); new AsyncJsonWebCall(_webAddress + "Pets/RemovePet").Execute(token);
Plugin.getServer().getScheduler().runTaskAsynchronously(Plugin, new Runnable() getPlugin().getServer().getScheduler().runTaskAsynchronously(getPlugin(), new Runnable()
{ {
public void run() public void run()
{ {
@ -72,7 +72,7 @@ public class PetRepository extends RepositoryBase
{ {
new AsyncJsonWebCall(_webAddress + "Pets/UpdatePet").Execute(token); new AsyncJsonWebCall(_webAddress + "Pets/UpdatePet").Execute(token);
Plugin.getServer().getScheduler().runTaskAsynchronously(Plugin, new Runnable() getPlugin().getServer().getScheduler().runTaskAsynchronously(getPlugin(), new Runnable()
{ {
public void run() public void run()
{ {

View File

@ -6,18 +6,19 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
import mineplex.core.database.MinecraftRepository;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.database.DBPool; import mineplex.serverdata.database.DBPool;
import mineplex.core.database.RepositoryBase; import mineplex.serverdata.database.RepositoryBase;
import mineplex.core.database.ResultSetCallable; import mineplex.serverdata.database.ResultSetCallable;
import mineplex.core.database.column.ColumnInt; import mineplex.serverdata.database.column.ColumnInt;
import mineplex.core.database.column.ColumnVarChar; import mineplex.serverdata.database.column.ColumnVarChar;
/** /**
* Created by Shaun on 8/16/2014. * Created by Shaun on 8/16/2014.
*/ */
public class PollRepository extends RepositoryBase public class PollRepository extends MinecraftRepository
{ {
private static String CREATE_POLL_TABLE = "CREATE TABLE IF NOT EXISTS polls (id INT NOT NULL AUTO_INCREMENT, enabled BIT(1), question VARCHAR(256) NOT NULL, answerA VARCHAR(256) NOT NULL, answerB VARCHAR(256), answerC VARCHAR(256), answerD VARCHAR(256), coinReward INT NOT NULL, displayType INT DEFAULT 0 NOT NULL, PRIMARY KEY (id));"; private static String CREATE_POLL_TABLE = "CREATE TABLE IF NOT EXISTS polls (id INT NOT NULL AUTO_INCREMENT, enabled BIT(1), question VARCHAR(256) NOT NULL, answerA VARCHAR(256) NOT NULL, answerB VARCHAR(256), answerC VARCHAR(256), answerD VARCHAR(256), coinReward INT NOT NULL, displayType INT DEFAULT 0 NOT NULL, PRIMARY KEY (id));";
private static String CREATE_RELATION_TABLE = "CREATE TABLE IF NOT EXISTS accountPolls (id INT NOT NULL AUTO_INCREMENT, accountId INT NOT NULL, pollId INT NOT NULL, value TINYINT(1) NOT NULL, PRIMARY KEY (id), FOREIGN KEY (accountId) REFERENCES accounts(id), FOREIGN KEY (pollId) REFERENCES polls(id), UNIQUE INDEX accountPollIndex (accountId, pollId));"; private static String CREATE_RELATION_TABLE = "CREATE TABLE IF NOT EXISTS accountPolls (id INT NOT NULL AUTO_INCREMENT, accountId INT NOT NULL, pollId INT NOT NULL, value TINYINT(1) NOT NULL, PRIMARY KEY (id), FOREIGN KEY (accountId) REFERENCES accounts(id), FOREIGN KEY (pollId) REFERENCES polls(id), UNIQUE INDEX accountPollIndex (accountId, pollId));";

View File

@ -6,14 +6,15 @@ import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.Map.Entry; import java.util.Map.Entry;
import mineplex.core.database.MinecraftRepository;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.NautHashMap;
import mineplex.core.database.DBPool; import mineplex.serverdata.database.DBPool;
import mineplex.core.database.RepositoryBase; import mineplex.serverdata.database.RepositoryBase;
import mineplex.core.database.column.ColumnVarChar; import mineplex.serverdata.database.column.ColumnVarChar;
public class PreferencesRepository extends RepositoryBase public class PreferencesRepository extends MinecraftRepository
{ {
// private static String CREATE_ACCOUNT_TABLE = "CREATE TABLE IF NOT EXISTS // private static String CREATE_ACCOUNT_TABLE = "CREATE TABLE IF NOT EXISTS
// accountPreferences (id INT NOT NULL AUTO_INCREMENT, uuid VARCHAR(256), // accountPreferences (id INT NOT NULL AUTO_INCREMENT, uuid VARCHAR(256),

View File

@ -1,22 +1,14 @@
package mineplex.core.report; package mineplex.core.report;
import java.sql.PreparedStatement; import mineplex.core.database.MinecraftRepository;
import java.sql.ResultSet; import mineplex.serverdata.database.DBPool;
import java.sql.SQLException; import mineplex.serverdata.database.RepositoryBase;
import java.util.UUID; import mineplex.serverdata.database.column.ColumnInt;
import java.util.Map.Entry; import mineplex.serverdata.database.column.ColumnVarChar;
import mineplex.core.common.util.NautHashMap;
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.core.preferences.UserPreferences;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
public class ReportRepository extends RepositoryBase public class ReportRepository extends MinecraftRepository
{ {
/* /*
* *ReportTicket * *ReportTicket

View File

@ -39,7 +39,6 @@ public class RewardManager
private CoreClientManager _clientManager; private CoreClientManager _clientManager;
private DonationManager _donationManager; private DonationManager _donationManager;
private ServerStatusManager _statusManager; private ServerStatusManager _statusManager;
private GiveawayManager _giveawayManager;
private boolean _doubleGadgetValue; private boolean _doubleGadgetValue;
@ -48,7 +47,7 @@ public class RewardManager
private int _legendaryShards = 5000; private int _legendaryShards = 5000;
public RewardManager(CoreClientManager clientManager, ServerStatusManager statusManager, DonationManager donationManager, InventoryManager inventoryManager, PetManager petManager, StatsManager statsManager, GiveawayManager giveawayManager, public RewardManager(CoreClientManager clientManager, ServerStatusManager statusManager, DonationManager donationManager, InventoryManager inventoryManager, PetManager petManager, StatsManager statsManager,
int commonValueMin, int commonValueMax, int commonValueMin, int commonValueMax,
int uncommonValueMin, int uncommonValueMax, int uncommonValueMin, int uncommonValueMax,
int rareValueMin, int rareValueMax, int rareValueMin, int rareValueMax,
@ -67,7 +66,6 @@ public class RewardManager
_clientManager = clientManager; _clientManager = clientManager;
_statusManager = statusManager; _statusManager = statusManager;
_donationManager = donationManager; _donationManager = donationManager;
_giveawayManager = giveawayManager;
_doubleGadgetValue = doubleGadgetValue; _doubleGadgetValue = doubleGadgetValue;
_carlSpinner = carlSpinner; _carlSpinner = carlSpinner;
@ -101,6 +99,58 @@ public class RewardManager
maxValue *= 2; maxValue *= 2;
} }
// Valentines
addReward(RewardPool.Type.VALENTINES_GIFT, new InventoryReward(inventoryManager, "Cupid's Arrows", "Cupid's Arrows", 1, 5,
new ItemStack(Material.BOW, 1), rarity, 300, 0));
// Pets
addReward(RewardPool.Type.VALENTINES_GIFT, new PetReward(petManager, inventoryManager, donationManager, "Cow Pet", "Cow",
EntityType.COW, rarity, 50, _uncommonShards));
addReward(RewardPool.Type.VALENTINES_GIFT, new PetReward(petManager, inventoryManager, donationManager, "Sheep Pet", "Sheep",
EntityType.SHEEP, rarity, 50, _uncommonShards));
addReward(RewardPool.Type.VALENTINES_GIFT, new PetReward(petManager, inventoryManager, donationManager, "Mooshroom Pet", "Mooshroom",
EntityType.MUSHROOM_COW, rarity, 50, _uncommonShards));
addReward(RewardPool.Type.VALENTINES_GIFT, new PetReward(petManager, inventoryManager, donationManager, "Pig Pet", "Pig",
EntityType.PIG, rarity, 50, _uncommonShards));
addReward(RewardPool.Type.VALENTINES_GIFT, new PetReward(petManager, inventoryManager, donationManager, "Ocelot Pet", "Cat",
EntityType.OCELOT, rarity, 50, _uncommonShards));
addReward(RewardPool.Type.VALENTINES_GIFT, new PetReward(petManager, inventoryManager, donationManager, "Chicken Pet", "Chicken",
EntityType.CHICKEN, rarity, 50, _uncommonShards));
addReward(RewardPool.Type.VALENTINES_GIFT, new PetReward(petManager, inventoryManager, donationManager, "Wolf Pet", "Dog",
EntityType.WOLF, rarity, 50, _uncommonShards));
// Discs
addReward(RewardPool.Type.VALENTINES_GIFT, new UnknownPackageReward(donationManager, "Music Disc", "13 Disc", "13 Disc",
new ItemStack(2256), rarity, 10, _uncommonShards));
addReward(RewardPool.Type.VALENTINES_GIFT, new UnknownPackageReward(donationManager, "Music Disc", "Cat Disc", "Cat Disc",
new ItemStack(2257), rarity, 10, _uncommonShards));
addReward(RewardPool.Type.VALENTINES_GIFT, new UnknownPackageReward(donationManager, "Music Disc", "Blocks Disc", "Blocks Disc",
new ItemStack(2258), rarity, 10, _uncommonShards));
addReward(RewardPool.Type.VALENTINES_GIFT, new UnknownPackageReward(donationManager, "Music Disc", "Chirp Disc", "Chirp Disc",
new ItemStack(2259), rarity, 10, _uncommonShards));
addReward(RewardPool.Type.VALENTINES_GIFT, new UnknownPackageReward(donationManager, "Music Disc", "Far Disc", "Far Disc",
new ItemStack(2260), rarity, 10, _uncommonShards));
addReward(RewardPool.Type.VALENTINES_GIFT, new UnknownPackageReward(donationManager, "Music Disc", "Mall Disc", "Mall Disc",
new ItemStack(2261), rarity, 10, _uncommonShards));
addReward(RewardPool.Type.VALENTINES_GIFT, new UnknownPackageReward(donationManager, "Music Disc", "Mellohi Disc", "Mellohi Disc",
new ItemStack(2262), rarity, 10, _uncommonShards));
addReward(RewardPool.Type.VALENTINES_GIFT, new UnknownPackageReward(donationManager, "Music Disc", "Stal Disc", "Stal Disc",
new ItemStack(2263), rarity, 10, _uncommonShards));
addReward(RewardPool.Type.VALENTINES_GIFT, new UnknownPackageReward(donationManager, "Music Disc", "Strad Disc", "Strad Disc",
new ItemStack(2264), rarity, 10, _uncommonShards));
addReward(RewardPool.Type.VALENTINES_GIFT, new UnknownPackageReward(donationManager, "Music Disc", "Ward Disc", "Ward Disc",
new ItemStack(2265), rarity, 10, _uncommonShards));
addReward(RewardPool.Type.VALENTINES_GIFT, new UnknownPackageReward(donationManager, "Music Disc", "Wait Disc", "Wait Disc",
new ItemStack(2267), rarity, 10, _uncommonShards));
// Mounts
addReward(RewardPool.Type.VALENTINES_GIFT, new UnknownPackageReward(donationManager, "Mount", "Mule", "Mount Mule",
new ItemStack(Material.HAY_BLOCK), rarity, 4, _rareShards));
addReward(RewardPool.Type.VALENTINES_GIFT, new UnknownPackageReward(donationManager, "Mount", "Minecart", "Minecart",
new ItemStack(Material.MINECART), rarity, 3, _rareShards));
addReward(RewardPool.Type.VALENTINES_GIFT, new UnknownPackageReward(donationManager, "Mount", "Slime", "Slime Mount",
new ItemStack(Material.SLIME_BALL), rarity, 2, _rareShards));
addReward(RewardPool.Type.VALENTINES_GIFT, new UnknownPackageReward(donationManager, "Mount", "Glacial Steed", "Glacial Steed",
new ItemStack(Material.SNOW_BALL), rarity, 1, _rareShards));
// Christmas
addReward(RewardPool.Type.WINTER_HOLIDAY, new InventoryReward(inventoryManager, "Coal", "Coal", 50, 100, addReward(RewardPool.Type.WINTER_HOLIDAY, new InventoryReward(inventoryManager, "Coal", "Coal", 50, 100,
new ItemStack(Material.COAL), rarity, 10, 0)); new ItemStack(Material.COAL), rarity, 10, 0));
@ -162,6 +212,12 @@ public class RewardManager
maxValue *= 2; maxValue *= 2;
} }
// Valentines
addReward(RewardPool.Type.VALENTINES_GIFT, new InventoryReward(inventoryManager, "Love Potion", "Love Potion", 1, 1,
new ItemStack(Material.POTION, 1), rarity, 100, 0));
addReward(RewardPool.Type.VALENTINES_GIFT, new TreasureShardReward(_clientManager, donationManager, 100, 200, 25, rarity));
// Christmas
addReward(RewardPool.Type.WINTER_HOLIDAY, new InventoryReward(inventoryManager, "Freeze Cannon", "Freeze Cannon", 5, 10, addReward(RewardPool.Type.WINTER_HOLIDAY, new InventoryReward(inventoryManager, "Freeze Cannon", "Freeze Cannon", 5, 10,
new ItemStack(Material.ICE), rarity, 10, 0)); new ItemStack(Material.ICE), rarity, 10, 0));
addReward(RewardPool.Type.WINTER_HOLIDAY, new InventoryReward(inventoryManager, "Party Popper", "Party Popper", 5, 10, addReward(RewardPool.Type.WINTER_HOLIDAY, new InventoryReward(inventoryManager, "Party Popper", "Party Popper", 5, 10,
@ -257,6 +313,19 @@ public class RewardManager
// addReward(new CoinReward(donationManager, (int)minValue, (int)maxValue, 100, RewardRarity.RARE)); // addReward(new CoinReward(donationManager, (int)minValue, (int)maxValue, 100, RewardRarity.RARE));
} }
// Valentines
addReward(RewardPool.Type.VALENTINES_GIFT, new UnknownPackageReward(donationManager, "Hat", "Companion Hat", "Companion",
SkinData.COMPANION_CUBE.getSkull(), rarity, 100, 0));
addReward(RewardPool.Type.VALENTINES_GIFT, new UnknownPackageReward(donationManager, "Hat", "Lovestruck Hat", "Lovestruck",
SkinData.LOVESTRUCK.getSkull(), rarity, 100, 0));
addReward(RewardPool.Type.VALENTINES_GIFT, new UnknownPackageReward(donationManager, "Hat", "Secret Package Hat", "Secret Package",
SkinData.SECRET_PACKAGE.getSkull(), rarity, 100, 0));
addReward(RewardPool.Type.VALENTINES_GIFT, new UnknownPackageReward(donationManager, "Hat", "Teddy Bear Hat", "Teddy Bear",
SkinData.TEDDY_BEAR.getSkull(), rarity, 100, 0));
addReward(RewardPool.Type.VALENTINES_GIFT, new InventoryReward(inventoryManager, "Love Potion", "Love Potion", 1, 1,
new ItemStack(Material.POTION, 1), rarity, 1, 0));
// Christmas
addReward(RewardPool.Type.WINTER_HOLIDAY, new UnknownPackageReward(donationManager, "Hat", "Santa", "Santa", addReward(RewardPool.Type.WINTER_HOLIDAY, new UnknownPackageReward(donationManager, "Hat", "Santa", "Santa",
SkinData.SANTA.getSkull(), rarity, 5, _rareShards)); SkinData.SANTA.getSkull(), rarity, 5, _rareShards));
addReward(RewardPool.Type.WINTER_HOLIDAY, new PetReward(petManager, inventoryManager, donationManager, "Elf", "Christmas Elf", addReward(RewardPool.Type.WINTER_HOLIDAY, new PetReward(petManager, inventoryManager, donationManager, "Elf", "Christmas Elf",
@ -326,6 +395,19 @@ public class RewardManager
// addReward(new CoinReward(donationManager, (int)minValue, (int)maxValue, 25, rarity)); // addReward(new CoinReward(donationManager, (int)minValue, (int)maxValue, 25, rarity));
} }
// Valentines
addReward(RewardPool.Type.VALENTINES_GIFT, new UnknownPackageReward(donationManager, "Arrow Effect", "Arrows of Cupid", "Arrows of Cupid",
new ItemStack(Material.POTION), rarity, 100, _rareShards));
addReward(RewardPool.Type.VALENTINES_GIFT, new UnknownPackageReward(donationManager, "Death Effect", "Broken Hearted", "Broken Hearted",
new ItemStack(Material.POTION), rarity, 100, _rareShards));
addReward(RewardPool.Type.VALENTINES_GIFT, new UnknownPackageReward(donationManager, "Jump Effect", "Wings of Love", "Wings of Love",
new ItemStack(Material.POTION), rarity, 100, _rareShards));
addReward(RewardPool.Type.VALENTINES_GIFT, new UnknownPackageReward(donationManager, "Particles", "Heartfelt Halo", "Heartfelt Halo",
new ItemStack(Material.POTION), rarity, 100, _rareShards));
addReward(RewardPool.Type.VALENTINES_GIFT, new InventoryReward(inventoryManager, "Love Potion", "Love Potion", 1, 1,
new ItemStack(Material.POTION, 1), rarity, 2, 0));
// Christmas
addReward(RewardPool.Type.WINTER_HOLIDAY, new UnknownPackageReward(donationManager, "Hat", "The Grinch", "The Grinch", addReward(RewardPool.Type.WINTER_HOLIDAY, new UnknownPackageReward(donationManager, "Hat", "The Grinch", "The Grinch",
SkinData.THE_GRINCH.getSkull(), rarity, 5, _legendaryShards)); SkinData.THE_GRINCH.getSkull(), rarity, 5, _legendaryShards));
addReward(RewardPool.Type.WINTER_HOLIDAY, new UnknownPackageReward(donationManager, "Morph", "Olaf", "Olaf Morph", addReward(RewardPool.Type.WINTER_HOLIDAY, new UnknownPackageReward(donationManager, "Morph", "Olaf", "Olaf Morph",
@ -480,7 +562,7 @@ public class RewardManager
} }
} }
if (!isExcluded) if (!isExcluded && (pool.getUseDuplicates() || treasure.canGiveReward(player)))
{ {
possibleRewards.add(treasure); possibleRewards.add(treasure);
totalWeight += treasure.getWeight(); totalWeight += treasure.getWeight();

View File

@ -34,7 +34,20 @@ public class RewardPool
public static enum Type public static enum Type
{ {
NORMAL, NORMAL(true),
WINTER_HOLIDAY; WINTER_HOLIDAY(true),
VALENTINES_GIFT(false);
private boolean _useDuplicates;
Type(boolean useDuplicates)
{
_useDuplicates = useDuplicates;
}
public boolean getUseDuplicates()
{
return _useDuplicates;
}
} }
} }

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