Merge branch 'master' of ssh://184.154.0.242:7999/min/Mineplex
This commit is contained in:
commit
0a874d0ee3
@ -5,7 +5,7 @@ import java.sql.Connection;
|
||||
|
||||
import org.apache.commons.dbcp2.BasicDataSource;
|
||||
|
||||
public class DBPool
|
||||
public final class DBPool
|
||||
{
|
||||
public static final DataSource ACCOUNT = openDataSource("jdbc:mysql://db.mineplex.com/Account", "root", "tAbechAk3wR7tuTh");
|
||||
public static final DataSource QUEUE = openDataSource("jdbc:mysql://db.mineplex.com/Queue", "root", "tAbechAk3wR7tuTh");
|
||||
@ -30,4 +30,9 @@ public class DBPool
|
||||
|
||||
return source;
|
||||
}
|
||||
|
||||
private DBPool()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ import mineplex.core.punish.Tokens.PunishClientToken;
|
||||
import mineplex.core.punish.Tokens.PunishmentToken;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.craftbukkit.libs.com.google.gson.Gson;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@ -154,7 +155,7 @@ public class Punish extends MiniPlugin
|
||||
}
|
||||
else if (banResult == PunishmentResponse.Punished)
|
||||
{
|
||||
final String durationString = F.time(UtilTime.convertString(finalDuration < 0 ? -1 : (long)(finalDuration * 3600000), 1, TimeUnit.FIT));
|
||||
final String durationString = UtilTime.convertString(finalDuration < 0 ? -1 : (long)(finalDuration * 3600000), 1, TimeUnit.FIT);
|
||||
|
||||
if (sentence == PunishmentSentence.Ban)
|
||||
{
|
||||
@ -178,8 +179,20 @@ public class Punish extends MiniPlugin
|
||||
System.out.println(F.main(GetName(), F.elem(caller == null ? "Mineplex Anti-Cheat" : caller.getName()) + " muted " + F.elem(playerName) + " because of " + F.elem(reason) + " for " +
|
||||
durationString + "."));
|
||||
|
||||
//Warning
|
||||
if (finalDuration == 0)
|
||||
UtilServer.broadcast(F.main(GetName(), caller == null ? "Mineplex Anti-Cheat" : caller.getName() + " issued a warning to " + playerName + "."));
|
||||
else
|
||||
UtilServer.broadcast(F.main(GetName(), caller == null ? "Mineplex Anti-Cheat" : caller.getName() + " muted " + playerName + " for " + durationString + "."));
|
||||
|
||||
//Inform
|
||||
Player target = UtilPlayer.searchExact(playerName);
|
||||
if (target != null)
|
||||
{
|
||||
UtilPlayer.message(target, F.main("Punish", F.elem(C.cGray + C.Bold + "Reason: ") + reason));
|
||||
target.playSound(target.getLocation(), Sound.CAT_MEOW, 1f, 1f);
|
||||
}
|
||||
|
||||
_repository.LoadPunishClient(playerName, new Callback<PunishClientToken>()
|
||||
{
|
||||
public void run(PunishClientToken token)
|
||||
|
@ -145,6 +145,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
private ServerStatusManager _serverStatusManager;
|
||||
private InventoryManager _inventoryManager;
|
||||
private CosmeticManager _cosmeticManager;
|
||||
private final IdleManager _idleManager;
|
||||
|
||||
private AchievementManager _achievementManager;
|
||||
private StatsManager _statsManager;
|
||||
@ -264,7 +265,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
new GameLootManager(this, petManager);
|
||||
_gameWorldManager = new GameWorldManager(this);
|
||||
new MiscManager(this);
|
||||
new IdleManager(this);
|
||||
_idleManager = new IdleManager(this);
|
||||
//new HalloweenManager(this);
|
||||
|
||||
_arcadeRepository = new ArcadeRepository(plugin);
|
||||
@ -1071,4 +1072,9 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
{
|
||||
_youtube.remove(event.getPlayer());
|
||||
}
|
||||
|
||||
public IdleManager getIdleManager()
|
||||
{
|
||||
return _idleManager;
|
||||
}
|
||||
}
|
||||
|
@ -1249,4 +1249,9 @@ public abstract class Game implements Listener
|
||||
|
||||
_statTrackers.clear();
|
||||
}
|
||||
|
||||
public ArcadeManager getArcadeManager()
|
||||
{
|
||||
return Manager;
|
||||
}
|
||||
}
|
||||
|
@ -125,6 +125,8 @@ public class Draw extends SoloGame
|
||||
new KeenEyeStatTracker(this),
|
||||
new PureLuckStatTracker(this)
|
||||
);
|
||||
|
||||
getArcadeManager().getIdleManager().setEnabled(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -102,6 +102,8 @@ public class UHC extends TeamGame
|
||||
|
||||
private boolean xrayDebug = false;
|
||||
|
||||
private long lastInform = 0;
|
||||
|
||||
public UHC(ArcadeManager manager)
|
||||
{
|
||||
super(manager, GameType.UHC,
|
||||
@ -1578,4 +1580,14 @@ public class UHC extends TeamGame
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void informStartSoon()
|
||||
{
|
||||
if (UtilTime.elapsed(lastInform, 20000))
|
||||
{
|
||||
lastInform = System.currentTimeMillis();
|
||||
|
||||
Bukkit.broadcastMessage(C.cGray + "Countdown will start in " + UtilTime.MakeStr(150000 - (System.currentTimeMillis() - GetStateTime())) +"...");
|
||||
}
|
||||
}
|
||||
}
|
@ -29,6 +29,7 @@ import nautilus.game.arcade.game.Game;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.Game.GameState;
|
||||
import nautilus.game.arcade.game.GameTeam.PlayerState;
|
||||
import nautilus.game.arcade.game.games.uhc.UHC;
|
||||
import nautilus.game.arcade.stats.StatTracker;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
@ -200,8 +201,13 @@ public class GameManager implements Listener
|
||||
public void StateCountdown(Game game, int timer, boolean force)
|
||||
{
|
||||
//Always give time to pick team.
|
||||
if (!game.GetCountdownForce() && !force && !UtilTime.elapsed(game.GetStateTime(), 15000))
|
||||
if (!game.GetCountdownForce() && !force && !UtilTime.elapsed(game.GetStateTime(), game.GetType() == GameType.UHC ? 150000 : 15000))
|
||||
{
|
||||
if (game.GetType() == GameType.UHC)
|
||||
{
|
||||
((UHC)game).informStartSoon();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package nautilus.game.arcade.managers;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.C;
|
||||
@ -22,24 +23,26 @@ import org.bukkit.event.player.PlayerQuitEvent;
|
||||
|
||||
public class IdleManager implements Listener
|
||||
{
|
||||
ArcadeManager Manager;
|
||||
|
||||
private HashMap<Player, Float> _yaw = new HashMap<Player, Float>();
|
||||
private HashMap<Player, Long> _idle = new HashMap<Player, Long>();
|
||||
private HashMap<Player, Integer> _beep = new HashMap<Player, Integer>();
|
||||
|
||||
private final ArcadeManager _arcadeManager;
|
||||
private final Map<Player, Float> _yaw = new HashMap<>();
|
||||
private final Map<Player, Long> _idle = new HashMap<>();
|
||||
private final Map<Player, Integer> _beep = new HashMap<>();
|
||||
private boolean _enabled = true;
|
||||
|
||||
public IdleManager(ArcadeManager manager)
|
||||
{
|
||||
Manager = manager;
|
||||
_arcadeManager = manager;
|
||||
|
||||
Manager.GetPluginManager().registerEvents(this, Manager.GetPlugin());
|
||||
Bukkit.getPluginManager().registerEvents(this, getArcadeManager().GetPlugin());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void ChatIdle(final AsyncPlayerChatEvent event)
|
||||
{
|
||||
Bukkit.getServer().getScheduler().runTaskLater(Manager.GetPlugin(), new Runnable()
|
||||
if (!isEnabled())
|
||||
return;
|
||||
|
||||
Bukkit.getServer().getScheduler().runTaskLater(getArcadeManager().GetPlugin(), new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
@ -50,15 +53,18 @@ public class IdleManager implements Listener
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void KickIdlePlayers(UpdateEvent event)
|
||||
public void kickIdlePlayers(UpdateEvent event)
|
||||
{
|
||||
if (!isEnabled())
|
||||
return;
|
||||
|
||||
if (event.getType() != UpdateType.FAST)
|
||||
return;
|
||||
|
||||
if (!Manager.IsPlayerKickIdle())
|
||||
if (!getArcadeManager().IsPlayerKickIdle())
|
||||
return;
|
||||
|
||||
if (Manager.GetGame() == null)
|
||||
if (getArcadeManager().GetGame() == null)
|
||||
return;
|
||||
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
@ -73,10 +79,10 @@ public class IdleManager implements Listener
|
||||
{
|
||||
if (UtilTime.elapsed(_idle.get(player), 120000))
|
||||
{
|
||||
if (Manager.GetGame().GetState() != GameState.Recruit && !Manager.GetGame().IsAlive(player))
|
||||
if (getArcadeManager().GetGame().GetState() != GameState.Recruit && !getArcadeManager().GetGame().IsAlive(player))
|
||||
continue;
|
||||
|
||||
if (Manager.GetClients().Get(player).GetRank().Has(Rank.MODERATOR))
|
||||
if (getArcadeManager().GetClients().Get(player).GetRank().Has(Rank.MODERATOR))
|
||||
continue;
|
||||
|
||||
//Start Beeps
|
||||
@ -92,7 +98,7 @@ public class IdleManager implements Listener
|
||||
if (count == 0)
|
||||
{
|
||||
player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 10f, 1f);
|
||||
Manager.GetPortal().SendPlayerToServer(player, "Lobby");
|
||||
getArcadeManager().GetPortal().SendPlayerToServer(player, "Lobby");
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -120,10 +126,25 @@ public class IdleManager implements Listener
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void Quit(PlayerQuitEvent event)
|
||||
public void onPlayerQuit(PlayerQuitEvent event)
|
||||
{
|
||||
_yaw.remove(event.getPlayer());
|
||||
_idle.remove(event.getPlayer());
|
||||
_beep.remove(event.getPlayer());
|
||||
}
|
||||
|
||||
public boolean isEnabled()
|
||||
{
|
||||
return _enabled;
|
||||
}
|
||||
|
||||
public void setEnabled(boolean enabled)
|
||||
{
|
||||
_enabled = enabled;
|
||||
}
|
||||
|
||||
public ArcadeManager getArcadeManager()
|
||||
{
|
||||
return _arcadeManager;
|
||||
}
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.game.Game;
|
||||
import nautilus.game.arcade.game.games.hideseek.HideSeek;
|
||||
import nautilus.game.arcade.game.games.hideseek.forms.CreatureForm;
|
||||
|
||||
public class BadHiderStatTracker extends StatTracker<HideSeek>
|
||||
{
|
||||
@ -28,6 +29,7 @@ public class BadHiderStatTracker extends StatTracker<HideSeek>
|
||||
if (getGame().GetState() != Game.GameState.Live)
|
||||
return;
|
||||
|
||||
if (event.getForm() instanceof CreatureForm)
|
||||
_disqualified.add(event.getPlayer().getUniqueId());
|
||||
}
|
||||
|
||||
@ -40,15 +42,6 @@ public class BadHiderStatTracker extends StatTracker<HideSeek>
|
||||
_disqualified.add(event.getEntity().getUniqueId());
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||
public void onPlayerSolidify(HideSeek.PlayerSolidifyEvent event)
|
||||
{
|
||||
if (getGame().GetState() != Game.GameState.Live)
|
||||
return;
|
||||
|
||||
_disqualified.add(event.getPlayer().getUniqueId());
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||
public void onGameStateChange(GameStateChangeEvent event)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user