Merge remote-tracking branch 'refs/remotes/origin/develop' into bugfix/mopple-sprint
This commit is contained in:
commit
3f62dd49ef
@ -11,6 +11,7 @@ import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
@ -112,7 +113,7 @@ public class UtilServer
|
||||
|
||||
public static Plugin getPlugin()
|
||||
{
|
||||
return getPluginManager().getPlugins()[0];
|
||||
return JavaPlugin.getProvidingPlugin(UtilServer.class);
|
||||
}
|
||||
|
||||
public static PluginManager getPluginManager()
|
||||
|
@ -22,6 +22,7 @@ import javax.net.ssl.TrustManager;
|
||||
import javax.net.ssl.X509TrustManager;
|
||||
|
||||
import org.apache.commons.lang3.Validate;
|
||||
import org.bukkit.block.Sign;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
@ -59,7 +60,7 @@ public class Chat extends MiniPlugin
|
||||
private PreferencesManager _preferences;
|
||||
private AchievementManager _achievements;
|
||||
private IncognitoManager _incognitoManager;
|
||||
|
||||
|
||||
private String[] _hackusations = {"hack", "hax", "hacker", "hacking", "cheat", "cheater", "cheating", "forcefield", "flyhack", "flyhacking", "autoclick", "aimbot"};
|
||||
private String _filterUrl = "https://chat.mineplex.com:8003/content/item/moderate";
|
||||
private String _appId = "34018d65-466d-4a91-8e92-29ca49f022c4";
|
||||
@ -69,22 +70,22 @@ public class Chat extends MiniPlugin
|
||||
private int _chatSlow = 0;
|
||||
private long _silenced = 0;
|
||||
private boolean _threeSecondDelay = true;
|
||||
|
||||
|
||||
private List<Function<AsyncPlayerChatEvent, Boolean>> _highPriorityFilters = new ArrayList<>();
|
||||
private List<Function<AsyncPlayerChatEvent, Boolean>> _lowPriorityFilters = new ArrayList<>();
|
||||
|
||||
|
||||
private HashMap<UUID, MessageData> _playerLastMessage = new HashMap<UUID, MessageData>();
|
||||
|
||||
public Chat(JavaPlugin plugin, IncognitoManager incognitoManager, CoreClientManager clientManager, PreferencesManager preferences, AchievementManager achievements, String serverName)
|
||||
{
|
||||
super("Chat", plugin);
|
||||
|
||||
|
||||
_incognitoManager = incognitoManager;
|
||||
_clientManager = clientManager;
|
||||
_serverName = serverName;
|
||||
_preferences = preferences;
|
||||
_achievements = achievements;
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
trustCert();
|
||||
@ -207,7 +208,7 @@ public class Chat extends MiniPlugin
|
||||
{
|
||||
if (event.isCancelled())
|
||||
return;
|
||||
|
||||
|
||||
if (event.isAsynchronous())
|
||||
{
|
||||
for (Iterator<Player> playerIterator = event.getRecipients().iterator(); playerIterator.hasNext();)
|
||||
@ -230,24 +231,41 @@ public class Chat extends MiniPlugin
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < event.getLines().length; i++)
|
||||
String[] lines = event.getLines();
|
||||
|
||||
runAsync(() ->
|
||||
{
|
||||
String line = event.getLine(i);
|
||||
if (line != null && line.length() > 0)
|
||||
for (int i = 0; i < lines.length; i++)
|
||||
{
|
||||
String filteredLine = getFilteredMessage(event.getPlayer(), line);
|
||||
if (filteredLine != null)
|
||||
event.setLine(i, filteredLine);
|
||||
String line = lines[i];
|
||||
if (line != null && line.length() > 0)
|
||||
{
|
||||
String filteredLine = getFilteredMessage(event.getPlayer(), line);
|
||||
if (filteredLine != null)
|
||||
{
|
||||
lines[i] = filteredLine;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
runSync(() ->
|
||||
{
|
||||
Sign sign = (Sign) event.getBlock().getState();
|
||||
for (int i = 0; i < lines.length; i++)
|
||||
{
|
||||
sign.setLine(i, lines[i]);
|
||||
}
|
||||
sign.update();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void filterChat(AsyncPlayerChatEvent event)
|
||||
{
|
||||
if (event.isCancelled())
|
||||
return;
|
||||
|
||||
|
||||
if (event.isAsynchronous())
|
||||
{
|
||||
event.setMessage(getFilteredMessage(event.getPlayer(), event.getMessage()));
|
||||
@ -266,7 +284,7 @@ public class Chat extends MiniPlugin
|
||||
|
||||
JSONObject message = buildJsonChatObject(filterType, displayName, playerName, originalMessage, _serverName, 1);
|
||||
String response = getResponseFromCleanSpeak(message, filterType);
|
||||
|
||||
|
||||
if (response == null)
|
||||
{
|
||||
System.out.println("[ERROR] Unable to filter chat message...thanks a lot CleanSpeak.");
|
||||
@ -284,7 +302,7 @@ public class Chat extends MiniPlugin
|
||||
System.out.println(o.toString());
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
String filteredMsg = "";
|
||||
|
||||
filteredMsg = ((JSONObject) JSONValue.parse(response)).get("content").toString();
|
||||
@ -293,7 +311,7 @@ public class Chat extends MiniPlugin
|
||||
filteredMsg = ((JSONObject) JSONValue.parse(filteredMsg)).get("parts").toString();
|
||||
filteredMsg = filteredMsg.replace('[', ' ').replace(']', ' ').trim();
|
||||
filteredMsg = ((JSONObject) JSONValue.parse(filteredMsg)).get("replacement").toString();
|
||||
|
||||
|
||||
return filteredMsg;
|
||||
}
|
||||
else
|
||||
@ -301,7 +319,7 @@ public class Chat extends MiniPlugin
|
||||
return originalMessage;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
public void HandleChat(AsyncPlayerChatEvent event)
|
||||
{
|
||||
@ -309,14 +327,14 @@ public class Chat extends MiniPlugin
|
||||
return;
|
||||
|
||||
Player sender = event.getPlayer();
|
||||
|
||||
|
||||
if (_incognitoManager != null && _incognitoManager.Get(sender).Status)
|
||||
{
|
||||
UtilPlayer.message(sender, C.cYellow + "You can not chat while incognito.");
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
for (Function<AsyncPlayerChatEvent, Boolean> filter : _highPriorityFilters)
|
||||
{
|
||||
if (filter.apply(event).booleanValue())
|
||||
@ -325,7 +343,7 @@ public class Chat extends MiniPlugin
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (SilenceCheck(sender))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
@ -349,7 +367,7 @@ public class Chat extends MiniPlugin
|
||||
else if (!_clientManager.Get(sender).GetRank().has(Rank.HELPER) &&
|
||||
msgContainsHack(event.getMessage()))
|
||||
{
|
||||
UtilPlayer.message(sender, F.main("Chat",
|
||||
UtilPlayer.message(sender, F.main("Chat",
|
||||
"Accusing players of cheating in-game is against the rules."
|
||||
+ "If you think someone is cheating, please gather evidence and report it at "
|
||||
+ F.link("www.mineplex.com/reports")));
|
||||
@ -372,10 +390,10 @@ public class Chat extends MiniPlugin
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!event.isCancelled())
|
||||
_playerLastMessage.put(sender.getUniqueId(), new MessageData(event.getMessage()));
|
||||
|
||||
|
||||
for (Function<AsyncPlayerChatEvent, Boolean> filter : _lowPriorityFilters)
|
||||
{
|
||||
if (filter.apply(event).booleanValue())
|
||||
@ -442,17 +460,17 @@ public class Chat extends MiniPlugin
|
||||
JSONObject content = new JSONObject();
|
||||
content.put("content", msg);
|
||||
content.put("type", "text");
|
||||
|
||||
|
||||
JSONArray parts = new JSONArray();
|
||||
parts.add(content);
|
||||
|
||||
|
||||
JSONObject mainContent = new JSONObject();
|
||||
mainContent.put("applicationId", _appId);
|
||||
mainContent.put("createInstant", System.currentTimeMillis());
|
||||
mainContent.put("parts", parts);
|
||||
mainContent.put("senderDisplayName", name);
|
||||
mainContent.put("senderId", player);
|
||||
|
||||
|
||||
message.put("content", mainContent);
|
||||
break;
|
||||
case "username":
|
||||
@ -558,7 +576,7 @@ public class Chat extends MiniPlugin
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (inputStream != null)
|
||||
{
|
||||
try
|
||||
@ -573,10 +591,10 @@ public class Chat extends MiniPlugin
|
||||
}
|
||||
|
||||
String pmresponse = null;
|
||||
|
||||
|
||||
if (response != null)
|
||||
pmresponse = response.toString();
|
||||
|
||||
|
||||
return pmresponse;
|
||||
}
|
||||
|
||||
@ -627,18 +645,18 @@ public class Chat extends MiniPlugin
|
||||
_playerLastMessage.remove(event.getPlayer().getUniqueId());
|
||||
}
|
||||
|
||||
public void setThreeSecondDelay(boolean b)
|
||||
public void setThreeSecondDelay(boolean b)
|
||||
{
|
||||
_threeSecondDelay = b;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* If the function returns Boolean.TRUE then the message will be CANCELLED.
|
||||
*/
|
||||
public void AddFilter(Function<AsyncPlayerChatEvent, Boolean> restriction, FilterPriority priority)
|
||||
{
|
||||
Validate.isTrue(priority != null, "Priority must not be null.");
|
||||
|
||||
|
||||
switch (priority)
|
||||
{
|
||||
case HIGH:
|
||||
@ -648,5 +666,5 @@ public class Chat extends MiniPlugin
|
||||
_lowPriorityFilters.add(restriction);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package mineplex.core.progression.gui.buttons;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import mineplex.core.progression.ProgressiveKit;
|
||||
import mineplex.core.progression.gui.guis.KitInformationTrackerMenu;
|
||||
@ -21,6 +22,11 @@ import static mineplex.core.common.util.UtilServer.getPlugin;
|
||||
public class KitUpgradeMenuButton extends KitButton
|
||||
{
|
||||
|
||||
private static final ItemStack ITEM_STACK = new ItemBuilder(Material.ENCHANTMENT_TABLE)
|
||||
.setTitle(C.cYellow + "Upgrade Level")
|
||||
.setLore(" ", C.cRed + "Upgrades Coming Soon!")
|
||||
.build();
|
||||
|
||||
private ItemStack _item;
|
||||
private boolean _flash;
|
||||
private BukkitTask _task;
|
||||
@ -29,6 +35,7 @@ public class KitUpgradeMenuButton extends KitButton
|
||||
{
|
||||
super(kit, null);
|
||||
|
||||
_item = ITEM_STACK;
|
||||
//The current upgrade level out of 5 for this kit
|
||||
int upgradeLevel = kit.getUpgradeLevel(player.getUniqueId());
|
||||
//The players level
|
||||
@ -50,12 +57,6 @@ public class KitUpgradeMenuButton extends KitButton
|
||||
|
||||
ChatColor color = Calculations.getColor(level, nextUpgradeLevelPlayer);
|
||||
|
||||
ItemBuilder builder = new ItemBuilder(Material.ENCHANTMENT_TABLE);
|
||||
|
||||
builder.setTitle(ChatColor.YELLOW + "Upgrade Level");
|
||||
builder.setLore(" ", ChatColor.RED + "Upgrades Coming Soon!");
|
||||
|
||||
_item = builder.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -75,7 +76,7 @@ public class KitUpgradeMenuButton extends KitButton
|
||||
this._task = new BukkitRunnable()
|
||||
{
|
||||
|
||||
private ItemStack itemClone = getItemStack().clone();
|
||||
private ItemStack itemClone = ITEM_STACK.clone();
|
||||
|
||||
private ItemStack AIR = new ItemStack(Material.AIR);
|
||||
|
||||
|
@ -85,15 +85,6 @@ public class ClanEnergyManager extends MiniPlugin implements Runnable
|
||||
return _clansManager;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void command(PlayerCommandPreprocessEvent event)
|
||||
{
|
||||
if (event.getMessage().startsWith("/energyshop"))
|
||||
{
|
||||
openShop(event.getPlayer());
|
||||
}
|
||||
}
|
||||
|
||||
public int convertEnergyToGold(int energy)
|
||||
{
|
||||
return (energy / 8) + (energy % 8 == 0 ? 0 : 1);
|
||||
|
@ -71,6 +71,7 @@ import mineplex.game.clans.core.repository.tokens.ClanToken;
|
||||
import mineplex.game.clans.economy.GoldManager;
|
||||
import mineplex.game.clans.fields.Field;
|
||||
import mineplex.game.clans.gameplay.Gameplay;
|
||||
import mineplex.game.clans.gameplay.HiddenChestManager;
|
||||
import mineplex.game.clans.gameplay.safelog.SafeLog;
|
||||
import mineplex.game.clans.gameplay.safelog.npc.NPCManager;
|
||||
import mineplex.game.clans.items.GearManager;
|
||||
@ -290,6 +291,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
|
||||
|
||||
new Weapon(plugin, energy);
|
||||
new Gameplay(plugin, this, blockRestore, _damageManager);
|
||||
new HiddenChestManager(this, packetHandler);
|
||||
_projectileManager = new ProjectileManager(plugin);
|
||||
Fire fire = new Fire(plugin, _condition, _damageManager);
|
||||
|
||||
@ -619,7 +621,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
|
||||
continue;
|
||||
}
|
||||
|
||||
other.sendMessage(F.sys("Quit ", event.getPlayer().getName()));
|
||||
other.sendMessage(F.sys("Quit", event.getPlayer().getName()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -482,7 +482,15 @@ public class ItemMapManager extends MiniPlugin
|
||||
}*/
|
||||
|
||||
byte color = (byte) (origColor + b0);
|
||||
map[(x + HALF_WORLD_SIZE) / zoom][(z + HALF_WORLD_SIZE) / zoom] = color;
|
||||
if((color <= -113 || color >= 0) && color <= 127)
|
||||
{
|
||||
map[(x + HALF_WORLD_SIZE) / zoom][(z + HALF_WORLD_SIZE) / zoom] = color;
|
||||
}
|
||||
else
|
||||
{
|
||||
System.out.println(String.format("Tried to set color to %s in colorWorldHeight scale: %s, sx: %s, sz: %s, x: %z, z: %s, zoom: %s",
|
||||
color, scale, startingX, startingZ, x, z, zoom));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -184,74 +184,83 @@ public class ItemMapRenderer extends MapRenderer
|
||||
|
||||
if (clanColor != null)
|
||||
{
|
||||
int chunkBX = blockX & 0xF;
|
||||
int chunkBZ = blockZ & 0xF;
|
||||
int chunkX1 = (int) Math.floor(blockX / 16D);
|
||||
int chunkZ1 = (int) Math.floor(blockZ / 16D);
|
||||
|
||||
//Border
|
||||
if (colorAll ||
|
||||
|
||||
((chunkBX == 0 || zoom == 13) &&
|
||||
|
||||
owningClan != _manager.getClansUtility().getOwner("world," + (chunkX1 - 1) + "," + chunkZ1))
|
||||
|
||||
|| ((chunkBZ == 0 || zoom == 13) &&
|
||||
|
||||
owningClan != _manager.getClansUtility().getOwner("world," + chunkX1 + "," + (chunkZ1 - 1)))
|
||||
|
||||
|| ((chunkBX + zoom > 15 || zoom == 13) &&
|
||||
|
||||
owningClan != _manager.getClansUtility().getOwner("world," + (chunkX1 + 1) + "," + chunkZ1))
|
||||
|
||||
|| ((chunkBZ + zoom > 15 || zoom == 13) &&
|
||||
|
||||
owningClan != _manager.getClansUtility().getOwner("world," + chunkX1 + "," + (chunkZ1 + 1))))
|
||||
if(! ((color <= -113 || color >= 0) && color <= 127))
|
||||
{
|
||||
Color cColor = MapPalette.getColor(color);
|
||||
double clans = colorAll ? 1 : 0.8;// 0.65;
|
||||
|
||||
//Use clanColor2 no matter what for admins
|
||||
Color drawColor = clanColor;
|
||||
if (owningClan.isAdmin() && clanColor2 != null)
|
||||
{
|
||||
drawColor = clanColor2;
|
||||
clans = 1;
|
||||
}
|
||||
|
||||
double base = 1 - clans;
|
||||
|
||||
int r = (int) ((cColor.getRed() * base) + (drawColor.getRed() * clans));
|
||||
int b = (int) ((cColor.getBlue() * base) + (drawColor.getBlue() * clans));
|
||||
int g = (int) ((cColor.getGreen() * base) + (drawColor.getGreen() * clans));
|
||||
|
||||
color = MapPalette.matchColor(r, g, b);
|
||||
color = (byte) 0;
|
||||
System.out.println(String.format("Tried to draw invalid color %s, player: %s, mapX: %s, mapZ: %s",
|
||||
color, player.getName(), mapX, mapZ));
|
||||
}
|
||||
|
||||
|
||||
//Inside
|
||||
else
|
||||
{
|
||||
Color cColor = MapPalette.getColor(color);
|
||||
int chunkBX = blockX & 0xF;
|
||||
int chunkBZ = blockZ & 0xF;
|
||||
int chunkX1 = (int) Math.floor(blockX / 16D);
|
||||
int chunkZ1 = (int) Math.floor(blockZ / 16D);
|
||||
|
||||
double clans = 0.065;
|
||||
//Border
|
||||
if (colorAll ||
|
||||
|
||||
//Stripes
|
||||
boolean checker = (mapX + (mapZ % 4)) % 4 == 0;
|
||||
Color drawColor = clanColor;
|
||||
if (checker && owningClan.isAdmin() && clanColor2 != null)
|
||||
((chunkBX == 0 || zoom == 13) &&
|
||||
|
||||
owningClan != _manager.getClansUtility().getOwner("world," + (chunkX1 - 1) + "," + chunkZ1))
|
||||
|
||||
|| ((chunkBZ == 0 || zoom == 13) &&
|
||||
|
||||
owningClan != _manager.getClansUtility().getOwner("world," + chunkX1 + "," + (chunkZ1 - 1)))
|
||||
|
||||
|| ((chunkBX + zoom > 15 || zoom == 13) &&
|
||||
|
||||
owningClan != _manager.getClansUtility().getOwner("world," + (chunkX1 + 1) + "," + chunkZ1))
|
||||
|
||||
|| ((chunkBZ + zoom > 15 || zoom == 13) &&
|
||||
|
||||
owningClan != _manager.getClansUtility().getOwner("world," + chunkX1 + "," + (chunkZ1 + 1))))
|
||||
{
|
||||
drawColor = clanColor2;
|
||||
clans = 1;
|
||||
Color cColor = MapPalette.getColor(color);
|
||||
double clans = colorAll ? 1 : 0.8;// 0.65;
|
||||
|
||||
//Use clanColor2 no matter what for admins
|
||||
Color drawColor = clanColor;
|
||||
if (owningClan.isAdmin() && clanColor2 != null)
|
||||
{
|
||||
drawColor = clanColor2;
|
||||
clans = 1;
|
||||
}
|
||||
|
||||
double base = 1 - clans;
|
||||
|
||||
int r = (int) ((cColor.getRed() * base) + (drawColor.getRed() * clans));
|
||||
int b = (int) ((cColor.getBlue() * base) + (drawColor.getBlue() * clans));
|
||||
int g = (int) ((cColor.getGreen() * base) + (drawColor.getGreen() * clans));
|
||||
|
||||
color = MapPalette.matchColor(r, g, b);
|
||||
}
|
||||
|
||||
double base = 1 - clans;
|
||||
|
||||
int r = (int) ((cColor.getRed() * base) + (drawColor.getRed() * clans));
|
||||
int b = (int) ((cColor.getBlue() * base) + (drawColor.getBlue() * clans));
|
||||
int g = (int) ((cColor.getGreen() * base) + (drawColor.getGreen() * clans));
|
||||
//Inside
|
||||
else
|
||||
{
|
||||
Color cColor = MapPalette.getColor(color);
|
||||
|
||||
color = MapPalette.matchColor(r, g, b);
|
||||
double clans = 0.065;
|
||||
|
||||
//Stripes
|
||||
boolean checker = (mapX + (mapZ % 4)) % 4 == 0;
|
||||
Color drawColor = clanColor;
|
||||
if (checker && owningClan.isAdmin() && clanColor2 != null)
|
||||
{
|
||||
drawColor = clanColor2;
|
||||
clans = 1;
|
||||
}
|
||||
|
||||
double base = 1 - clans;
|
||||
|
||||
int r = (int) ((cColor.getRed() * base) + (drawColor.getRed() * clans));
|
||||
int b = (int) ((cColor.getBlue() * base) + (drawColor.getBlue() * clans));
|
||||
int g = (int) ((cColor.getGreen() * base) + (drawColor.getGreen() * clans));
|
||||
|
||||
color = MapPalette.matchColor(r, g, b);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -332,35 +332,6 @@ public class Gameplay extends MiniPlugin
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onInteract(PlayerInteractEvent event)
|
||||
{
|
||||
if (!_clansManager.getIncognitoManager().Get(event.getPlayer()).Status)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.getAction() != Action.RIGHT_CLICK_BLOCK)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.getClickedBlock() == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Material type = event.getClickedBlock().getType();
|
||||
if (type != Material.CHEST && type != Material.TRAPPED_CHEST)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Chest chest = (Chest) event.getClickedBlock().getState();
|
||||
event.getPlayer().openInventory(chest.getInventory());
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable all Piston related events in Clans
|
||||
*
|
||||
|
@ -0,0 +1,111 @@
|
||||
package mineplex.game.clans.gameplay;
|
||||
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.packethandler.IPacketHandler;
|
||||
import mineplex.core.packethandler.PacketHandler;
|
||||
import mineplex.core.packethandler.PacketInfo;
|
||||
import mineplex.game.clans.clans.ClansManager;
|
||||
import net.minecraft.server.v1_8_R3.BaseBlockPosition;
|
||||
import net.minecraft.server.v1_8_R3.BlockPosition;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutBlockAction;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutNamedSoundEffect;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class HiddenChestManager implements Listener
|
||||
{
|
||||
private final Set<BaseBlockPosition> _locationsToCancel = Collections.synchronizedSet(new HashSet<>());
|
||||
private final Set<String> _fine = new HashSet<>();
|
||||
private final ClansManager _clansManager;
|
||||
|
||||
public HiddenChestManager(ClansManager clansManager, PacketHandler packetHandler)
|
||||
{
|
||||
this._clansManager = clansManager;
|
||||
|
||||
UtilServer.RegisterEvents(this);
|
||||
// packetHandler.addPacketHandler(this, PacketPlayOutBlockAction.class, PacketPlayOutNamedSoundEffect.class);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onInteract(PlayerInteractEvent event)
|
||||
{
|
||||
if (!_clansManager.getIncognitoManager().Get(event.getPlayer()).Status)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.getAction() != Action.RIGHT_CLICK_BLOCK)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.getClickedBlock() == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Material type = event.getClickedBlock().getType();
|
||||
if (type != Material.CHEST && type != Material.TRAPPED_CHEST)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Location location = event.getClickedBlock().getLocation();
|
||||
|
||||
if (!_fine.contains(event.getPlayer().getName()))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
UtilPlayer.message(event.getPlayer(), F.main("Clans", "Opening chests while vanished will still make the chest open noise"));
|
||||
UtilPlayer.message(event.getPlayer(), F.main("Clans", "If you are sure, run /IUnderstandOpeningChestsWillMakeNoise"));
|
||||
}
|
||||
|
||||
// _locationsToCancel.add(new BaseBlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ()));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void areYouReallySureYouWantTo(PlayerCommandPreprocessEvent event)
|
||||
{
|
||||
if (event.getMessage().equalsIgnoreCase("/IUnderstandOpeningChestsWillMakeNoise"))
|
||||
{
|
||||
_fine.add(event.getPlayer().getName());
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public void handle(PacketInfo packetInfo)
|
||||
// {
|
||||
// if (packetInfo.getPacket() instanceof PacketPlayOutBlockAction)
|
||||
// {
|
||||
// PacketPlayOutBlockAction blockAction = (PacketPlayOutBlockAction) packetInfo.getPacket();
|
||||
// if (_locationsToCancel.contains(blockAction.a))
|
||||
// {
|
||||
// System.out.println(blockAction.b + " " + blockAction.c);
|
||||
// packetInfo.setCancelled(true);
|
||||
// if (blockAction.c == 0)
|
||||
// {
|
||||
// _locationsToCancel.remove(blockAction.a);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// else if (packetInfo.getPacket() instanceof PacketPlayOutNamedSoundEffect)
|
||||
// {
|
||||
// PacketPlayOutNamedSoundEffect soundEffect = (PacketPlayOutNamedSoundEffect) packetInfo.getPacket();
|
||||
//
|
||||
// System.out.println(soundEffect.a);
|
||||
// }
|
||||
// }
|
||||
}
|
@ -74,6 +74,11 @@ public abstract class Tutorial implements Listener, ObjectiveListener
|
||||
|
||||
public void start(Player player)
|
||||
{
|
||||
if (!canStart(player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
System.out.println(String.format("Tutorial> [%s] started tutorial [%s]", player.getName(), getName()));
|
||||
|
||||
TutorialSession session = new TutorialSession();
|
||||
@ -223,6 +228,8 @@ public abstract class Tutorial implements Listener, ObjectiveListener
|
||||
*/
|
||||
protected abstract void onQuit(Player player);
|
||||
|
||||
protected abstract boolean canStart(Player player);
|
||||
|
||||
public void unregisterAll()
|
||||
{
|
||||
HandlerList.unregisterAll(this);
|
||||
|
@ -171,6 +171,18 @@ public class ClansMainTutorial extends Tutorial
|
||||
*/
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canStart(Player player)
|
||||
{
|
||||
ClanInfo clan = ClansManager.getInstance().getClan(player);
|
||||
if (clan != null)
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Clans", "You are part of a clan - please leave or disband the clan before doing the tutorial"));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart(Player player)
|
||||
{
|
||||
@ -205,13 +217,6 @@ public class ClansMainTutorial extends Tutorial
|
||||
addHologram(player,
|
||||
getPoint(region, ClansMainTutorial.Point.SPAWN).add(0, 1.5, -23),
|
||||
"Jump Off!");
|
||||
|
||||
ClanInfo clan = ClansManager.getInstance().getClan(player);
|
||||
if (clan != null)
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Clans", "You are part of a clan - please leave or disband the clan before doing the tutorial"));
|
||||
ClansManager.getInstance().getTutorial().finishTutorial(player); //nopenopenopenopenope
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -659,6 +659,10 @@ public abstract class Game implements Listener
|
||||
{
|
||||
for (Kit kit : _kits)
|
||||
{
|
||||
if(kit == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
UtilServer.getServer().getPluginManager().registerEvents(kit, Manager.getPlugin());
|
||||
|
||||
for (Perk perk : kit.GetPerks())
|
||||
@ -673,6 +677,11 @@ public abstract class Game implements Listener
|
||||
{
|
||||
for (Kit kit : _kits)
|
||||
{
|
||||
if(kit == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
HandlerList.unregisterAll(kit);
|
||||
|
||||
for (Perk perk : kit.GetPerks())
|
||||
|
@ -9,14 +9,6 @@ import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.game.games.bridge.Bridge;
|
||||
import nautilus.game.arcade.game.games.bridge.kits.KitApple;
|
||||
import nautilus.game.arcade.game.games.bridge.kits.KitArcher;
|
||||
import nautilus.game.arcade.game.games.bridge.kits.KitBeserker;
|
||||
import nautilus.game.arcade.game.games.bridge.kits.KitBomber;
|
||||
import nautilus.game.arcade.game.games.bridge.kits.KitDestructor;
|
||||
import nautilus.game.arcade.game.games.bridge.kits.KitMammoth;
|
||||
import nautilus.game.arcade.game.games.bridge.kits.KitMiner;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
|
||||
/**
|
||||
* SpeedBridges gamemode for Bridges
|
||||
|
@ -24,6 +24,7 @@ import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
@ -157,6 +158,26 @@ public class ProgressingKitManager implements Listener
|
||||
_manager.getKitProgressionManager().getDataManager().remove(playerKit);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void testCommand(PlayerCommandPreprocessEvent event)
|
||||
{
|
||||
//This needs to stay in for testing sakes if the issue arises connor
|
||||
String message = event.getMessage();
|
||||
if(!event.getPlayer().getName().equalsIgnoreCase("TadahTech"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(!message.startsWith("/kpsetlevel"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
event.setCancelled(true);
|
||||
int level = Integer.parseInt(message.split(" ")[1]);
|
||||
ProgressingKit kit = (ProgressingKit) _manager.GetGame().GetKit(event.getPlayer());
|
||||
kit.setLevel(level, event.getPlayer().getUniqueId());
|
||||
event.getPlayer().sendMessage("Set level for "+ kit.GetName() + " to " + level);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void cancelParticles(GameStateChangeEvent event)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user