Merge branch 'develop' of ssh://git@github.com/Mineplex-LLC/Minecraft-PC.git into bugfix/pc-120+698

This commit is contained in:
xGamingDudex 2016-08-20 11:40:15 +02:00
commit e64324b36c
22 changed files with 316 additions and 238 deletions

View File

@ -2,14 +2,15 @@ package mineplex.core.antihack;
import com.google.common.cache.Cache; import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder; import com.google.common.cache.CacheBuilder;
import com.google.common.collect.ImmutableMap;
import com.google.common.util.concurrent.AtomicDouble; import com.google.common.util.concurrent.AtomicDouble;
import com.mineplex.anticheat.api.GameEndEvent; import com.mineplex.anticheat.api.GameEndEvent;
import com.mineplex.anticheat.api.GameStartEvent; import com.mineplex.anticheat.api.GameStartEvent;
import com.mineplex.anticheat.api.MineplexLink; import com.mineplex.anticheat.api.MineplexLink;
import com.mineplex.anticheat.api.PlayerViolationEvent; import com.mineplex.anticheat.api.PlayerViolationEvent;
import mineplex.core.PlayerSelector;
import mineplex.core.Managers; import mineplex.core.Managers;
import mineplex.core.MiniPlugin; import mineplex.core.MiniPlugin;
import mineplex.core.PlayerSelector;
import mineplex.core.ReflectivelyCreateMiniPlugin; import mineplex.core.ReflectivelyCreateMiniPlugin;
import mineplex.core.account.CoreClient; import mineplex.core.account.CoreClient;
import mineplex.core.account.CoreClientManager; import mineplex.core.account.CoreClientManager;
@ -21,15 +22,7 @@ import mineplex.core.antihack.types.Reach;
import mineplex.core.antihack.types.Speed; import mineplex.core.antihack.types.Speed;
import mineplex.core.command.CommandBase; import mineplex.core.command.CommandBase;
import mineplex.core.common.Rank; import mineplex.core.common.Rank;
import mineplex.core.common.util.C; import mineplex.core.common.util.*;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.disguise.DisguiseManager; import mineplex.core.disguise.DisguiseManager;
import mineplex.core.disguise.disguises.DisguiseBase; import mineplex.core.disguise.disguises.DisguiseBase;
import mineplex.core.portal.Portal; import mineplex.core.portal.Portal;
@ -41,44 +34,23 @@ import mineplex.core.punish.Punishment;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import mineplex.serverdata.commands.ServerCommandManager; import mineplex.serverdata.commands.ServerCommandManager;
import net.minecraft.server.v1_8_R3.ChatClickable; import net.minecraft.server.v1_8_R3.*;
import net.minecraft.server.v1_8_R3.ChatComponentText; import org.bukkit.*;
import net.minecraft.server.v1_8_R3.ChatHoverable;
import net.minecraft.server.v1_8_R3.ChatModifier;
import net.minecraft.server.v1_8_R3.EnumChatFormat;
import net.minecraft.server.v1_8_R3.IChatBaseComponent;
import net.minecraft.server.v1_8_R3.MathHelper;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.*;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerTeleportEvent;
import org.bukkit.event.player.PlayerToggleFlightEvent;
import org.bukkit.event.player.PlayerVelocityEvent;
import org.bukkit.event.server.ServerListPingEvent; import org.bukkit.event.server.ServerListPingEvent;
import org.bukkit.plugin.ServicePriority; import org.bukkit.plugin.ServicePriority;
import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType; import org.bukkit.potion.PotionEffectType;
import org.bukkit.scheduler.BukkitTask; import org.bukkit.scheduler.BukkitTask;
import java.util.ArrayList; import java.util.*;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
@ -89,7 +61,14 @@ import java.util.function.Predicate;
@ReflectivelyCreateMiniPlugin @ReflectivelyCreateMiniPlugin
public class AntiHack extends MiniPlugin public class AntiHack extends MiniPlugin
{ {
public static final boolean IS_PHASE_TWO = false; public static final Map<String, CheckThresholds> CHECKS = ImmutableMap.of(
"Killaura (Type A)", new CheckThresholds("Kill Aura", 25, 50),
"Killaura (Type B)", new CheckThresholds("High CPS", 0, Integer.MAX_VALUE),
"Killaura (Type C)", new CheckThresholds("Reach", Integer.MAX_VALUE, Integer.MAX_VALUE),
"Killaura (Type D)", new CheckThresholds("Kill Aura", 1000, 1500),
"BadPackets", new CheckThresholds("Regen", 1000, 2000)
);
public static final String NAME = "Chiss"; public static final String NAME = "Chiss";
public static final String USER_HAS_BEEN_BANNED = F.main("GWEN", "%s has been banned. I am always watching"); public static final String USER_HAS_BEEN_BANNED = F.main("GWEN", "%s has been banned. I am always watching");
public static final String USER_HAS_BEEN_BANNED_BANWAVE = USER_HAS_BEEN_BANNED; public static final String USER_HAS_BEEN_BANNED_BANWAVE = USER_HAS_BEEN_BANNED;
@ -200,74 +179,17 @@ public class AntiHack extends MiniPlugin
ServerCommandManager.getInstance().registerCommandType(MajorViolationCommand.class, violation -> ServerCommandManager.getInstance().registerCommandType(MajorViolationCommand.class, violation ->
{ {
if (!violation.getOriginatingServer().equals(this._thisServer)) IChatBaseComponent component = getMinimalMessage(violation);
{
IChatBaseComponent component = new ChatComponentText("")
.addSibling(
new ChatComponentText("A")
.setChatModifier(
new ChatModifier()
.setColor(EnumChatFormat.AQUA)
.setRandom(true)
)
)
.addSibling(
new ChatComponentText(" GWEN > ")
.setChatModifier(
new ChatModifier()
.setColor(EnumChatFormat.RED)
.setBold(true)
)
)
.addSibling(
new ChatComponentText(violation.getPlayerName())
.setChatModifier(
new ChatModifier()
.setColor(EnumChatFormat.GOLD)
)
)
.addSibling(
new ChatComponentText(" failed " + violation.getHackType() + " VL" + violation.getViolations() + " in server ")
.setChatModifier(
new ChatModifier()
.setColor(EnumChatFormat.YELLOW)
)
)
.addSibling(
new ChatComponentText(
violation.getOriginatingServer()
)
.setChatModifier(
new ChatModifier()
.setColor(EnumChatFormat.YELLOW)
.setChatClickable(
new ChatClickable(
ChatClickable.EnumClickAction.RUN_COMMAND,
"/server " + violation.getOriginatingServer()
)
)
.setChatHoverable(
new ChatHoverable(
ChatHoverable.EnumHoverAction.SHOW_TEXT,
new ChatComponentText("Teleport to " + violation.getOriginatingServer())
)
)
)
)
.addSibling(
new ChatComponentText(": " + violation.getMessage() + ". Please investigate")
.setChatModifier(
new ChatModifier()
.setColor(EnumChatFormat.YELLOW)
)
);
for (Player player : Bukkit.getOnlinePlayers()) for (Player player : Bukkit.getOnlinePlayers())
{
if (player.getName().equals("Spoobncoobr"))
{ {
if (Managers.get(PreferencesManager.class).Get(player).ShowMacReports && _clientManager.Get(player).GetRank().has(Rank.HELPER)) ((CraftPlayer) player).getHandle().sendMessage(getDetailedMessage(violation));
{
((CraftPlayer) player).getHandle().sendMessage(component); } else if (_clientManager.Get(player).GetRank().has(Rank.HELPER) && (violation.getOriginatingServer().equals(_thisServer) || Managers.get(PreferencesManager.class).Get(player).ShowMacReports))
} {
((CraftPlayer) player).getHandle().sendMessage(component);
} }
} }
}); });
@ -355,6 +277,144 @@ public class AntiHack extends MiniPlugin
require(BanWaveManager.class); require(BanWaveManager.class);
} }
private IChatBaseComponent getDetailedMessage(MajorViolationCommand violation)
{
return new ChatComponentText("")
.addSibling(
new ChatComponentText("A")
.setChatModifier(
new ChatModifier()
.setColor(EnumChatFormat.AQUA)
.setRandom(true)
)
)
.addSibling(
new ChatComponentText(" GWEN > ")
.setChatModifier(
new ChatModifier()
.setColor(EnumChatFormat.RED)
.setBold(true)
)
)
.addSibling(
new ChatComponentText(violation.getPlayerName())
.setChatModifier(
new ChatModifier()
.setColor(EnumChatFormat.GOLD)
)
)
.addSibling(
new ChatComponentText(" failed " + violation.getHackType() + " VL" + violation.getViolations() + " in server ")
.setChatModifier(
new ChatModifier()
.setColor(EnumChatFormat.YELLOW)
)
)
.addSibling(
new ChatComponentText(
violation.getOriginatingServer()
)
.setChatModifier(
new ChatModifier()
.setColor(EnumChatFormat.YELLOW)
.setChatClickable(
new ChatClickable(
ChatClickable.EnumClickAction.RUN_COMMAND,
"/server " + violation.getOriginatingServer()
)
)
.setChatHoverable(
new ChatHoverable(
ChatHoverable.EnumHoverAction.SHOW_TEXT,
new ChatComponentText("Teleport to " + violation.getOriginatingServer())
)
)
)
)
.addSibling(
new ChatComponentText(": " + violation.getMessage() + ". Please investigate!")
.setChatModifier(
new ChatModifier()
.setColor(EnumChatFormat.YELLOW)
)
);
}
private IChatBaseComponent getMinimalMessage(MajorViolationCommand violation)
{
IChatBaseComponent component = new ChatComponentText("")
.addSibling(
new ChatComponentText("A")
.setChatModifier(
new ChatModifier()
.setColor(EnumChatFormat.AQUA)
.setRandom(true)
)
)
.addSibling(
new ChatComponentText(" GWEN > ")
.setChatModifier(
new ChatModifier()
.setColor(EnumChatFormat.RED)
.setBold(true)
)
)
.addSibling(
new ChatComponentText(violation.getPlayerName())
.setChatModifier(
new ChatModifier()
.setColor(EnumChatFormat.GOLD)
)
)
.addSibling(
new ChatComponentText(" suspected of ")
.setChatModifier(
new ChatModifier()
.setColor(EnumChatFormat.YELLOW)
)
)
.addSibling(CHECKS.get(violation.getHackType()).format(violation.getViolations()));
if (!violation.getOriginatingServer().equals(this._thisServer))
{
component
.addSibling(
new ChatComponentText(" in ")
.setChatModifier(
new ChatModifier()
.setColor(EnumChatFormat.YELLOW)
)
)
.addSibling(
new ChatComponentText(violation.getOriginatingServer())
.setChatModifier(
new ChatModifier()
.setColor(EnumChatFormat.AQUA)
.setChatClickable(
new ChatClickable(
ChatClickable.EnumClickAction.RUN_COMMAND,
"/server " + violation.getOriginatingServer()
)
)
.setChatHoverable(
new ChatHoverable(
ChatHoverable.EnumHoverAction.SHOW_TEXT,
new ChatComponentText("Teleport to " + violation.getOriginatingServer())
)
)
)
);
}
return component.addSibling(
new ChatComponentText(". Please investigate!")
.setChatModifier(
new ChatModifier()
.setColor(EnumChatFormat.YELLOW)
)
);
}
public void registerFilter(Predicate<Player> filter) public void registerFilter(Predicate<Player> filter)
{ {
if (filter == null) if (filter == null)
@ -382,9 +442,6 @@ public class AntiHack extends MiniPlugin
public void runBanAnimation(Player player, Runnable after) public void runBanAnimation(Player player, Runnable after)
{ {
if (!IS_PHASE_TWO)
return;
if (_pendingBan.add(player)) if (_pendingBan.add(player))
{ {
float oldWalkSpeed = player.getWalkSpeed(); float oldWalkSpeed = player.getWalkSpeed();
@ -495,19 +552,17 @@ public class AntiHack extends MiniPlugin
{ {
runSync(() -> runSync(() ->
{ {
int totalPunishments = getPunishments(player);
int daysBanned = getDaysBanned(player);
CoreClient coreClient = _clientManager.Get(player); CoreClient coreClient = _clientManager.Get(player);
if (coreClient.GetRank().has(Rank.TWITCH)) if (coreClient.GetRank().has(Rank.TWITCH))
{ {
require(Punish.class).AddPunishment(coreClient.getName(), Category.Hacking, message, AntiHack.NAME, totalPunishments + 1, true, daysBanned == -1 ? -1 : TimeUnit.DAYS.toHours(daysBanned), true); require(Punish.class).AddPunishment(coreClient.getName(), Category.Hacking, message, AntiHack.NAME, 3, true, -1, true);
} }
else else
{ {
runBanAnimation(player, () -> runBanAnimation(player, () ->
{ {
require(Punish.class).AddPunishment(coreClient.getName(), Category.Hacking, message, AntiHack.NAME, totalPunishments + 1, true, daysBanned == -1 ? -1 : TimeUnit.DAYS.toHours(daysBanned), true); require(Punish.class).AddPunishment(coreClient.getName(), Category.Hacking, message, AntiHack.NAME, 3, true, -1, true);
announceBan(player); announceBan(player);
}); });
} }
@ -576,10 +631,7 @@ public class AntiHack extends MiniPlugin
@EventHandler @EventHandler
public void on(PlayerViolationEvent event) public void on(PlayerViolationEvent event)
{ {
if (IS_PHASE_TWO) AntiHackAction.getAction(event.getCheckClass()).handle(event);
{
AntiHackAction.getAction(event.getCheckClass()).handle(event);
}
} }
public void announceBan(Player player) public void announceBan(Player player)
@ -918,21 +970,9 @@ public class AntiHack extends MiniPlugin
@EventHandler @EventHandler
public void onHack(PlayerViolationEvent event) public void onHack(PlayerViolationEvent event)
{ {
for (Player player : Bukkit.getOnlinePlayers())
{
CoreClient client = _clientManager.Get(player);
if (event.shouldTellStaff())
{
if (client.GetRank().has(Rank.HELPER))
{
UtilPlayer.message(player, C.cAqua + C.Scramble + "A" + ChatColor.RESET + C.cRed + C.Bold + " GWEN > " + ChatColor.RESET + C.cGold + event.getPlayer().getName() + C.cYellow + " failed " + event.getHackType() + " VL" + event.getViolations() + ": " + event.getMessage() + ". Please investigate");
}
}
}
if (event.shouldTellStaff()) if (event.shouldTellStaff())
{ {
String key = event.getPlayer().getName() + "." + event.getHackType(); String key = event.getPlayer().getName() + "." + event.getHackType() + "." + CHECKS.get(event.getHackType()).getSeverity(event.getViolations()).toString();
Integer pastVl = this._cooldown.getIfPresent(key); Integer pastVl = this._cooldown.getIfPresent(key);
if (pastVl != null) if (pastVl != null)
{ {

View File

@ -0,0 +1,61 @@
package mineplex.core.antihack;
import net.minecraft.server.v1_8_R3.ChatComponentText;
import net.minecraft.server.v1_8_R3.ChatModifier;
import net.minecraft.server.v1_8_R3.EnumChatFormat;
import net.minecraft.server.v1_8_R3.IChatBaseComponent;
public class CheckThresholds
{
private final String _friendlyName;
private final int _med;
private final int _high;
public CheckThresholds(String friendlyName, int med, int high)
{
_friendlyName = friendlyName;
_med = med;
_high = high;
}
public String getFriendlyName()
{
return _friendlyName;
}
public IChatBaseComponent format(int violationLevel)
{
EnumChatFormat color = getSeverity(violationLevel)._color;
return new ChatComponentText(_friendlyName).setChatModifier(new ChatModifier().setColor(color));
}
public Severity getSeverity(int violationLevel)
{
if (violationLevel >= _high)
{
return Severity.HIGH;
} else if (violationLevel >= _med)
{
return Severity.MEDIUM;
} else
{
return Severity.LOW;
}
}
public enum Severity
{
LOW(EnumChatFormat.GREEN),
MEDIUM(EnumChatFormat.GOLD),
HIGH(EnumChatFormat.RED),
;
private final EnumChatFormat _color;
Severity(EnumChatFormat color)
{
_color = color;
}
}
}

View File

@ -2,9 +2,6 @@ package mineplex.core.antihack.actions;
import com.mineplex.anticheat.api.PlayerViolationEvent; import com.mineplex.anticheat.api.PlayerViolationEvent;
import com.mineplex.anticheat.checks.combat.KillauraTypeA; import com.mineplex.anticheat.checks.combat.KillauraTypeA;
import com.mineplex.anticheat.checks.combat.KillauraTypeB;
import com.mineplex.anticheat.checks.combat.KillauraTypeD;
import com.mineplex.anticheat.checks.player.BadPackets;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
@ -22,10 +19,7 @@ public abstract class AntiHackAction implements Listener
static static
{ {
ACTIONS.put(KillauraTypeA.class, new ImmediateBanAction(60)); ACTIONS.put(KillauraTypeA.class, new ImmediateBanAction(200));
ACTIONS.put(KillauraTypeB.class, new BanwaveAction(NEXT_BAN_WAVE, 50));
ACTIONS.put(KillauraTypeD.class, new BanwaveAction(NEXT_BAN_WAVE, 550));
ACTIONS.put(BadPackets.class, new MixedAction(new BanwaveAction(NEXT_BAN_WAVE, 80), new ImmediateBanAction(120)));
} }
private int _vl; private int _vl;

View File

@ -3,10 +3,7 @@ package mineplex.core.antihack.actions;
import com.mineplex.anticheat.api.PlayerViolationEvent; import com.mineplex.anticheat.api.PlayerViolationEvent;
import mineplex.core.Managers; import mineplex.core.Managers;
import mineplex.core.antihack.AntiHack; import mineplex.core.antihack.AntiHack;
import mineplex.core.punish.Category; import mineplex.core.common.util.UtilServer;
import mineplex.core.punish.Punish;
import java.util.concurrent.TimeUnit;
class ImmediateBanAction extends AntiHackAction class ImmediateBanAction extends AntiHackAction
{ {
@ -20,7 +17,12 @@ class ImmediateBanAction extends AntiHackAction
{ {
if (event.getViolations() >= this.getMinVl()) if (event.getViolations() >= this.getMinVl())
{ {
Managers.get(AntiHack.class).doBan(event.getPlayer(), event.getMessage()); String server = UtilServer.getServerName();
if (server.contains("-"))
{
server = server.substring(0, server.indexOf('-'));
}
Managers.get(AntiHack.class).doBan(event.getPlayer(), "[GWEN] Hacking - " + AntiHack.CHECKS.get(event.getHackType()).getFriendlyName() + " [" + server + "]");
} }
} }
} }

View File

@ -24,11 +24,6 @@ public class BanWaveManager extends MiniPlugin
@EventHandler @EventHandler
public void onJoin(PlayerJoinEvent event) public void onJoin(PlayerJoinEvent event)
{ {
if (!AntiHack.IS_PHASE_TWO)
{
return;
}
runAsync(() -> runAsync(() ->
{ {
CoreClient client = require(CoreClientManager.class).Get(event.getPlayer()); CoreClient client = require(CoreClientManager.class).Get(event.getPlayer());

View File

@ -37,8 +37,6 @@ public class LagMeter extends MiniPlugin
private boolean _timingsPasted; private boolean _timingsPasted;
private long _timingsStarted; private long _timingsStarted;
private boolean _fakeTps = false;
private HashSet<Player> _monitoring = new HashSet<Player>(); private HashSet<Player> _monitoring = new HashSet<Player>();
public LagMeter(JavaPlugin plugin, CoreClientManager clientManager) public LagMeter(JavaPlugin plugin, CoreClientManager clientManager)
@ -122,10 +120,6 @@ public class LagMeter extends MiniPlugin
public double getTicksPerSecond() public double getTicksPerSecond()
{ {
if (_fakeTps)
{
return 20.0;
}
return _ticksPerSecond; return _ticksPerSecond;
} }
@ -170,10 +164,4 @@ public class LagMeter extends MiniPlugin
player.sendMessage(F.main(getName(), ChatColor.GRAY + "Free-------" + ChatColor.YELLOW + (Runtime.getRuntime().freeMemory() / 1048576) + "MB")); player.sendMessage(F.main(getName(), ChatColor.GRAY + "Free-------" + ChatColor.YELLOW + (Runtime.getRuntime().freeMemory() / 1048576) + "MB"));
player.sendMessage(F.main(getName(), ChatColor.GRAY + "Max--------" + ChatColor.YELLOW + (Runtime.getRuntime().maxMemory() / 1048576)) + "MB"); player.sendMessage(F.main(getName(), ChatColor.GRAY + "Max--------" + ChatColor.YELLOW + (Runtime.getRuntime().maxMemory() / 1048576)) + "MB");
} }
// I'm so sorry. Blame ServerMonitor for being so strict
public void setFakeTps(boolean fakeTps)
{
this._fakeTps = fakeTps;
}
} }

View File

@ -126,7 +126,7 @@ public class ExclusivePreferencesPage extends ShopPageBase<PreferencesManager, E
buildPreference(indices[0], Material.NETHER_STAR, "Hub Invisibility", userPreferences.Invisibility, _toggleHubInvisibility); buildPreference(indices[0], Material.NETHER_STAR, "Hub Invisibility", userPreferences.Invisibility, _toggleHubInvisibility);
buildPreference(indices[1], Material.SLIME_BALL, "Hub Forcefield", userPreferences.HubForcefield, _toggleHubForcefield); buildPreference(indices[1], Material.SLIME_BALL, "Hub Forcefield", userPreferences.HubForcefield, _toggleHubForcefield);
buildPreference(indices[2], Material.PAPER, "GWEN Reports", userPreferences.ShowMacReports, _toggleMacReports); buildPreference(indices[2], Material.PAPER, "Global GWEN Reports", userPreferences.ShowMacReports, _toggleMacReports);
buildPreference(indices[3], Material.SADDLE, "Hub Ignore Velocity", userPreferences.IgnoreVelocity, _toggleHubIgnoreVelocity); buildPreference(indices[3], Material.SADDLE, "Hub Ignore Velocity", userPreferences.IgnoreVelocity, _toggleHubIgnoreVelocity);
buildPreference(indices[4], Material.BOOK, "User Reports", userPreferences.ShowUserReports, _toggleUserReports); buildPreference(indices[4], Material.BOOK, "User Reports", userPreferences.ShowUserReports, _toggleUserReports);
} }
@ -134,7 +134,7 @@ public class ExclusivePreferencesPage extends ShopPageBase<PreferencesManager, E
{ {
int[] indices = UtilUI.getIndicesFor(3, 0, 2); int[] indices = UtilUI.getIndicesFor(3, 0, 2);
buildPreference(indices[0], Material.PAPER, "GWEN Reports", userPreferences.ShowMacReports, _toggleMacReports); buildPreference(indices[0], Material.PAPER, "Global GWEN Reports", userPreferences.ShowMacReports, _toggleMacReports);
buildPreference(indices[1], Material.SADDLE, "Hub Ignore Velocity", userPreferences.IgnoreVelocity, _toggleHubIgnoreVelocity); buildPreference(indices[1], Material.SADDLE, "Hub Ignore Velocity", userPreferences.IgnoreVelocity, _toggleHubIgnoreVelocity);
buildPreference(indices[2], Material.BOOK, "User Reports", userPreferences.ShowUserReports, _toggleUserReports); buildPreference(indices[2], Material.BOOK, "User Reports", userPreferences.ShowUserReports, _toggleUserReports);
} }
@ -142,7 +142,7 @@ public class ExclusivePreferencesPage extends ShopPageBase<PreferencesManager, E
{ {
int[] indices = UtilUI.getIndicesFor(3, 0, 2); int[] indices = UtilUI.getIndicesFor(3, 0, 2);
buildPreference(indices[0], Material.PAPER, "GWEN Reports", userPreferences.ShowMacReports, _toggleMacReports); buildPreference(indices[0], Material.PAPER, "Global GWEN Reports", userPreferences.ShowMacReports, _toggleMacReports);
buildPreference(indices[1], Material.SADDLE, "Hub Ignore Velocity", userPreferences.IgnoreVelocity, _toggleHubIgnoreVelocity); buildPreference(indices[1], Material.SADDLE, "Hub Ignore Velocity", userPreferences.IgnoreVelocity, _toggleHubIgnoreVelocity);
buildPreference(indices[2], Material.BOOK, "User Reports", userPreferences.ShowUserReports, _toggleUserReports); buildPreference(indices[2], Material.BOOK, "User Reports", userPreferences.ShowUserReports, _toggleUserReports);
} }
@ -150,7 +150,7 @@ public class ExclusivePreferencesPage extends ShopPageBase<PreferencesManager, E
{ {
int[] indices = UtilUI.getIndicesFor(1, 0, 2); int[] indices = UtilUI.getIndicesFor(1, 0, 2);
buildPreference(indices[0], Material.PAPER, "GWEN Reports", userPreferences.ShowMacReports, _toggleMacReports); buildPreference(indices[0], Material.PAPER, "Global GWEN Reports", userPreferences.ShowMacReports, _toggleMacReports);
} }
else if (rank == Rank.YOUTUBE || rank == Rank.TWITCH) else if (rank == Rank.YOUTUBE || rank == Rank.TWITCH)
{ {

View File

@ -77,6 +77,8 @@ public class Clans extends JavaPlugin
@Override @Override
public void onEnable() public void onEnable()
{ {
Bukkit.setSpawnRadius(0);
// Configs // Configs
getConfig().addDefault(WEB_CONFIG, "http://accounts.mineplex.com/"); getConfig().addDefault(WEB_CONFIG, "http://accounts.mineplex.com/");
getConfig().set(WEB_CONFIG, getConfig().getString(WEB_CONFIG)); getConfig().set(WEB_CONFIG, getConfig().getString(WEB_CONFIG));
@ -130,7 +132,7 @@ public class Clans extends JavaPlugin
AntiHack antiHack = require(AntiHack.class); AntiHack antiHack = require(AntiHack.class);
antiHack.setKick(false); antiHack.setKick(false);
antiHack.enableNewAnticheat(); Bukkit.getScheduler().runTask(this, antiHack::enableNewAnticheat);
{ {
// West Shop // West Shop

View File

@ -545,14 +545,20 @@ public class DamageManager extends MiniPlugin
origin = event.GetDamagerEntity(true).getLocation(); origin = event.GetDamagerEntity(true).getLocation();
if (event.getKnockbackOrigin() != null) if (event.getKnockbackOrigin() != null)
origin = event.getKnockbackOrigin(); origin = event.getKnockbackOrigin();
else if (event.GetProjectile() != null)
origin = event.GetProjectile().getLocation();
//Vec //Vec
Vector trajectory = UtilAlg.getTrajectory2d(origin, event.GetDamageeEntity().getLocation()); Vector trajectory = UtilAlg.getTrajectory2d(origin, event.GetDamageeEntity().getLocation());
trajectory.multiply(0.6 * knockback); trajectory.multiply(0.6 * knockback);
trajectory.setY(Math.abs(trajectory.getY())); trajectory.setY(Math.abs(trajectory.getY()));
if (event.GetProjectile() != null && event.getKnockbackOrigin() == null)
{
trajectory = event.GetProjectile().getVelocity();
trajectory.setY(0);
trajectory.multiply(0.37 * knockback / trajectory.length());
trajectory.setY(0.06);
}
//Apply //Apply
double vel = 0.2 + trajectory.length() * 0.8; double vel = 0.2 + trajectory.length() * 0.8;

View File

@ -4,11 +4,9 @@ import java.io.File;
import java.util.HashMap; import java.util.HashMap;
import mineplex.core.Managers; import mineplex.core.Managers;
import mineplex.core.antihack.AntiHackGuardian;
import mineplex.core.boosters.BoosterManager; import mineplex.core.boosters.BoosterManager;
import mineplex.core.thank.ThankManager; import mineplex.core.thank.ThankManager;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
@ -144,11 +142,6 @@ public class Arcade extends JavaPlugin
AntiHack antiHack = require(AntiHack.class); AntiHack antiHack = require(AntiHack.class);
antiHack.setKick(false); antiHack.setKick(false);
for (int i = 0; i < 10; i++)
{
antiHack.registerGuardian(new AntiHackGuardian(new Location(Bukkit.getWorld("world"), 0, 125, 0), 23, -23, 130, 120, 23, -23));
}
IgnoreManager ignoreManager = new IgnoreManager(this, _clientManager, preferenceManager, portal); IgnoreManager ignoreManager = new IgnoreManager(this, _clientManager, preferenceManager, portal);
StatsManager statsManager = new StatsManager(this, _clientManager); StatsManager statsManager = new StatsManager(this, _clientManager);
EloManager eloManager = new EloManager(this, _clientManager); EloManager eloManager = new EloManager(this, _clientManager);

View File

@ -5,8 +5,6 @@ import mineplex.core.MiniPlugin;
import mineplex.core.account.CoreClient; import mineplex.core.account.CoreClient;
import mineplex.core.account.CoreClientManager; import mineplex.core.account.CoreClientManager;
import mineplex.core.achievement.AchievementManager; import mineplex.core.achievement.AchievementManager;
import mineplex.core.antihack.AntiHack;
import mineplex.core.antihack.AntiHackGuardian;
import mineplex.core.blockrestore.BlockRestore; import mineplex.core.blockrestore.BlockRestore;
import mineplex.core.blood.Blood; import mineplex.core.blood.Blood;
import mineplex.core.bonuses.BonusManager; import mineplex.core.bonuses.BonusManager;
@ -99,8 +97,6 @@ import nautilus.game.arcade.shop.ArcadeShop;
import net.minecraft.server.v1_8_R3.EntityLiving; import net.minecraft.server.v1_8_R3.EntityLiving;
import org.bukkit.*; import org.bukkit.*;
import org.bukkit.GameMode; import org.bukkit.GameMode;
import org.bukkit.Material;
import org.bukkit.OfflinePlayer;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
@ -1948,37 +1944,6 @@ public class ArcadeManager extends MiniPlugin implements IRelation
} }
} }
@EventHandler
public void spawnGuardians(GameStateChangeEvent event)
{
if (event.GetState() == GameState.Live)
{
require(AntiHack.class).clearGuardians();
Location specLocation = GetGame().GetSpectatorLocation().add(0, 5, 0);
int maxX = (int) (specLocation.getX() + 50);
int minX = (int) (specLocation.getX() - 50);
int maxY = (int) (specLocation.getY() + 5);
int minY = (int) (specLocation.getY() - 5);
int maxZ = (int) (specLocation.getZ() + 50);
int minZ = (int) (specLocation.getZ() - 50);
for (int i = 0; i < 10; i++)
{
require(AntiHack.class).registerGuardian(new AntiHackGuardian(specLocation, maxX, minX, maxY, minY, maxZ, minZ));
}
}
else if (event.GetState() == GameState.Recruit)
{
require(AntiHack.class).clearGuardians();
for (int i = 0; i < 10; i++)
{
require(AntiHack.class).registerGuardian(new AntiHackGuardian(new Location(Bukkit.getWorld("world"), 0, 125, 0), 23, -23, 130, 120, 23, -23));
}
}
}
public ProgressingKitManager getProgressionKitManager() public ProgressingKitManager getProgressionKitManager()
{ {
return _progressionKitManager; return _progressionKitManager;

View File

@ -49,6 +49,7 @@ import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.gadget.set.SetCandyCane;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTime;
@ -444,6 +445,11 @@ public class CastleSiege extends TeamGame
if (!Recharge.Instance.use(damager, "Damage King", 400, false, false)) if (!Recharge.Instance.use(damager, "Damage King", 400, false, false))
return; return;
if (!IsAlive(damager))
{
return;
}
_king.playEffect(EntityEffect.HURT); _king.playEffect(EntityEffect.HURT);
_kingDamager = damager; _kingDamager = damager;
@ -583,7 +589,7 @@ public class CastleSiege extends TeamGame
if (!IsLive()) if (!IsLive())
return; return;
if (this.WorldTimeSet > 24100) if (this.WorldTimeSet > 24100 || GetTeam(ChatColor.RED).GetSize() == 0)
{ {
SetCustomWinLine(_kingName + ChatColor.RESET + " has survived the siege!"); SetCustomWinLine(_kingName + ChatColor.RESET + " has survived the siege!");
@ -607,7 +613,7 @@ public class CastleSiege extends TeamGame
SetState(GameState.End); SetState(GameState.End);
} }
if (!_king.isValid()) if (!_king.isValid() || GetTeam(ChatColor.AQUA).GetSize() == 0)
{ {
if (_kingDamager != null) if (_kingDamager != null)
{ {

View File

@ -111,7 +111,7 @@ public class Draw extends SoloGame
{ {
"Take turns to draw something", "Take turns to draw something",
"Right-Click with items to draw", "Right-Click with items to draw",
"Hints are given at top of screen", "Hints are given at the bottom of screen",
}); });
StrictAntiHack = true; StrictAntiHack = true;

View File

@ -1339,6 +1339,11 @@ public class HideSeek extends TeamGame
if (UtilBlock.usable(event.getClickedBlock())) if (UtilBlock.usable(event.getClickedBlock()))
event.setCancelled(true); event.setCancelled(true);
if (event.getClickedBlock().getType() == Material.WOODEN_DOOR)
{
event.setCancelled(false);
}
} }
public GameTeam getHiders() public GameTeam getHiders()

View File

@ -1043,6 +1043,11 @@ public class Minestrike extends TeamGame
if (GetState() == GameState.Recruit || GetState() == GameState.Loading) if (GetState() == GameState.Recruit || GetState() == GameState.Loading)
return; return;
if (Manager.isVanished(event.getPlayer()))
{
return;
}
//Target Team //Target Team
GameTeam targetTeam = null; GameTeam targetTeam = null;
if (GetTeamList().get(0).GetPlayers(false).size() < GetTeamList().get(1).GetPlayers(false).size()) if (GetTeamList().get(0).GetPlayers(false).size() < GetTeamList().get(1).GetPlayers(false).size())

View File

@ -76,8 +76,8 @@ public class KitPig extends SmashKit
private static final ItemStack[] PLAYER_ARMOR = { private static final ItemStack[] PLAYER_ARMOR = {
ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS), ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS),
ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE),
ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS), ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS),
ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE),
null, null,
}; };

View File

@ -67,10 +67,10 @@ public class KitWitherSkeleton extends SmashKit
private static final ItemStack[] PLAYER_ARMOR = { private static final ItemStack[] PLAYER_ARMOR = {
ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET), ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS),
ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE),
ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS), ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS),
ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS) ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE),
ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET)
}; };

View File

@ -36,6 +36,7 @@ import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.entity.EntityShootBowEvent; import org.bukkit.event.entity.EntityShootBowEvent;
import org.bukkit.event.entity.ExplosionPrimeEvent; import org.bukkit.event.entity.ExplosionPrimeEvent;
import org.bukkit.event.entity.ItemSpawnEvent; import org.bukkit.event.entity.ItemSpawnEvent;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.ProjectileHitEvent; import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.event.hanging.HangingBreakEvent; import org.bukkit.event.hanging.HangingBreakEvent;
@ -1267,6 +1268,15 @@ public abstract class SurvivalGames extends Game
return sides >= 3; return sides >= 3;
} }
@EventHandler
public void borderSpecInteraction(EntityDamageByEntityEvent event)
{
if (event.getEntity() instanceof Fireball && UtilPlayer.isSpectator(event.getDamager()))
{
event.setCancelled(true);
}
}
@EventHandler @EventHandler
public void borderDamage(CustomDamageEvent event) public void borderDamage(CustomDamageEvent event)
{ {

View File

@ -715,19 +715,6 @@ public class UHC extends TeamGame implements NCPHook
} }
} }
@EventHandler
public void toggleFakeTps(GameStateChangeEvent event)
{
if (event.GetState() != GameState.Dead)
{
Managers.get(LagMeter.class).setFakeTps(true);
}
else
{
Managers.get(LagMeter.class).setFakeTps(false);
}
}
@EventHandler @EventHandler
public void generateWorld(GameStateChangeEvent event) public void generateWorld(GameStateChangeEvent event)
{ {

View File

@ -271,13 +271,6 @@ public class WitherGame extends TeamGame implements IBlockRestorer
return; return;
} }
if(event.getBlock().getLocation().getBlockY() < _maxY - 4)
{
event.getPlayer().sendMessage(F.main("BlockChecker", "You may not build under this height!"));
event.setCancelled(true);
return;
}
_locationsOfBlocks.add(event.getBlock().getLocation()); _locationsOfBlocks.add(event.getBlock().getLocation());
} }

View File

@ -17,15 +17,17 @@ import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTime;
import mineplex.core.recharge.Recharge; import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.games.smash.TeamSuperSmash;
import nautilus.game.arcade.kit.SmashPerk; import nautilus.game.arcade.kit.SmashPerk;
import nautilus.game.arcade.kit.perks.data.FireflyData; import nautilus.game.arcade.kit.perks.data.FireflyData;
@ -170,6 +172,11 @@ public class PerkFirefly extends SmashPerk
if (event.GetDamage() <= 4) if (event.GetDamage() <= 4)
return; return;
if (!(event.GetDamagerEntity(true) instanceof Player))
{
return;
}
Iterator<FireflyData> dataIterator = _data.iterator(); Iterator<FireflyData> dataIterator = _data.iterator();
while (dataIterator.hasNext()) while (dataIterator.hasNext())
@ -181,6 +188,17 @@ public class PerkFirefly extends SmashPerk
if (!UtilTime.elapsed(data.Time, 1250) && !isSuperActive(data.Player))// && event.GetCause() == DamageCause.PROJECTILE) if (!UtilTime.elapsed(data.Time, 1250) && !isSuperActive(data.Player))// && event.GetCause() == DamageCause.PROJECTILE)
{ {
Game game = Manager.GetGame();
if (game instanceof TeamSuperSmash)
{
if (game.GetTeam(data.Player).equals(game.GetTeam(event.GetDamagerPlayer(true))))
{
event.SetCancelled("Team Damage");
return;
}
}
dataIterator.remove(); dataIterator.remove();
} }
else else

View File

@ -427,6 +427,13 @@ public class GameHostManager implements Listener
} }
msg = msg.trim(); msg = msg.trim();
msg = Manager.GetChat().getFilteredMessage(event.getPlayer(), msg);
if (msg == null)
{
return;
}
Bukkit.broadcastMessage(C.cDGreen + C.Bold + event.getPlayer().getName() + " " + C.cGreen + msg); Bukkit.broadcastMessage(C.cDGreen + C.Bold + event.getPlayer().getName() + " " + C.cGreen + msg);
} }
@ -678,10 +685,11 @@ public class GameHostManager implements Listener
} }
UtilPlayer.message(player, F.main("Server", "Your Co-Host privileges were removed.")); UtilPlayer.message(player, F.main("Server", "Your Co-Host privileges were removed."));
player.setGameMode(GameMode.SURVIVAL);
if (isEventServer()) if (isEventServer())
{
player.setGameMode(GameMode.SURVIVAL);
worldeditPermissionSet(player, false); worldeditPermissionSet(player, false);
}
} }
} }