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