mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-25 22:56:45 +01:00
Fixes #1672
This commit is contained in:
parent
c36ef1d237
commit
c3759f8963
@ -7,7 +7,7 @@ repositories {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile project(':Core')
|
compile project(':Core')
|
||||||
compile 'org.spigotmc:spigot-api:1.11.2-R0.1-SNAPSHOT'
|
compile 'org.spigotmc:spigot-api:1.12.1-R0.1-SNAPSHOT'
|
||||||
compile("net.milkbowl.vault:VaultAPI:1.6") {
|
compile("net.milkbowl.vault:VaultAPI:1.6") {
|
||||||
exclude module: 'bukkit'
|
exclude module: 'bukkit'
|
||||||
}
|
}
|
||||||
|
@ -49,6 +49,8 @@ import com.plotsquared.bukkit.listeners.PlayerEvents183;
|
|||||||
import com.plotsquared.bukkit.listeners.PlayerEvents_1_8;
|
import com.plotsquared.bukkit.listeners.PlayerEvents_1_8;
|
||||||
import com.plotsquared.bukkit.listeners.PlayerEvents_1_9;
|
import com.plotsquared.bukkit.listeners.PlayerEvents_1_9;
|
||||||
import com.plotsquared.bukkit.listeners.PlotPlusListener;
|
import com.plotsquared.bukkit.listeners.PlotPlusListener;
|
||||||
|
import com.plotsquared.bukkit.listeners.PlotPlusListener_1_12;
|
||||||
|
import com.plotsquared.bukkit.listeners.PlotPlusListener_Legacy;
|
||||||
import com.plotsquared.bukkit.listeners.WorldEvents;
|
import com.plotsquared.bukkit.listeners.WorldEvents;
|
||||||
import com.plotsquared.bukkit.titles.DefaultTitle_111;
|
import com.plotsquared.bukkit.titles.DefaultTitle_111;
|
||||||
import com.plotsquared.bukkit.util.BukkitChatManager;
|
import com.plotsquared.bukkit.util.BukkitChatManager;
|
||||||
@ -532,6 +534,11 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
|||||||
public void registerPlotPlusEvents() {
|
public void registerPlotPlusEvents() {
|
||||||
PlotPlusListener.startRunnable(this);
|
PlotPlusListener.startRunnable(this);
|
||||||
getServer().getPluginManager().registerEvents(new PlotPlusListener(), this);
|
getServer().getPluginManager().registerEvents(new PlotPlusListener(), this);
|
||||||
|
if (PS.get().checkVersion(getServerVersion(), BukkitVersion.v1_12_0)) {
|
||||||
|
getServer().getPluginManager().registerEvents(new PlotPlusListener_1_12(), this);
|
||||||
|
} else {
|
||||||
|
getServer().getPluginManager().registerEvents(new PlotPlusListener_Legacy(), this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -24,7 +24,6 @@ import org.bukkit.event.block.BlockBreakEvent;
|
|||||||
import org.bukkit.event.block.BlockDamageEvent;
|
import org.bukkit.event.block.BlockDamageEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent;
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
import org.bukkit.event.player.PlayerDropItemEvent;
|
import org.bukkit.event.player.PlayerDropItemEvent;
|
||||||
import org.bukkit.event.player.PlayerPickupItemEvent;
|
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
@ -114,20 +113,6 @@ public class PlotPlusListener extends PlotListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onItemPickup(PlayerPickupItemEvent event) {
|
|
||||||
Player player = event.getPlayer();
|
|
||||||
PlotPlayer pp = BukkitUtil.getPlayer(player);
|
|
||||||
Plot plot = BukkitUtil.getLocation(player).getOwnedPlot();
|
|
||||||
if (plot == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
UUID uuid = pp.getUUID();
|
|
||||||
if (plot.isAdded(uuid) && Flags.DROP_PROTECTION.isTrue(plot)) {
|
|
||||||
event.setCancelled(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onItemDrop(PlayerDropItemEvent event) {
|
public void onItemDrop(PlayerDropItemEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
@ -0,0 +1,31 @@
|
|||||||
|
package com.plotsquared.bukkit.listeners;
|
||||||
|
|
||||||
|
import com.intellectualcrafters.plot.flag.Flags;
|
||||||
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
|
import com.plotsquared.bukkit.util.BukkitUtil;
|
||||||
|
import java.util.UUID;
|
||||||
|
import org.bukkit.entity.LivingEntity;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.entity.EntityPickupItemEvent;
|
||||||
|
|
||||||
|
public class PlotPlusListener_1_12 implements Listener {
|
||||||
|
@EventHandler
|
||||||
|
public void onItemPickup(EntityPickupItemEvent event) {
|
||||||
|
LivingEntity ent = event.getEntity();
|
||||||
|
if (ent instanceof Player) {
|
||||||
|
Player player = (Player) ent;
|
||||||
|
PlotPlayer pp = BukkitUtil.getPlayer(player);
|
||||||
|
Plot plot = BukkitUtil.getLocation(player).getOwnedPlot();
|
||||||
|
if (plot == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
UUID uuid = pp.getUUID();
|
||||||
|
if (plot.isAdded(uuid) && Flags.DROP_PROTECTION.isTrue(plot)) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,27 @@
|
|||||||
|
package com.plotsquared.bukkit.listeners;
|
||||||
|
|
||||||
|
import com.intellectualcrafters.plot.flag.Flags;
|
||||||
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
|
import com.plotsquared.bukkit.util.BukkitUtil;
|
||||||
|
import java.util.UUID;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.player.PlayerPickupItemEvent;
|
||||||
|
|
||||||
|
public class PlotPlusListener_Legacy implements Listener {
|
||||||
|
@EventHandler
|
||||||
|
public void onItemPickup(PlayerPickupItemEvent event) {
|
||||||
|
Player player = event.getPlayer();
|
||||||
|
PlotPlayer pp = BukkitUtil.getPlayer(player);
|
||||||
|
Plot plot = BukkitUtil.getLocation(player).getOwnedPlot();
|
||||||
|
if (plot == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
UUID uuid = pp.getUUID();
|
||||||
|
if (plot.isAdded(uuid) && Flags.DROP_PROTECTION.isTrue(plot)) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,6 +1,8 @@
|
|||||||
package com.plotsquared.bukkit.util;
|
package com.plotsquared.bukkit.util;
|
||||||
|
|
||||||
public class BukkitVersion {
|
public class BukkitVersion {
|
||||||
|
public static int[] v1_12_1 = {1, 12, 1};
|
||||||
|
public static int[] v1_12_0 = {1, 12, 0};
|
||||||
public static int[] v1_11_0 = {1, 11, 0};
|
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};
|
||||||
|
Loading…
Reference in New Issue
Block a user