Merge branch 'master' of ssh://184.154.0.242:7999/min/Mineplex
This commit is contained in:
commit
ce306e88ed
@ -6,20 +6,6 @@ import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.antihack.types.*;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilGear;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.portal.Portal;
|
||||
import mineplex.core.punish.Punish;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Material;
|
||||
@ -33,6 +19,24 @@ import org.bukkit.event.player.PlayerVelocityEvent;
|
||||
import org.bukkit.event.server.ServerListPingEvent;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.antihack.types.Fly;
|
||||
import mineplex.core.antihack.types.Idle;
|
||||
import mineplex.core.antihack.types.Speed;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.portal.Portal;
|
||||
import mineplex.core.preferences.PreferencesManager;
|
||||
import mineplex.core.punish.Punish;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
|
||||
public class AntiHack extends MiniPlugin
|
||||
{
|
||||
private static Object _antiHackLock = new Object();
|
||||
@ -43,6 +47,8 @@ public class AntiHack extends MiniPlugin
|
||||
|
||||
public Punish Punish;
|
||||
public Portal Portal;
|
||||
private PreferencesManager _preferences;
|
||||
private CoreClientManager _clientManager;
|
||||
|
||||
//Record Offenses
|
||||
private HashMap<Player, HashMap<String, ArrayList<Long>>> _suspicion = new HashMap<Player, HashMap<String, ArrayList<Long>>>();
|
||||
@ -71,12 +77,14 @@ public class AntiHack extends MiniPlugin
|
||||
|
||||
private AntiHackRepository _repository;
|
||||
|
||||
protected AntiHack(JavaPlugin plugin, Punish punish, Portal portal)
|
||||
protected AntiHack(JavaPlugin plugin, Punish punish, Portal portal, PreferencesManager preferences, CoreClientManager clientManager)
|
||||
{
|
||||
super("AntiHack", plugin);
|
||||
|
||||
Punish = punish;
|
||||
Portal = portal;
|
||||
_preferences = preferences;
|
||||
_clientManager = clientManager;
|
||||
|
||||
_repository = new AntiHackRepository(plugin.getConfig().getString("serverstatus.name"));
|
||||
_repository.initialize();
|
||||
@ -88,9 +96,9 @@ public class AntiHack extends MiniPlugin
|
||||
_detectors.add(new Speed(this));
|
||||
}
|
||||
|
||||
public static void Initialize(JavaPlugin plugin, Punish punish, Portal portal)
|
||||
public static void Initialize(JavaPlugin plugin, Punish punish, Portal portal, PreferencesManager preferences, CoreClientManager clientManager)
|
||||
{
|
||||
Instance = new AntiHack(plugin, punish, portal);
|
||||
Instance = new AntiHack(plugin, punish, portal, preferences, clientManager);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -248,7 +256,7 @@ public class AntiHack extends MiniPlugin
|
||||
}
|
||||
|
||||
for (Player admin : UtilServer.getPlayers())
|
||||
if (admin.isOp() && UtilGear.isMat(admin.getItemInHand(), Material.PAPER))
|
||||
if (_clientManager.Get(admin).GetRank().Has(Rank.MODERATOR) && _preferences.Get(admin).ShowMacReports)
|
||||
UtilPlayer.message(admin, C.cRed + C.Bold + player.getName() + " suspected for " + type + ".");
|
||||
|
||||
// Print (Debug)
|
||||
|
@ -15,10 +15,10 @@ import mineplex.core.database.column.ColumnVarChar;
|
||||
|
||||
public class PreferencesRepository extends RepositoryBase
|
||||
{
|
||||
private static String CREATE_ACCOUNT_TABLE = "CREATE TABLE IF NOT EXISTS accountPreferences (id INT NOT NULL AUTO_INCREMENT, uuid VARCHAR(256), games BOOL NOT NULL DEFAULT 1, visibility BOOL NOT NULL DEFAULT 1, showChat BOOL NOT NULL DEFAULT 1, friendChat BOOL NOT NULL DEFAULT 1, privateMessaging BOOL NOT NULL DEFAULT 1, partyRequests BOOL NOT NULL DEFAULT 0, invisibility BOOL NOT NULL DEFAULT 0, forcefield BOOL NOT NULL DEFAULT 0, PRIMARY KEY (id), UNIQUE INDEX uuid_index (uuid));";
|
||||
private static String CREATE_ACCOUNT_TABLE = "CREATE TABLE IF NOT EXISTS accountPreferences (id INT NOT NULL AUTO_INCREMENT, uuid VARCHAR(256), games BOOL NOT NULL DEFAULT 1, visibility BOOL NOT NULL DEFAULT 1, showChat BOOL NOT NULL DEFAULT 1, friendChat BOOL NOT NULL DEFAULT 1, privateMessaging BOOL NOT NULL DEFAULT 1, partyRequests BOOL NOT NULL DEFAULT 0, invisibility BOOL NOT NULL DEFAULT 0, forcefield BOOL NOT NULL DEFAULT 0, showMacReports BOOL NOT NULL DEFAULT 0, ignoreVelocity BOOL NOT NULL DEFAULT 0, PRIMARY KEY (id), UNIQUE INDEX uuid_index (uuid));";
|
||||
private static String INSERT_ACCOUNT = "INSERT INTO accountPreferences (uuid) VALUES (?) ON DUPLICATE KEY UPDATE uuid=uuid;";
|
||||
private static String RETRIEVE_ACCOUNT_PREFERENCES = "SELECT games, visibility, showChat, friendChat, privateMessaging, partyRequests, invisibility, forcefield FROM accountPreferences WHERE uuid = ?;";
|
||||
private static String UPDATE_ACCOUNT_PREFERENCES = "UPDATE accountPreferences SET games = ?, visibility = ?, showChat = ?, friendChat = ?, privateMessaging = ?, partyRequests = ?, invisibility = ?, forcefield = ? WHERE uuid=?;";
|
||||
private static String RETRIEVE_ACCOUNT_PREFERENCES = "SELECT games, visibility, showChat, friendChat, privateMessaging, partyRequests, invisibility, forcefield, showMacReports, ignoreVelocity FROM accountPreferences WHERE uuid = ?;";
|
||||
private static String UPDATE_ACCOUNT_PREFERENCES = "UPDATE accountPreferences SET games = ?, visibility = ?, showChat = ?, friendChat = ?, privateMessaging = ?, partyRequests = ?, invisibility = ?, forcefield = ?, showMacReports = ?, ignoreVelocity = ? WHERE uuid=?;";
|
||||
|
||||
public PreferencesRepository(JavaPlugin plugin, String connectionString)
|
||||
{
|
||||
@ -54,7 +54,9 @@ public class PreferencesRepository extends RepositoryBase
|
||||
preparedStatement.setBoolean(6, entry.getValue().PartyRequests);
|
||||
preparedStatement.setBoolean(7, entry.getValue().Invisibility);
|
||||
preparedStatement.setBoolean(8, entry.getValue().HubForcefield);
|
||||
preparedStatement.setString(9, entry.getKey());
|
||||
preparedStatement.setBoolean(9, entry.getValue().ShowMacReports);
|
||||
preparedStatement.setBoolean(10, entry.getValue().IgnoreVelocity);
|
||||
preparedStatement.setString(11, entry.getKey());
|
||||
|
||||
preparedStatement.addBatch();
|
||||
}
|
||||
@ -103,6 +105,8 @@ public class PreferencesRepository extends RepositoryBase
|
||||
preferences.PartyRequests = resultSet.getBoolean(6);
|
||||
preferences.Invisibility = resultSet.getBoolean(7);
|
||||
preferences.HubForcefield = resultSet.getBoolean(8);
|
||||
preferences.ShowMacReports = resultSet.getBoolean(9);
|
||||
preferences.IgnoreVelocity = resultSet.getBoolean(10);
|
||||
}
|
||||
}
|
||||
}, new ColumnVarChar("uuid", 100, uuid.toString()));
|
||||
|
@ -11,4 +11,6 @@ public class UserPreferences
|
||||
public boolean PartyRequests = true;
|
||||
public boolean Invisibility = false;
|
||||
public boolean HubForcefield = false;
|
||||
public boolean ShowMacReports = false;
|
||||
public boolean IgnoreVelocity = false;
|
||||
}
|
||||
|
@ -1,5 +1,9 @@
|
||||
package mineplex.core.preferences.ui;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
@ -9,10 +13,6 @@ import mineplex.core.shop.item.IButton;
|
||||
import mineplex.core.shop.item.ShopItem;
|
||||
import mineplex.core.shop.page.ShopPageBase;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class PreferencesPage extends ShopPageBase<PreferencesManager, PreferencesShop>
|
||||
{
|
||||
private IButton _toggleHubGames;
|
||||
@ -22,7 +22,9 @@ public class PreferencesPage extends ShopPageBase<PreferencesManager, Preference
|
||||
private IButton _toggleHubPartyRequests;
|
||||
private IButton _toggleHubInvisibility;
|
||||
private IButton _toggleHubForcefield;
|
||||
|
||||
private IButton _toggleHubIgnoreVelocity;
|
||||
private IButton _toggleMacReports;
|
||||
|
||||
private boolean _hubGamesToggled;
|
||||
private boolean _hubPlayersToggled;
|
||||
private boolean _hubChatToggled;
|
||||
@ -30,6 +32,8 @@ public class PreferencesPage extends ShopPageBase<PreferencesManager, Preference
|
||||
private boolean _hubPartyRequestsToggled;
|
||||
private boolean _hubInvisibilityToggled;
|
||||
private boolean _hubForcefieldToggled;
|
||||
private boolean _macReportsToggled;
|
||||
private boolean _hubIgnoreVelocityToggled;
|
||||
|
||||
public PreferencesPage(PreferencesManager plugin, PreferencesShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player)
|
||||
{
|
||||
@ -145,6 +149,36 @@ public class PreferencesPage extends ShopPageBase<PreferencesManager, Preference
|
||||
toggleHubForcefield(player);
|
||||
}
|
||||
};
|
||||
|
||||
_toggleMacReports = new IButton()
|
||||
{
|
||||
@Override
|
||||
public void ClickedLeft(Player player)
|
||||
{
|
||||
toggleMacReports(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ClickedRight(Player player)
|
||||
{
|
||||
toggleMacReports(player);
|
||||
}
|
||||
};
|
||||
|
||||
_toggleHubIgnoreVelocity = new IButton()
|
||||
{
|
||||
@Override
|
||||
public void ClickedLeft(Player player)
|
||||
{
|
||||
toggleHubIgnoreVelocity(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ClickedRight(Player player)
|
||||
{
|
||||
toggleHubIgnoreVelocity(player);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private void buildPreference(int index, Material material, String name, boolean preference, IButton button)
|
||||
@ -157,7 +191,7 @@ public class PreferencesPage extends ShopPageBase<PreferencesManager, Preference
|
||||
String[] description = new String[] {
|
||||
"" + (preference ? ChatColor.GREEN + "Enabled" : ChatColor.RED + "Disabled"),
|
||||
ChatColor.RED + " ",
|
||||
"Click to " + (preference ? "Disable" : "Enable") };
|
||||
ChatColor.RESET + "Click to " + (preference ? "Disable" : "Enable") };
|
||||
|
||||
AddButton(index, new ShopItem(material, data, (preference ? ChatColor.GREEN : ChatColor.RED) + name, description, 1, false, false), button);
|
||||
AddButton(index + 9, new ShopItem(Material.INK_SACK, (preference ? (byte)10 : (byte)8), (preference ? ChatColor.GREEN : ChatColor.RED) + name, description, 1, false, false), button);
|
||||
@ -211,6 +245,20 @@ public class PreferencesPage extends ShopPageBase<PreferencesManager, Preference
|
||||
_hubGamesToggled = !_hubGamesToggled;
|
||||
BuildPage();
|
||||
}
|
||||
|
||||
protected void toggleMacReports(org.bukkit.entity.Player player)
|
||||
{
|
||||
Plugin.Get(player).ShowMacReports = !Plugin.Get(player).ShowMacReports;
|
||||
_macReportsToggled = !_macReportsToggled;
|
||||
BuildPage();
|
||||
}
|
||||
|
||||
protected void toggleHubIgnoreVelocity(org.bukkit.entity.Player player)
|
||||
{
|
||||
Plugin.Get(player).IgnoreVelocity = !Plugin.Get(player).IgnoreVelocity;
|
||||
_hubIgnoreVelocityToggled = !_hubIgnoreVelocityToggled;
|
||||
BuildPage();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void PlayerClosed()
|
||||
@ -230,7 +278,7 @@ public class PreferencesPage extends ShopPageBase<PreferencesManager, Preference
|
||||
UserPreferences userPreferences = Plugin.Get(Player);
|
||||
int index = 18;
|
||||
|
||||
if (ClientManager.Get(Player).GetRank().Has(Rank.ADMIN) || ClientManager.Get(Player).GetRank() == Rank.YOUTUBE)
|
||||
if (ClientManager.Get(Player).GetRank().Has(Rank.MODERATOR) || ClientManager.Get(Player).GetRank() == Rank.YOUTUBE)
|
||||
{
|
||||
index = 9;
|
||||
}
|
||||
@ -244,12 +292,24 @@ public class PreferencesPage extends ShopPageBase<PreferencesManager, Preference
|
||||
buildPreference(index, Material.EMPTY_MAP, "Private Messaging", userPreferences.PrivateMessaging, _togglePrivateChat);
|
||||
index += 2;
|
||||
buildPreference(index, Material.SKULL_ITEM, (byte)3, "Hub Party Requests", userPreferences.PartyRequests, _toggleHubPartyRequests);
|
||||
|
||||
if (ClientManager.Get(Player).GetRank().Has(Rank.ADMIN) || ClientManager.Get(Player).GetRank() == Rank.YOUTUBE)
|
||||
|
||||
if (ClientManager.Get(Player).GetRank() == Rank.YOUTUBE)
|
||||
{
|
||||
buildPreference(39, Material.NETHER_STAR, "Hub Invisibility", userPreferences.Invisibility, _toggleHubInvisibility);
|
||||
buildPreference(41, Material.SLIME_BALL, "Hub Forcefield", userPreferences.HubForcefield, _toggleHubForcefield);
|
||||
}
|
||||
if (ClientManager.Get(Player).GetRank().Has(Rank.ADMIN))
|
||||
{
|
||||
buildPreference(37, Material.NETHER_STAR, "Hub Invisibility", userPreferences.Invisibility, _toggleHubInvisibility);
|
||||
buildPreference(39, Material.SLIME_BALL, "Hub Forcefield", userPreferences.HubForcefield, _toggleHubForcefield);
|
||||
buildPreference(41, Material.PAPER, "Mac Reports", userPreferences.ShowMacReports, _toggleMacReports);
|
||||
buildPreference(43, Material.SADDLE, "Hub Ignore Velocity", userPreferences.IgnoreVelocity, _toggleHubIgnoreVelocity);
|
||||
}
|
||||
else if (ClientManager.Get(Player).GetRank().Has(Rank.MODERATOR))
|
||||
{
|
||||
buildPreference(39, Material.PAPER, "Mac Reports", userPreferences.ShowMacReports, _toggleMacReports);
|
||||
buildPreference(41, Material.SADDLE, "Hub Ignore Velocity", userPreferences.IgnoreVelocity, _toggleHubIgnoreVelocity);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean preferencesChanged()
|
||||
|
@ -10,7 +10,6 @@ import mineplex.core.antistack.AntiStack;
|
||||
import mineplex.core.blockrestore.BlockRestore;
|
||||
import mineplex.core.chat.Chat;
|
||||
import mineplex.core.command.CommandCenter;
|
||||
import mineplex.minecraft.game.core.condition.ConditionManager;
|
||||
import mineplex.core.creature.Creature;
|
||||
import mineplex.core.disguise.DisguiseManager;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
@ -50,6 +49,7 @@ import mineplex.minecraft.game.classcombat.shop.ClassCombatShop;
|
||||
import mineplex.minecraft.game.classcombat.shop.ClassShopManager;
|
||||
import mineplex.minecraft.game.core.IRelation;
|
||||
import mineplex.minecraft.game.core.combat.CombatManager;
|
||||
import mineplex.minecraft.game.core.condition.ConditionManager;
|
||||
import mineplex.minecraft.game.core.damage.DamageManager;
|
||||
import mineplex.minecraft.game.core.fire.Fire;
|
||||
|
||||
@ -94,7 +94,7 @@ public class Hub extends JavaPlugin implements IRelation
|
||||
//new FriendManager(this, packetHandler);
|
||||
PartyManager partyManager = new PartyManager(this, clientManager, preferenceManager);
|
||||
Portal portal = new Portal(this, serverStatusManager.getCurrentServerName());
|
||||
AntiHack.Initialize(this, punish, portal);
|
||||
AntiHack.Initialize(this, punish, portal, preferenceManager, clientManager);
|
||||
PacketHandler packetHandler = new PacketHandler(this);
|
||||
DisguiseManager disguiseManager = new DisguiseManager(this, packetHandler);
|
||||
HubManager hubManager = new HubManager(this, new BlockRestore(this), clientManager, donationManager, new ConditionManager(this), disguiseManager, new TaskManager(this, webServerAddress), portal, partyManager, preferenceManager, petManager, pollManager);
|
||||
|
@ -28,6 +28,7 @@ import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerLoginEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.event.player.PlayerRespawnEvent;
|
||||
import org.bukkit.event.player.PlayerVelocityEvent;
|
||||
import org.bukkit.event.server.ServerListPingEvent;
|
||||
import org.bukkit.event.world.ChunkLoadEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@ -949,4 +950,13 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void ignoreVelocity(PlayerVelocityEvent event)
|
||||
{
|
||||
if (_clientManager.Get(event.getPlayer()).GetRank().Has(Rank.MODERATOR) && _preferences.Get(event.getPlayer()).IgnoreVelocity)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -107,7 +107,10 @@ public class WorldManager
|
||||
|
||||
try
|
||||
{
|
||||
FileUtils.copyFile(new File(fileName), new File(File.separator + "home" + File.separator + "mineplex" + File.separator + "update" + File.separator + "maps" + File.separator + gameType.GetName() + File.separator + fileName));
|
||||
File zipFile = new File(fileName);
|
||||
FileUtils.copyFile(zipFile, new File(File.separator + "home" + File.separator + "mineplex" + File.separator + "update" + File.separator + "maps" + File.separator + gameType.GetName() + File.separator + fileName));
|
||||
// Delete the zip file in root directory once zip is copied
|
||||
FileUtils.deleteQuietly(zipFile);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
|
@ -104,7 +104,7 @@ public class Arcade extends JavaPlugin
|
||||
_damageManager = new DamageManager(this, new CombatManager(this), new NpcManager(this, creature), disguiseManager);
|
||||
|
||||
Punish punish = new Punish(this, webServerAddress, _clientManager);
|
||||
AntiHack.Initialize(this, punish, portal);
|
||||
AntiHack.Initialize(this, punish, portal, preferenceManager, _clientManager);
|
||||
|
||||
BlockRestore blockRestore = new BlockRestore(this);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user