API 1.16.1

This commit is contained in:
tr7zw 2020-06-27 15:19:40 +02:00
parent b08ee86c99
commit 928002b2b9
90 changed files with 29 additions and 2172 deletions

@ -1 +1 @@
Subproject commit 98e9d5b19201b71db13e2d57846c935b19b10764
Subproject commit 6b221e20347786520a7a56d9430d6e5362b9a54e

View File

@ -1,6 +1,7 @@
cd Tuinity
git fetch
git reset --hard origin/head
git reset --hard origin/ver/1.16
git submodule update --init --recursive -f
cd ..
sh patchPaper.sh
cd Tuinity

View File

@ -1,17 +1,17 @@
From 3f7f02d0d9e68b60c6c92144fc458afd99a64eb2 Mon Sep 17 00:00:00 2001
From 8fb20c925ac9da854016fa50004c8c946c7fe54e Mon Sep 17 00:00:00 2001
From: tr7zw <tr7zw@live.de>
Date: Wed, 26 Feb 2020 17:03:06 +0100
Subject: [PATCH] Modify POM
---
pom.xml | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
pom.xml | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/pom.xml b/pom.xml
index bab0b017..4bb7efe9 100644
index 85573acf8..1328fe869 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,18 +3,19 @@
@@ -3,18 +3,18 @@
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>
<parent>
@ -24,9 +24,8 @@ index bab0b017..4bb7efe9 100644
</parent>
- <artifactId>tuinity-api</artifactId>
+ <groupId>de.tr7zw.yapfa</groupId>
+ <artifactId>yapfa-api</artifactId>
<version>1.15.2-R0.1-SNAPSHOT</version>
<version>1.16.1-R0.1-SNAPSHOT</version>
<packaging>jar</packaging>
- <name>Tuinity-API</name>

View File

@ -1,105 +0,0 @@
From e72605a4f618a89a89976cc645ed73c24905831c Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sat, 15 Jun 2013 23:19:03 -0400
Subject: [PATCH] EMC ItemStack isSimiliar API to skip durability and name
checks
Skip Durability is useful if you simply want to see if an item type is the same for weapons
Skip Item Name is useful if you want to treat a renamed item the same as an unrenamed item, when lore is involved
For example, lore can be used to identify a custom item, but then if a player renames it, the isSimilar breaks.
This new boolean allows you to verify if the item is the same ignoring the name field by temporarily nulling it during the check.
---
.../java/org/bukkit/inventory/ItemStack.java | 66 ++++++++++++++++++-
1 file changed, 65 insertions(+), 1 deletion(-)
diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java
index d7d6a3e8..291285aa 100644
--- a/src/main/java/org/bukkit/inventory/ItemStack.java
+++ b/src/main/java/org/bukkit/inventory/ItemStack.java
@@ -281,16 +281,80 @@ public class ItemStack implements Cloneable, ConfigurationSerializable {
* @param stack the item stack to compare to
* @return true if the two stacks are equal, ignoring the amount
*/
+ // Paper start - add API to skip checking durability and item name
@Utility
public boolean isSimilar(@Nullable ItemStack stack) {
+ return isSimilar(stack, false);
+ }
+
+ /**
+ * This method is the same as equals, but does not consider stack size
+ * (amount).
+ *
+ * @param stack the item stack to compare to
+ * @param skipDur Ignore differences in durability
+ * @return true if the two stacks are equal, ignoring the amount, and optionally durability
+ */
+ @Utility
+ public boolean isSimilar(@Nullable ItemStack stack, boolean skipDur) {
+ return isSimilar(stack, skipDur, false);
+ }
+
+ /**
+ * This method is the same as equals, but does not consider stack size
+ * (amount).
+ *
+ * @param stack the item stack to compare to
+ * @param skipDur Ignore differences in durability
+ * @param skipCheckingName Ignore differences in display name
+ * @return true if the two stacks are equal, ignoring the amount, and optionally durability/name
+ */
+ @Utility
+ public boolean isSimilar(@Nullable ItemStack stack, boolean skipDur, boolean skipCheckingName) {
if (stack == null) {
return false;
}
if (stack == this) {
return true;
}
+
Material comparisonType = (this.type.isLegacy()) ? Bukkit.getUnsafe().fromLegacy(this.getData(), true) : this.type; // This may be called from legacy item stacks, try to get the right material
- return comparisonType == stack.getType() && getDurability() == stack.getDurability() && hasItemMeta() == stack.hasItemMeta() && (hasItemMeta() ? Bukkit.getItemFactory().equals(getItemMeta(), stack.getItemMeta()) : true);
+ if (comparisonType != stack.getType() || (!skipDur && getDurability() != stack.getDurability())) {
+ return false;
+ }
+ final boolean hasMeta1 = hasItemMeta();
+ final boolean hasMeta2 = stack.hasItemMeta();
+ if (!hasMeta1 && !hasMeta2) {
+ return true;
+ }
+
+ final ItemMeta meta1 = hasMeta1 ? getItemMeta() : null;
+ final ItemMeta meta2 = hasMeta2 ? stack.getItemMeta() : null;
+
+ final String prevName1 = meta1 != null ? meta1.getDisplayName() : null;
+ final String prevName2 = meta2 != null ? meta2.getDisplayName() : null;
+ if (skipCheckingName) {
+ if (meta1 != null) {
+ meta1.setDisplayName(null);
+ }
+ if (meta2 != null) {
+ meta2.setDisplayName(null);
+ }
+ }
+
+ try {
+ return Bukkit.getItemFactory().equals(meta1, meta2);
+ } finally {
+ if (skipCheckingName) {
+ if (meta1 != null) {
+ meta1.setDisplayName(prevName1);
+ }
+ if (meta2 != null) {
+ meta2.setDisplayName(prevName2);
+ }
+ }
+ }
+ // Paper end
}
@NotNull
--
2.25.1.windows.1

View File

@ -1,4 +1,4 @@
From 52f749da74d25a52cffdfcfe3074c9c4fc3956fb Mon Sep 17 00:00:00 2001
From d3a4fd51f8bdd2da33da8db08ce0bba90bbe9eae Mon Sep 17 00:00:00 2001
From: tr7zw <tr7zw@live.de>
Date: Wed, 26 Feb 2020 20:10:31 +0100
Subject: [PATCH] Kill AnnotationTest

View File

@ -1,4 +1,4 @@
From 13418a9704424199ec438a0902be3707801ed055 Mon Sep 17 00:00:00 2001
From e6764aeb9184e2b0b67261d7f5bad3b22c4cfb42 Mon Sep 17 00:00:00 2001
From: tr7zw <tr7zw@live.de>
Date: Wed, 26 Feb 2020 22:21:14 +0100
Subject: [PATCH] Add GameProfileLookupEvent
@ -10,10 +10,10 @@ Subject: [PATCH] Add GameProfileLookupEvent
create mode 100644 src/main/java/de/tr7zw/yapfa/events/GameProfileLookupEvent.java
diff --git a/pom.xml b/pom.xml
index b9d515237..9b9e8c5c3 100644
index 1328fe869..1394dbd8f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -40,6 +40,10 @@
@@ -39,6 +39,10 @@
<id>sonatype</id>
<url>https://oss.sonatype.org/content/groups/public/</url>
</repository>
@ -24,7 +24,7 @@ index b9d515237..9b9e8c5c3 100644
</repositories>
<pluginRepositories>
@@ -50,6 +54,13 @@
@@ -49,6 +53,13 @@
</pluginRepositories>
<dependencies>

View File

@ -1,25 +0,0 @@
From d4186dbbc8621facafd0c7b2dd02260435577000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 3 Jun 2015 21:39:34 -0400
Subject: [PATCH] EMC Ignore completion starting with _
---
src/main/java/org/bukkit/command/SimpleCommandMap.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/main/java/org/bukkit/command/SimpleCommandMap.java b/src/main/java/org/bukkit/command/SimpleCommandMap.java
index 460fda05..a8e33960 100644
--- a/src/main/java/org/bukkit/command/SimpleCommandMap.java
+++ b/src/main/java/org/bukkit/command/SimpleCommandMap.java
@@ -218,7 +218,7 @@ public class SimpleCommandMap implements CommandMap {
String name = commandEntry.getKey(); // Use the alias, not command name
- if (StringUtil.startsWithIgnoreCase(name, cmdLine)) {
+ if (name.charAt(0) != '_' && StringUtil.startsWithIgnoreCase(name, cmdLine)) { // EMC
completions.add(prefix + name);
}
}
--
2.25.1.windows.1

View File

@ -1,4 +1,4 @@
From 57d7a7ef1af8f2c43b23e1ac143990866a7dc861 Mon Sep 17 00:00:00 2001
From e2bd08ef856e14e38d65c094a0723e95b3bb635c Mon Sep 17 00:00:00 2001
From: tr7zw <tr7zw@live.de>
Date: Thu, 5 Mar 2020 21:13:14 +0100
Subject: [PATCH] Add getLastTickMs() api
@ -9,10 +9,10 @@ Subject: [PATCH] Add getLastTickMs() api
2 files changed, 19 insertions(+)
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index a9c10228e..53589303e 100644
index 329e2dd1c..0d1105413 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -1712,6 +1712,14 @@ public final class Bukkit {
@@ -1744,6 +1744,14 @@ public final class Bukkit {
return server.getMobGoals();
}
// Paper end
@ -28,10 +28,10 @@ index a9c10228e..53589303e 100644
@NotNull
public static Server.Spigot spigot() {
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index cf20e7541..771827d80 100644
index 959e4e7e7..544ccd353 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1504,4 +1504,15 @@ public interface Server extends PluginMessageRecipient {
@@ -1532,4 +1532,15 @@ public interface Server extends PluginMessageRecipient {
@NotNull
com.destroystokyo.paper.entity.ai.MobGoals getMobGoals();
// Paper end

View File

@ -1,92 +0,0 @@
From bf1346bd3ddefd7bbf005af9b9c78d3c85fca4b0 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 3 Jan 2016 22:02:53 -0500
Subject: [PATCH] EMC Add UnknownCommandEvent
---
.../customevents/UnknownCommandEvent.java | 59 +++++++++++++++++++
.../org/bukkit/command/SimpleCommandMap.java | 2 +-
2 files changed, 60 insertions(+), 1 deletion(-)
create mode 100644 src/main/java/com/empireminecraft/customevents/UnknownCommandEvent.java
diff --git a/src/main/java/com/empireminecraft/customevents/UnknownCommandEvent.java b/src/main/java/com/empireminecraft/customevents/UnknownCommandEvent.java
new file mode 100644
index 00000000..071ca87d
--- /dev/null
+++ b/src/main/java/com/empireminecraft/customevents/UnknownCommandEvent.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2016. Starlis LLC / dba Empire Minecraft
+ *
+ * This source code is proprietary software and must not be redistributed without Starlis LLC's approval
+ *
+ */
+
+package com.empireminecraft.customevents;
+
+import org.bukkit.command.CommandSender;
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+
+public class UnknownCommandEvent extends Event implements Cancellable {
+ private final CommandSender sender;
+ private final String sentCommandLabel;
+ private final String commandLine;
+
+ public UnknownCommandEvent(CommandSender sender, String sentCommandLabel, String commandLine) {
+ this.sender = sender;
+ this.sentCommandLabel = sentCommandLabel;
+ this.commandLine = commandLine;
+ }
+
+ public CommandSender getSender() {
+ return sender;
+ }
+
+ public String getSentCommandLabel() {
+ return sentCommandLabel;
+ }
+
+ public String getCommandLine() {
+ return commandLine;
+ }
+
+ private static final HandlerList handlers = new HandlerList();
+
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+ private boolean cancelled = false;
+
+ @Override
+ public boolean isCancelled() {
+ return cancelled;
+ }
+
+ @Override
+ public void setCancelled(boolean cancel) {
+ cancelled = cancel;
+ }
+}
diff --git a/src/main/java/org/bukkit/command/SimpleCommandMap.java b/src/main/java/org/bukkit/command/SimpleCommandMap.java
index a8e33960..e917b0df 100644
--- a/src/main/java/org/bukkit/command/SimpleCommandMap.java
+++ b/src/main/java/org/bukkit/command/SimpleCommandMap.java
@@ -144,7 +144,7 @@ public class SimpleCommandMap implements CommandMap {
Command target = getCommand(sentCommandLabel);
if (target == null) {
- return false;
+ return !(new com.empireminecraft.customevents.UnknownCommandEvent(sender, sentCommandLabel, commandLine).callEvent()); // EMC
}
// Paper start - Plugins do weird things to workaround normal registration
--
2.25.1.windows.1

View File

@ -1,4 +1,4 @@
From b5a55ea43296414f1d165aa3bd643e9fc5ca4299 Mon Sep 17 00:00:00 2001
From f649be2d0b23094e667771a20cf7d5f1ad805ed1 Mon Sep 17 00:00:00 2001
From: tr7zw <tr7zw@live.de>
Date: Thu, 2 Apr 2020 18:49:56 +0200
Subject: [PATCH] Add NBT-API as first-class lib
@ -11,10 +11,10 @@ Subject: [PATCH] Add NBT-API as first-class lib
4 files changed, 56 insertions(+)
diff --git a/pom.xml b/pom.xml
index 9b9e8c5c3..bd1fc68a6 100644
index 1394dbd8f..acf15bcf9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -44,6 +44,11 @@
@@ -43,6 +43,11 @@
<id>mojang</id>
<url>https://libraries.minecraft.net/</url>
</repository>
@ -26,19 +26,19 @@ index 9b9e8c5c3..bd1fc68a6 100644
</repositories>
<pluginRepositories>
@@ -158,6 +163,11 @@
@@ -157,6 +162,11 @@
<artifactId>asm-commons</artifactId>
<version>8.0.1</version>
</dependency>
+ <dependency>
+ <groupId>de.tr7zw</groupId>
+ <artifactId>item-nbt-api</artifactId>
+ <version>2.4.0-SNAPSHOT</version>
+ <version>2.4.1</version>
+ </dependency>
</dependencies>
<build>
@@ -228,6 +238,12 @@
@@ -227,6 +237,12 @@
<dependencyReducedPomLocation>${project.build.directory}/dependency-reduced-pom.xml</dependencyReducedPomLocation>
<!-- when downloading via Maven we can pull depends individually -->
<shadedArtifactAttached>true</shadedArtifactAttached>
@ -104,7 +104,7 @@ index 3f0f38031..771e7ea73 100644
+ // YAPFA end
}
diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java
index eed5110bd..69d90f7d9 100644
index ccd81fca2..433d29ba0 100644
--- a/src/main/java/org/bukkit/inventory/ItemStack.java
+++ b/src/main/java/org/bukkit/inventory/ItemStack.java
@@ -1,6 +1,10 @@
@ -118,7 +118,7 @@ index eed5110bd..69d90f7d9 100644
import java.util.LinkedHashMap;
import java.util.List; // Paper
import java.util.Map;
@@ -855,4 +859,20 @@ public class ItemStack implements Cloneable, ConfigurationSerializable {
@@ -791,4 +795,20 @@ public class ItemStack implements Cloneable, ConfigurationSerializable {
return itemMeta.hasItemFlag(flag);
}
// Paper end

View File

@ -1,69 +0,0 @@
From a9ae2995a9f48f0ceec5d1c68bf0f2604e0e679c Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 27 Apr 2016 02:14:00 -0400
Subject: [PATCH] EMC Rework Spigot Deprecations
Deprecate Inventory.getContents because md5 likes to make stupid changes
Undeprecate (get/set)MaxHealth
---
src/main/java/org/bukkit/entity/Damageable.java | 4 ----
src/main/java/org/bukkit/inventory/Inventory.java | 7 +++++--
2 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/src/main/java/org/bukkit/entity/Damageable.java b/src/main/java/org/bukkit/entity/Damageable.java
index fc4d3bcd..13e8ce4d 100644
--- a/src/main/java/org/bukkit/entity/Damageable.java
+++ b/src/main/java/org/bukkit/entity/Damageable.java
@@ -60,9 +60,7 @@ public interface Damageable extends Entity {
* Gets the maximum health this entity has.
*
* @return Maximum health
- * @deprecated use {@link Attribute#GENERIC_MAX_HEALTH}.
*/
- @Deprecated
double getMaxHealth();
/**
@@ -75,9 +73,7 @@ public interface Damageable extends Entity {
* {@link Wither}, etc...} will have their bar scaled accordingly.
*
* @param health amount of health to set the maximum to
- * @deprecated use {@link Attribute#GENERIC_MAX_HEALTH}.
*/
- @Deprecated
void setMaxHealth(double health);
/**
diff --git a/src/main/java/org/bukkit/inventory/Inventory.java b/src/main/java/org/bukkit/inventory/Inventory.java
index 01fe217d..730f6e0f 100644
--- a/src/main/java/org/bukkit/inventory/Inventory.java
+++ b/src/main/java/org/bukkit/inventory/Inventory.java
@@ -156,20 +156,23 @@ public interface Inventory extends Iterable<ItemStack> {
/**
* Returns all ItemStacks from the inventory
*
- * @return An array of ItemStacks from the inventory. Individual items may be null.
+ * @deprecated because people love breaking API's for no reason. you probally want @{see {@link #getStorageContents()}}
+ * @return An array of ItemStacks from the inventory.
*/
- @NotNull
+ @Deprecated @NotNull
public ItemStack[] getContents();
/**
* Completely replaces the inventory's contents. Removes all existing
* contents and replaces it with the ItemStacks given in the array.
*
+ @deprecated because people love breaking API's for no reason. you probally want @{see {@link #setStorageContents(ItemStack[])}}
* @param items A complete replacement for the contents; the length must
* be less than or equal to {@link #getSize()}.
* @throws IllegalArgumentException If the array has more items than the
* inventory.
*/
+ @Deprecated
public void setContents(@NotNull ItemStack[] items) throws IllegalArgumentException;
/**
--
2.25.1.windows.1

View File

@ -1,4 +1,4 @@
From 4794bde4a196219c0f7e564dbb98805fde222ced Mon Sep 17 00:00:00 2001
From b9aa28e48ad85980e0004b20d6ff412e54abd34c Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 24 Apr 2017 20:27:23 -0400
Subject: [PATCH] EMC Add ChatColor.getById
@ -9,7 +9,7 @@ Bukkit has had a map of this for years and it was totally unused...
1 file changed, 20 insertions(+)
diff --git a/src/main/java/org/bukkit/ChatColor.java b/src/main/java/org/bukkit/ChatColor.java
index a0ef2a827..eb60aedba 100644
index 44d597d7a..3461c5a86 100644
--- a/src/main/java/org/bukkit/ChatColor.java
+++ b/src/main/java/org/bukkit/ChatColor.java
@@ -263,6 +263,15 @@ public enum ChatColor {

View File

@ -1,89 +0,0 @@
From a634bb4e44b87f66984e2c2a1e791327c2e6d202 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 21 Nov 2016 17:02:11 -0500
Subject: [PATCH] EMC MonsterEggSpawn Events
---
.../customevents/MonsterEggSpawnEvent.java | 70 +++++++++++++++++++
1 file changed, 70 insertions(+)
create mode 100644 src/main/java/com/empireminecraft/customevents/MonsterEggSpawnEvent.java
diff --git a/src/main/java/com/empireminecraft/customevents/MonsterEggSpawnEvent.java b/src/main/java/com/empireminecraft/customevents/MonsterEggSpawnEvent.java
new file mode 100644
index 00000000..cb54d6d5
--- /dev/null
+++ b/src/main/java/com/empireminecraft/customevents/MonsterEggSpawnEvent.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2016. Starlis LLC / dba Empire Minecraft
+ *
+ * This source code is proprietary software and must not be redistributed without Starlis LLC's approval
+ *
+ */
+
+package com.empireminecraft.customevents;
+
+
+import org.bukkit.entity.HumanEntity;
+import org.bukkit.entity.LivingEntity;
+import org.bukkit.entity.Player;
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+import org.bukkit.inventory.ItemStack;
+
+public class MonsterEggSpawnEvent extends Event implements Cancellable {
+ private static final HandlerList handlers = new HandlerList();
+ private boolean canceled;
+
+
+ private final Player player;
+ private LivingEntity entity;
+ private final ItemStack item;
+
+ public MonsterEggSpawnEvent(HumanEntity player, LivingEntity entity, ItemStack item) {
+ this.player = (Player) player;
+ this.entity = entity;
+ this.item = item;
+ }
+
+ public Player getPlayer() {
+ return player;
+ }
+
+ public LivingEntity getEntity() {
+ return entity;
+ }
+
+ public void setEntity(LivingEntity entity) {
+ if (entity == null) {
+ canceled = true;
+ return;
+ }
+ this.entity = entity;
+ }
+
+ public ItemStack getItem() {
+ return item;
+ }
+
+ public boolean isCancelled() {
+ return canceled;
+ }
+
+ public void setCancelled(boolean cancel) {
+ canceled = cancel;
+ }
+
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+}
--
2.25.1.windows.1

View File

@ -1,110 +0,0 @@
From 167c725c39eea50e343b733f65474b229b62da87 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 4 Dec 2016 01:02:45 -0500
Subject: [PATCH] EMC AnvilEvent
---
.../customevents/AnvilEvent.java | 91 +++++++++++++++++++
1 file changed, 91 insertions(+)
create mode 100644 src/main/java/com/empireminecraft/customevents/AnvilEvent.java
diff --git a/src/main/java/com/empireminecraft/customevents/AnvilEvent.java b/src/main/java/com/empireminecraft/customevents/AnvilEvent.java
new file mode 100644
index 000000000..efa108cd3
--- /dev/null
+++ b/src/main/java/com/empireminecraft/customevents/AnvilEvent.java
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2016 Starlis LLC / Daniel Ennis (Aikar) - MIT License
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+package com.empireminecraft.customevents;
+
+import org.bukkit.entity.Player;
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+import org.bukkit.inventory.ItemStack;
+
+public class AnvilEvent extends Event implements Cancellable {
+ private static final HandlerList handlers = new HandlerList();
+ private boolean canceled;
+ final Player player;
+ final ItemStack left;
+ final ItemStack right;
+ ItemStack result;
+ int cost;
+ public AnvilEvent(Player player, ItemStack left, ItemStack right, ItemStack result, int cost) {
+ this.player = player;
+ this.left = left;
+ this.right = right;
+ this.result = result;
+ this.cost = cost;
+ }
+
+ public Player getPlayer() {
+ return player;
+ }
+
+ public ItemStack getLeft() {
+ return left;
+ }
+
+ public ItemStack getRight() {
+ return right;
+ }
+
+ public ItemStack getResult() {
+ return result;
+ }
+
+ public int getCost() {
+ return cost;
+ }
+
+ public void setCost(int cost) {
+ this.cost = cost;
+ }
+
+ public void setResult(ItemStack result) {
+ this.result = result;
+ }
+
+ public boolean isCancelled() {
+ return canceled;
+ }
+
+ public void setCancelled(boolean cancel) {
+ canceled = cancel;
+ }
+
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+}
--
2.25.1.windows.1

View File

@ -1,113 +0,0 @@
From 71c51dc65b2ffb34299d9789605dbcc5a6383f3b Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 4 Dec 2016 01:03:19 -0500
Subject: [PATCH] EMC ArrowHitBlockEvent
---
.../event/entity/ArrowHitBlockEvent.java | 94 +++++++++++++++++++
1 file changed, 94 insertions(+)
create mode 100644 src/main/java/com/destroystokyo/paper/event/entity/ArrowHitBlockEvent.java
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/ArrowHitBlockEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/ArrowHitBlockEvent.java
new file mode 100644
index 000000000..cffeea865
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/entity/ArrowHitBlockEvent.java
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 2018 Daniel Ennis (Aikar) MIT License
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+package com.destroystokyo.paper.event.entity;
+
+import org.bukkit.block.Block;
+import org.bukkit.entity.AbstractArrow;
+import org.bukkit.entity.Arrow;
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.entity.EntityEvent;
+
+/**
+ * Different from ProjectileHitEvent in that it will let you cancel if the projectile will
+ * "trigger" the block, such as TNT.
+ * This includes all variants of arrows including tridents
+ *
+ */
+public class ArrowHitBlockEvent extends EntityEvent implements Cancellable {
+ private static final HandlerList handlers = new HandlerList();
+ private boolean canceled;
+
+ private final Block block;
+
+ public ArrowHitBlockEvent(AbstractArrow entity, Block block) {
+ super(entity);
+ this.block = block;
+ }
+
+ /**
+ * @return The Arrow that hit the block
+ */
+ public AbstractArrow getArrow() {
+ return (AbstractArrow) entity;
+ }
+
+ /**
+ * @return The Arrow that hit the block
+ */
+ public AbstractArrow getEntity() {
+ return (AbstractArrow) entity;
+ }
+
+ /**
+ * @return The block hit by the arrow that may trigger behavior
+ */
+ public Block getBlock() {
+ return block;
+ }
+
+ /**
+ * @return If the arrow activating a block should be cancelled
+ */
+ public boolean isCancelled() {
+ return canceled;
+ }
+
+ /**
+ * Whether or not to cancel any behavior that would occur from the arrow hitting the block
+ * @param cancel true if you wish to cancel this event
+ */
+ public void setCancelled(boolean cancel) {
+ canceled = cancel;
+ }
+
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+}
--
2.25.1.windows.1

View File

@ -1,62 +0,0 @@
From 28f9faf0a305cb6b46b143d28e06ba150b568b14 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 4 Dec 2016 01:19:01 -0500
Subject: [PATCH] EMC EntityKnockbackEvent
---
.../customevents/EntityKnockbackEvent.java | 43 +++++++++++++++++++
1 file changed, 43 insertions(+)
create mode 100644 src/main/java/com/empireminecraft/customevents/EntityKnockbackEvent.java
diff --git a/src/main/java/com/empireminecraft/customevents/EntityKnockbackEvent.java b/src/main/java/com/empireminecraft/customevents/EntityKnockbackEvent.java
new file mode 100644
index 000000000..5e10e241b
--- /dev/null
+++ b/src/main/java/com/empireminecraft/customevents/EntityKnockbackEvent.java
@@ -0,0 +1,43 @@
+package com.empireminecraft.customevents;
+
+import org.bukkit.entity.LivingEntity;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+
+public class EntityKnockbackEvent extends Event {
+ private final LivingEntity attackingEntity;
+ private final LivingEntity targetEntity;
+ private int level;
+
+ public EntityKnockbackEvent(LivingEntity attackingEntity, LivingEntity targetEntity, int level) {
+ this.attackingEntity = attackingEntity;
+ this.targetEntity = targetEntity;
+ this.level = level;
+ }
+
+ public LivingEntity getAttackingEntity() {
+ return attackingEntity;
+ }
+
+ public LivingEntity getTargetEntity() {
+ return targetEntity;
+ }
+
+ public int getLevel() {
+ return level;
+ }
+
+ public void setLevel(int level) {
+ this.level = level;
+ }
+
+ private static final HandlerList handlers = new HandlerList();
+
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+}
--
2.25.1.windows.1

View File

@ -1,68 +0,0 @@
From ab11e91f290f83baea612b0739e3ff53f5a0e7a3 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 4 Dec 2016 01:19:22 -0500
Subject: [PATCH] EMC MovedTooQuicklyEvent
---
.../customevents/MovedTooQuicklyEvent.java | 49 +++++++++++++++++++
1 file changed, 49 insertions(+)
create mode 100644 src/main/java/com/empireminecraft/customevents/MovedTooQuicklyEvent.java
diff --git a/src/main/java/com/empireminecraft/customevents/MovedTooQuicklyEvent.java b/src/main/java/com/empireminecraft/customevents/MovedTooQuicklyEvent.java
new file mode 100644
index 000000000..9c69b6da7
--- /dev/null
+++ b/src/main/java/com/empireminecraft/customevents/MovedTooQuicklyEvent.java
@@ -0,0 +1,49 @@
+package com.empireminecraft.customevents;
+
+import org.bukkit.entity.Player;
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+
+public class MovedTooQuicklyEvent extends Event implements Cancellable {
+
+
+ private static final HandlerList handlers = new HandlerList();
+ private final double speed;
+ private final Player player;
+ private boolean cancelled = false;
+
+ public MovedTooQuicklyEvent(double speed,
+ Player player) {
+
+
+ this.speed = speed;
+ this.player = player;
+ }
+
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+ public Player getPlayer() {
+ return player;
+ }
+
+ public double getSpeed() {
+ return speed;
+ }
+
+ @Override
+ public boolean isCancelled() {
+ return cancelled;
+ }
+
+ @Override
+ public void setCancelled(boolean cancel) {
+ cancelled = cancel;
+ }
+}
--
2.25.1.windows.1

View File

@ -1,39 +0,0 @@
From d28edc33a8c24ae343460a1560b568de1bf6ffdf Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 4 Dec 2016 01:19:32 -0500
Subject: [PATCH] EMC ServerReloadEvent
---
.../customevents/ServerReloadEvent.java | 20 +++++++++++++++++++
1 file changed, 20 insertions(+)
create mode 100644 src/main/java/com/empireminecraft/customevents/ServerReloadEvent.java
diff --git a/src/main/java/com/empireminecraft/customevents/ServerReloadEvent.java b/src/main/java/com/empireminecraft/customevents/ServerReloadEvent.java
new file mode 100644
index 000000000..2a5b39d8b
--- /dev/null
+++ b/src/main/java/com/empireminecraft/customevents/ServerReloadEvent.java
@@ -0,0 +1,20 @@
+package com.empireminecraft.customevents;
+
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+
+public class ServerReloadEvent extends Event {
+ public ServerReloadEvent() {
+ }
+
+
+ private static final HandlerList handlers = new HandlerList();
+
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+}
--
2.25.1.windows.1

View File

@ -1,68 +0,0 @@
From 34060791800f40b4c99dcc0376a53eb036535638 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 4 Dec 2016 14:59:41 -0500
Subject: [PATCH] EMC EntityEffectAddedEvent
---
.../customevents/EntityEffectAddedEvent.java | 49 +++++++++++++++++++
1 file changed, 49 insertions(+)
create mode 100644 src/main/java/com/empireminecraft/customevents/EntityEffectAddedEvent.java
diff --git a/src/main/java/com/empireminecraft/customevents/EntityEffectAddedEvent.java b/src/main/java/com/empireminecraft/customevents/EntityEffectAddedEvent.java
new file mode 100644
index 000000000..4695943b1
--- /dev/null
+++ b/src/main/java/com/empireminecraft/customevents/EntityEffectAddedEvent.java
@@ -0,0 +1,49 @@
+package com.empireminecraft.customevents;
+
+import org.bukkit.entity.LivingEntity;
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+import org.bukkit.potion.PotionEffect;
+
+public class EntityEffectAddedEvent extends Event implements Cancellable {
+ private static final HandlerList handlers = new HandlerList();
+ private boolean canceled;
+
+ private final LivingEntity entity;
+ private PotionEffect effect;
+
+ public EntityEffectAddedEvent(LivingEntity entity, PotionEffect effect) {
+ this.entity = entity;
+ this.effect = effect;
+ }
+
+ public PotionEffect getEffect() {
+ return effect;
+ }
+
+ public void setEffect(PotionEffect effect) {
+ this.effect = effect;
+ }
+
+ public LivingEntity getEntity() {
+ return entity;
+ }
+
+ public boolean isCancelled() {
+ return canceled;
+ }
+
+ public void setCancelled(boolean cancel) {
+ canceled = cancel;
+ }
+
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+}
--
2.25.1.windows.1

View File

@ -1,57 +0,0 @@
From 3a8581ff21f4597afbb7ecbe3411d8781a518851 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 4 Dec 2016 15:09:48 -0500
Subject: [PATCH] EMC LivingEntityArmorProtectEvent
---
.../LivingEntityArmorProtectEvent.java | 38 +++++++++++++++++++
1 file changed, 38 insertions(+)
create mode 100644 src/main/java/com/empireminecraft/customevents/LivingEntityArmorProtectEvent.java
diff --git a/src/main/java/com/empireminecraft/customevents/LivingEntityArmorProtectEvent.java b/src/main/java/com/empireminecraft/customevents/LivingEntityArmorProtectEvent.java
new file mode 100644
index 000000000..07e095737
--- /dev/null
+++ b/src/main/java/com/empireminecraft/customevents/LivingEntityArmorProtectEvent.java
@@ -0,0 +1,38 @@
+package com.empireminecraft.customevents;
+
+import org.bukkit.entity.LivingEntity;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.entity.EntityEvent;
+
+public class LivingEntityArmorProtectEvent extends EntityEvent {
+
+ private static final HandlerList handlers = new HandlerList();
+ private final LivingEntity entity;
+
+ private double armorValue = 0;
+
+ public LivingEntityArmorProtectEvent(LivingEntity entity, double armorValue) {
+ super(entity);
+ this.entity = entity;
+ this.armorValue = armorValue;
+ }
+ public double getArmorValue() {
+ return armorValue;
+ }
+
+ public void setArmorValue(double armorValue) {
+ this.armorValue = armorValue;
+ }
+
+ public LivingEntity getEntity() {
+ return entity;
+ }
+
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+}
--
2.25.1.windows.1

View File

@ -1,107 +0,0 @@
From fe58683941d495f79180bc9b79847dd6924d60e8 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 4 Dec 2016 15:22:03 -0500
Subject: [PATCH] EMC SpawnerInitiateEvent
---
.../customevents/SpawnerInitiateEvent.java | 88 +++++++++++++++++++
1 file changed, 88 insertions(+)
create mode 100644 src/main/java/com/empireminecraft/customevents/SpawnerInitiateEvent.java
diff --git a/src/main/java/com/empireminecraft/customevents/SpawnerInitiateEvent.java b/src/main/java/com/empireminecraft/customevents/SpawnerInitiateEvent.java
new file mode 100644
index 000000000..6c7d5821d
--- /dev/null
+++ b/src/main/java/com/empireminecraft/customevents/SpawnerInitiateEvent.java
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2016 Starlis LLC / Daniel Ennis (Aikar) - MIT License
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+package com.empireminecraft.customevents;
+
+import org.bukkit.NamespacedKey;
+import org.bukkit.Location;
+import org.bukkit.World;
+import org.bukkit.entity.EntityType;
+import org.bukkit.entity.HumanEntity;
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+
+import javax.annotation.Nullable;
+
+public class SpawnerInitiateEvent extends Event implements Cancellable {
+ private static final HandlerList handlers = new HandlerList();
+ private boolean canceled;
+ private final Location loc;
+ private final World world;
+ private final HumanEntity entity;
+ private NamespacedKey mob;
+
+ public SpawnerInitiateEvent(NamespacedKey mob, World world, Location loc, HumanEntity entity) {
+ this.world = world;
+ this.loc = loc;
+ this.mob = mob;
+ this.entity = entity;
+ }
+
+ public World getWorld() {
+ return this.world;
+ }
+
+ @Nullable
+ public EntityType getMobType() {
+ return mob != null ? EntityType.fromName(mob.getKey()) : null;
+ }
+
+ public void setMobType(NamespacedKey key) {
+ this.mob = key;
+ }
+
+ public HumanEntity getTriggeringPlayer() {
+ return this.entity;
+ }
+
+ public Location getSpawnerLocation() {
+ return this.loc;
+ }
+
+ public boolean isCancelled() {
+ return canceled;
+ }
+
+ public void setCancelled(boolean cancel) {
+ canceled = cancel;
+ }
+
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+}
--
2.25.1.windows.1

View File

@ -1,71 +0,0 @@
From e7633e832fdccfa7b3de15b3a339e6541a7d8245 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 4 Dec 2016 15:27:06 -0500
Subject: [PATCH] EMC ZombieReinforcementEvent
---
.../ZombieReinforcementEvent.java | 52 +++++++++++++++++++
1 file changed, 52 insertions(+)
create mode 100644 src/main/java/com/empireminecraft/customevents/ZombieReinforcementEvent.java
diff --git a/src/main/java/com/empireminecraft/customevents/ZombieReinforcementEvent.java b/src/main/java/com/empireminecraft/customevents/ZombieReinforcementEvent.java
new file mode 100644
index 000000000..5e0a9bb41
--- /dev/null
+++ b/src/main/java/com/empireminecraft/customevents/ZombieReinforcementEvent.java
@@ -0,0 +1,52 @@
+package com.empireminecraft.customevents;
+
+import org.bukkit.entity.Entity;
+import org.bukkit.entity.LivingEntity;
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.entity.EntityEvent;
+
+public class ZombieReinforcementEvent extends EntityEvent implements Cancellable {
+ private static final HandlerList handlers = new HandlerList();
+ private final LivingEntity targetEntity;
+ private double chance;
+
+ public ZombieReinforcementEvent(Entity sourceZombie, LivingEntity targetEntity, double chance) {
+ super(sourceZombie);
+ this.targetEntity = targetEntity;
+ this.chance = chance;
+ }
+
+
+ public LivingEntity getTargetEntity() {
+ return targetEntity;
+ }
+
+ public double getChance() {
+ return chance;
+ }
+
+ public void setChance(double chance) {
+ this.chance = chance;
+ }
+
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+ private boolean cancelled = false;
+
+ @Override
+ public boolean isCancelled() {
+ return cancelled;
+ }
+
+ @Override
+ public void setCancelled(boolean cancel) {
+ cancelled = cancel;
+ }
+}
--
2.25.1.windows.1

View File

@ -1,82 +0,0 @@
From 6e8f73be1f943d62a9e6720c5e118efb07ea1123 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 4 Dec 2016 20:28:24 -0500
Subject: [PATCH] EMC SnowmanThrowSnowballEvent
---
.../SnowmanThrowSnowballEvent.java | 63 +++++++++++++++++++
1 file changed, 63 insertions(+)
create mode 100644 src/main/java/com/empireminecraft/customevents/SnowmanThrowSnowballEvent.java
diff --git a/src/main/java/com/empireminecraft/customevents/SnowmanThrowSnowballEvent.java b/src/main/java/com/empireminecraft/customevents/SnowmanThrowSnowballEvent.java
new file mode 100644
index 000000000..53311062e
--- /dev/null
+++ b/src/main/java/com/empireminecraft/customevents/SnowmanThrowSnowballEvent.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2015. Starlis LLC / dba Empire Minecraft
+ *
+ * This source code is proprietary software and must not be redistributed without Starlis LLC's approval
+ *
+ */
+
+package com.empireminecraft.customevents;
+
+import org.bukkit.entity.LivingEntity;
+import org.bukkit.entity.Snowball;
+import org.bukkit.entity.Snowman;
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.entity.EntityEvent;
+
+public class SnowmanThrowSnowballEvent extends EntityEvent implements Cancellable {
+ private final Snowman snowman;
+ private final Snowball snowball;
+ private final LivingEntity target;
+
+ private static final HandlerList handlers = new HandlerList();
+
+ public SnowmanThrowSnowballEvent(Snowman snowman, Snowball snowball, LivingEntity target) {
+ super(snowman);
+ this.snowman = snowman;
+ this.snowball = snowball;
+ this.target = target;
+ }
+
+ public Snowman getSnowman() {
+ return snowman;
+ }
+
+ public Snowball getSnowball() {
+ return snowball;
+ }
+
+ public LivingEntity getTarget() {
+ return target;
+ }
+
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+ private boolean cancelled = false;
+
+ @Override
+ public boolean isCancelled() {
+ return cancelled;
+ }
+
+ @Override
+ public void setCancelled(boolean cancel) {
+ cancelled = cancel;
+ }
+
+}
--
2.25.1.windows.1

View File

@ -1,391 +0,0 @@
From 0dc1464f8ad2c288ca853947560842de763b7890 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 7 Dec 2016 00:22:09 -0500
Subject: [PATCH] EMC PlayerUseItemEvent
---
.../player/PlayerPostPlaceItemAtEvent.java | 80 +++++++++++++
.../event/player/PlayerPostUseItemEvent.java | 69 +++++++++++
.../customevents/PlayerPlaceItemAtEvent.java | 110 ++++++++++++++++++
.../customevents/PlayerUseItemEvent.java | 89 ++++++++++++++
4 files changed, 348 insertions(+)
create mode 100644 src/main/java/com/destroystokyo/paper/event/player/PlayerPostPlaceItemAtEvent.java
create mode 100644 src/main/java/com/destroystokyo/paper/event/player/PlayerPostUseItemEvent.java
create mode 100644 src/main/java/com/empireminecraft/customevents/PlayerPlaceItemAtEvent.java
create mode 100644 src/main/java/com/empireminecraft/customevents/PlayerUseItemEvent.java
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerPostPlaceItemAtEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerPostPlaceItemAtEvent.java
new file mode 100644
index 000000000..8e83d0d9a
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerPostPlaceItemAtEvent.java
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2018 Daniel Ennis (Aikar) MIT License
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+package com.destroystokyo.paper.event.player;
+
+import org.bukkit.Location;
+import org.bukkit.block.BlockFace;
+import org.bukkit.entity.Player;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.player.PlayerEvent;
+import org.bukkit.inventory.EquipmentSlot;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.util.Vector;
+
+public class PlayerPostPlaceItemAtEvent extends PlayerEvent {
+ private final ItemStack usedItem;
+ private final Location targetLoc;
+ private final BlockFace clickFace;
+ private final Vector hitVector;
+ private final EquipmentSlot hand;
+
+ public PlayerPostPlaceItemAtEvent(Player player, ItemStack usedItem, Location targetLoc, BlockFace clickFace, Vector hitVector, EquipmentSlot hand) {
+ super(player);
+ this.usedItem = usedItem;
+ this.targetLoc = targetLoc;
+ this.clickFace = clickFace;
+ this.hitVector = hitVector;
+ this.hand = hand;
+ }
+
+ public Location getTargetLoc() {
+ return targetLoc;
+ }
+
+ public BlockFace getClickFace() {
+ return clickFace;
+ }
+
+ public Vector getHitVector() {
+ return hitVector;
+ }
+
+ public EquipmentSlot getHand() {
+ return hand;
+ }
+
+ public ItemStack getUsedItem() {
+ return usedItem;
+ }
+
+ private static final HandlerList handlers = new HandlerList();
+
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+}
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerPostUseItemEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerPostUseItemEvent.java
new file mode 100644
index 000000000..511082ea1
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerPostUseItemEvent.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2018 Daniel Ennis (Aikar) MIT License
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+package com.destroystokyo.paper.event.player;
+
+import org.bukkit.entity.Player;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.player.PlayerEvent;
+import org.bukkit.inventory.EquipmentSlot;
+import org.bukkit.inventory.ItemStack;
+
+public class PlayerPostUseItemEvent extends PlayerEvent {
+ private final ItemStack usedItem;
+ private ItemStack newItem;
+ private final EquipmentSlot hand;
+
+ public PlayerPostUseItemEvent(Player player, ItemStack usedItem, ItemStack newItem, EquipmentSlot hand) {
+ super(player);
+ this.usedItem = usedItem;
+ this.newItem = newItem;
+ this.hand = hand;
+ }
+
+ public EquipmentSlot getHand() {
+ return hand;
+ }
+
+ public ItemStack getUsedItem() {
+ return usedItem;
+ }
+
+ public ItemStack getNewItem() {
+ return newItem;
+ }
+
+ public void setNewItem(ItemStack newItem) {
+ this.newItem = newItem;
+ }
+
+ private static final HandlerList handlers = new HandlerList();
+
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+}
diff --git a/src/main/java/com/empireminecraft/customevents/PlayerPlaceItemAtEvent.java b/src/main/java/com/empireminecraft/customevents/PlayerPlaceItemAtEvent.java
new file mode 100644
index 000000000..1b1bf8546
--- /dev/null
+++ b/src/main/java/com/empireminecraft/customevents/PlayerPlaceItemAtEvent.java
@@ -0,0 +1,110 @@
+/*
+ * Copyright (c) 2016 Starlis LLC / Daniel Ennis (Aikar) - MIT License
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+package com.empireminecraft.customevents;
+
+import org.bukkit.Location;
+import org.bukkit.block.BlockFace;
+import org.bukkit.entity.Player;
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.player.PlayerEvent;
+import org.bukkit.inventory.EquipmentSlot;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.util.Vector;
+
+public class PlayerPlaceItemAtEvent extends PlayerEvent implements Cancellable {
+ private static final HandlerList handlers = new HandlerList();
+ private boolean canceled;
+ private final ItemStack item;
+ private final Location targetLoc;
+ private final BlockFace clickFace;
+ private final Vector hitVector;
+ private final EquipmentSlot hand;
+ private ItemStack tempItem;
+ private boolean consume = true;
+
+
+ public PlayerPlaceItemAtEvent(Player player, ItemStack item, Location targetLoc, BlockFace clickFace, Vector hitVector, EquipmentSlot hand) {
+ super(player);
+ this.item = item;
+ this.targetLoc = targetLoc;
+ this.clickFace = clickFace;
+ this.hitVector = hitVector;
+ this.hand = hand;
+ }
+
+ public ItemStack getItem() {
+ return item;
+ }
+
+ public EquipmentSlot getHand() {
+ return hand;
+ }
+
+ public Location getTargetLoc() {
+ return targetLoc;
+ }
+
+ public BlockFace getClickFace() {
+ return clickFace;
+ }
+
+ public Vector getHitVector() {
+ return hitVector;
+ }
+
+ public ItemStack getTempItem() {
+ return this.tempItem;
+ }
+
+ public void setTempItem(ItemStack item) {
+ if (item == null) {
+ canceled = true;
+ }
+ this.tempItem = item;
+ }
+
+ public boolean getConsumeItem() {
+ return this.consume;
+ }
+
+ public void setConsumeItem(boolean consume) {
+ this.consume = consume;
+ }
+ public boolean isCancelled() {
+ return canceled;
+ }
+
+ public void setCancelled(boolean cancel) {
+ canceled = cancel;
+ }
+
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+}
diff --git a/src/main/java/com/empireminecraft/customevents/PlayerUseItemEvent.java b/src/main/java/com/empireminecraft/customevents/PlayerUseItemEvent.java
new file mode 100644
index 000000000..c61c6a44f
--- /dev/null
+++ b/src/main/java/com/empireminecraft/customevents/PlayerUseItemEvent.java
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 2016 Starlis LLC / Daniel Ennis (Aikar) - MIT License
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+package com.empireminecraft.customevents;
+
+import org.bukkit.entity.Player;
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.player.PlayerEvent;
+import org.bukkit.inventory.EquipmentSlot;
+import org.bukkit.inventory.ItemStack;
+
+public class PlayerUseItemEvent extends PlayerEvent implements Cancellable {
+ private static final HandlerList handlers = new HandlerList();
+ private boolean canceled;
+ private final ItemStack item;
+ private final EquipmentSlot hand;
+ private ItemStack tempItem;
+ private boolean consumeItem = true;
+
+ public PlayerUseItemEvent(Player player, ItemStack item, EquipmentSlot hand) {
+ super(player);
+ this.item = item;
+ this.hand = hand;
+ }
+
+ public EquipmentSlot getHand() {
+ return hand;
+ }
+
+ public ItemStack getItem() {
+ return this.item;
+ }
+
+ public ItemStack getTempItem() {
+ return this.tempItem;
+ }
+
+ public void setTempItem(ItemStack item) {
+ if (item == null) {
+ canceled = true;
+ }
+ this.tempItem = item;
+ }
+
+ public boolean shouldConsumeItem() {
+ return this.consumeItem;
+ }
+
+ public void setConsumeItem(boolean consume) {
+ this.consumeItem = consume;
+ }
+
+ public boolean isCancelled() {
+ return canceled;
+ }
+
+ public void setCancelled(boolean cancel) {
+ canceled = cancel;
+ }
+
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+}
--
2.25.1.windows.1

View File

@ -1,210 +0,0 @@
From 7558ddfe88217b313c46c0ec7caa7c2476479f06 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 20 Dec 2017 21:55:16 -0500
Subject: [PATCH] EMC EntityAttackedEntityEvent
For when you need to know one Entity has attacked another entity
and that the damage event was not cancelled.
---
.../entity/EntityAttackedEntityEvent.java | 92 +++++++++++++++++++
.../entity/EntityAttackedPlayerEvent.java | 40 ++++++++
.../entity/PlayerAttackedEntityEvent.java | 41 +++++++++
3 files changed, 173 insertions(+)
create mode 100644 src/main/java/com/destroystokyo/paper/event/entity/EntityAttackedEntityEvent.java
create mode 100644 src/main/java/com/destroystokyo/paper/event/entity/EntityAttackedPlayerEvent.java
create mode 100644 src/main/java/com/destroystokyo/paper/event/entity/PlayerAttackedEntityEvent.java
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/EntityAttackedEntityEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/EntityAttackedEntityEvent.java
new file mode 100644
index 000000000..0f32f157b
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/entity/EntityAttackedEntityEvent.java
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2017 Daniel Ennis (Aikar) MIT License
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+package com.destroystokyo.paper.event.entity;
+
+import org.bukkit.entity.Entity;
+import org.bukkit.entity.LivingEntity;
+import org.bukkit.entity.Player;
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
+import org.bukkit.event.entity.EntityEvent;
+
+public class EntityAttackedEntityEvent extends EntityEvent implements Cancellable {
+ private final Entity victim;
+ private final DamageCause cause;
+ private final double damage;
+
+ public EntityAttackedEntityEvent(Entity attacker, Entity victim, final DamageCause cause, final double damage) {
+ super(attacker);
+ this.victim = victim;
+ this.cause = cause;
+ this.damage = damage;
+ }
+
+ public Entity getVictim() {
+ return victim;
+ }
+
+ public DamageCause getCause() {
+ return cause;
+ }
+
+ public double getDamage() {
+ return damage;
+ }
+
+ private static final HandlerList handlers = new HandlerList();
+
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+ private boolean cancelled = false;
+
+ @Override
+ public boolean isCancelled() {
+ return cancelled;
+ }
+
+ @Override
+ public void setCancelled(boolean cancel) {
+ cancelled = cancel;
+ }
+
+ public static boolean callEvent(Entity attacker, Entity victim, DamageCause cause, double damage) {
+ EntityAttackedEntityEvent event;
+ if (attacker instanceof Player) {
+ event = new PlayerAttackedEntityEvent((Player) attacker, victim, cause, damage);
+ } else if (victim instanceof Player) {
+ event = new EntityAttackedPlayerEvent(attacker, (Player) victim, cause, damage);
+ } else {
+ event = new EntityAttackedEntityEvent(attacker, victim, cause, damage);
+ }
+ return event.callEvent();
+ }
+}
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/EntityAttackedPlayerEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/EntityAttackedPlayerEvent.java
new file mode 100644
index 000000000..8ce33f32d
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/entity/EntityAttackedPlayerEvent.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2017 Daniel Ennis (Aikar) MIT License
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+package com.destroystokyo.paper.event.entity;
+
+import org.bukkit.entity.Entity;
+import org.bukkit.entity.Player;
+import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
+
+public class EntityAttackedPlayerEvent extends EntityAttackedEntityEvent {
+ public EntityAttackedPlayerEvent(Entity attacker, Player victim,
+ DamageCause cause, double damage) {
+ super(attacker, victim, cause, damage);
+ }
+
+ @Override
+ public Player getVictim() {
+ return (Player) super.getVictim();
+ }
+}
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/PlayerAttackedEntityEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/PlayerAttackedEntityEvent.java
new file mode 100644
index 000000000..134a7e02d
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/entity/PlayerAttackedEntityEvent.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2017 Daniel Ennis (Aikar) MIT License
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+package com.destroystokyo.paper.event.entity;
+
+import org.bukkit.entity.Entity;
+import org.bukkit.entity.Player;
+import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
+
+public class PlayerAttackedEntityEvent extends EntityAttackedEntityEvent {
+
+ public PlayerAttackedEntityEvent(Player player, Entity victim,
+ DamageCause cause, double damage) {
+ super(player, victim, cause, damage);
+ }
+
+ @Override
+ public Player getEntity() {
+ return (Player) super.getEntity();
+ }
+}
--
2.25.1.windows.1

View File

@ -1,85 +0,0 @@
From 8e24ceec37ab2fb1a40b0004a4b01b137f501a1f Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Thu, 10 May 2018 20:25:37 -0400
Subject: [PATCH] EMC BlazeLaunchFireballEvent
---
.../BlazeLaunchFireballEvent.java | 66 +++++++++++++++++++
1 file changed, 66 insertions(+)
create mode 100644 src/main/java/com/empireminecraft/customevents/BlazeLaunchFireballEvent.java
diff --git a/src/main/java/com/empireminecraft/customevents/BlazeLaunchFireballEvent.java b/src/main/java/com/empireminecraft/customevents/BlazeLaunchFireballEvent.java
new file mode 100644
index 000000000..029a1f9a1
--- /dev/null
+++ b/src/main/java/com/empireminecraft/customevents/BlazeLaunchFireballEvent.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2017 Daniel Ennis (Aikar) MIT License
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+package com.empireminecraft.customevents;
+
+import org.bukkit.entity.Blaze;
+import org.bukkit.entity.SmallFireball;
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.entity.EntityEvent;
+
+public class BlazeLaunchFireballEvent extends EntityEvent implements Cancellable {
+ private final SmallFireball fireball;
+
+ public BlazeLaunchFireballEvent(Blaze blaze, SmallFireball fireball) {
+ super(blaze);
+ this.fireball = fireball;
+ }
+
+ public SmallFireball getFireball() {
+ return fireball;
+ }
+
+ private static final HandlerList handlers = new HandlerList();
+
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+ private boolean cancelled = false;
+
+ @Override
+ public boolean isCancelled() {
+ return cancelled;
+ }
+
+ @Override
+ public void setCancelled(boolean cancel) {
+ cancelled = cancel;
+ }
+}
--
2.25.1.windows.1

View File

@ -1,24 +0,0 @@
From 00ea91f49ff5e2e1885a117fe06d77975ad21cc9 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 17 Jun 2018 02:08:40 -0400
Subject: [PATCH] EMC Human#getAttackPct
---
src/main/java/org/bukkit/entity/HumanEntity.java | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/main/java/org/bukkit/entity/HumanEntity.java b/src/main/java/org/bukkit/entity/HumanEntity.java
index c0d38f5a3..70f046ce5 100644
--- a/src/main/java/org/bukkit/entity/HumanEntity.java
+++ b/src/main/java/org/bukkit/entity/HumanEntity.java
@@ -20,6 +20,7 @@ import org.jetbrains.annotations.Nullable;
*/
public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder {
+ float getAttackPct(); // EMC
/**
* Returns the name of this player
*
--
2.25.1.windows.1

View File

@ -1,65 +0,0 @@
From 7094b3659d2dd916153c186397afa1166c03ae93 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sat, 18 Aug 2018 21:09:39 -0400
Subject: [PATCH] EMC SpawnEggMeta#setSpawnedEntity API
lets you copy an entities data into a spawn egg.
Partial data is supported through a predicate, letting MC
follow normal spawn behavior in the summon phase.
---
.../bukkit/inventory/meta/SpawnEggMeta.java | 39 +++++++++++++++++++
1 file changed, 39 insertions(+)
diff --git a/src/main/java/org/bukkit/inventory/meta/SpawnEggMeta.java b/src/main/java/org/bukkit/inventory/meta/SpawnEggMeta.java
index 9ae84de43..f6ee31cd6 100644
--- a/src/main/java/org/bukkit/inventory/meta/SpawnEggMeta.java
+++ b/src/main/java/org/bukkit/inventory/meta/SpawnEggMeta.java
@@ -9,6 +9,45 @@ import org.jetbrains.annotations.NotNull;
*/
public interface SpawnEggMeta extends ItemMeta {
+ // Paper start
+
+ /**
+ * Copies the Entity as is into the spawn egg.
+ *
+ * All non positional data properties will be saved
+ * @param entity
+ */
+ default void setSpawnedEntity(org.bukkit.entity.Entity entity) {
+ setSpawnedEntity(entity, null);
+ }
+ /**
+ * Copies the Entity into the spawn egg, giving you
+ * control over which NBT Tags are to be saved.
+ *
+ * Note that while Mojang has made data properties more
+ * of a user facing detail, there is no guarantee that
+ * they will not change names between versions.
+ *
+ * If a key is filtered out, it will assume the default
+ * value upon spawn as a normal spawned entity of this type
+ * might receive. If one key is fitlered that has a strong
+ * relationship to another key, such as Villager Professions
+ * and Careers, you should filter them both/all to avoid buggy
+ * behavior in spawning the entity.
+ *
+ * Filtering by values is not supported.
+ *
+ * Certain keys such as "UUIDLeast", "UUIDMost", "Pos",
+ * "PortalCooldown", "Dimension"
+ *
+ * are default filtered.
+ *
+ * @param entity
+ * @param keyFilter
+ */
+ void setSpawnedEntity(org.bukkit.entity.Entity entity, java.util.function.Predicate<String> keyFilter);
+ // Paper end
+
/**
* Get the type of entity this egg will spawn.
*
--
2.25.1.windows.1

View File

@ -1,58 +0,0 @@
From 0fa053d7c4445f2241a5e49d6c4bc9909ad10ab9 Mon Sep 17 00:00:00 2001
From: chickeneer <emcchickeneer@gmail.com>
Date: Sun, 14 Jul 2019 13:50:18 -0500
Subject: [PATCH] EMC Add ConduitNewTargetEvent
---
.../customevents/ConduitNewTargetEvent.java | 39 +++++++++++++++++++
1 file changed, 39 insertions(+)
create mode 100644 src/main/java/com/empireminecraft/customevents/ConduitNewTargetEvent.java
diff --git a/src/main/java/com/empireminecraft/customevents/ConduitNewTargetEvent.java b/src/main/java/com/empireminecraft/customevents/ConduitNewTargetEvent.java
new file mode 100644
index 000000000..c3de31cf5
--- /dev/null
+++ b/src/main/java/com/empireminecraft/customevents/ConduitNewTargetEvent.java
@@ -0,0 +1,39 @@
+package com.empireminecraft.customevents;
+
+import org.bukkit.block.Block;
+import org.bukkit.entity.LivingEntity;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.block.BlockEvent;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.List;
+
+public class ConduitNewTargetEvent extends BlockEvent {
+ private static final HandlerList handlers = new HandlerList();
+ private final List<LivingEntity> entities;
+
+ public ConduitNewTargetEvent(List<LivingEntity> entities, @NotNull Block theBlock) {
+ super(theBlock);
+ this.entities = entities;
+ }
+
+ /**
+ * Remove entities from this list to remove them from the potential targets of the conduit.
+ * Implementation will not use any additions to this list.
+ *
+ * @return
+ */
+ public List<LivingEntity> potentialTargets() {
+ return entities;
+ }
+
+ @NotNull
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+}
--
2.25.1.windows.1

View File

@ -1,68 +0,0 @@
From ee8f6d71dfddc1d1a4202156d06cceef1ba0f9da Mon Sep 17 00:00:00 2001
From: chickeneer <emcchickeneer@gmail.com>
Date: Fri, 29 Nov 2019 02:47:35 -0600
Subject: [PATCH] EMC Add a PlayerThrowTrident event
---
.../event/player/PlayerThrowTridentEvent.java | 49 +++++++++++++++++++
1 file changed, 49 insertions(+)
create mode 100644 src/main/java/com/destroystokyo/paper/event/player/PlayerThrowTridentEvent.java
diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerThrowTridentEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerThrowTridentEvent.java
new file mode 100644
index 000000000..1ee88dcf3
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerThrowTridentEvent.java
@@ -0,0 +1,49 @@
+package com.destroystokyo.paper.event.player;
+
+import org.bukkit.entity.Entity;
+import org.bukkit.entity.Player;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.player.PlayerEvent;
+import org.bukkit.inventory.ItemStack;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Called when a Player throws a trident
+ */
+public class PlayerThrowTridentEvent extends PlayerEvent {
+ private static final HandlerList handlers = new HandlerList();
+ private final Entity projectile;
+ private final ItemStack tridentItem;
+
+ @NotNull
+ public ItemStack getTridentItem() {
+ return tridentItem;
+ }
+
+ public PlayerThrowTridentEvent(@NotNull final Player shooter, @NotNull ItemStack tridentItem, @NotNull final Entity projectile) {
+ super(shooter);
+ this.tridentItem = tridentItem;
+ this.projectile = projectile;
+ }
+
+ /**
+ * Gets the projectile which will be launched by this event
+ *
+ * @return the launched projectile
+ */
+ @NotNull
+ public Entity getProjectile() {
+ return projectile;
+ }
+
+ @NotNull
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+}
--
2.25.1.windows.1

View File

@ -1,85 +0,0 @@
From 501bfd3c933463bd4234d90973e387b50b24de1f Mon Sep 17 00:00:00 2001
From: chickeneer <emcchickeneer@gmail.com>
Date: Fri, 17 Jan 2020 21:27:29 -0600
Subject: [PATCH] EMC Add a BlockHarvestBeehiveEvent
---
.../BlockHarvestBeehiveEvent.java | 66 +++++++++++++++++++
1 file changed, 66 insertions(+)
create mode 100644 src/main/java/com/empireminecraft/customevents/BlockHarvestBeehiveEvent.java
diff --git a/src/main/java/com/empireminecraft/customevents/BlockHarvestBeehiveEvent.java b/src/main/java/com/empireminecraft/customevents/BlockHarvestBeehiveEvent.java
new file mode 100644
index 000000000..39cc3a973
--- /dev/null
+++ b/src/main/java/com/empireminecraft/customevents/BlockHarvestBeehiveEvent.java
@@ -0,0 +1,66 @@
+package com.empireminecraft.customevents;
+
+import org.bukkit.block.Block;
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.block.BlockEvent;
+import org.bukkit.inventory.ItemStack;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Event fired when a dispenser harvests a nearby beehive.
+ */
+public class BlockHarvestBeehiveEvent extends BlockEvent implements Cancellable {
+ private static final HandlerList handlers = new HandlerList();
+
+ private final Block beehive;
+ private final ItemStack tool;
+ private boolean cancelled;
+
+ public BlockHarvestBeehiveEvent(@NotNull Block dispenser, @NotNull Block beehive, @NotNull ItemStack tool) {
+ super(dispenser);
+ this.beehive = beehive;
+ this.tool = tool;
+ }
+
+ /**
+ * Gets the beehive that was harvested.
+ *
+ * @return the beehive that was harvested.
+ */
+ @NotNull
+ public Block getBeehive() {
+ return beehive;
+ }
+
+ /**
+ * Gets the item used to harvest the beehive.
+ *
+ * @return the item used to harvest the beehive.
+ */
+ @NotNull
+ public ItemStack getTool() {
+ return tool.clone();
+ }
+
+ @Override
+ public boolean isCancelled() {
+ return cancelled;
+ }
+
+ @Override
+ public void setCancelled(boolean cancelled) {
+ this.cancelled = cancelled;
+ }
+
+ @NotNull
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+}
--
2.25.1.windows.1