This commit is contained in:
MattBDev 2016-11-20 22:24:27 -05:00
parent e0208aa369
commit 77281017d4
10 changed files with 165 additions and 81 deletions

View File

@ -2,12 +2,15 @@ repositories {
maven {url "https://hub.spigotmc.org/nexus/content/groups/public/"} maven {url "https://hub.spigotmc.org/nexus/content/groups/public/"}
maven { url = "https://oss.sonatype.org/content/repositories/snapshots/"} maven { url = "https://oss.sonatype.org/content/repositories/snapshots/"}
maven {url "http://nexus.hc.to/content/repositories/pub_releases"} maven {url "http://nexus.hc.to/content/repositories/pub_releases"}
mavenLocal()
} }
dependencies { dependencies {
compile project(':Core') compile project(':Core')
compile 'org.spigotmc:spigot-api:1.10.2-R0.1-SNAPSHOT' compile 'org.spigotmc:spigot-api:1.11-R0.1-SNAPSHOT'
compile 'net.milkbowl.vault:VaultAPI:1.6' compile("net.milkbowl.vault:VaultAPI:1.6") {
exclude module: 'bukkit'
}
} }
sourceCompatibility = 1.7 sourceCompatibility = 1.7

View File

@ -72,15 +72,6 @@ import com.plotsquared.bukkit.uuid.LowerOfflineUUIDWrapper;
import com.plotsquared.bukkit.uuid.OfflineUUIDWrapper; import com.plotsquared.bukkit.uuid.OfflineUUIDWrapper;
import com.plotsquared.bukkit.uuid.SQLUUIDHandler; import com.plotsquared.bukkit.uuid.SQLUUIDHandler;
import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEdit;
import java.io.File;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Location; import org.bukkit.Location;
@ -97,12 +88,22 @@ import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import java.io.File;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain { public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
private static ConcurrentHashMap<String, Plugin> pluginMap; private static ConcurrentHashMap<String, Plugin> pluginMap;
static { static {
{ // Disable AWE as otherwise both fail to load // Disable AWE as otherwise both fail to load
PluginManager manager = Bukkit.getPluginManager(); PluginManager manager = Bukkit.getPluginManager();
try { try {
Settings.load(new File("plugins/PlotSquared/config/settings.yml")); Settings.load(new File("plugins/PlotSquared/config/settings.yml"));
@ -145,7 +146,6 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
} }
} catch (Throwable ignore) {} } catch (Throwable ignore) {}
} }
}
public static WorldEdit worldEdit; public static WorldEdit worldEdit;
@ -299,6 +299,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
case TIPPED_ARROW: case TIPPED_ARROW:
case ENDER_PEARL: case ENDER_PEARL:
case ARROW: case ARROW:
case LLAMA_SPIT:
// managed elsewhere | projectile // managed elsewhere | projectile
continue; continue;
case ITEM_FRAME: case ITEM_FRAME:
@ -315,7 +316,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
case MINECART_MOB_SPAWNER: case MINECART_MOB_SPAWNER:
case ENDER_CRYSTAL: case ENDER_CRYSTAL:
case MINECART_TNT: case MINECART_TNT:
case BOAT: { case BOAT:
if (Settings.Enabled_Components.KILL_ROAD_VEHICLES) { if (Settings.Enabled_Components.KILL_ROAD_VEHICLES) {
com.intellectualcrafters.plot.object.Location location = BukkitUtil.getLocation(entity.getLocation()); com.intellectualcrafters.plot.object.Location location = BukkitUtil.getLocation(entity.getLocation());
Plot plot = location.getPlot(); Plot plot = location.getPlot();
@ -339,7 +340,6 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
} else { } else {
continue; continue;
} }
}
case SMALL_FIREBALL: case SMALL_FIREBALL:
case FIREBALL: case FIREBALL:
case DRAGON_FIREBALL: case DRAGON_FIREBALL:
@ -350,6 +350,20 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
case FALLING_BLOCK: case FALLING_BLOCK:
// managed elsewhere // managed elsewhere
continue; continue;
case LLAMA:
case DONKEY:
case MULE:
case ZOMBIE_HORSE:
case SKELETON_HORSE:
case HUSK:
case ELDER_GUARDIAN:
case WITHER_SKELETON:
case STRAY:
case ZOMBIE_VILLAGER:
case EVOKER:
case EVOKER_FANGS:
case VEX:
case VINDICATOR:
case POLAR_BEAR: case POLAR_BEAR:
case BAT: case BAT:
case BLAZE: case BLAZE:
@ -530,8 +544,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
public boolean initPlotMeConverter() { public boolean initPlotMeConverter() {
if (new LikePlotMeConverter("PlotMe").run(new ClassicPlotMeConnector())) { if (new LikePlotMeConverter("PlotMe").run(new ClassicPlotMeConnector())) {
return true; return true;
} } else if (new LikePlotMeConverter("PlotMe").run(new PlotMeConnector_017())) {
else if (new LikePlotMeConverter("PlotMe").run(new PlotMeConnector_017())) {
return true; return true;
} }
return false; return false;

View File

@ -67,7 +67,7 @@ public class PlotMeConnector_017 extends APlotMeConnector {
return null; return null;
} }
boolean checkUUID = DBFunc.hasColumn(resultSet, "ownerID"); boolean checkUUID = DBFunc.hasColumn(resultSet, "ownerID");
boolean merge = !this.plugin.equals("plotme") && Settings.Enabled_Components.PLOTME_CONVERTER; boolean merge = !"plotme".equals(this.plugin) && Settings.Enabled_Components.PLOTME_CONVERTER;
while (resultSet.next()) { while (resultSet.next()) {
int key = resultSet.getInt("plot_id"); int key = resultSet.getInt("plot_id");
PlotId id = new PlotId(resultSet.getInt("plotX"), resultSet.getInt("plotZ")); PlotId id = new PlotId(resultSet.getInt("plotX"), resultSet.getInt("plotZ"));

View File

@ -2,7 +2,6 @@ package com.plotsquared.bukkit.generator;
import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.generator.GeneratorWrapper; import com.intellectualcrafters.plot.generator.GeneratorWrapper;
import com.intellectualcrafters.plot.generator.HybridGen;
import com.intellectualcrafters.plot.generator.IndependentPlotGenerator; import com.intellectualcrafters.plot.generator.IndependentPlotGenerator;
import com.intellectualcrafters.plot.object.ChunkLoc; import com.intellectualcrafters.plot.object.ChunkLoc;
import com.intellectualcrafters.plot.object.ChunkWrapper; import com.intellectualcrafters.plot.object.ChunkWrapper;
@ -245,8 +244,7 @@ public class BukkitPlotGenerator extends ChunkGenerator implements GeneratorWrap
ArrayList<BlockPopulator> toAdd = new ArrayList<>(); ArrayList<BlockPopulator> toAdd = new ArrayList<>();
List<BlockPopulator> existing = world.getPopulators(); List<BlockPopulator> existing = world.getPopulators();
if (populators == null && platformGenerator != null) { if (populators == null && platformGenerator != null) {
populators = new ArrayList<>(); populators = new ArrayList<>(platformGenerator.getDefaultPopulators(world));
this.populators.addAll(platformGenerator.getDefaultPopulators(world));
} }
for (BlockPopulator populator : this.populators) { for (BlockPopulator populator : this.populators) {
if (!existing.contains(populator)) { if (!existing.contains(populator)) {

View File

@ -25,17 +25,9 @@ import com.intellectualcrafters.plot.util.UUIDHandler;
import com.plotsquared.bukkit.object.BukkitLazyBlock; import com.plotsquared.bukkit.object.BukkitLazyBlock;
import com.plotsquared.bukkit.object.BukkitPlayer; import com.plotsquared.bukkit.object.BukkitPlayer;
import com.plotsquared.bukkit.util.BukkitUtil; import com.plotsquared.bukkit.util.BukkitUtil;
import com.plotsquared.bukkit.util.BukkitVersion;
import com.plotsquared.listener.PlayerBlockEventType; import com.plotsquared.listener.PlayerBlockEventType;
import com.plotsquared.listener.PlotListener; import com.plotsquared.listener.PlotListener;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map.Entry;
import java.util.Objects;
import java.util.Set;
import java.util.UUID;
import java.util.regex.Pattern;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
@ -123,6 +115,18 @@ import org.bukkit.projectiles.BlockProjectileSource;
import org.bukkit.projectiles.ProjectileSource; import org.bukkit.projectiles.ProjectileSource;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map.Entry;
import java.util.Objects;
import java.util.Set;
import java.util.UUID;
import java.util.regex.Pattern;
/** /**
* Player Events involving plots. * Player Events involving plots.
* *
@ -160,6 +164,7 @@ public class PlayerEvents extends PlotListener implements Listener {
public void onRedstoneEvent(BlockRedstoneEvent event) { public void onRedstoneEvent(BlockRedstoneEvent event) {
Block block = event.getBlock(); Block block = event.getBlock();
switch (block.getType()) { switch (block.getType()) {
case OBSERVER:
case REDSTONE_LAMP_OFF: case REDSTONE_LAMP_OFF:
case REDSTONE_WIRE: case REDSTONE_WIRE:
case REDSTONE_LAMP_ON: case REDSTONE_LAMP_ON:
@ -604,7 +609,7 @@ public class PlayerEvents extends PlotListener implements Listener {
PlotPlayer plotPlayer = BukkitUtil.getPlayer(event.getPlayer()); PlotPlayer plotPlayer = BukkitUtil.getPlayer(event.getPlayer());
Location location = plotPlayer.getLocation(); Location location = plotPlayer.getLocation();
PlotArea area = location.getPlotArea(); PlotArea area = location.getPlotArea();
if (area == null || (!area.PLOT_CHAT != plotPlayer.getAttribute("chat"))) { if (area == null || (area.PLOT_CHAT == plotPlayer.getAttribute("chat"))) {
return; return;
} }
Plot plot = area.getPlot(location); Plot plot = area.getPlot(location);
@ -1223,6 +1228,25 @@ public class PlayerEvents extends PlotListener implements Listener {
case NOTE_BLOCK: case NOTE_BLOCK:
case JUKEBOX: case JUKEBOX:
case WORKBENCH: case WORKBENCH:
case SILVER_SHULKER_BOX:
case BLACK_SHULKER_BOX:
case BLUE_SHULKER_BOX:
case RED_SHULKER_BOX:
case PINK_SHULKER_BOX:
case ORANGE_SHULKER_BOX:
case WHITE_SHULKER_BOX:
case YELLOW_SHULKER_BOX:
case BROWN_SHULKER_BOX:
case CYAN_SHULKER_BOX:
case GREEN_SHULKER_BOX:
case PURPLE_SHULKER_BOX:
case GRAY_SHULKER_BOX:
case LIME_SHULKER_BOX:
case LIGHT_BLUE_SHULKER_BOX:
case MAGENTA_SHULKER_BOX:
case COMMAND_REPEATING:
case COMMAND_CHAIN:
eventType = PlayerBlockEventType.INTERACT_BLOCK; eventType = PlayerBlockEventType.INTERACT_BLOCK;
break; break;
case DRAGON_EGG: case DRAGON_EGG:
@ -1241,7 +1265,7 @@ public class PlayerEvents extends PlotListener implements Listener {
} }
Material type = (hand == null) ? null : hand.getType(); Material type = (hand == null) ? null : hand.getType();
int id = (type == null) ? 0 : type.getId(); int id = (type == null) ? 0 : type.getId();
if (id == 0) { if (type == Material.AIR) {
eventType = PlayerBlockEventType.INTERACT_BLOCK; eventType = PlayerBlockEventType.INTERACT_BLOCK;
break; break;
} }
@ -1258,18 +1282,15 @@ public class PlayerEvents extends PlotListener implements Listener {
case MONSTER_EGGS: case MONSTER_EGGS:
eventType = PlayerBlockEventType.SPAWN_MOB; eventType = PlayerBlockEventType.SPAWN_MOB;
break; break;
case ARMOR_STAND: case ARMOR_STAND:
location = BukkitUtil.getLocation(block.getRelative(event.getBlockFace()).getLocation()); location = BukkitUtil.getLocation(block.getRelative(event.getBlockFace()).getLocation());
eventType = PlayerBlockEventType.PLACE_MISC; eventType = PlayerBlockEventType.PLACE_MISC;
break; break;
case WRITTEN_BOOK: case WRITTEN_BOOK:
case BOOK_AND_QUILL: case BOOK_AND_QUILL:
case BOOK: case BOOK:
eventType = PlayerBlockEventType.READ; eventType = PlayerBlockEventType.READ;
break; break;
case APPLE: case APPLE:
case BAKED_POTATO: case BAKED_POTATO:
case MUSHROOM_SOUP: case MUSHROOM_SOUP:
@ -1510,6 +1531,7 @@ public class PlayerEvents extends PlotListener implements Listener {
switch (entity.getType()) { switch (entity.getType()) {
case PLAYER: case PLAYER:
return false; return false;
case LLAMA_SPIT:
case SMALL_FIREBALL: case SMALL_FIREBALL:
case FIREBALL: case FIREBALL:
case DROPPED_ITEM: case DROPPED_ITEM:
@ -1539,6 +1561,7 @@ public class PlayerEvents extends PlotListener implements Listener {
case AREA_EFFECT_CLOUD: case AREA_EFFECT_CLOUD:
case LIGHTNING: case LIGHTNING:
case WITHER_SKULL: case WITHER_SKULL:
case EVOKER_FANGS:
case UNKNOWN: case UNKNOWN:
// non moving / unmovable // non moving / unmovable
return checkEntity(plot, Flags.ENTITY_CAP); return checkEntity(plot, Flags.ENTITY_CAP);
@ -1571,6 +1594,11 @@ public class PlayerEvents extends PlotListener implements Listener {
case SNOWMAN: case SNOWMAN:
case BAT: case BAT:
case HORSE: case HORSE:
case DONKEY:
case LLAMA:
case MULE:
case ZOMBIE_HORSE:
case SKELETON_HORSE:
// animal // animal
return checkEntity(plot, Flags.ENTITY_CAP, Flags.MOB_CAP, Flags.ANIMAL_CAP); return checkEntity(plot, Flags.ENTITY_CAP, Flags.MOB_CAP, Flags.ANIMAL_CAP);
case BLAZE: case BLAZE:
@ -1592,6 +1620,14 @@ public class PlayerEvents extends PlotListener implements Listener {
case WITHER: case WITHER:
case ZOMBIE: case ZOMBIE:
case SHULKER: case SHULKER:
case HUSK:
case STRAY:
case ELDER_GUARDIAN:
case WITHER_SKELETON:
case VINDICATOR:
case EVOKER:
case VEX:
case ZOMBIE_VILLAGER:
// monster // monster
return checkEntity(plot, Flags.ENTITY_CAP, Flags.MOB_CAP, Flags.HOSTILE_CAP); return checkEntity(plot, Flags.ENTITY_CAP, Flags.MOB_CAP, Flags.HOSTILE_CAP);
default: default:
@ -2055,7 +2091,23 @@ public class PlayerEvents extends PlotListener implements Listener {
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
@EventHandler(priority = EventPriority.HIGHEST) @EventHandler(priority = EventPriority.HIGHEST)
public void onEntityCombustByEntity(EntityCombustByEntityEvent event) { public void onEntityCombustByEntity(EntityCombustByEntityEvent event) {
EntityDamageByEntityEvent eventChange = new EntityDamageByEntityEvent(event.getCombuster(), event.getEntity(), EntityDamageEvent.DamageCause.FIRE_TICK, event.getDuration()); EntityDamageByEntityEvent eventChange = null;
if (PS.get().checkVersion(PS.get().IMP.getServerVersion(), BukkitVersion.v1_11_0)) {
eventChange = new EntityDamageByEntityEvent(event.getCombuster(), event.getEntity(),
EntityDamageEvent.DamageCause.FIRE_TICK, (double)event.getDuration());
} else {
try {
Constructor<EntityDamageByEntityEvent> constructor = EntityDamageByEntityEvent.class.getConstructor(Entity.class,
Entity.class, EntityDamageEvent.DamageCause.class, Integer.TYPE);
eventChange = constructor.newInstance(event.getCombuster(), event.getEntity(),
EntityDamageEvent.DamageCause.FIRE_TICK, event.getDuration());
} catch (NoSuchMethodException | IllegalAccessException | InstantiationException | InvocationTargetException e) {
e.printStackTrace();
}
}
if (eventChange == null) {
return;
}
onEntityDamageByEntityEvent(eventChange); onEntityDamageByEntityEvent(eventChange);
} }

View File

@ -11,9 +11,6 @@ import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.Permissions; import com.intellectualcrafters.plot.util.Permissions;
import com.plotsquared.bukkit.util.BukkitUtil; import com.plotsquared.bukkit.util.BukkitUtil;
import com.plotsquared.listener.PlotListener; import com.plotsquared.listener.PlotListener;
import java.util.HashSet;
import java.util.List;
import java.util.UUID;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.BlockState; import org.bukkit.block.BlockState;
import org.bukkit.entity.ArmorStand; import org.bukkit.entity.ArmorStand;
@ -30,6 +27,10 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory; import org.bukkit.inventory.PlayerInventory;
import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.ItemMeta;
import java.util.HashSet;
import java.util.List;
import java.util.UUID;
public class PlayerEvents_1_8 extends PlotListener implements Listener { public class PlayerEvents_1_8 extends PlotListener implements Listener {
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
@ -66,7 +67,7 @@ public class PlayerEvents_1_8 extends PlotListener implements Listener {
oldLore = lore.toString(); oldLore = lore.toString();
} }
} }
if (!newLore.equals("[(+NBT)]") || (current.equals(newItem) && newLore.equals(oldLore))) { if (!"[(+NBT)]".equals(newLore) || (current.equals(newItem) && newLore.equals(oldLore))) {
return; return;
} }
HashSet<Byte> blocks = null; HashSet<Byte> blocks = null;

View File

@ -6,6 +6,7 @@ import com.intellectualcrafters.plot.util.TaskManager;
import com.plotsquared.bukkit.object.BukkitPlayer; import com.plotsquared.bukkit.object.BukkitPlayer;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@SuppressWarnings("deprecation")
public class DefaultTitle_19 extends AbstractTitle { public class DefaultTitle_19 extends AbstractTitle {
@Override @Override

View File

@ -516,6 +516,7 @@ public class BukkitChunkManager extends ChunkManager {
case SHULKER_BULLET: case SHULKER_BULLET:
case SPECTRAL_ARROW: case SPECTRAL_ARROW:
case DRAGON_FIREBALL: case DRAGON_FIREBALL:
case LLAMA_SPIT:
// projectile // projectile
case PRIMED_TNT: case PRIMED_TNT:
case FALLING_BLOCK: case FALLING_BLOCK:
@ -533,6 +534,7 @@ public class BukkitChunkManager extends ChunkManager {
case UNKNOWN: case UNKNOWN:
case AREA_EFFECT_CLOUD: case AREA_EFFECT_CLOUD:
case LINGERING_POTION: case LINGERING_POTION:
case EVOKER_FANGS:
// non moving / unremovable // non moving / unremovable
break; break;
case ITEM_FRAME: case ITEM_FRAME:
@ -566,6 +568,11 @@ public class BukkitChunkManager extends ChunkManager {
case COW: case COW:
case SNOWMAN: case SNOWMAN:
case BAT: case BAT:
case DONKEY:
case LLAMA:
case SKELETON_HORSE:
case ZOMBIE_HORSE:
case MULE:
// animal // animal
count[3]++; count[3]++;
count[1]++; count[1]++;
@ -589,6 +596,14 @@ public class BukkitChunkManager extends ChunkManager {
case WITHER: case WITHER:
case ZOMBIE: case ZOMBIE:
case SHULKER: case SHULKER:
case ELDER_GUARDIAN:
case STRAY:
case HUSK:
case EVOKER:
case VEX:
case WITHER_SKELETON:
case ZOMBIE_VILLAGER:
case VINDICATOR:
// monster // monster
count[3]++; count[3]++;
count[2]++; count[2]++;

View File

@ -1,6 +1,7 @@
package com.plotsquared.bukkit.util; package com.plotsquared.bukkit.util;
public class BukkitVersion { public class BukkitVersion {
public static int[] v1_11_0 = {1, 11, 0};
public static int[] v1_10_2 = {1, 10, 2}; public static int[] v1_10_2 = {1, 10, 2};
public static int[] v1_10_0 = {1, 10, 0}; public static int[] v1_10_0 = {1, 10, 0};
public static int[] v1_9_4 = {1, 9, 4}; public static int[] v1_9_4 = {1, 9, 4};

View File

@ -1,6 +1,6 @@
#Wed Oct 26 22:42:12 EDT 2016 #Thu Nov 17 22:56:15 EST 2016
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.0-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-3.0-all.zip