Update to 1.12
This commit is contained in:
parent
ddbc7c7eac
commit
0b3c51eb6b
|
@ -5,7 +5,7 @@
|
|||
<groupId>tc.oc</groupId>
|
||||
<artifactId>api-parent</artifactId>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
<version>1.11-SNAPSHOT</version>
|
||||
<version>1.12-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>api-bukkit</artifactId>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<groupId>tc.oc</groupId>
|
||||
<artifactId>api-parent</artifactId>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
<version>1.11-SNAPSHOT</version>
|
||||
<version>1.12-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>api-bungee</artifactId>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<groupId>tc.oc</groupId>
|
||||
<artifactId>api-parent</artifactId>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
<version>1.11-SNAPSHOT</version>
|
||||
<version>1.12-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>api-minecraft</artifactId>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<groupId>tc.oc</groupId>
|
||||
<artifactId>api-parent</artifactId>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
<version>1.11-SNAPSHOT</version>
|
||||
<version>1.12-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>api-ocn</artifactId>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<groupId>tc.oc</groupId>
|
||||
<artifactId>ProjectAres</artifactId>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
<version>1.11-SNAPSHOT</version>
|
||||
<version>1.12-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>api-parent</artifactId>
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<artifactId>commons</artifactId>
|
||||
<groupId>tc.oc</groupId>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
<version>1.11-SNAPSHOT</version>
|
||||
<version>1.12-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>commons-bukkit</artifactId>
|
||||
|
|
|
@ -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<PotionEffect> 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 <BENEFICIAL>",
|
||||
PotionClassification.BENEFICIAL, classify(effects));
|
||||
}
|
||||
}
|
|
@ -8,7 +8,7 @@
|
|||
<artifactId>commons</artifactId>
|
||||
<groupId>tc.oc</groupId>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
<version>1.11-SNAPSHOT</version>
|
||||
<version>1.12-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>commons-bungee</artifactId>
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<artifactId>commons</artifactId>
|
||||
<groupId>tc.oc</groupId>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
<version>1.11-SNAPSHOT</version>
|
||||
<version>1.12-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>commons-core</artifactId>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<groupId>tc.oc</groupId>
|
||||
<artifactId>ProjectAres</artifactId>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
<version>1.11-SNAPSHOT</version>
|
||||
<version>1.12-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>Lobby</artifactId>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<groupId>tc.oc</groupId>
|
||||
<artifactId>ProjectAres</artifactId>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
<version>1.11-SNAPSHOT</version>
|
||||
<version>1.12-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<!-- Parent Project Information -->
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<groupId>tc.oc</groupId>
|
||||
<artifactId>ProjectAres</artifactId>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
<version>1.11-SNAPSHOT</version>
|
||||
<version>1.12-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<groupId>net.anxuiz</groupId>
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<artifactId>util</artifactId>
|
||||
<groupId>tc.oc</groupId>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
<version>1.11-SNAPSHOT</version>
|
||||
<version>1.12-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>util-bukkit</artifactId>
|
||||
|
@ -34,12 +34,14 @@
|
|||
<dependency>
|
||||
<groupId>tc.oc</groupId>
|
||||
<artifactId>sportbukkit-api</artifactId>
|
||||
<version>1.12-pre6-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<!-- This dependency is NOT transitive, no clue why -->
|
||||
<groupId>tc.oc</groupId>
|
||||
<artifactId>sportbukkit</artifactId>
|
||||
<version>1.12-pre6-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Bukkit plugins/libraries -->
|
||||
|
|
|
@ -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<Float> zeroHealth = new DataWatcher.Item<>(EntityPlayer.class, EntityLiving.HEALTH, 0f);
|
||||
DataWatcher.Item<Float> zeroHealth = new DataWatcher.Item<>(EntityLiving.HEALTH, 0f);
|
||||
|
||||
if(packet.b != null) {
|
||||
for(int i = 0; i < packet.b.size(); i++) {
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<artifactId>util</artifactId>
|
||||
<groupId>tc.oc</groupId>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
<version>1.11-SNAPSHOT</version>
|
||||
<version>1.12-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>util-bungee</artifactId>
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<groupId>tc.oc</groupId>
|
||||
<artifactId>ProjectAres</artifactId>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
<version>1.11-SNAPSHOT</version>
|
||||
<version>1.12-SNAPSHOT</version>
|
||||
<!-- Don't use $global.version because we want to be able to use this in other projects -->
|
||||
</parent>
|
||||
|
||||
|
|
6
pom.xml
6
pom.xml
|
@ -8,7 +8,7 @@
|
|||
|
||||
<groupId>tc.oc</groupId>
|
||||
<artifactId>ProjectAres</artifactId>
|
||||
<version>1.11-SNAPSHOT</version>
|
||||
<version>1.12-SNAPSHOT</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<scm>
|
||||
|
@ -200,12 +200,12 @@
|
|||
<dependency>
|
||||
<groupId>tc.oc</groupId>
|
||||
<artifactId>sportbukkit-api</artifactId>
|
||||
<version>1.11.1-R0.1-SNAPSHOT</version>
|
||||
<version>1.12-pre6-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>tc.oc</groupId>
|
||||
<artifactId>sportbukkit</artifactId>
|
||||
<version>1.11.1-R0.1-SNAPSHOT</version>
|
||||
<version>1.12-pre6-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sk89q</groupId>
|
||||
|
|
Loading…
Reference in New Issue