mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-29 16:46:45 +01:00
Removed warnings on listeners
This commit is contained in:
parent
4e552b870d
commit
6e1ca16121
@ -27,9 +27,13 @@ import java.util.Iterator;
|
|||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Empire92
|
||||||
|
*/
|
||||||
|
@SuppressWarnings({"unused", "deprecation"})
|
||||||
public class EntityListener implements Listener {
|
public class EntityListener implements Listener {
|
||||||
|
|
||||||
public static HashMap<String, HashMap<Plot, HashSet<Integer>>> entityMap = new HashMap<String, HashMap<Plot, HashSet<Integer>>>();
|
public static HashMap<String, HashMap<Plot, HashSet<Integer>>> entityMap = new HashMap<>();
|
||||||
|
|
||||||
public EntityListener() {
|
public EntityListener() {
|
||||||
BukkitScheduler scheduler = Bukkit.getServer().getScheduler();
|
BukkitScheduler scheduler = Bukkit.getServer().getScheduler();
|
||||||
@ -169,9 +173,7 @@ public class EntityListener implements Listener {
|
|||||||
entityMap.get(w).get(plot).remove(id);
|
entityMap.get(w).get(plot).remove(id);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Iterator<Entry<Plot, HashSet<Integer>>> it = entityMap.get(w).entrySet().iterator();
|
for (Entry<Plot, HashSet<Integer>> n : entityMap.get(w).entrySet()) {
|
||||||
while (it.hasNext()) {
|
|
||||||
Entry<Plot, HashSet<Integer>> n = it.next();
|
|
||||||
n.getValue().remove(id);
|
n.getValue().remove(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ import java.util.HashSet;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Citymonstret on 2014-10-24.
|
* @author Citymonstret
|
||||||
*/
|
*/
|
||||||
public class ForceFieldListener implements Listener {
|
public class ForceFieldListener implements Listener {
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ public class ForceFieldListener implements Listener {
|
|||||||
|
|
||||||
private Set<Player> getNearbyPlayers(final Player player, final Plot plot) {
|
private Set<Player> getNearbyPlayers(final Player player, final Plot plot) {
|
||||||
final Set<Player> players = new HashSet<>();
|
final Set<Player> players = new HashSet<>();
|
||||||
Player oPlayer = null;
|
Player oPlayer;
|
||||||
for (final Entity entity : player.getNearbyEntities(5d, 5d, 5d)) {
|
for (final Entity entity : player.getNearbyEntities(5d, 5d, 5d)) {
|
||||||
if (!(entity instanceof Player) || ((oPlayer = (Player) entity) == null) || !PlayerFunctions.isInPlot(oPlayer) || !PlayerFunctions.getCurrentPlot(oPlayer).equals(plot)) {
|
if (!(entity instanceof Player) || ((oPlayer = (Player) entity) == null) || !PlayerFunctions.isInPlot(oPlayer) || !PlayerFunctions.getCurrentPlot(oPlayer).equals(plot)) {
|
||||||
continue;
|
continue;
|
||||||
@ -59,7 +59,7 @@ public class ForceFieldListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Player hasNearbyPermitted(final Player player, final Plot plot) {
|
private Player hasNearbyPermitted(final Player player, final Plot plot) {
|
||||||
Player oPlayer = null;
|
Player oPlayer;
|
||||||
for (final Entity entity : player.getNearbyEntities(5d, 5d, 5d)) {
|
for (final Entity entity : player.getNearbyEntities(5d, 5d, 5d)) {
|
||||||
if (!(entity instanceof Player) || ((oPlayer = (Player) entity) == null) || !PlayerFunctions.isInPlot(oPlayer) || !PlayerFunctions.getCurrentPlot(oPlayer).equals(plot)) {
|
if (!(entity instanceof Player) || ((oPlayer = (Player) entity) == null) || !PlayerFunctions.isInPlot(oPlayer) || !PlayerFunctions.getCurrentPlot(oPlayer).equals(plot)) {
|
||||||
continue;
|
continue;
|
||||||
@ -95,6 +95,7 @@ public class ForceFieldListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
@SuppressWarnings("unused")
|
||||||
public void onPlotEntry(final PlayerMoveEvent event) {
|
public void onPlotEntry(final PlayerMoveEvent event) {
|
||||||
final Player player = event.getPlayer();
|
final Player player = event.getPlayer();
|
||||||
if (!PlayerFunctions.isInPlot(player)) {
|
if (!PlayerFunctions.isInPlot(player)) {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.intellectualcrafters.plot.listeners;
|
package com.intellectualcrafters.plot.listeners;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.object.InfoInventory;
|
import com.intellectualcrafters.plot.object.InfoInventory;
|
||||||
|
import com.intellectualcrafters.plot.util.PlayerFunctions;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.Event;
|
import org.bukkit.event.Event;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
@ -29,6 +30,16 @@ public class InventoryListener implements Listener {
|
|||||||
final Player player = (Player) event.getWhoClicked();
|
final Player player = (Player) event.getWhoClicked();
|
||||||
if (inventory.getHolder() instanceof InfoInventory) {
|
if (inventory.getHolder() instanceof InfoInventory) {
|
||||||
// TODO: Do stuff
|
// TODO: Do stuff
|
||||||
|
switch (event.getSlot()) {
|
||||||
|
case 3:
|
||||||
|
case 4:
|
||||||
|
case 5:
|
||||||
|
case 6:
|
||||||
|
PlayerFunctions.sendMessage(player, "This is not implemented yet");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,6 +56,7 @@ import java.util.Set;
|
|||||||
* Player Events involving plots
|
* Player Events involving plots
|
||||||
*
|
*
|
||||||
* @author Citymonstret
|
* @author Citymonstret
|
||||||
|
* @author Empire92
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotListener implements Listener {
|
public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotListener implements Listener {
|
||||||
|
@ -41,8 +41,10 @@ import java.util.Arrays;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Citymonstret on 2014-10-21.
|
* @author Citymonstret
|
||||||
|
* @author Empire92
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings({"unused", "deprecation"})
|
||||||
public class PlotListener {
|
public class PlotListener {
|
||||||
|
|
||||||
public static void textures(final Player p) {
|
public static void textures(final Player p) {
|
||||||
@ -87,37 +89,19 @@ public class PlotListener {
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean enteredPlot(final Location l1, final Location l2) {
|
public static boolean enteredPlot(final Location l1, final Location l2) {
|
||||||
final PlotId p1 = PlayerFunctions.getPlot(new Location(l1.getWorld(), l1.getBlockX(), 64, l1.getBlockZ()));
|
final PlotId p1 = PlayerFunctions.getPlot(new Location(l1.getWorld(), l1.getBlockX(), 64, l1.getBlockZ()));
|
||||||
final PlotId p2 = PlayerFunctions.getPlot(new Location(l2.getWorld(), l2.getBlockX(), 64, l2.getBlockZ()));
|
final PlotId p2 = PlayerFunctions.getPlot(new Location(l2.getWorld(), l2.getBlockX(), 64, l2.getBlockZ()));
|
||||||
if (p2 == null) {
|
return p2 != null && (p1 == null || !p1.equals(p2));
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (p1 == null) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (p1.equals(p2)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean leftPlot(final Location l1, final Location l2) {
|
public static boolean leftPlot(final Location l1, final Location l2) {
|
||||||
final PlotId p1 = PlayerFunctions.getPlot(new Location(l1.getWorld(), l1.getBlockX(), 64, l1.getBlockZ()));
|
final PlotId p1 = PlayerFunctions.getPlot(new Location(l1.getWorld(), l1.getBlockX(), 64, l1.getBlockZ()));
|
||||||
final PlotId p2 = PlayerFunctions.getPlot(new Location(l2.getWorld(), l2.getBlockX(), 64, l2.getBlockZ()));
|
final PlotId p2 = PlayerFunctions.getPlot(new Location(l2.getWorld(), l2.getBlockX(), 64, l2.getBlockZ()));
|
||||||
if (p1 == null) {
|
return p1 != null && (p2 == null || !p1.equals(p2));
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (p2 == null) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (p1.equals(p2)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isPlotWorld(final Location l) {
|
public static boolean isPlotWorld(final Location l) {
|
||||||
|
@ -43,8 +43,11 @@ import org.bukkit.plugin.java.JavaPlugin;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Citymonstret on 2014-10-30.
|
* Created 2014-10-30 for PlotSquared
|
||||||
|
*
|
||||||
|
* @author Citymonstret
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings({"deprecation", "unused"})
|
||||||
public class PlotPlusListener extends PlotListener implements Listener {
|
public class PlotPlusListener extends PlotListener implements Listener {
|
||||||
|
|
||||||
private static HashMap<String, Interval> feedRunnable = new HashMap<>();
|
private static HashMap<String, Interval> feedRunnable = new HashMap<>();
|
||||||
@ -239,7 +242,9 @@ public class PlotPlusListener extends PlotListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Citymonstret on 2014-10-22.
|
* Record Meta Class
|
||||||
|
*
|
||||||
|
* @author Citymonstret
|
||||||
*/
|
*/
|
||||||
public static class RecordMeta {
|
public static class RecordMeta {
|
||||||
public static List<RecordMeta> metaList = new ArrayList<>();
|
public static List<RecordMeta> metaList = new ArrayList<>();
|
||||||
@ -263,6 +268,11 @@ public class PlotPlusListener extends PlotListener implements Listener {
|
|||||||
return this.name;
|
return this.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return this.name.hashCode();
|
||||||
|
}
|
||||||
|
|
||||||
public Material getMaterial() {
|
public Material getMaterial() {
|
||||||
return this.material;
|
return this.material;
|
||||||
}
|
}
|
||||||
|
@ -45,11 +45,13 @@ import java.util.Set;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Citymonstret
|
* @author Citymonstret
|
||||||
|
* @author Empire92
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("unused")
|
||||||
public class WorldEditListener implements Listener {
|
public class WorldEditListener implements Listener {
|
||||||
|
|
||||||
public final Set<String> blockedcmds = new HashSet<String>(Arrays.asList("/gmask", "//gmask", "/worldedit:gmask"));
|
public final Set<String> blockedcmds = new HashSet<>(Arrays.asList("/gmask", "//gmask", "/worldedit:gmask"));
|
||||||
public final Set<String> restrictedcmds = new HashSet<String>(Arrays.asList("/up", "//up", "/worldedit:up"));
|
public final Set<String> restrictedcmds = new HashSet<>(Arrays.asList("/up", "//up", "/worldedit:up"));
|
||||||
|
|
||||||
private boolean isPlotWorld(final Location l) {
|
private boolean isPlotWorld(final Location l) {
|
||||||
return (PlotMain.isPlotWorld(l.getWorld()));
|
return (PlotMain.isPlotWorld(l.getWorld()));
|
||||||
@ -93,7 +95,7 @@ public class WorldEditListener implements Listener {
|
|||||||
}
|
}
|
||||||
final Plot plot = PlotHelper.getCurrentPlot(b.getLocation());
|
final Plot plot = PlotHelper.getCurrentPlot(b.getLocation());
|
||||||
if (plot != null) {
|
if (plot != null) {
|
||||||
if ((plot != null) && plot.hasOwner() && (plot.helpers != null) && (plot.helpers.contains(DBFunc.everyone) || plot.helpers.contains(p.getUniqueId()))) {
|
if (plot.hasOwner() && (plot.helpers != null) && (plot.helpers.contains(DBFunc.everyone) || plot.helpers.contains(p.getUniqueId()))) {
|
||||||
PWE.setMask(p, l);
|
PWE.setMask(p, l);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -173,7 +175,6 @@ public class WorldEditListener implements Listener {
|
|||||||
}
|
}
|
||||||
if ((f != null) && isPlotWorld(f)) {
|
if ((f != null) && isPlotWorld(f)) {
|
||||||
PWE.removeMask(p);
|
PWE.removeMask(p);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,14 +52,19 @@ import java.util.Map;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Citymonstret on 2014-09-24.
|
* Created 2014-09-24 for PlotSquared
|
||||||
|
*
|
||||||
|
* @author Citymonstret
|
||||||
|
* @author Empire92
|
||||||
*/
|
*/
|
||||||
public class WorldGuardListener implements Listener {
|
public class WorldGuardListener implements Listener {
|
||||||
public ArrayList<String> str_flags = new ArrayList<String>();
|
public final ArrayList<String> str_flags;
|
||||||
public ArrayList<Flag<?>> flags = new ArrayList<Flag<?>>();
|
public final ArrayList<Flag<?>> flags;
|
||||||
|
|
||||||
public WorldGuardListener(final PlotMain plugin) {
|
public WorldGuardListener(final PlotMain plugin) {
|
||||||
plugin.getServer().getPluginManager().registerEvents(this, plugin);
|
plugin.getServer().getPluginManager().registerEvents(this, plugin);
|
||||||
|
str_flags = new ArrayList<>();
|
||||||
|
flags = new ArrayList<>();
|
||||||
for (final Flag<?> flag : DefaultFlag.getFlags()) {
|
for (final Flag<?> flag : DefaultFlag.getFlags()) {
|
||||||
this.str_flags.add(flag.getName());
|
this.str_flags.add(flag.getName());
|
||||||
this.flags.add(flag);
|
this.flags.add(flag);
|
||||||
@ -127,6 +132,7 @@ public class WorldGuardListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onMerge(final PlotMergeEvent event) {
|
public void onMerge(final PlotMergeEvent event) {
|
||||||
final Plot main = event.getPlot();
|
final Plot main = event.getPlot();
|
||||||
@ -134,7 +140,7 @@ public class WorldGuardListener implements Listener {
|
|||||||
final World world = event.getWorld();
|
final World world = event.getWorld();
|
||||||
final RegionManager manager = PlotMain.worldGuard.getRegionManager(world);
|
final RegionManager manager = PlotMain.worldGuard.getRegionManager(world);
|
||||||
for (final PlotId plot : plots) {
|
for (final PlotId plot : plots) {
|
||||||
if (!plot.equals(main)) {
|
if (!plot.equals(main.getId())) {
|
||||||
manager.removeRegion(plot.x + "-" + plot.y);
|
manager.removeRegion(plot.x + "-" + plot.y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -160,6 +166,7 @@ public class WorldGuardListener implements Listener {
|
|||||||
manager.addRegion(rg);
|
manager.addRegion(rg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onUnlink(final PlotUnlinkEvent event) {
|
public void onUnlink(final PlotUnlinkEvent event) {
|
||||||
try {
|
try {
|
||||||
@ -193,10 +200,11 @@ public class WorldGuardListener implements Listener {
|
|||||||
manager.addRegion(rg);
|
manager.addRegion(rg);
|
||||||
}
|
}
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
|
//
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlotClaim(final PlayerClaimPlotEvent event) {
|
public void onPlotClaim(final PlayerClaimPlotEvent event) {
|
||||||
try {
|
try {
|
||||||
@ -219,10 +227,11 @@ public class WorldGuardListener implements Listener {
|
|||||||
|
|
||||||
manager.addRegion(region);
|
manager.addRegion(region);
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
|
//
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlotDelete(final PlotDeleteEvent event) {
|
public void onPlotDelete(final PlotDeleteEvent event) {
|
||||||
try {
|
try {
|
||||||
@ -232,7 +241,7 @@ public class WorldGuardListener implements Listener {
|
|||||||
final RegionManager manager = PlotMain.worldGuard.getRegionManager(world);
|
final RegionManager manager = PlotMain.worldGuard.getRegionManager(world);
|
||||||
manager.removeRegion(plot.x + "-" + plot.y);
|
manager.removeRegion(plot.x + "-" + plot.y);
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
|
//
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user