mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2025-01-01 05:57:54 +01:00
Moved User to its own package + added Notifier to avoid massive "Island protected" spam
This commit is contained in:
parent
1a233e3e83
commit
6ba27eef4e
@ -4,6 +4,7 @@ import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import us.tastybento.bskyblock.api.placeholders.PlaceholderHandler;
|
||||
import us.tastybento.bskyblock.api.user.Notifier;
|
||||
import us.tastybento.bskyblock.commands.AdminCommand;
|
||||
import us.tastybento.bskyblock.commands.IslandCommand;
|
||||
import us.tastybento.bskyblock.database.BSBDatabase;
|
||||
@ -44,8 +45,10 @@ public class BSkyBlock extends JavaPlugin {
|
||||
private RanksManager ranksManager;
|
||||
|
||||
// Settings
|
||||
Settings settings;
|
||||
private Settings settings;
|
||||
|
||||
// Notifier
|
||||
private Notifier notifier;
|
||||
|
||||
@Override
|
||||
public void onEnable(){
|
||||
@ -77,6 +80,9 @@ public class BSkyBlock extends JavaPlugin {
|
||||
metrics = new Metrics(plugin);
|
||||
registerCustomCharts();
|
||||
|
||||
// Load Notifier
|
||||
notifier = new Notifier();
|
||||
|
||||
// Set up commands
|
||||
commandsManager = new CommandsManager();
|
||||
new IslandCommand();
|
||||
@ -229,13 +235,12 @@ public class BSkyBlock extends JavaPlugin {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the settings
|
||||
* @return the ranksManager
|
||||
*/
|
||||
public Settings getSettings() {
|
||||
return settings;
|
||||
public RanksManager getRanksManager() {
|
||||
return ranksManager;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the Island World Manager
|
||||
*/
|
||||
@ -243,13 +248,17 @@ public class BSkyBlock extends JavaPlugin {
|
||||
return islandWorldManager;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @return the ranksManager
|
||||
* @return the settings
|
||||
*/
|
||||
public RanksManager getRanksManager() {
|
||||
return ranksManager;
|
||||
public Settings getSettings() {
|
||||
return settings;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the notifier
|
||||
*/
|
||||
public Notifier getNotifier() {
|
||||
return notifier;
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
package us.tastybento.bskyblock.api.commands;
|
||||
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
@ -19,6 +19,7 @@ import org.bukkit.entity.Player;
|
||||
import us.tastybento.bskyblock.BSkyBlock;
|
||||
import us.tastybento.bskyblock.Settings;
|
||||
import us.tastybento.bskyblock.api.events.command.CommandEvent;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
import us.tastybento.bskyblock.database.managers.PlayersManager;
|
||||
import us.tastybento.bskyblock.database.managers.island.IslandsManager;
|
||||
import us.tastybento.bskyblock.util.Util;
|
||||
|
@ -5,6 +5,7 @@ import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.apache.commons.lang.math.NumberUtils;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
|
||||
/**
|
||||
* Adds a default help to every command that will show the usage of the command
|
||||
|
@ -6,10 +6,9 @@ import org.bukkit.Material;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import us.tastybento.bskyblock.api.commands.User;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
import us.tastybento.bskyblock.api.panels.PanelItem;
|
||||
import us.tastybento.bskyblock.api.panels.builders.PanelItemBuilder;
|
||||
import us.tastybento.bskyblock.managers.RanksManager;
|
||||
|
||||
public class Flag implements Comparable<Flag> {
|
||||
|
||||
|
@ -7,7 +7,7 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
|
||||
import us.tastybento.bskyblock.api.commands.User;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
import us.tastybento.bskyblock.listeners.PanelListenerManager;
|
||||
|
||||
public class Panel {
|
||||
|
@ -8,7 +8,7 @@ import org.bukkit.inventory.ItemFlag;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import us.tastybento.bskyblock.api.commands.User;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
import us.tastybento.bskyblock.api.panels.builders.PanelItemBuilder;
|
||||
|
||||
public class PanelItem {
|
||||
|
@ -3,7 +3,7 @@ package us.tastybento.bskyblock.api.panels;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.inventory.InventoryCloseEvent;
|
||||
|
||||
import us.tastybento.bskyblock.api.commands.User;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
|
||||
public interface PanelListener {
|
||||
|
||||
|
@ -2,7 +2,7 @@ package us.tastybento.bskyblock.api.panels.builders;
|
||||
|
||||
import java.util.TreeMap;
|
||||
|
||||
import us.tastybento.bskyblock.api.commands.User;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
import us.tastybento.bskyblock.api.panels.Panel;
|
||||
import us.tastybento.bskyblock.api.panels.PanelItem;
|
||||
import us.tastybento.bskyblock.api.panels.PanelListener;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package us.tastybento.bskyblock.api.placeholders;
|
||||
|
||||
import us.tastybento.bskyblock.api.commands.User;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
|
||||
/**
|
||||
* @author Poslovitch
|
||||
|
@ -1,7 +1,7 @@
|
||||
package us.tastybento.bskyblock.api.placeholders;
|
||||
|
||||
import us.tastybento.bskyblock.BSkyBlock;
|
||||
import us.tastybento.bskyblock.api.commands.User;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
|
||||
/**
|
||||
* Simple interface for every Placeholder API.
|
||||
|
@ -5,7 +5,7 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import us.tastybento.bskyblock.BSkyBlock;
|
||||
import us.tastybento.bskyblock.api.commands.User;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
|
||||
/**
|
||||
* Handles hooks with other Placeholder APIs.
|
||||
|
@ -1,7 +1,7 @@
|
||||
package us.tastybento.bskyblock.api.placeholders.hooks;
|
||||
|
||||
import us.tastybento.bskyblock.BSkyBlock;
|
||||
import us.tastybento.bskyblock.api.commands.User;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
import us.tastybento.bskyblock.api.placeholders.Placeholder;
|
||||
import us.tastybento.bskyblock.api.placeholders.PlaceholderAPIInterface;
|
||||
import us.tastybento.bskyblock.lists.Placeholders;
|
||||
|
64
src/main/java/us/tastybento/bskyblock/api/user/Notifier.java
Normal file
64
src/main/java/us/tastybento/bskyblock/api/user/Notifier.java
Normal file
@ -0,0 +1,64 @@
|
||||
package us.tastybento.bskyblock.api.user;
|
||||
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
import com.google.common.cache.CacheLoader;
|
||||
import com.google.common.cache.LoadingCache;
|
||||
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* Utilities class that helps to avoid spamming the User with potential repeated messages
|
||||
* @author Poslovitch
|
||||
*/
|
||||
public class Notifier {
|
||||
|
||||
/**
|
||||
* Time in seconds before {@link #notificationCache} removes the entry related to the player.
|
||||
*/
|
||||
private final int NOTIFICATION_DELAY = 5;
|
||||
|
||||
private final LoadingCache<User, Notification> notificationCache = CacheBuilder.newBuilder()
|
||||
.expireAfterAccess(NOTIFICATION_DELAY, TimeUnit.SECONDS)
|
||||
.maximumSize(500)
|
||||
.build(
|
||||
new CacheLoader<User, Notification>() {
|
||||
@Override
|
||||
public Notification load(User user) throws Exception {
|
||||
return new Notification(null, 0);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
public synchronized boolean notify(User user, String message) {
|
||||
try {
|
||||
Notification lastNotification = notificationCache.get(user);
|
||||
long now = System.currentTimeMillis();
|
||||
if (now >= lastNotification.getTime() + NOTIFICATION_DELAY * 1000 || !message.equals(lastNotification.getMessage())) {
|
||||
notificationCache.put(user, new Notification(message, now));
|
||||
user.sendRawMessage(message);
|
||||
}
|
||||
return true;
|
||||
} catch (ExecutionException e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public class Notification {
|
||||
private final String message;
|
||||
private final long time;
|
||||
|
||||
public Notification(String message, long time) {
|
||||
this.message = message;
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public long getTime() {
|
||||
return time;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,11 +1,16 @@
|
||||
package us.tastybento.bskyblock.api.commands;
|
||||
package us.tastybento.bskyblock.api.user;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
import com.google.common.cache.CacheLoader;
|
||||
import com.google.common.cache.LoadingCache;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameMode;
|
||||
@ -199,7 +204,7 @@ public class User {
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a message to sender if message is not empty. Does not include color codes or spaces.
|
||||
* Send a message to sender if message is not empty.
|
||||
* @param reference - language file reference
|
||||
* @param variables - CharSequence target, replacement pairs
|
||||
*/
|
||||
@ -217,7 +222,6 @@ public class User {
|
||||
|
||||
/**
|
||||
* Sends a message to sender without any modification (colors, multi-lines, placeholders).
|
||||
* Should only be used for debug purposes.
|
||||
* @param message - the message to send
|
||||
*/
|
||||
public void sendRawMessage(String message) {
|
||||
@ -229,6 +233,20 @@ public class User {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a message to sender if message is not empty and if the same wasn't sent within the previous {@link Notifier#NOTIFICATION_DELAY} seconds.
|
||||
* @param reference - language file reference
|
||||
* @param variables - CharSequence target, replacement pairs
|
||||
*
|
||||
* @see Notifier
|
||||
*/
|
||||
public void notify(String reference, String... variables) {
|
||||
String message = getTranslation(reference, variables);
|
||||
if (!ChatColor.stripColor(message).trim().isEmpty()) {
|
||||
if (sender != null || !plugin.getNotifier().notify(this, message)) sendRawMessage(message);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the user's game mode
|
||||
* @param mode
|
@ -4,7 +4,7 @@ import java.util.List;
|
||||
|
||||
import us.tastybento.bskyblock.Constants;
|
||||
import us.tastybento.bskyblock.api.commands.CompositeCommand;
|
||||
import us.tastybento.bskyblock.api.commands.User;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
import us.tastybento.bskyblock.commands.admin.AdminReloadCommand;
|
||||
import us.tastybento.bskyblock.commands.admin.AdminTeleportCommand;
|
||||
import us.tastybento.bskyblock.commands.admin.AdminVersionCommand;
|
||||
|
@ -5,7 +5,7 @@ import java.util.List;
|
||||
|
||||
import us.tastybento.bskyblock.Constants;
|
||||
import us.tastybento.bskyblock.api.commands.CompositeCommand;
|
||||
import us.tastybento.bskyblock.api.commands.User;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
import us.tastybento.bskyblock.commands.island.IslandAboutCommand;
|
||||
import us.tastybento.bskyblock.commands.island.IslandCreateCommand;
|
||||
import us.tastybento.bskyblock.commands.island.IslandGoCommand;
|
||||
|
@ -6,7 +6,7 @@ package us.tastybento.bskyblock.commands.admin;
|
||||
import java.util.List;
|
||||
|
||||
import us.tastybento.bskyblock.api.commands.CompositeCommand;
|
||||
import us.tastybento.bskyblock.api.commands.User;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
|
||||
/**
|
||||
* @author tastybento
|
||||
@ -30,7 +30,7 @@ public class AdminReloadCommand extends CompositeCommand {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see us.tastybento.bskyblock.api.commands.BSBCommand#execute(us.tastybento.bskyblock.api.commands.User, java.util.List)
|
||||
* @see us.tastybento.bskyblock.api.commands.BSBCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List)
|
||||
*/
|
||||
@Override
|
||||
public boolean execute(User user, List<String> args) {
|
||||
|
@ -10,7 +10,7 @@ import org.bukkit.Location;
|
||||
|
||||
import us.tastybento.bskyblock.Constants;
|
||||
import us.tastybento.bskyblock.api.commands.CompositeCommand;
|
||||
import us.tastybento.bskyblock.api.commands.User;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
import us.tastybento.bskyblock.util.Util;
|
||||
import us.tastybento.bskyblock.util.teleport.SafeTeleportBuilder;
|
||||
|
||||
|
@ -4,7 +4,7 @@ import java.util.List;
|
||||
|
||||
import us.tastybento.bskyblock.Constants;
|
||||
import us.tastybento.bskyblock.api.commands.CompositeCommand;
|
||||
import us.tastybento.bskyblock.api.commands.User;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
|
||||
public class AdminVersionCommand extends CompositeCommand {
|
||||
|
||||
|
@ -4,7 +4,7 @@ import java.util.List;
|
||||
|
||||
import us.tastybento.bskyblock.Constants;
|
||||
import us.tastybento.bskyblock.api.commands.CompositeCommand;
|
||||
import us.tastybento.bskyblock.api.commands.User;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
import us.tastybento.bskyblock.util.Util;
|
||||
|
||||
/**
|
||||
|
@ -4,7 +4,7 @@ import java.util.List;
|
||||
|
||||
import us.tastybento.bskyblock.BSkyBlock;
|
||||
import us.tastybento.bskyblock.api.commands.CompositeCommand;
|
||||
import us.tastybento.bskyblock.api.commands.User;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
|
||||
public class IslandAboutCommand extends CompositeCommand {
|
||||
|
||||
|
@ -8,7 +8,7 @@ import java.util.List;
|
||||
|
||||
import us.tastybento.bskyblock.Constants;
|
||||
import us.tastybento.bskyblock.api.commands.CompositeCommand;
|
||||
import us.tastybento.bskyblock.api.commands.User;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
import us.tastybento.bskyblock.api.events.island.IslandEvent.Reason;
|
||||
import us.tastybento.bskyblock.commands.IslandCommand;
|
||||
import us.tastybento.bskyblock.database.managers.island.NewIsland;
|
||||
|
@ -10,7 +10,7 @@ import org.bukkit.ChatColor;
|
||||
|
||||
import us.tastybento.bskyblock.Constants;
|
||||
import us.tastybento.bskyblock.api.commands.CompositeCommand;
|
||||
import us.tastybento.bskyblock.api.commands.User;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
import us.tastybento.bskyblock.commands.IslandCommand;
|
||||
import us.tastybento.bskyblock.util.Util;
|
||||
|
||||
|
@ -8,7 +8,7 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import us.tastybento.bskyblock.Constants;
|
||||
import us.tastybento.bskyblock.api.commands.CompositeCommand;
|
||||
import us.tastybento.bskyblock.api.commands.User;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
import us.tastybento.bskyblock.api.events.island.IslandEvent.Reason;
|
||||
import us.tastybento.bskyblock.database.managers.island.NewIsland;
|
||||
import us.tastybento.bskyblock.database.objects.Island;
|
||||
|
@ -8,7 +8,7 @@ import java.util.UUID;
|
||||
|
||||
import us.tastybento.bskyblock.Constants;
|
||||
import us.tastybento.bskyblock.api.commands.CompositeCommand;
|
||||
import us.tastybento.bskyblock.api.commands.User;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
|
||||
/**
|
||||
* @author tastybento
|
||||
|
@ -5,7 +5,7 @@ import java.util.UUID;
|
||||
|
||||
import us.tastybento.bskyblock.Constants;
|
||||
import us.tastybento.bskyblock.api.commands.CompositeCommand;
|
||||
import us.tastybento.bskyblock.api.commands.User;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
import us.tastybento.bskyblock.util.Util;
|
||||
|
||||
public class IslandSethomeCommand extends CompositeCommand {
|
||||
|
@ -12,7 +12,7 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import us.tastybento.bskyblock.Constants;
|
||||
import us.tastybento.bskyblock.api.commands.CompositeCommand;
|
||||
import us.tastybento.bskyblock.api.commands.User;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
|
||||
/**
|
||||
* @author tastybento
|
||||
|
@ -4,7 +4,7 @@ import java.util.List;
|
||||
|
||||
import us.tastybento.bskyblock.Constants;
|
||||
import us.tastybento.bskyblock.api.commands.CompositeCommand;
|
||||
import us.tastybento.bskyblock.api.commands.User;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
import us.tastybento.bskyblock.commands.IslandCommand;
|
||||
import us.tastybento.bskyblock.panels.SettingsPanel;
|
||||
|
||||
|
@ -12,7 +12,7 @@ import com.google.common.collect.BiMap;
|
||||
import com.google.common.collect.HashBiMap;
|
||||
|
||||
import us.tastybento.bskyblock.api.commands.CompositeCommand;
|
||||
import us.tastybento.bskyblock.api.commands.User;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
import us.tastybento.bskyblock.util.Util;
|
||||
|
||||
/**
|
||||
|
@ -6,7 +6,7 @@ import java.util.UUID;
|
||||
|
||||
import us.tastybento.bskyblock.Constants;
|
||||
import us.tastybento.bskyblock.api.commands.CompositeCommand;
|
||||
import us.tastybento.bskyblock.api.commands.User;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
import us.tastybento.bskyblock.api.events.IslandBaseEvent;
|
||||
import us.tastybento.bskyblock.api.events.team.TeamEvent;
|
||||
|
||||
|
@ -8,7 +8,7 @@ import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
|
||||
import us.tastybento.bskyblock.Constants;
|
||||
import us.tastybento.bskyblock.api.commands.User;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
import us.tastybento.bskyblock.api.events.IslandBaseEvent;
|
||||
import us.tastybento.bskyblock.api.events.team.TeamEvent;
|
||||
import us.tastybento.bskyblock.database.objects.Island;
|
||||
|
@ -10,7 +10,7 @@ import java.util.UUID;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
|
||||
import us.tastybento.bskyblock.Constants;
|
||||
import us.tastybento.bskyblock.api.commands.User;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
import us.tastybento.bskyblock.api.events.IslandBaseEvent;
|
||||
import us.tastybento.bskyblock.api.events.team.TeamEvent;
|
||||
import us.tastybento.bskyblock.util.Util;
|
||||
|
@ -4,7 +4,7 @@ import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import us.tastybento.bskyblock.Constants;
|
||||
import us.tastybento.bskyblock.api.commands.User;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
import us.tastybento.bskyblock.api.events.IslandBaseEvent;
|
||||
import us.tastybento.bskyblock.api.events.team.TeamEvent;
|
||||
|
||||
|
@ -8,7 +8,7 @@ import java.util.UUID;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import us.tastybento.bskyblock.Constants;
|
||||
import us.tastybento.bskyblock.api.commands.User;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
|
||||
public class IslandTeamKickCommand extends AbstractIslandTeamCommand {
|
||||
|
||||
|
@ -8,7 +8,7 @@ import java.util.UUID;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import us.tastybento.bskyblock.Constants;
|
||||
import us.tastybento.bskyblock.api.commands.User;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
|
||||
public class IslandTeamLeaveCommand extends AbstractIslandTeamCommand {
|
||||
|
||||
|
@ -5,7 +5,7 @@ import java.util.List;
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
import us.tastybento.bskyblock.Constants;
|
||||
import us.tastybento.bskyblock.api.commands.User;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
|
||||
public class IslandTeamPromoteCommand extends AbstractIslandTeamCommand {
|
||||
|
||||
|
@ -7,7 +7,7 @@ import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
import us.tastybento.bskyblock.Constants;
|
||||
import us.tastybento.bskyblock.api.commands.User;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
import us.tastybento.bskyblock.api.events.IslandBaseEvent;
|
||||
import us.tastybento.bskyblock.api.events.team.TeamEvent;
|
||||
import us.tastybento.bskyblock.database.objects.Island;
|
||||
|
@ -18,7 +18,7 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import us.tastybento.bskyblock.BSkyBlock;
|
||||
import us.tastybento.bskyblock.Constants;
|
||||
import us.tastybento.bskyblock.api.commands.User;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
import us.tastybento.bskyblock.database.BSBDatabase;
|
||||
import us.tastybento.bskyblock.database.objects.Island;
|
||||
import us.tastybento.bskyblock.database.objects.Players;
|
||||
|
@ -22,7 +22,7 @@ import org.bukkit.util.Vector;
|
||||
|
||||
import us.tastybento.bskyblock.BSkyBlock;
|
||||
import us.tastybento.bskyblock.Constants;
|
||||
import us.tastybento.bskyblock.api.commands.User;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
import us.tastybento.bskyblock.database.BSBDatabase;
|
||||
import us.tastybento.bskyblock.database.managers.AbstractDatabaseHandler;
|
||||
import us.tastybento.bskyblock.database.objects.Island;
|
||||
|
@ -19,7 +19,7 @@ import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.ImmutableSet.Builder;
|
||||
|
||||
import us.tastybento.bskyblock.BSkyBlock;
|
||||
import us.tastybento.bskyblock.api.commands.User;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
import us.tastybento.bskyblock.api.events.IslandBaseEvent;
|
||||
import us.tastybento.bskyblock.api.events.island.IslandEvent;
|
||||
import us.tastybento.bskyblock.api.events.island.IslandEvent.IslandLockEvent;
|
||||
|
@ -20,7 +20,7 @@ import org.bukkit.material.Chest;
|
||||
import us.tastybento.bskyblock.BSkyBlock;
|
||||
import us.tastybento.bskyblock.Constants;
|
||||
import us.tastybento.bskyblock.Constants.GameType;
|
||||
import us.tastybento.bskyblock.api.commands.User;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
import us.tastybento.bskyblock.database.objects.Island;
|
||||
|
||||
/**
|
||||
|
@ -10,7 +10,7 @@ import org.bukkit.event.player.PlayerQuitEvent;
|
||||
|
||||
import us.tastybento.bskyblock.BSkyBlock;
|
||||
import us.tastybento.bskyblock.Constants;
|
||||
import us.tastybento.bskyblock.api.commands.User;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
import us.tastybento.bskyblock.database.managers.PlayersManager;
|
||||
import us.tastybento.bskyblock.database.objects.Island;
|
||||
|
||||
|
@ -23,7 +23,7 @@ import org.bukkit.event.world.StructureGrowEvent;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import us.tastybento.bskyblock.BSkyBlock;
|
||||
import us.tastybento.bskyblock.api.commands.User;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
import us.tastybento.bskyblock.util.teleport.SafeTeleportBuilder;
|
||||
|
||||
public class NetherPortals implements Listener {
|
||||
|
@ -12,7 +12,7 @@ import org.bukkit.event.inventory.InventoryCloseEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
|
||||
import us.tastybento.bskyblock.api.commands.User;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
import us.tastybento.bskyblock.api.panels.ClickType;
|
||||
import us.tastybento.bskyblock.api.panels.Panel;
|
||||
|
||||
|
@ -15,7 +15,7 @@ import org.bukkit.event.Event;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
import us.tastybento.bskyblock.BSkyBlock;
|
||||
import us.tastybento.bskyblock.api.commands.User;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
import us.tastybento.bskyblock.api.flags.Flag;
|
||||
import us.tastybento.bskyblock.api.flags.Flag.Type;
|
||||
import us.tastybento.bskyblock.database.managers.island.IslandsManager;
|
||||
@ -99,7 +99,7 @@ public abstract class AbstractFlagListener implements Listener {
|
||||
}
|
||||
if (user != null) {
|
||||
if (!silent) {
|
||||
user.sendMessage("protection.protected");
|
||||
user.notify("protection.protected");
|
||||
}
|
||||
user.updateInventory();
|
||||
}
|
||||
@ -112,9 +112,9 @@ public abstract class AbstractFlagListener implements Listener {
|
||||
* @return true if the location is in the island worlds
|
||||
*/
|
||||
public boolean inWorld(Location loc) {
|
||||
return (loc != null && (loc.getWorld().equals(plugin.getIslandWorldManager().getIslandWorld())
|
||||
return loc != null && (loc.getWorld().equals(plugin.getIslandWorldManager().getIslandWorld())
|
||||
|| loc.getWorld().equals(plugin.getIslandWorldManager().getNetherWorld())
|
||||
|| loc.getWorld().equals(plugin.getIslandWorldManager().getEndWorld()))) ? true : false;
|
||||
|| loc.getWorld().equals(plugin.getIslandWorldManager().getEndWorld()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -17,7 +17,7 @@ import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.vehicle.VehicleDamageEvent;
|
||||
import org.bukkit.util.BlockIterator;
|
||||
|
||||
import us.tastybento.bskyblock.api.commands.User;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
import us.tastybento.bskyblock.lists.Flags;
|
||||
|
||||
public class BreakBlocksListener extends AbstractFlagListener {
|
||||
|
@ -19,7 +19,7 @@ import org.bukkit.event.entity.EntityChangeBlockEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.util.BlockIterator;
|
||||
|
||||
import us.tastybento.bskyblock.api.commands.User;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
import us.tastybento.bskyblock.api.flags.Flag;
|
||||
import us.tastybento.bskyblock.lists.Flags;
|
||||
|
||||
|
@ -30,7 +30,7 @@ import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
import org.bukkit.inventory.EquipmentSlot;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
|
||||
import us.tastybento.bskyblock.api.commands.User;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
import us.tastybento.bskyblock.api.flags.Flag;
|
||||
|
||||
/**
|
||||
|
@ -16,7 +16,7 @@ import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
|
||||
import us.tastybento.bskyblock.api.commands.User;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
import us.tastybento.bskyblock.lists.Flags;
|
||||
|
||||
/**
|
||||
|
@ -9,7 +9,7 @@ import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.entity.EntityPickupItemEvent;
|
||||
import org.bukkit.event.player.PlayerDropItemEvent;
|
||||
|
||||
import us.tastybento.bskyblock.api.commands.User;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
import us.tastybento.bskyblock.lists.Flags;
|
||||
|
||||
/**
|
||||
|
@ -20,7 +20,7 @@ import org.bukkit.event.entity.PotionSplashEvent;
|
||||
import org.bukkit.event.player.PlayerFishEvent;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
|
||||
import us.tastybento.bskyblock.api.commands.User;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
import us.tastybento.bskyblock.api.flags.Flag;
|
||||
|
||||
/**
|
||||
|
@ -8,7 +8,7 @@ import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
|
||||
import us.tastybento.bskyblock.BSkyBlock;
|
||||
import us.tastybento.bskyblock.api.commands.User;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
import us.tastybento.bskyblock.api.localization.BSBLocale;
|
||||
import us.tastybento.bskyblock.util.FileLister;
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
package us.tastybento.bskyblock.panels;
|
||||
|
||||
import us.tastybento.bskyblock.BSkyBlock;
|
||||
import us.tastybento.bskyblock.api.commands.User;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
import us.tastybento.bskyblock.api.flags.Flag;
|
||||
import us.tastybento.bskyblock.api.panels.PanelItem;
|
||||
import us.tastybento.bskyblock.api.panels.builders.PanelBuilder;
|
||||
|
@ -20,7 +20,7 @@ import org.bukkit.permissions.PermissionAttachmentInfo;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import us.tastybento.bskyblock.BSkyBlock;
|
||||
import us.tastybento.bskyblock.api.commands.User;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
|
||||
/**
|
||||
* A set of utility methods
|
||||
|
@ -5,7 +5,7 @@ import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import us.tastybento.bskyblock.BSkyBlock;
|
||||
import us.tastybento.bskyblock.api.commands.User;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
import us.tastybento.bskyblock.database.objects.Island;
|
||||
|
||||
public class SafeTeleportBuilder {
|
||||
|
@ -51,7 +51,7 @@ import us.tastybento.bskyblock.BSkyBlock;
|
||||
import us.tastybento.bskyblock.Constants;
|
||||
import us.tastybento.bskyblock.Settings;
|
||||
import us.tastybento.bskyblock.api.commands.CompositeCommand;
|
||||
import us.tastybento.bskyblock.api.commands.User;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
import us.tastybento.bskyblock.api.events.IslandBaseEvent;
|
||||
import us.tastybento.bskyblock.api.events.team.TeamEvent;
|
||||
import us.tastybento.bskyblock.api.flags.Flag;
|
||||
|
@ -28,7 +28,7 @@ import org.junit.runner.RunWith;
|
||||
import org.mockito.Mockito;
|
||||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
|
||||
import us.tastybento.bskyblock.api.commands.User;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
import us.tastybento.bskyblock.api.panels.ClickType;
|
||||
import us.tastybento.bskyblock.api.panels.PanelItem;
|
||||
|
||||
|
@ -41,7 +41,7 @@ import org.powermock.modules.junit4.PowerMockRunner;
|
||||
|
||||
import us.tastybento.bskyblock.BSkyBlock;
|
||||
import us.tastybento.bskyblock.Settings;
|
||||
import us.tastybento.bskyblock.api.commands.User;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
import us.tastybento.bskyblock.database.managers.island.IslandsManager;
|
||||
import us.tastybento.bskyblock.database.objects.Island;
|
||||
import us.tastybento.bskyblock.generators.IslandWorld;
|
||||
|
Loading…
Reference in New Issue
Block a user