QA changes

This commit is contained in:
Sam 2016-11-18 21:32:02 +00:00
parent 0ca79f193f
commit 92ed095e92
6 changed files with 94 additions and 40 deletions

View File

@ -358,6 +358,8 @@ public abstract class Game implements Listener
// Used for "%player% is your teammate" // Used for "%player% is your teammate"
public boolean ShowTeammateMessage = false; public boolean ShowTeammateMessage = false;
public boolean ShowEveryoneSpecChat = true;
public boolean ForceTeamSize = true; public boolean ForceTeamSize = true;
public int PlayersPerTeam = 2; public int PlayersPerTeam = 2;

View File

@ -23,6 +23,7 @@ import org.bukkit.World;
import org.bukkit.World.Environment; import org.bukkit.World.Environment;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
import org.bukkit.block.Chest;
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
import org.bukkit.craftbukkit.v1_8_R3.util.CraftMagicNumbers; import org.bukkit.craftbukkit.v1_8_R3.util.CraftMagicNumbers;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
@ -49,6 +50,7 @@ import org.bukkit.event.player.PlayerPortalEvent;
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
import org.bukkit.event.world.ChunkUnloadEvent; import org.bukkit.event.world.ChunkUnloadEvent;
import org.bukkit.inventory.CraftingInventory; import org.bukkit.inventory.CraftingInventory;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.ShapelessRecipe; import org.bukkit.inventory.ShapelessRecipe;
import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffect;
@ -96,7 +98,6 @@ import nautilus.game.arcade.game.modules.OreVeinEditorModule;
import nautilus.game.arcade.game.modules.PlayerHeadModule; import nautilus.game.arcade.game.modules.PlayerHeadModule;
import nautilus.game.arcade.game.modules.RejoinModule; import nautilus.game.arcade.game.modules.RejoinModule;
import nautilus.game.arcade.game.modules.RejoinModule.RejoinPlayerData; import nautilus.game.arcade.game.modules.RejoinModule.RejoinPlayerData;
import nautilus.game.arcade.game.modules.SafezoneModule;
import nautilus.game.arcade.game.modules.combatlog.CombatLogModule; import nautilus.game.arcade.game.modules.combatlog.CombatLogModule;
import nautilus.game.arcade.game.modules.combatlog.CombatLogNPC; import nautilus.game.arcade.game.modules.combatlog.CombatLogNPC;
import nautilus.game.arcade.game.modules.combatlog.CombatLogNPCExpiredEvent; import nautilus.game.arcade.game.modules.combatlog.CombatLogNPCExpiredEvent;
@ -138,7 +139,7 @@ public abstract class UHC extends Game
public static final int PRE_DEATHMATCH_TIME_SECONDS = 11; public static final int PRE_DEATHMATCH_TIME_SECONDS = 11;
// The amount of damage to give from hitting the world border // The amount of damage to give from hitting the world border
public static final int WORLD_BORDER_DAMAGE = 5; public static final int WORLD_BORDER_DAMAGE = 2;
// The amount of damage to give from hitting the world border // The amount of damage to give from hitting the world border
public static final int WORLD_BORDER_TIME = 5; public static final int WORLD_BORDER_TIME = 5;
@ -200,12 +201,10 @@ public abstract class UHC extends Game
StrictAntiHack = true; StrictAntiHack = true;
GameTimeout = 10800000; GameTimeout = TimeUnit.HOURS.toMillis(2);
DamagePvP = false; DamagePvP = false;
DeathDropItems = true;
ItemDrop = true; ItemDrop = true;
ItemPickup = true; ItemPickup = true;
@ -218,7 +217,7 @@ public abstract class UHC extends Game
DeathOut = true; DeathOut = true;
QuitOut = false; QuitOut = false;
CreatureAllow = true; CreatureAllow = true;
AnnounceStay = false; AnnounceStay = false;
@ -247,6 +246,8 @@ public abstract class UHC extends Game
WorldBoneMeal = true; WorldBoneMeal = true;
WorldChunkUnload = true; WorldChunkUnload = true;
ShowEveryoneSpecChat = false;
CraftRecipes(); CraftRecipes();
// Disable Custom Mob Drops (and EXP Disable) // Disable Custom Mob Drops (and EXP Disable)
@ -268,7 +269,6 @@ public abstract class UHC extends Game
_freezer = new UHCFreezer(this); _freezer = new UHCFreezer(this);
new PlayerHeadModule().register(this); new PlayerHeadModule().register(this);
new SafezoneModule().filter(location -> location.getX() <= SAFE_REGION && location.getX() >= -SAFE_REGION && location.getZ() <= SAFE_REGION && location.getZ() >= -SAFE_REGION).register(this);
new CompassModule().setGiveCompass(false).register(this); new CompassModule().setGiveCompass(false).register(this);
new OreVeinEditorModule().removeNonAirVeins().register(this); new OreVeinEditorModule().removeNonAirVeins().register(this);
new AntiExpOrbModule().register(this); new AntiExpOrbModule().register(this);
@ -667,7 +667,7 @@ public abstract class UHC extends Game
if (IsAlive(player)) if (IsAlive(player))
{ {
Manager.GetDamage().NewDamageEvent(player, null, null, DamageCause.CUSTOM, WORLD_BORDER_DAMAGE, false, false, false, "Nether Field", "Vaporize"); Manager.GetDamage().NewDamageEvent(player, null, null, DamageCause.CUSTOM, WORLD_BORDER_DAMAGE, false, false, true, "Nether Field", "Vaporize");
player.getWorld().playSound(loc, Sound.NOTE_BASS, 2f, 1f); player.getWorld().playSound(loc, Sound.NOTE_BASS, 2f, 1f);
player.getWorld().playSound(loc, Sound.NOTE_BASS, 2f, 1f); player.getWorld().playSound(loc, Sound.NOTE_BASS, 2f, 1f);
@ -879,8 +879,6 @@ public abstract class UHC extends Game
// Toggle temporary game settings // Toggle temporary game settings
Damage = true; Damage = true;
getModule(SafezoneModule.class).filter(location -> location.getX() <= DEATHMATCH_ARENA_SIZE && location.getX() >= -DEATHMATCH_ARENA_SIZE && location.getZ() <= DEATHMATCH_ARENA_SIZE&& location.getZ() >= -DEATHMATCH_ARENA_SIZE);
// Set the border // Set the border
_border.setSize(0, DEATHMATCH_TIME_SECONDS); _border.setSize(0, DEATHMATCH_TIME_SECONDS);
@ -1039,11 +1037,7 @@ public abstract class UHC extends Game
return; return;
} }
if (isSpeedMode()) if (!isSpeedMode())
{
_border.setSize(MAX_ARENA_SIZE / 2, MINING_TIME / 1000);
}
else
{ {
_border.setSize(0, MINING_TIME / 1000); _border.setSize(0, MINING_TIME / 1000);
} }
@ -1300,7 +1294,7 @@ public abstract class UHC extends Game
} }
} }
@EventHandler @EventHandler(priority = EventPriority.HIGHEST)
public void PlayerDeath(PlayerDeathEvent event) public void PlayerDeath(PlayerDeathEvent event)
{ {
Player player = event.getEntity(); Player player = event.getEntity();
@ -1319,6 +1313,21 @@ public abstract class UHC extends Game
{ {
long timeAlive = System.currentTimeMillis() - GetStateTime(); long timeAlive = System.currentTimeMillis() - GetStateTime();
AddGems(player, timeAlive / 60000d, "Survived " + UtilTime.MakeStr(timeAlive), false, false); AddGems(player, timeAlive / 60000d, "Survived " + UtilTime.MakeStr(timeAlive), false, false);
// Place their items in a chest
Block block = player.getLocation().getBlock();
block.setType(Material.CHEST);
block.getRelative(BlockFace.NORTH).setType(Material.CHEST);
Chest chest = (Chest) block.getState();
Inventory inventory = chest.getInventory();
int i = 0;
for (ItemStack itemStack : event.getDrops())
{
inventory.setItem(i++, itemStack);
}
} }
} }

View File

@ -34,7 +34,8 @@ public class UHCSpeedMode implements Listener
new ItemStack(Material.STONE_PICKAXE), new ItemStack(Material.STONE_PICKAXE),
new ItemStack(Material.STONE_AXE), new ItemStack(Material.STONE_AXE),
new ItemStack(Material.STONE_SPADE), new ItemStack(Material.STONE_SPADE),
new ItemStack(Material.APPLE, 3), new ItemStack(Material.COOKED_BEEF, 10),
new ItemStack(Material.WOOD, 32)
}; };
private UHC _host; private UHC _host;

View File

@ -5,7 +5,6 @@ import java.util.Iterator;
import java.util.Set; import java.util.Set;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
@ -18,6 +17,7 @@ import mineplex.core.common.Rank;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTime;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
@ -64,6 +64,7 @@ public class RejoinModule extends Module
} }
caller.sendMessage(F.main("Debug", C.cYellow + player + C.cGray + " is now allowed to rejoin. If they are online tell them to relog.")); caller.sendMessage(F.main("Debug", C.cYellow + player + C.cGray + " is now allowed to rejoin. If they are online tell them to relog."));
caller.sendMessage(F.main("Debug", "There are issues with this and it should not be used outside of the testing environment!"));
} }
}); });
} }
@ -111,7 +112,7 @@ public class RejoinModule extends Module
team.RemovePlayer(player); team.RemovePlayer(player);
// Announcement // Announcement
getGame().Announce(team.GetColor() + C.Bold + player.getName() + " has disconnected! " + UtilTime.MakeStr(_rejoinTime) + " minutes to rejoin.", false); getGame().Announce(team.GetColor() + C.Bold + player.getName() + " has disconnected! " + UtilTime.MakeStr(_rejoinTime) + " to rejoin.", false);
} }
@EventHandler(priority = EventPriority.LOWEST) @EventHandler(priority = EventPriority.LOWEST)
@ -124,13 +125,20 @@ public class RejoinModule extends Module
Player player = event.getPlayer(); Player player = event.getPlayer();
RejoinPlayerData data = getRejoinPlayerData(player.getName()); RejoinPlayerData data = getRejoinPlayerData(player.getName());
GameTeam team = data.getTeam();
if (data == null)
if (data.getTeam() == null)
{ {
return; return;
} }
GameTeam team = data.getTeam();
// Assume they have been revived
if (data.getTeam() == null)
{
team = UtilAlg.Random(getGame().GetTeamList());
}
team.AddPlayer(player, true); team.AddPlayer(player, true);
getGame().Announce(team.GetColor() + C.Bold + event.getPlayer().getName() + " has reconnected!", false); getGame().Announce(team.GetColor() + C.Bold + event.getPlayer().getName() + " has reconnected!", false);
@ -138,6 +146,8 @@ public class RejoinModule extends Module
{ {
getGame().SetKit(player, data.getKit(), false); getGame().SetKit(player, data.getKit(), false);
} }
_data.remove(data);
} }
// Do this on Join, not Login, otherwise player no get heal. // Do this on Join, not Login, otherwise player no get heal.
@ -160,6 +170,14 @@ public class RejoinModule extends Module
getGame().Manager.runSyncLater(() -> { getGame().Manager.runSyncLater(() -> {
player.setHealth(health); player.setHealth(health);
NautHashMap<String, Location> location = getGame().GetLocationStore();
if (location.containsKey(player.getName()))
{
player.teleport(location.get(player.getName()));
}
}, 1L); }, 1L);
} }

View File

@ -146,7 +146,7 @@ public class SafezoneModule extends Module
{ {
if (isInSafeZone(event.getBlock().getLocation())) if (isInSafeZone(event.getBlock().getLocation()))
{ {
UtilPlayer.message(event.getPlayer(), F.main("Game", "You cannot build this high near center of map.")); UtilPlayer.message(event.getPlayer(), F.main("Game", "You cannot build in this area!"));
event.setCancelled(true); event.setCancelled(true);
} }
} }

View File

@ -1,15 +1,12 @@
package nautilus.game.arcade.managers.chat; package nautilus.game.arcade.managers.chat;
import mineplex.core.common.Rank; import java.text.DecimalFormat;
import mineplex.core.common.jsonchat.JsonMessage; import java.util.AbstractMap;
import mineplex.core.common.util.C; import java.util.Collection;
import mineplex.core.common.util.F; import java.util.Iterator;
import mineplex.core.common.util.UtilPlayer; import java.util.LinkedList;
import mineplex.core.party.Party; import java.util.Map;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.GameTeam;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -19,13 +16,17 @@ import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.jooq.tools.json.JSONObject; import org.jooq.tools.json.JSONObject;
import java.text.DecimalFormat; import mineplex.core.common.Rank;
import java.util.AbstractMap; import mineplex.core.common.jsonchat.JsonMessage;
import java.util.Collection; import mineplex.core.common.util.C;
import java.util.Iterator; import mineplex.core.common.util.F;
import java.util.LinkedList; import mineplex.core.common.util.UtilPlayer;
import java.util.Map; import mineplex.core.party.Party;
import java.util.UUID;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.GameTeam;
public class GameChatManager implements Listener public class GameChatManager implements Listener
{ {
@ -208,6 +209,29 @@ public class GameChatManager implements Listener
if (globalMessage) if (globalMessage)
{ {
if (!_manager.GetGame().ShowEveryoneSpecChat)
{
//Team Message Remove Recipient
Iterator<Player> recipientIterator = event.getRecipients().iterator();
while (recipientIterator.hasNext())
{
Player receiver = recipientIterator.next();
if (_manager.IsAlive(sender) || _manager.GetClients().Get(sender).GetRank().has(Rank.HELPER))
{
continue;
}
if (!_manager.IsAlive(receiver) || _manager.GetClients().Get(receiver).GetRank().has(Rank.MODERATOR))
{
continue;
}
recipientIterator.remove();
}
}
if(safeSend(sender, format, rankStr, rank, name, message, event.getRecipients())) if(safeSend(sender, format, rankStr, rank, name, message, event.getRecipients()))
{ {
event.setCancelled(true); event.setCancelled(true);