From 0b3c51eb6b5557c9300d20d0c50a2eb45f883797 Mon Sep 17 00:00:00 2001 From: ShinyDialga Date: Thu, 22 Jun 2017 01:05:08 -0500 Subject: [PATCH] Update to 1.12 --- API/bukkit/pom.xml | 2 +- API/bungee/pom.xml | 2 +- API/minecraft/pom.xml | 2 +- API/ocn/pom.xml | 2 +- API/pom.xml | 2 +- Commons/bukkit/pom.xml | 2 +- .../bukkit/util/PotionClassificationTest.java | 125 ------------------ Commons/bungee/pom.xml | 2 +- Commons/core/pom.xml | 2 +- Lobby/pom.xml | 2 +- PGM/pom.xml | 2 +- .../java/tc/oc/pgm/match/MatchPlayer.java | 5 - .../pgm/modules/ArrowRemovalMatchModule.java | 2 +- .../FriendlyFireRefundMatchModule.java | 2 +- .../pgm/projectile/ProjectilePlayerFacet.java | 2 +- .../java/tc/oc/pgm/tablist/MatchTabView.java | 1 - Tourney/pom.xml | 2 +- Util/bukkit/pom.xml | 4 +- .../tc/oc/commons/bukkit/util/NMSHacks.java | 4 +- .../oc/commons/bukkit/util/PacketTracer.java | 15 ++- Util/bungee/pom.xml | 2 +- Util/pom.xml | 2 +- pom.xml | 6 +- 23 files changed, 35 insertions(+), 157 deletions(-) delete mode 100644 Commons/bukkit/src/test/java/tc/oc/commons/bukkit/util/PotionClassificationTest.java diff --git a/API/bukkit/pom.xml b/API/bukkit/pom.xml index acfe812..1331503 100644 --- a/API/bukkit/pom.xml +++ b/API/bukkit/pom.xml @@ -5,7 +5,7 @@ tc.oc api-parent ../pom.xml - 1.11-SNAPSHOT + 1.12-SNAPSHOT api-bukkit diff --git a/API/bungee/pom.xml b/API/bungee/pom.xml index 69d78c4..ef61228 100644 --- a/API/bungee/pom.xml +++ b/API/bungee/pom.xml @@ -5,7 +5,7 @@ tc.oc api-parent ../pom.xml - 1.11-SNAPSHOT + 1.12-SNAPSHOT api-bungee diff --git a/API/minecraft/pom.xml b/API/minecraft/pom.xml index cdb239e..cc3628c 100644 --- a/API/minecraft/pom.xml +++ b/API/minecraft/pom.xml @@ -5,7 +5,7 @@ tc.oc api-parent ../pom.xml - 1.11-SNAPSHOT + 1.12-SNAPSHOT api-minecraft diff --git a/API/ocn/pom.xml b/API/ocn/pom.xml index 5616e4d..64f9757 100644 --- a/API/ocn/pom.xml +++ b/API/ocn/pom.xml @@ -5,7 +5,7 @@ tc.oc api-parent ../pom.xml - 1.11-SNAPSHOT + 1.12-SNAPSHOT api-ocn diff --git a/API/pom.xml b/API/pom.xml index 05b29cb..75e1c93 100644 --- a/API/pom.xml +++ b/API/pom.xml @@ -5,7 +5,7 @@ tc.oc ProjectAres ../pom.xml - 1.11-SNAPSHOT + 1.12-SNAPSHOT api-parent diff --git a/Commons/bukkit/pom.xml b/Commons/bukkit/pom.xml index 467baae..8feedba 100644 --- a/Commons/bukkit/pom.xml +++ b/Commons/bukkit/pom.xml @@ -8,7 +8,7 @@ commons tc.oc ../pom.xml - 1.11-SNAPSHOT + 1.12-SNAPSHOT commons-bukkit diff --git a/Commons/bukkit/src/test/java/tc/oc/commons/bukkit/util/PotionClassificationTest.java b/Commons/bukkit/src/test/java/tc/oc/commons/bukkit/util/PotionClassificationTest.java deleted file mode 100644 index b839ab6..0000000 --- a/Commons/bukkit/src/test/java/tc/oc/commons/bukkit/util/PotionClassificationTest.java +++ /dev/null @@ -1,125 +0,0 @@ -package tc.oc.commons.bukkit.util; - -import java.util.List; - -import com.google.common.collect.ImmutableList; -import org.bukkit.Bukkit; -import org.bukkit.CraftBukkitRuntime; -import org.bukkit.Material; -import org.bukkit.craftbukkit.potion.CraftPotionBrewer; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.PotionMeta; -import org.bukkit.potion.Potion; -import org.bukkit.potion.PotionData; -import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionType; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; - -import static org.bukkit.potion.PotionEffectType.*; -import static org.junit.Assert.*; -import static tc.oc.commons.bukkit.util.PotionClassification.*; - -/** Tests for {@link PotionUtils} and {@link PotionClassification} */ -@RunWith(JUnit4.class) -public class PotionClassificationTest { - - @Before - public void setUp() { - CraftBukkitRuntime.load(); - if(Potion.getBrewer() == null) { - Potion.setPotionBrewer(new CraftPotionBrewer()); - } - } - - @Test - public void effectTypes() throws Exception { - assertEquals(BENEFICIAL, classify(HEAL)); - assertEquals(HARMFUL, classify(HARM)); - } - - @Test - public void classifyByMostEffects() throws Exception { - assertEquals(BENEFICIAL, classify(ImmutableList.of( - new PotionEffect(SPEED, 1, 0), - new PotionEffect(HARM, 1, 0), - new PotionEffect(LUCK, 1, 0) - ))); - - assertEquals(HARMFUL, classify(ImmutableList.of( - new PotionEffect(SLOW, 1, 0), - new PotionEffect(HEAL, 1, 0), - new PotionEffect(UNLUCK, 1, 0) - ))); - } - - @Test - public void classifyByDuration() throws Exception { - assertEquals(BENEFICIAL, classify(ImmutableList.of( - new PotionEffect(HEAL, 2, 0), - new PotionEffect(HARM, 1, 0) - ))); - - assertEquals(HARMFUL, classify(ImmutableList.of( - new PotionEffect(HEAL, 1, 0), - new PotionEffect(HARM, 2, 0) - ))); - } - - @Test - public void classifyByAmplifier() throws Exception { - assertEquals(BENEFICIAL, classify(ImmutableList.of( - new PotionEffect(HEAL, 1, 1), - new PotionEffect(HARM, 1, 0) - ))); - - assertEquals(HARMFUL, classify(ImmutableList.of( - new PotionEffect(HEAL, 1, 0), - new PotionEffect(HARM, 1, 1) - ))); - } - - @Test - public void negativeAmplifier() throws Exception { - assertEquals(BENEFICIAL, classify(ImmutableList.of( - new PotionEffect(HARM, 1, -1) - ))); - assertEquals(HARMFUL, classify(ImmutableList.of( - new PotionEffect(HEAL, 1, -1) - ))); - } - - @Test - public void vanillaBrews() throws Exception { - assertEquals(BENEFICIAL, classify(Bukkit.potionRegistry().get(Bukkit.key("healing")))); - assertEquals(BENEFICIAL, classify(new PotionData(PotionType.INSTANT_HEAL, false, false))); - assertEquals(HARMFUL, classify(Bukkit.potionRegistry().get(Bukkit.key("harming")))); - assertEquals(HARMFUL, classify(new PotionData(PotionType.INSTANT_DAMAGE, false, false))); - } - - @Test - public void potionItem() throws Exception { - final ItemStack item = new ItemStack(Material.POTION); - final PotionMeta meta = (PotionMeta) item.getItemMeta(); - meta.setPotionBrew(Bukkit.potionRegistry().get(Bukkit.key("healing"))); - item.setItemMeta(meta); - - } - - @Test - public void riftCaseTest() { - List effects = ImmutableList.of( - new PotionEffect(FAST_DIGGING, 3600, 3), - new PotionEffect(REGENERATION, 3600, 2), - new PotionEffect(DAMAGE_RESISTANCE, 3600, 1), - new PotionEffect(FIRE_RESISTANCE, 3600, 1), - new PotionEffect(SPEED, 3600, 1), - new PotionEffect(INCREASE_DAMAGE, 3600, 1) - ); - - assertEquals("Rift Baron potion was not classified as ", - PotionClassification.BENEFICIAL, classify(effects)); - } -} diff --git a/Commons/bungee/pom.xml b/Commons/bungee/pom.xml index 86e4dbf..8ef327f 100644 --- a/Commons/bungee/pom.xml +++ b/Commons/bungee/pom.xml @@ -8,7 +8,7 @@ commons tc.oc ../pom.xml - 1.11-SNAPSHOT + 1.12-SNAPSHOT commons-bungee diff --git a/Commons/core/pom.xml b/Commons/core/pom.xml index 430cdf1..4a6775c 100644 --- a/Commons/core/pom.xml +++ b/Commons/core/pom.xml @@ -8,7 +8,7 @@ commons tc.oc ../pom.xml - 1.11-SNAPSHOT + 1.12-SNAPSHOT commons-core diff --git a/Lobby/pom.xml b/Lobby/pom.xml index 2ab7772..2b9cbe5 100644 --- a/Lobby/pom.xml +++ b/Lobby/pom.xml @@ -5,7 +5,7 @@ tc.oc ProjectAres ../pom.xml - 1.11-SNAPSHOT + 1.12-SNAPSHOT Lobby diff --git a/PGM/pom.xml b/PGM/pom.xml index abebfdb..32367bd 100644 --- a/PGM/pom.xml +++ b/PGM/pom.xml @@ -5,7 +5,7 @@ tc.oc ProjectAres ../pom.xml - 1.11-SNAPSHOT + 1.12-SNAPSHOT diff --git a/PGM/src/main/java/tc/oc/pgm/match/MatchPlayer.java b/PGM/src/main/java/tc/oc/pgm/match/MatchPlayer.java index 663b671..5f9778d 100644 --- a/PGM/src/main/java/tc/oc/pgm/match/MatchPlayer.java +++ b/PGM/src/main/java/tc/oc/pgm/match/MatchPlayer.java @@ -14,7 +14,6 @@ import me.anxuiz.settings.Setting; import me.anxuiz.settings.SettingManager; import me.anxuiz.settings.bukkit.PlayerSettings; import net.md_5.bungee.api.ChatColor; -import net.md_5.bungee.api.ChatMessageType; import net.md_5.bungee.api.chat.BaseComponent; import org.bukkit.EntityLocation; import org.bukkit.Location; @@ -35,7 +34,6 @@ import tc.oc.api.docs.User; import tc.oc.commons.bukkit.attribute.AttributeUtils; import tc.oc.commons.bukkit.chat.BukkitAudiences; import tc.oc.commons.bukkit.chat.BukkitSound; -import tc.oc.commons.bukkit.chat.ComponentRenderers; import tc.oc.commons.bukkit.chat.NameStyle; import tc.oc.commons.bukkit.chat.Named; import tc.oc.commons.bukkit.chat.PlayerComponent; @@ -44,7 +42,6 @@ import tc.oc.commons.bukkit.nick.IdentityProvider; import tc.oc.commons.bukkit.settings.SettingManagerProvider; import tc.oc.commons.bukkit.util.PlayerStates; import tc.oc.commons.core.chat.Audience; -import tc.oc.commons.core.chat.Component; import tc.oc.commons.core.chat.ForwardingAudience; import tc.oc.commons.core.chat.Sound; import tc.oc.commons.core.logging.Loggers; @@ -56,8 +53,6 @@ import tc.oc.pgm.kits.WalkSpeedKit; import tc.oc.pgm.settings.ObserverSetting; import tc.oc.pgm.settings.Settings; -import static com.google.common.base.Preconditions.checkNotNull; - /** * MatchPlayer represents a player who is part of a match. Note that the * MatchPlayer object should only exist as long as the corresponding Match diff --git a/PGM/src/main/java/tc/oc/pgm/modules/ArrowRemovalMatchModule.java b/PGM/src/main/java/tc/oc/pgm/modules/ArrowRemovalMatchModule.java index aaedc21..4102000 100644 --- a/PGM/src/main/java/tc/oc/pgm/modules/ArrowRemovalMatchModule.java +++ b/PGM/src/main/java/tc/oc/pgm/modules/ArrowRemovalMatchModule.java @@ -20,7 +20,7 @@ public class ArrowRemovalMatchModule extends MatchModule implements Listener { @Repeatable(interval = @Time(seconds = 1)) public void repeat() { for(Arrow arrow : getMatch().getWorld().getEntitiesByClass(Arrow.class)) { - if(arrow.getTicksLived() >= this.maxTicks && arrow.getPickupRule() != Arrow.PickupRule.ALLOWED) arrow.remove(); + if(arrow.getTicksLived() >= this.maxTicks && arrow.getPickupStatus() != Arrow.PickupStatus.ALLOWED) arrow.remove(); } } } diff --git a/PGM/src/main/java/tc/oc/pgm/modules/FriendlyFireRefundMatchModule.java b/PGM/src/main/java/tc/oc/pgm/modules/FriendlyFireRefundMatchModule.java index 1e965af..d9f8152 100644 --- a/PGM/src/main/java/tc/oc/pgm/modules/FriendlyFireRefundMatchModule.java +++ b/PGM/src/main/java/tc/oc/pgm/modules/FriendlyFireRefundMatchModule.java @@ -26,7 +26,7 @@ public class FriendlyFireRefundMatchModule extends MatchModule implements Listen public void handleFriendlyFire(EntityDamageByEntityEvent event) { if(event.isCancelled() && event.getDamager() instanceof Arrow) { Arrow arrow = (Arrow) event.getDamager(); - if(arrow.getPickupRule() == Arrow.PickupRule.ALLOWED && arrow.getShooter() != null && arrow.getShooter() instanceof Player){ + if(arrow.getPickupStatus() == Arrow.PickupStatus.ALLOWED && arrow.getShooter() != null && arrow.getShooter() instanceof Player){ Player owner = (Player) arrow.getShooter(); owner.getInventory().addItem(new ItemStack(Material.ARROW)); arrow.remove(); diff --git a/PGM/src/main/java/tc/oc/pgm/projectile/ProjectilePlayerFacet.java b/PGM/src/main/java/tc/oc/pgm/projectile/ProjectilePlayerFacet.java index a66b863..5507f83 100644 --- a/PGM/src/main/java/tc/oc/pgm/projectile/ProjectilePlayerFacet.java +++ b/PGM/src/main/java/tc/oc/pgm/projectile/ProjectilePlayerFacet.java @@ -79,7 +79,7 @@ public class ProjectilePlayerFacet implements MatchPlayerFacet, Listener { } if (projectile instanceof Arrow && item.getEnchantments().containsKey(Enchantment.ARROW_INFINITE)) { - ((Arrow) projectile).setPickupRule(Arrow.PickupRule.DISALLOWED); + ((Arrow) projectile).setPickupStatus(Arrow.PickupStatus.DISALLOWED); } // If the entity implements Projectile, it will have already generated a ProjectileLaunchEvent. diff --git a/PGM/src/main/java/tc/oc/pgm/tablist/MatchTabView.java b/PGM/src/main/java/tc/oc/pgm/tablist/MatchTabView.java index be17807..aea2bd1 100644 --- a/PGM/src/main/java/tc/oc/pgm/tablist/MatchTabView.java +++ b/PGM/src/main/java/tc/oc/pgm/tablist/MatchTabView.java @@ -10,7 +10,6 @@ import javax.annotation.Nullable; import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.ListMultimap; -import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; diff --git a/Tourney/pom.xml b/Tourney/pom.xml index f0d63bc..bd39545 100644 --- a/Tourney/pom.xml +++ b/Tourney/pom.xml @@ -5,7 +5,7 @@ tc.oc ProjectAres ../pom.xml - 1.11-SNAPSHOT + 1.12-SNAPSHOT net.anxuiz diff --git a/Util/bukkit/pom.xml b/Util/bukkit/pom.xml index e58ea45..9671b74 100644 --- a/Util/bukkit/pom.xml +++ b/Util/bukkit/pom.xml @@ -8,7 +8,7 @@ util tc.oc ../pom.xml - 1.11-SNAPSHOT + 1.12-SNAPSHOT util-bukkit @@ -34,12 +34,14 @@ tc.oc sportbukkit-api + 1.12-pre6-SNAPSHOT tc.oc sportbukkit + 1.12-pre6-SNAPSHOT diff --git a/Util/bukkit/src/main/java/tc/oc/commons/bukkit/util/NMSHacks.java b/Util/bukkit/src/main/java/tc/oc/commons/bukkit/util/NMSHacks.java index 714723f..6891147 100644 --- a/Util/bukkit/src/main/java/tc/oc/commons/bukkit/util/NMSHacks.java +++ b/Util/bukkit/src/main/java/tc/oc/commons/bukkit/util/NMSHacks.java @@ -408,7 +408,7 @@ public class NMSHacks { super(new EntityZombie(((CraftWorld) world).getHandle())); entity.setInvisible(invisible); - entity.setAI(true); + entity.setNoAI(false); } } @@ -684,7 +684,7 @@ public class NMSHacks { // Add/replace health to zero boolean replaced = false; - DataWatcher.Item zeroHealth = new DataWatcher.Item<>(EntityPlayer.class, EntityLiving.HEALTH, 0f); + DataWatcher.Item zeroHealth = new DataWatcher.Item<>(EntityLiving.HEALTH, 0f); if(packet.b != null) { for(int i = 0; i < packet.b.size(); i++) { diff --git a/Util/bukkit/src/main/java/tc/oc/commons/bukkit/util/PacketTracer.java b/Util/bukkit/src/main/java/tc/oc/commons/bukkit/util/PacketTracer.java index b7934fa..a2041ec 100644 --- a/Util/bukkit/src/main/java/tc/oc/commons/bukkit/util/PacketTracer.java +++ b/Util/bukkit/src/main/java/tc/oc/commons/bukkit/util/PacketTracer.java @@ -185,9 +185,13 @@ public class PacketTracer extends PacketDataSerializer { @Override protected void encode(ChannelHandlerContext context, Packet packet, ByteBuf buffer) throws Exception { final NetworkManager networkManager = context.pipeline().get(NetworkManager.class); - final Integer id = context.channel().attr(NetworkManager.c).get().a(EnumProtocolDirection.CLIENTBOUND, packet, networkManager.protocolVersion); + final Integer id = context.channel().attr(NetworkManager.c).get().a(EnumProtocolDirection.CLIENTBOUND, packet); + if (id == null) { - throw new IOException("Cannot encode unregistered packet class " + packet.getClass()); + final Integer latestId = context.channel().attr(NetworkManager.c).get().a(EnumProtocolDirection.CLIENTBOUND, packet); + if (latestId == null) { + throw new IOException("Cannot encode unregistered packet class " + packet.getClass()); + } } else { try { final PacketTracer dumper = new PacketTracer(buffer, logger, client); @@ -216,10 +220,13 @@ public class PacketTracer extends PacketDataSerializer { final PacketTracer dumper = new PacketTracer(buffer, logger, client); final int id = dumper.g(); // read VarInt final NetworkManager networkManager = context.pipeline().get(NetworkManager.class); - final Packet packet = context.channel().attr(NetworkManager.c).get().a(EnumProtocolDirection.SERVERBOUND, id, networkManager.protocolVersion); + final Packet packet = context.channel().attr(NetworkManager.c).get().a(EnumProtocolDirection.SERVERBOUND, id); if (packet == null) { - throw new IOException("Cannot decode unregistered packet ID " + id); + final Packet latestPacket = context.channel().attr(NetworkManager.c).get().a(EnumProtocolDirection.SERVERBOUND, id); + if (latestPacket == null) { + throw new IOException("Cannot decode unregistered packet ID " + id); + } } else { packet.a(dumper); // read packet diff --git a/Util/bungee/pom.xml b/Util/bungee/pom.xml index 106af56..c02eac3 100644 --- a/Util/bungee/pom.xml +++ b/Util/bungee/pom.xml @@ -8,7 +8,7 @@ util tc.oc ../pom.xml - 1.11-SNAPSHOT + 1.12-SNAPSHOT util-bungee diff --git a/Util/pom.xml b/Util/pom.xml index b43bffd..c99dac5 100644 --- a/Util/pom.xml +++ b/Util/pom.xml @@ -8,7 +8,7 @@ tc.oc ProjectAres ../pom.xml - 1.11-SNAPSHOT + 1.12-SNAPSHOT diff --git a/pom.xml b/pom.xml index f0b6765..5fc3d82 100644 --- a/pom.xml +++ b/pom.xml @@ -8,7 +8,7 @@ tc.oc ProjectAres - 1.11-SNAPSHOT + 1.12-SNAPSHOT pom @@ -200,12 +200,12 @@ tc.oc sportbukkit-api - 1.11.1-R0.1-SNAPSHOT + 1.12-pre6-SNAPSHOT tc.oc sportbukkit - 1.11.1-R0.1-SNAPSHOT + 1.12-pre6-SNAPSHOT com.sk89q