Merge branch 'master' of ssh://184.154.0.242:7999/min/Mineplex
This commit is contained in:
commit
504d23ba06
@ -7,9 +7,14 @@ import java.util.List;
|
||||
import net.minecraft.server.v1_7_R4.EntityBat;
|
||||
import net.minecraft.server.v1_7_R4.EntityCreature;
|
||||
import net.minecraft.server.v1_7_R4.EntityEnderDragon;
|
||||
import net.minecraft.server.v1_7_R4.EntityHuman;
|
||||
import net.minecraft.server.v1_7_R4.EntityInsentient;
|
||||
import net.minecraft.server.v1_7_R4.EntityLiving;
|
||||
import net.minecraft.server.v1_7_R4.Navigation;
|
||||
import net.minecraft.server.v1_7_R4.PathfinderGoal;
|
||||
import net.minecraft.server.v1_7_R4.PathfinderGoalLookAtPlayer;
|
||||
import net.minecraft.server.v1_7_R4.PathfinderGoalMoveTowardsRestriction;
|
||||
import net.minecraft.server.v1_7_R4.PathfinderGoalRandomLookaround;
|
||||
import net.minecraft.server.v1_7_R4.PathfinderGoalSelector;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
@ -76,6 +81,47 @@ public class UtilEnt
|
||||
|
||||
leashed.setLeashHolder(holder);
|
||||
}
|
||||
|
||||
public static void addLookAtPlayerAI(Entity entity, float dist)
|
||||
{
|
||||
if (((CraftEntity) entity).getHandle() instanceof EntityInsentient)
|
||||
{
|
||||
addAI(entity, 7, new PathfinderGoalLookAtPlayer(((EntityInsentient) ((CraftEntity) entity).getHandle()), EntityHuman.class, dist));
|
||||
addAI(entity, 8, new PathfinderGoalRandomLookaround(((EntityInsentient) ((CraftEntity) entity).getHandle())));
|
||||
}
|
||||
}
|
||||
|
||||
public static void addAI(Entity entity, int value, PathfinderGoal ai)
|
||||
{
|
||||
if (((CraftEntity) entity).getHandle() instanceof EntityInsentient)
|
||||
{
|
||||
EntityInsentient ei = ((EntityInsentient) ((CraftEntity) entity).getHandle());
|
||||
|
||||
if (_goalSelector == null)
|
||||
{
|
||||
try
|
||||
{
|
||||
_goalSelector = EntityInsentient.class.getDeclaredField("goalSelector");
|
||||
}
|
||||
catch (NoSuchFieldException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
_goalSelector.setAccessible(true);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
((PathfinderGoalSelector) _goalSelector.get(ei)).a(value, ai);
|
||||
}
|
||||
catch (IllegalAccessException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void Vegetate(Entity entity)
|
||||
{
|
||||
|
@ -103,17 +103,17 @@ public abstract class MiniPlugin implements Listener
|
||||
System.out.println(F.main(_moduleName, message));
|
||||
}
|
||||
|
||||
protected void runAsync(Runnable runnable)
|
||||
public void runAsync(Runnable runnable)
|
||||
{
|
||||
_plugin.getServer().getScheduler().runTaskAsynchronously(_plugin, runnable);
|
||||
}
|
||||
|
||||
protected void runSync(Runnable runnable)
|
||||
public void runSync(Runnable runnable)
|
||||
{
|
||||
_plugin.getServer().getScheduler().runTask(_plugin, runnable);
|
||||
}
|
||||
|
||||
protected void runSyncLater(Runnable runnable, long delay)
|
||||
public void runSyncLater(Runnable runnable, long delay)
|
||||
{
|
||||
_plugin.getServer().getScheduler().runTaskLater(_plugin, runnable, delay);
|
||||
}
|
||||
|
@ -191,6 +191,13 @@ public enum Achievement
|
||||
new int[]{1},
|
||||
AchievementCategory.DRAW_MY_THING),
|
||||
|
||||
// Master Builders
|
||||
MASTER_BUILDER_WINS("Master Builder", 1000,
|
||||
new String[]{"Master Builders.Wins"},
|
||||
new String[]{"Win 30 games of Master Builders"},
|
||||
new int[]{30},
|
||||
AchievementCategory.MASTER_BUILDERS),
|
||||
|
||||
//Castle Siege
|
||||
CASTLE_SIEGE_WINS("FOR THE KING!", 600,
|
||||
new String[]{"Castle Siege.ForTheKing"},
|
||||
|
@ -12,136 +12,113 @@ import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.stats.PlayerStats;
|
||||
import mineplex.core.stats.StatsManager;
|
||||
|
||||
/**
|
||||
* Created by Shaun on 8/21/2014.
|
||||
* Edited by Chris on 9/13/2059.
|
||||
*/
|
||||
public enum AchievementCategory
|
||||
{
|
||||
GLOBAL("Global", null,
|
||||
new String[] { "GemsEarned", null, "GamesPlayed", "TimeInGame" },
|
||||
new String[] { "Gems Earned", null, "Games Played", "Time In Game" },
|
||||
new StatDisplay[] { StatDisplay.GEMS_EARNED, null, new StatDisplay("Games Played", "GamesPlayed"), StatDisplay.TIME_IN_GAME },
|
||||
Material.EMERALD, 0, GameCategory.GLOBAL, null),
|
||||
|
||||
//Survival
|
||||
BRIDGES("The Bridges", null,
|
||||
new String[] {"Wins", "Losses", "Kills", "Deaths", "GemsEarned"},
|
||||
new String[] { "Wins", "Losses", "Kills", "Deaths", "Gems Earned" },
|
||||
new StatDisplay[] { StatDisplay.WINS, StatDisplay.LOSSES, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
|
||||
Material.IRON_PICKAXE, 0, GameCategory.SURVIVAL, "Destructor Kit"),
|
||||
|
||||
SURVIVAL_GAMES("Survival Games", null,
|
||||
new String[] { "Wins", "Losses", "Kills", "Deaths", "GemsEarned" },
|
||||
new String[] { "Wins", "Losses", "Kills", "Deaths", "Gems Earned" },
|
||||
Material.IRON_SWORD, 0, GameCategory.SURVIVAL, "Horseman Kit"),
|
||||
new StatDisplay[] { StatDisplay.WINS, StatDisplay.LOSSES, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
|
||||
Material.DIAMOND_SWORD, 0, GameCategory.SURVIVAL, "Horseman Kit"),
|
||||
|
||||
MINE_STRIKE("MineStrike", null,
|
||||
new StatDisplay[] { StatDisplay.WINS, StatDisplay.LOSSES, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
|
||||
Material.TNT, 0, GameCategory.CLASSICS, null),
|
||||
|
||||
WIZARDS("Wizards", null,
|
||||
new StatDisplay[] { StatDisplay.WINS, StatDisplay.LOSSES, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
|
||||
Material.BLAZE_ROD, 0, GameCategory.SURVIVAL, "Extra Class Skills"),
|
||||
|
||||
UHC("Ultra Hardcore", null,
|
||||
new String[] { "Wins", "Losses", "Kills", "Deaths", "GemsEarned" },
|
||||
new String[] { "Wins", "Losses", "Kills", "Deaths", "Gems Earned" },
|
||||
new StatDisplay[] { StatDisplay.WINS, StatDisplay.LOSSES, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
|
||||
Material.GOLD_INGOT, 0, GameCategory.SURVIVAL, "Extra Class Skills"),
|
||||
|
||||
WIZARDS("Wizards", null,
|
||||
new String[] { "Wins", "Losses", "Kills", "Deaths", "GemsEarned" },
|
||||
new String[] { "Wins", "Losses", "Kills", "Deaths", "Gems Earned" },
|
||||
Material.BLAZE_ROD, 0, GameCategory.SURVIVAL, "Extra Class Skills"),
|
||||
|
||||
MINE_STRIKE("MineStrike", null,
|
||||
new String[] {"Wins", "Losses", "Kills", "Deaths", "GemsEarned"},
|
||||
new String[] {"Wins", "Losses", "Kills", "Deaths", "Gems Earned"},
|
||||
Material.TNT, 0, GameCategory.CLASSICS, null),
|
||||
|
||||
//Classics
|
||||
SMASH_MOBS("Super Smash Mobs", null,
|
||||
new String[] { "Wins", "Losses", "Kills", "Deaths", "GemsEarned" },
|
||||
new String[] { "Wins", "Losses", "Kills", "Deaths", "Gems Earned" },
|
||||
new StatDisplay[] { StatDisplay.WINS, StatDisplay.LOSSES, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
|
||||
Material.SKULL_ITEM, 4, GameCategory.CLASSICS, "Sheep Kit"),
|
||||
|
||||
BLOCK_HUNT("Block Hunt", null,
|
||||
new String[] {"Wins", "Losses", "Kills", "Deaths", "GemsEarned"},
|
||||
new String[] {"Wins", "Losses", "Kills", "Deaths", "Gems Earned"},
|
||||
new StatDisplay[] { StatDisplay.WINS, StatDisplay.LOSSES, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
|
||||
Material.GRASS, 0, GameCategory.CLASSICS, null),
|
||||
|
||||
|
||||
MASTER_BUILDERS("Master Builders", null,
|
||||
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED_GAME, StatDisplay.GEMS_EARNED },
|
||||
Material.WOOD, 0, GameCategory.CLASSICS, null),
|
||||
|
||||
DRAW_MY_THING("Draw My Thing", null,
|
||||
new String[] {"Wins", "Losses", "GemsEarned"},
|
||||
new String[] {"Wins", "Losses", "GemsEarned"},
|
||||
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED_GAME, StatDisplay.GEMS_EARNED },
|
||||
Material.BOOK_AND_QUILL, 0, GameCategory.CLASSICS, null),
|
||||
|
||||
CASTLE_SIEGE("Castle Siege", null,
|
||||
new String[] {"Wins", "Losses", "Kills as Defenders", "Deaths as Defenders", "Kills as Undead", "Deaths as Undead", "GemsEarned"},
|
||||
new String[] {"Wins", "Losses", "Kills as Defenders", "Deaths as Defenders", "Kills as Undead", "Deaths as Undead", "Gems Earned"},
|
||||
new StatDisplay[] { StatDisplay.WINS, StatDisplay.LOSSES, new StatDisplay("Kills as Defenders"), new StatDisplay("Deaths as Defenders"),
|
||||
new StatDisplay("Kills as Undead"), new StatDisplay("Deaths as Undead"), StatDisplay.GEMS_EARNED },
|
||||
Material.DIAMOND_CHESTPLATE, 0, GameCategory.CLASSICS, null),
|
||||
|
||||
//Champions
|
||||
CHAMPIONS("Champions", new String[] {"Champions Domination", "Champions TDM"},
|
||||
new String[] {"Wins", "Losses", "Kills", "Deaths", "GemsEarned"},
|
||||
new String[] {"Wins", "Losses", "Kills", "Deaths", "Gems Earned"},
|
||||
new StatDisplay[] { StatDisplay.WINS, StatDisplay.LOSSES, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
|
||||
Material.BEACON, 0, GameCategory.CHAMPIONS, "Extra Class Skills"),
|
||||
|
||||
|
||||
|
||||
//Arcade
|
||||
DRAGONS("Dragons", null,
|
||||
new String[] {"Wins", "Losses", "GemsEarned"},
|
||||
new String[] {"Wins", "Losses", "Gems Earned"},
|
||||
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED_GAME, StatDisplay.GEMS_EARNED },
|
||||
Material.ENDER_STONE, 0, GameCategory.ARCADE, null),
|
||||
|
||||
DRAGON_ESCAPE("Dragon Escape", null,
|
||||
new String[] {"Wins", "Losses", "GemsEarned"},
|
||||
new String[] {"Wins", "Losses", "Gems Earned"},
|
||||
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED_GAME, StatDisplay.GEMS_EARNED },
|
||||
Material.DRAGON_EGG, 0, GameCategory.ARCADE, null),
|
||||
|
||||
SHEEP_QUEST("Sheep Quest", null,
|
||||
new String[] {"Wins", "Losses", "Kills", "Deaths", "GemsEarned"},
|
||||
new String[] {"Wins", "Losses", "Kills", "Deaths", "Gems Earned"},
|
||||
new StatDisplay[] { StatDisplay.WINS, StatDisplay.LOSSES, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
|
||||
Material.WOOL, 0, GameCategory.ARCADE, null),
|
||||
|
||||
SNEAKY_ASSASSINS("Sneaky Assassins", null,
|
||||
new String[] {"Wins", "Losses", "Kills", "Deaths", "GemsEarned"},
|
||||
new String[] {"Wins", "Losses", "Kills", "Deaths", "Gems Earned"},
|
||||
new StatDisplay[] { StatDisplay.WINS, StatDisplay.LOSSES, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
|
||||
Material.INK_SACK, 0, GameCategory.ARCADE, null),
|
||||
|
||||
ONE_IN_THE_QUIVER("One in the Quiver", null,
|
||||
new String[] {"Wins", "Losses", "Kills", "Deaths", "GemsEarned"},
|
||||
new String[] {"Wins", "Losses", "Kills", "Deaths", "Gems Earned"},
|
||||
new StatDisplay[] { StatDisplay.WINS, StatDisplay.LOSSES, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
|
||||
Material.BOW, 0, GameCategory.ARCADE, null),
|
||||
|
||||
SUPER_PAINTBALL("Super Paintball", null,
|
||||
new String[] {"Wins", "Losses", "Kills", "Deaths", "GemsEarned"},
|
||||
new String[] {"Wins", "Losses", "Kills", "Deaths", "Gems Earned"},
|
||||
new StatDisplay[] { StatDisplay.WINS, StatDisplay.LOSSES, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
|
||||
Material.ENDER_PEARL, 0, GameCategory.ARCADE, null),
|
||||
|
||||
TURF_WARS("Turf Wars", null,
|
||||
new String[] {"Wins", "Losses", "Kills", "Deaths", "GemsEarned"},
|
||||
new String[] {"Wins", "Losses", "Kills", "Deaths", "Gems Earned"},
|
||||
new StatDisplay[] { StatDisplay.WINS, StatDisplay.LOSSES, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
|
||||
Material.HARD_CLAY, 14, GameCategory.ARCADE, null),
|
||||
|
||||
RUNNER("Runner", null,
|
||||
new String[] {"Wins", "Losses", "Kills", "Deaths", "GemsEarned"},
|
||||
new String[] {"Wins", "Losses", "Kills", "Deaths", "Gems Earned"},
|
||||
new StatDisplay[] { StatDisplay.WINS, StatDisplay.LOSSES, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
|
||||
Material.LEATHER_BOOTS, 0, GameCategory.ARCADE, null),
|
||||
|
||||
SPLEEF("Super Spleef", null,
|
||||
new String[] {"Wins", "Losses", "Kills", "Deaths", "GemsEarned"},
|
||||
new String[] {"Wins", "Losses", "Kills", "Deaths", "Gems Earned"},
|
||||
new StatDisplay[] { StatDisplay.WINS, StatDisplay.LOSSES, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
|
||||
Material.IRON_SPADE, 0, GameCategory.ARCADE, null),
|
||||
|
||||
DEATH_TAG("Death Tag", null,
|
||||
new String[] {"Wins", "Losses", "Kills", "Deaths", "GemsEarned"},
|
||||
new String[] {"Wins", "Losses", "Kills", "Deaths", "Gems Earned"},
|
||||
new StatDisplay[] { StatDisplay.WINS, StatDisplay.LOSSES, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
|
||||
Material.SKULL_ITEM, 0, GameCategory.ARCADE, null),
|
||||
|
||||
SNAKE("Snake", null,
|
||||
new String[] {"Wins", "Losses", "Kills", "Deaths", "GemsEarned"},
|
||||
new String[] {"Wins", "Losses", "Kills", "Deaths", "Gems Earned"},
|
||||
new StatDisplay[] { StatDisplay.WINS, StatDisplay.LOSSES, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
|
||||
Material.WOOL, 4, GameCategory.ARCADE, null),
|
||||
|
||||
BACON_BRAWL("Bacon Brawl", null,
|
||||
new String[] {"Wins", "Losses", "Kills", "Deaths", "GemsEarned"},
|
||||
new String[] {"Wins", "Losses", "Kills", "Deaths", "Gems Earned"},
|
||||
new StatDisplay[] { StatDisplay.WINS, StatDisplay.LOSSES, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
|
||||
Material.PORK, 0, GameCategory.ARCADE, null),
|
||||
|
||||
MICRO_BATTLE("Micro Battle", null,
|
||||
new String[] {"Wins", "Losses", "Kills", "Deaths", "GemsEarned"},
|
||||
new String[] {"Wins", "Losses", "Kills", "Deaths", "Gems Earned"},
|
||||
new StatDisplay[] { StatDisplay.WINS, StatDisplay.LOSSES, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
|
||||
Material.LAVA, 0, GameCategory.ARCADE, null),
|
||||
|
||||
;
|
||||
@ -149,14 +126,13 @@ public enum AchievementCategory
|
||||
|
||||
private String _name;
|
||||
private String[] _statsToPull;
|
||||
private String[] _statsToDisplay;
|
||||
private String[] _friendlyStatNames;
|
||||
private StatDisplay[] _statDisplays;
|
||||
private Material _icon;
|
||||
private GameCategory _gameCategory;
|
||||
private byte _iconData;
|
||||
private String _kitReward;
|
||||
|
||||
AchievementCategory(String name, String[] statsToPull, String[] statsToDisplay, String[] friendlyStatNames, Material icon, int iconData, GameCategory gameCategory, String kitReward)
|
||||
AchievementCategory(String name, String[] statsToPull, StatDisplay[] statDisplays, Material icon, int iconData, GameCategory gameCategory, String kitReward)
|
||||
{
|
||||
_name = name;
|
||||
|
||||
@ -164,9 +140,7 @@ public enum AchievementCategory
|
||||
_statsToPull = statsToPull;
|
||||
else
|
||||
_statsToPull = new String[] {name};
|
||||
|
||||
_statsToDisplay = statsToDisplay;
|
||||
_friendlyStatNames = friendlyStatNames;
|
||||
_statDisplays = statDisplays;
|
||||
_icon = icon;
|
||||
_iconData = (byte)iconData;
|
||||
_gameCategory = gameCategory;
|
||||
@ -193,9 +167,9 @@ public enum AchievementCategory
|
||||
return _statsToPull;
|
||||
}
|
||||
|
||||
public String[] getStatsToDisplay()
|
||||
public StatDisplay[] getStatsToDisplay()
|
||||
{
|
||||
return _statsToDisplay;
|
||||
return _statDisplays;
|
||||
}
|
||||
|
||||
public byte getIconData()
|
||||
@ -208,11 +182,6 @@ public enum AchievementCategory
|
||||
return _gameCategory;
|
||||
}
|
||||
|
||||
public String[] getFriendlyStatNames()
|
||||
{
|
||||
return _friendlyStatNames;
|
||||
}
|
||||
|
||||
public void addStats(CoreClientManager clientManager, StatsManager statsManager, List<String> lore, Player player, Player target)
|
||||
{
|
||||
addStats(clientManager, statsManager, lore, Integer.MAX_VALUE, player, target);
|
||||
@ -221,29 +190,32 @@ public enum AchievementCategory
|
||||
public void addStats(CoreClientManager clientManager, StatsManager statsManager, List<String> lore, int max, Player player, Player target)
|
||||
{
|
||||
PlayerStats stats = statsManager.Get(target);
|
||||
for (int i = 0; i < _statsToDisplay.length && i < max; i++)
|
||||
for (int i = 0; i < _statDisplays.length && i < max; i++)
|
||||
{
|
||||
// If the stat is null then just display a blank line instead
|
||||
if (_statsToDisplay[i] == null || _friendlyStatNames[i] == null)
|
||||
if (_statDisplays[i] == null)
|
||||
{
|
||||
lore.add(" ");
|
||||
continue;
|
||||
}
|
||||
|
||||
String displayName = _statDisplays[i].getDisplayName();
|
||||
|
||||
// Skip showing Losses, Kills, Deaths for other players
|
||||
if (!clientManager.Get(player).GetRank().Has(Rank.MODERATOR) && !player.equals(target) && (_statsToDisplay[i].contains("Losses") || _statsToDisplay[i].contains("Kills") || _statsToDisplay[i].contains("Deaths") || _statsToDisplay[i].equals("Time In Game") || _statsToDisplay.equals("Games Played")))
|
||||
if (!clientManager.Get(player).GetRank().Has(Rank.MODERATOR) && !player.equals(target) && (displayName.contains("Losses") || displayName.contains("Kills") || displayName.contains("Deaths") || displayName.equals("Time In Game") || displayName.equals("Games Played")))
|
||||
continue;
|
||||
|
||||
int statNumber = 0;
|
||||
for (String statToPull : _statsToPull)
|
||||
statNumber += stats.getStat(statToPull + "." + _statsToDisplay[i]);
|
||||
for (String statName : _statDisplays[i].getStats())
|
||||
statNumber += stats.getStat(statToPull + "." + statName);
|
||||
|
||||
String statString = C.cWhite + statNumber;
|
||||
// Need to display special for time
|
||||
if (_statsToDisplay[i].equalsIgnoreCase("TimeInGame"))
|
||||
if (displayName.equalsIgnoreCase("Time In Game"))
|
||||
statString = C.cWhite + UtilTime.convertString(statNumber * 1000L, 0, UtilTime.TimeUnit.FIT);
|
||||
|
||||
lore.add(C.cYellow + _friendlyStatNames[i] + ": " + statString);
|
||||
lore.add(C.cYellow + displayName + ": " + statString);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,44 @@
|
||||
package mineplex.core.achievement;
|
||||
|
||||
/**
|
||||
* The purpose of extracting stats to this class is so we can display stats that are a combination
|
||||
* of different stat values. For example, since we don't have a specific stat for games played of a game,
|
||||
* we can use this class to display the stat "Games Played" that sums up "Wins" and "Losses"
|
||||
* See: StatDisplay.GAMES_PLAYED_GAME
|
||||
*/
|
||||
public class StatDisplay
|
||||
{
|
||||
public String _displayName;
|
||||
public String[] _stats;
|
||||
|
||||
public StatDisplay(String stat)
|
||||
{
|
||||
_displayName = stat;
|
||||
_stats = new String[] { stat };
|
||||
}
|
||||
|
||||
public StatDisplay(String displayName, String... stats)
|
||||
{
|
||||
_displayName = displayName;
|
||||
_stats = stats;
|
||||
}
|
||||
|
||||
public String getDisplayName()
|
||||
{
|
||||
return _displayName;
|
||||
}
|
||||
|
||||
public String[] getStats()
|
||||
{
|
||||
return _stats;
|
||||
}
|
||||
|
||||
public static final StatDisplay WINS = new StatDisplay("Wins");
|
||||
public static final StatDisplay LOSSES = new StatDisplay("Losses");
|
||||
public static final StatDisplay KILLS = new StatDisplay("Kills");
|
||||
public static final StatDisplay DEATHS = new StatDisplay("Deaths");
|
||||
public static final StatDisplay GEMS_EARNED = new StatDisplay("Gems Earned", "GemsEarned");
|
||||
public static final StatDisplay TIME_IN_GAME = new StatDisplay("Time In Game", "TimeInGame");
|
||||
public static final StatDisplay GAMES_PLAYED_GAME = new StatDisplay("Games Played", "Wins", "Losses");
|
||||
|
||||
}
|
@ -22,9 +22,6 @@ import mineplex.core.shop.item.ShopItem;
|
||||
import mineplex.core.shop.page.ShopPageBase;
|
||||
import mineplex.core.stats.StatsManager;
|
||||
|
||||
/**
|
||||
* Created by Shaun on 8/21/2014.
|
||||
*/
|
||||
public class AchievementMainPage extends ShopPageBase<AchievementManager, AchievementShop>
|
||||
{
|
||||
protected Player _target;
|
||||
@ -32,7 +29,7 @@ public class AchievementMainPage extends ShopPageBase<AchievementManager, Achiev
|
||||
|
||||
public AchievementMainPage(AchievementManager plugin, StatsManager statsManager, AchievementShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player, Player target)
|
||||
{
|
||||
super(plugin, shop, clientManager, donationManager, name, player);
|
||||
super(plugin, shop, clientManager, donationManager, name, player, 9 * 4);
|
||||
|
||||
_target = target;
|
||||
_statsManager = statsManager;
|
||||
@ -45,11 +42,9 @@ public class AchievementMainPage extends ShopPageBase<AchievementManager, Achiev
|
||||
{
|
||||
ArrayList<Integer> pageLayout = new ItemLayout(
|
||||
"XXXXOXXXX",
|
||||
"XXXXXXXXX",
|
||||
"OXOXOXOXO",
|
||||
"XXXXXXXXX",
|
||||
"OXOXOXOXO",
|
||||
"XXXXOXXXX").getItemSlots();
|
||||
"XOXOXOXOX",
|
||||
"XOXOXOXOX",
|
||||
"XOXOXOXOX").getItemSlots();
|
||||
int listSlot = 0;
|
||||
|
||||
for (AchievementCategory category : AchievementCategory.values())
|
||||
|
@ -36,6 +36,7 @@ import mineplex.core.common.util.UtilTime;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.block.SignChangeEvent;
|
||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
@ -198,6 +199,30 @@ public class Chat extends MiniPlugin
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onSignChange(SignChangeEvent event)
|
||||
{
|
||||
if (_clientManager.Get(event.getPlayer()).GetRank().Has(Rank.ADMIN)) return;
|
||||
|
||||
// Prevent silenced players from using signs
|
||||
if (SilenceCheck(event.getPlayer()))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < event.getLines().length; i++)
|
||||
{
|
||||
String line = event.getLine(i);
|
||||
if (line != null && line.length() > 0)
|
||||
{
|
||||
String filteredLine = getFilteredMessage(event.getPlayer(), line);
|
||||
if (filteredLine != null)
|
||||
event.setLine(i, filteredLine);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void filterChat(AsyncPlayerChatEvent event)
|
||||
@ -224,7 +249,7 @@ public class Chat extends MiniPlugin
|
||||
originalMessage = originalMessage.replaceAll("[^\\x00-\\x7F]", "").trim();
|
||||
final String filterType = "moderate";
|
||||
final String displayName = player.getPlayerListName();
|
||||
|
||||
|
||||
JSONObject message = buildJsonChatObject(filterType, displayName, playerName, originalMessage, _serverName, 1);
|
||||
String response = getResponseFromCleanSpeak(message, filterType);
|
||||
|
||||
|
@ -98,10 +98,10 @@ public class InventoryRepository extends RepositoryBase
|
||||
|
||||
public boolean incrementClientInventoryItem(int accountId, int itemId, int count)
|
||||
{
|
||||
System.out.println("Updating " + accountId + "'s " + itemId + " with " + count);
|
||||
//System.out.println("Updating " + accountId + "'s " + itemId + " with " + count);
|
||||
if (executeUpdate(UPDATE_CLIENT_INVENTORY, new ColumnInt("count", count), new ColumnInt("id", accountId), new ColumnInt("itemid", itemId)) < 1)
|
||||
{
|
||||
System.out.println("Inserting " + accountId + "'s " + itemId + " with " + count);
|
||||
//System.out.println("Inserting " + accountId + "'s " + itemId + " with " + count);
|
||||
return executeUpdate(INSERT_CLIENT_INVENTORY, new ColumnInt("id", accountId), new ColumnInt("itemid", itemId), new ColumnInt("count", count)) > 0;
|
||||
}
|
||||
else
|
||||
|
@ -4,4 +4,6 @@ public class ClientMessage
|
||||
{
|
||||
public String LastTo;
|
||||
public String LastAdminTo;
|
||||
public long LastToTime;
|
||||
public int SpamCounter;
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package mineplex.core.message;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.UUID;
|
||||
@ -49,7 +50,7 @@ public class MessageManager extends MiniClientPlugin<ClientMessage>
|
||||
private PreferencesManager _preferences;
|
||||
private Punish _punish;
|
||||
private Chat _chat;
|
||||
private LinkedList<String> _randomMessage;
|
||||
private ArrayList<String> _randomMessage;
|
||||
private String _serverName;
|
||||
|
||||
public MessageManager(JavaPlugin plugin, CoreClientManager clientManager, PreferencesManager preferences,
|
||||
@ -190,6 +191,25 @@ public class MessageManager extends MiniClientPlugin<ClientMessage>
|
||||
return;
|
||||
}
|
||||
|
||||
// My attempt at trying to mitigate some of the spam bots - Phinary
|
||||
// Triggers if they are whispering a new player
|
||||
if (!GetClientManager().Get(from).GetRank().Has(Rank.HELPER) && Get(from).LastTo != null && !Get(from).LastTo.equalsIgnoreCase(to.getName()))
|
||||
{
|
||||
long delta = System.currentTimeMillis() - Get(from).LastToTime;
|
||||
|
||||
if (Get(from).SpamCounter > 3 && delta < Get(from).SpamCounter * 1000)
|
||||
{
|
||||
from.sendMessage(F.main("Cooldown", "Try sending that message again in a few seconds"));
|
||||
Get(from).LastTo = to.getName();
|
||||
return;
|
||||
}
|
||||
else if (delta < 8000)
|
||||
{
|
||||
// Silently increment spam counter whenever delta is less than 8 seconds
|
||||
Get(from).SpamCounter++;
|
||||
}
|
||||
}
|
||||
|
||||
message = _chat.getFilteredMessage(from, message);
|
||||
|
||||
// Inform
|
||||
@ -197,11 +217,12 @@ public class MessageManager extends MiniClientPlugin<ClientMessage>
|
||||
|
||||
// Save
|
||||
Get(from).LastTo = to.getName();
|
||||
Get(from).LastToTime = System.currentTimeMillis();
|
||||
|
||||
// Chiss or defek7
|
||||
if (to.getName().equals("Chiss") || to.getName().equals("defek7"))
|
||||
if (to.getName().equals("Chiss") || to.getName().equals("defek7") || to.getName().equals("Phinary"))
|
||||
{
|
||||
UtilPlayer.message(from, C.cPurple + to.getName() + "is often AFK or minimized, due to plugin development.");
|
||||
UtilPlayer.message(from, C.cPurple + to.getName() + " is often AFK or minimized, due to plugin development.");
|
||||
UtilPlayer.message(from, C.cPurple + "Please be patient if he does not reply instantly.");
|
||||
}
|
||||
|
||||
@ -254,7 +275,7 @@ public class MessageManager extends MiniClientPlugin<ClientMessage>
|
||||
@Override
|
||||
public void enable()
|
||||
{
|
||||
_randomMessage = new LinkedList<String>();
|
||||
_randomMessage = new ArrayList<String>();
|
||||
_randomMessage.clear();
|
||||
_randomMessage.add("Hello, do you have any wild boars for purchase?");
|
||||
_randomMessage.add("There's a snake in my boot!");
|
||||
@ -307,7 +328,7 @@ public class MessageManager extends MiniClientPlugin<ClientMessage>
|
||||
return _randomMessage.get(UtilMath.r(_randomMessage.size()));
|
||||
}
|
||||
|
||||
public LinkedList<String> GetRandomMessages()
|
||||
public ArrayList<String> GetRandomMessages()
|
||||
{
|
||||
return _randomMessage;
|
||||
}
|
||||
|
@ -349,6 +349,9 @@ public class NpcManager extends MiniPlugin
|
||||
UtilEnt.Vegetate(entity);
|
||||
UtilEnt.silence(entity, true);
|
||||
UtilEnt.ghost(entity, true, false);
|
||||
|
||||
// Add Look AI
|
||||
UtilEnt.addLookAtPlayerAI(entity, 10.0F);
|
||||
}
|
||||
|
||||
if (npc.getDatabaseRecord().getHelmet() != null)
|
||||
|
@ -93,7 +93,6 @@ import mineplex.hub.modules.JumpManager;
|
||||
import mineplex.hub.modules.NewsManager;
|
||||
import mineplex.hub.modules.ParkourManager;
|
||||
import mineplex.hub.modules.TextManager;
|
||||
import mineplex.hub.modules.UHCManager;
|
||||
import mineplex.hub.modules.HubVisibilityManager;
|
||||
import mineplex.hub.modules.WorldManager;
|
||||
import mineplex.hub.poll.PollManager;
|
||||
@ -170,7 +169,6 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
||||
|
||||
new WorldManager(this);
|
||||
new JumpManager(this);
|
||||
new UHCManager(this);
|
||||
//new TournamentInviter(this);
|
||||
|
||||
_news = new NewsManager(this);
|
||||
|
@ -1,101 +0,0 @@
|
||||
package mineplex.hub.modules;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTextMiddle;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.hub.HubManager;
|
||||
import mineplex.serverdata.Utility;
|
||||
|
||||
public class UHCManager extends MiniPlugin
|
||||
{
|
||||
public HubManager Manager;
|
||||
|
||||
private long _delay = 3600000;
|
||||
private boolean _canAnnounce3 = true;
|
||||
private boolean _canAnnounce2 = true;
|
||||
private boolean _canAnnounce1 = true;
|
||||
private boolean _canAnnounce0 = true;
|
||||
|
||||
public UHCManager(HubManager manager)
|
||||
{
|
||||
super("UHC Manager", manager.getPlugin());
|
||||
|
||||
Manager = manager;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void AnnounceUpdate(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.SEC)
|
||||
return;
|
||||
|
||||
Bukkit.getScheduler().runTaskAsynchronously(Manager.getPlugin(), new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
long time = Utility.currentTimeMillis();
|
||||
|
||||
//System.out.println("UHC in " + UtilTime.MakeStr(_delay - (time % _delay)));
|
||||
|
||||
//Reset
|
||||
if (time % _delay > 30000 && time % _delay < _delay - 180000)
|
||||
{
|
||||
_canAnnounce3 = true;
|
||||
_canAnnounce2 = true;
|
||||
_canAnnounce1 = true;
|
||||
_canAnnounce0 = true;
|
||||
}
|
||||
//Announce
|
||||
else
|
||||
{
|
||||
if (_canAnnounce3 && time % _delay > _delay - 180000)
|
||||
{
|
||||
_canAnnounce3 = false;
|
||||
announce("Opening in 3 minutes...");
|
||||
|
||||
UtilTextMiddle.display(C.cRed + "Ultra Hardcore", "Open in 3 minutes...", 10, 100, 20);
|
||||
}
|
||||
|
||||
else if (_canAnnounce2 && time % _delay > _delay - 120000)
|
||||
{
|
||||
_canAnnounce2 = false;
|
||||
announce("Opening in 2 minutes...");
|
||||
|
||||
UtilTextMiddle.display(C.cRed + "Ultra Hardcore", "Open in 2 minutes...", 10, 100, 20);
|
||||
}
|
||||
|
||||
else if (_canAnnounce1 && time % _delay > _delay - 60000)
|
||||
{
|
||||
_canAnnounce1 = false;
|
||||
announce("Opening in 1 minute...");
|
||||
|
||||
UtilTextMiddle.display(C.cRed + "Ultra Hardcore", "Open in 1 minute...", 10, 100, 20);
|
||||
}
|
||||
|
||||
else if (_canAnnounce0 && time % _delay < 30000)
|
||||
{
|
||||
_canAnnounce0 = false;
|
||||
announce("UHC Open! Join at the Ultra Hardcore NPC!");
|
||||
|
||||
UtilTextMiddle.display(C.cRed + "Ultra Hardcore", "Join at the NPC to play", 10, 100, 20);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void announce(String message)
|
||||
{
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
UtilPlayer.message(player, C.cDPurple + "[Ultra Hardcore] " + C.cPurple + C.Bold + message);
|
||||
}
|
||||
}
|
@ -39,7 +39,7 @@ public class ServerGameMenu extends ShopPageBase<ServerManager, QuickShop>
|
||||
|
||||
public ServerGameMenu(ServerManager plugin, QuickShop quickShop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player)
|
||||
{
|
||||
super(plugin, quickShop, clientManager, donationManager, name, player, 56);
|
||||
super(plugin, quickShop, clientManager, donationManager, name, player, 47);
|
||||
|
||||
createSuperSmashCycle();
|
||||
createMinigameCycle();
|
||||
|
@ -84,6 +84,7 @@ import mineplex.core.status.ServerStatusManager;
|
||||
import mineplex.core.task.TaskManager;
|
||||
import mineplex.core.teleport.Teleport;
|
||||
import mineplex.core.timing.TimingManager;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.classcombat.Class.ClassManager;
|
||||
import mineplex.minecraft.game.classcombat.Condition.SkillConditionManager;
|
||||
|
@ -54,6 +54,7 @@ public class GameTeam
|
||||
}
|
||||
|
||||
private String _name;
|
||||
private String _displayName;
|
||||
private ChatColor _color;
|
||||
|
||||
private HashMap<Player, PlayerState> _players = new HashMap<Player, PlayerState>();
|
||||
@ -75,6 +76,7 @@ public class GameTeam
|
||||
{
|
||||
Host = host;
|
||||
|
||||
_displayName = name;
|
||||
_name = name;
|
||||
_color = color;
|
||||
_spawns = spawns;
|
||||
@ -139,11 +141,19 @@ public class GameTeam
|
||||
{
|
||||
_players.put(player, in ? PlayerState.IN : PlayerState.OUT);
|
||||
|
||||
UtilPlayer.message(player, F.main("Team", _color + C.Bold + "You joined " + _name + " Team") + ".");
|
||||
UtilPlayer.message(player, F.main("Team", _color + C.Bold + "You joined " + _displayName + " Team."));
|
||||
|
||||
VisibilityManager.Instance.refreshPlayerToAll(player);
|
||||
}
|
||||
|
||||
public void DisbandTeam()
|
||||
{
|
||||
for (Player player : _players.keySet())
|
||||
UtilPlayer.message(player, F.main("Team", _color + C.Bold + _displayName + " Team was disbanded."));
|
||||
|
||||
_players.clear();
|
||||
}
|
||||
|
||||
public void RemovePlayer(Player player)
|
||||
{
|
||||
_players.remove(player);
|
||||
@ -261,6 +271,11 @@ public class GameTeam
|
||||
{
|
||||
_name = name;
|
||||
}
|
||||
|
||||
public void setDisplayName(String name)
|
||||
{
|
||||
_displayName = name;
|
||||
}
|
||||
|
||||
public byte GetColorData()
|
||||
{
|
||||
@ -375,4 +390,6 @@ public class GameTeam
|
||||
|
||||
return _places;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ import nautilus.game.arcade.kit.*;
|
||||
import nautilus.game.arcade.stats.TeamDeathsStatTracker;
|
||||
import nautilus.game.arcade.stats.TeamKillsStatTracker;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.*;
|
||||
import org.bukkit.event.*;
|
||||
import org.bukkit.event.player.*;
|
||||
@ -71,9 +72,9 @@ public abstract class TeamGame extends Game
|
||||
|
||||
if (player.isDead())
|
||||
return;
|
||||
|
||||
|
||||
if (player.getWorld().getName().equalsIgnoreCase("world"))
|
||||
return;
|
||||
return;
|
||||
|
||||
if (!QuitOut)
|
||||
{
|
||||
@ -83,7 +84,7 @@ public abstract class TeamGame extends Game
|
||||
|
||||
if (GetKit(player) != null)
|
||||
RejoinKit.put(player.getName(), GetKit(player));
|
||||
|
||||
|
||||
RejoinHealth.put(player.getName(), player.getHealth());
|
||||
|
||||
GetLocationStore().put(player.getName(), player.getLocation());
|
||||
@ -110,22 +111,40 @@ public abstract class TeamGame extends Game
|
||||
Kit kit = RejoinKit.remove(event.getPlayer().getName());
|
||||
if (kit != null)
|
||||
_playerKit.put(event.getPlayer(), kit);
|
||||
|
||||
if (RejoinHealth.containsKey(event.getPlayer().getName()))
|
||||
event.getPlayer().setHealth(RejoinHealth.remove(event.getPlayer().getName()));
|
||||
|
||||
// final Player player = event.getPlayer();
|
||||
// Bukkit.getScheduler().runTaskLater(Manager.getPlugin(), new Runnable()
|
||||
// {
|
||||
// @Override
|
||||
// public void run()
|
||||
// {
|
||||
// if (RejoinHealth.containsKey(player.getName()))
|
||||
// {
|
||||
// double health = RejoinHealth.remove(player.getName());
|
||||
// player.setHealth(health);
|
||||
// player.sendMessage("DEBUG: restored hp to " + health);
|
||||
// }
|
||||
// }
|
||||
// }, 20);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
//Owner Bypass
|
||||
if (Manager.GetClients().Get(event.getPlayer()).GetRank().Has(Rank.OWNER))
|
||||
}
|
||||
|
||||
//Do this on Join, not Login, otherwise player no get heal.
|
||||
@EventHandler
|
||||
public void playerRejoinGame(PlayerJoinEvent event)
|
||||
{
|
||||
if (!InProgress() || QuitOut)
|
||||
return;
|
||||
|
||||
//Disallow
|
||||
event.setResult(PlayerLoginEvent.Result.KICK_OTHER);
|
||||
event.disallow(PlayerLoginEvent.Result.KICK_OTHER, ChatColor.YELLOW + "You cannot join this UHC.");
|
||||
*/
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (RejoinHealth.containsKey(player.getName()))
|
||||
{
|
||||
double health = RejoinHealth.remove(player.getName());
|
||||
player.setHealth(health);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -179,8 +179,22 @@ public class Build extends SoloGame
|
||||
|
||||
_words = new String[]
|
||||
{
|
||||
"Rollercoaster", "Archery Range", "Pokemon", "Pirates", "Vikings", "Dinosaur", "Dragon", "Toilet", "Farm", "Tree House", "Burger", "Cat", "Truck", "Bicycle", "Soda", "Music Instrument", "Statue", "Cannon", "Catapult", "Sailing Boat", "Grim Reaper", "Star Wars", "Elephant", "Penguin", "Ninja", "Pot of Gold", "Shrek", "Fruit", "Breakfast", "Toaster", "Robot", "Camping", "Rocket", "Aliens", "Shipwreck", "Flying Creature", "Beach Creature", "Sea Creature", "Spongebob", "Car", "Potted Plant", "Weapons", "Christmas", "King", "Queen", "Angel", "Demon", "Halloween", "Tank", "Aeroplane"
|
||||
|
||||
"Rollercoaster", "Pokemon", "Pirates", "Vikings", "Dinosaur", "Dragon", "Toilet", "Farm", "Tree House",
|
||||
"Cat", "Truck", "Bicycle", "Soda", "Music Instrument", "Statue", "Pot of Gold", "Shrek", "Fruit", "Breakfast",
|
||||
"Toaster", "Robot", "Camping", "Rocket", "Aliens", "Shipwreck", "Spongebob", "Car", "Potted Plant", "Weapons",
|
||||
"Christmas", "King", "Queen", "Angel", "Demon", "Halloween", "Tank", "Helicopter", "Knight", "Rabbit",
|
||||
"Sandwich", "Snowman", "Basketball", "Ice Cream", "Sea Shell", "Lightbulb", "Rainbow", "iPad", "Crayon",
|
||||
"Volcano", "Hot Tub", "Octopus", "Ghost", "Ant", "Cheese", "Kite", "Reptile", "Leaning Tower Pisa",
|
||||
"Disney", "Space Ship", "Pixel Art", "Chicken", "Shoe", "Owl", "Bear", "Flowers", "Teapot", "Lighthouse",
|
||||
"Lion", "Grandfather Clock", "Nintendo", "Television", "Batman", "Tiger", "Computer", "Castle", "House",
|
||||
"Bed", "Party", "Volleyball", "Toys", "Hula Hooper", "Bow", "Library", "Love", "Seasons", "Skull",
|
||||
"Hat", "Snake", "Vacation", "Umbrella", "Magic", "Tornado", "Candy", "Dentist", "Pizza", "Bird",
|
||||
"Superhero", "Turtle", "Chicken", "School", "Build Anything!", "Cabin", "Coral Reef", "Food", "Picnic",
|
||||
"Trophy", "Pool", "Telephone", "Cell Phone", "Hot Air Balloon", "Train", "Candyland", "Chocolate Bar",
|
||||
"Mountain", "Potato", "Glasses", "Domino", "Clown", "River", "Mario", "Luigi", "Windmill", "Alligator",
|
||||
"Police", "Igloo", "Puppy", "Gift", "Harry Potter", "Desk", "Bumblebee", "Jellyfish", "Speedboat",
|
||||
"Fall", "Summer", "Autumn", "Winter", "Sunset", "Calculator", "Disco", "Giant", "Moose", "Salad",
|
||||
"Water Gun", "Astronaut", "Kitchen", "Wither", "Meteor"
|
||||
};
|
||||
|
||||
_mobShop = new MobShop(getArcadeManager(), getArcadeManager().GetClients(), getArcadeManager().GetDonation());
|
||||
|
@ -32,7 +32,8 @@ public class GroundPage extends ShopPageBase<ArcadeManager, OptionsShop>
|
||||
new GroundData(Material.STAINED_CLAY, (byte) 0), new GroundData(Material.STAINED_CLAY, (byte) 15),
|
||||
new GroundData(Material.STAINED_CLAY, (byte) 4), new GroundData(Material.STAINED_CLAY, (byte) 3),
|
||||
new GroundData(Material.STAINED_CLAY, (byte) 5), new GroundData(Material.STAINED_CLAY, (byte) 6),
|
||||
new GroundData(Material.QUARTZ_BLOCK)};
|
||||
new GroundData(Material.QUARTZ_BLOCK), new GroundData(Material.ICE), new GroundData(Material.IRON_BLOCK),
|
||||
new GroundData(Material.GOLD_BLOCK), new GroundData(Material.DIAMOND_BLOCK)};
|
||||
|
||||
private Build _game;
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package nautilus.game.arcade.game.games.build.gui.page;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftLivingEntity;
|
||||
import org.bukkit.entity.Ageable;
|
||||
@ -155,7 +156,6 @@ public class MobPage extends ShopPageBase<ArcadeManager, MobShop>
|
||||
}
|
||||
|
||||
// Entity look at player (Currently Bugged)
|
||||
/*
|
||||
if (_entity instanceof LivingEntity)
|
||||
{
|
||||
ShopItem lookAtMe = new ShopItem(Material.GHAST_TEAR, "Look at Me", null, 0, false);
|
||||
@ -164,16 +164,26 @@ public class MobPage extends ShopPageBase<ArcadeManager, MobShop>
|
||||
@Override
|
||||
public void onClick(Player player, ClickType clickType)
|
||||
{
|
||||
Location entityLocation = _entity.getLocation();
|
||||
entityLocation.setDirection(player.getLocation().getDirection().multiply(-1));
|
||||
_entity.teleport(entityLocation);
|
||||
final Location newLoc = _entity.getLocation();
|
||||
newLoc.setDirection(player.getLocation().getDirection().multiply(-1));
|
||||
|
||||
((CraftLivingEntity) _entity).getHandle().setPositionRotation(newLoc.getX(), newLoc.getY(), newLoc.getZ(), newLoc.getYaw(), newLoc.getPitch());
|
||||
((CraftLivingEntity) _entity).getHandle().g(0.05, 0.0, 0.05);
|
||||
|
||||
getPlugin().runSyncLater(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
_entity.teleport(newLoc);
|
||||
}
|
||||
}, 1L);
|
||||
|
||||
UtilPlayer.message(player, F.main("Game", entityName + " is now looking at you"));
|
||||
}
|
||||
});
|
||||
buttonSlot += 2;
|
||||
}
|
||||
*/
|
||||
|
||||
// Delete Entity
|
||||
ShopItem deleteButton = new ShopItem(Material.TNT, "Delete " + entityName, null, 0, false);
|
||||
|
@ -108,10 +108,10 @@ public class Draw extends SoloGame
|
||||
this.WorldTimeSet = 8000;
|
||||
|
||||
_words = new String[]
|
||||
{
|
||||
"Bird", "Volcano", "Sloth", "Love", "Dance", "Hair", "Glasses", "Domino", "Dice", "Computer", "Top Hat", "Beard", "Wind", "Rain", "Minecraft", "Push", "Fighting", "Juggle", "Clown", "Miner", "Creeper", "Ghast", "Spider", "Punch", "Roll", "River", "Desert", "Cold", "Pregnant", "Photo", "Quick", "Mario", "Luigi", "Bridge", "Turtle", "Door Knob", "Mineplex", "Binoculars", "Telescope", "Planet", "Mountain Bike", "Moon", "Comet", "Flower", "Squirrel", "Horse Riding", "Chef", "Elephant", "Yoshi", "Shotgun", "Pistol", "James Bond", "Money", "Salt and Pepper", "Truck", "Helicopter", "Hot Air Balloon", "Sprout", "Yelling", "Muscles", "Skinny", "Zombie", "Lava", "Snake", "Motorbike", "Whale", "Boat", "Letterbox", "Window", "Lollipop", "Handcuffs", "Police", "Uppercut", "Windmill", "Eyepatch", "Campfire", "Rainbow", "Storm", "Pikachu", "Charmander", "Tornado", "Crying", "King", "Hobo", "Worm", "Snail", "XBox", "Playstation", "Nintendo", "Duck", "Pull", "Dinosaur", "Alligator", "Ankle", "Angel", "Acorn", "Bread", "Booty", "Bacon", "Crown", "Donut", "Drill", "Leash", "Magic", "Wizard", "Igloo", "Plant", "Screw", "Rifle", "Puppy", "Stool", "Stamp", "Letter", "Witch", "Zebra", "Wagon", "Compass", "Watch", "Clock", "Time", "Cyclops", "Coconut", "Hang", "Penguin", "Confused", "Bucket", "Lion", "Rubbish", "Spaceship", "Bowl", "Shark", "Pizza", "Pyramid", "Dress", "Pants", "Shorts", "Boots", "Boy", "Girl", "Math", "Sunglasses", "Frog", "Chair", "Cake", "Grapes", "Kiss", "Snorlax", "Earth", "Spaghetti", "Couch", "Family", "Milk", "Blood", "Pig", "Giraffe", "Mouse", "Couch", "Fat", "Chocolate", "Camel", "Cheese", "Beans", "Water", "Chicken", "Cannibal", "Zipper", "Book", "Swimming", "Horse", "Paper", "Toaster", "Television", "Hammer", "Piano", "Sleeping", "Yawn", "Sheep", "Night", "Chest", "Lamp", "Redstone", "Grass", "Plane", "Ocean", "Lake", "Melon", "Pumpkin", "Gift", "Fishing", "Pirate", "Lightning", "Stomach", "Belly Button", "Fishing Rod", "Iron Ore", "Diamonds", "Emeralds", "Nether Portal", "Ender Dragon", "Rabbit", "Harry Potter", "Torch", "Light", "Battery", "Zombie Pigman", "Telephone", "Tent", "Hand", "Traffic Lights", "Anvil", "Tail", "Umbrella", "Piston", "Skeleton", "Spikes", "Bridge", "Bomb", "Spoon", "Rainbow", "Staircase", "Poop", "Dragon", "Fire", "Apple", "Shoe", "Squid", "Cookie", "Tooth", "Camera", "Sock", "Monkey", "Unicorn", "Smile", "Pool", "Rabbit", "Cupcake", "Pancake", "Princess", "Castle", "Flag", "Planet", "Stars", "Camp Fire", "Rose", "Spray", "Pencil", "Ice Cream", "Toilet", "Moose", "Bear", "Beer", "Batman", "Eggs", "Teapot", "Golf Club", "Tennis Racket", "Shield", "Crab", "Pot of Gold", "Cactus", "Television", "Pumpkin Pie", "Chimney", "Stable", "Nether", "Wither", "Beach", "Stop Sign", "Chestplate", "Pokeball", "Christmas Tree", "Present", "Snowflake", "Laptop", "Superman", "Football", "Basketball", "Creeper", "Tetris", "Jump", "Ninja", "Baby", "Troll Face", "Grim Reaper", "Temple", "Explosion", "Vomit", "Ants", "Barn", "Burn", "Baggage", "Frisbee", "Iceberg", "Sleeping", "Dream", "Snorlax", "Balloons", "Elevator", "Alligator", "Bikini", "Butterfly", "Bumblebee", "Pizza", "Jellyfish", "Sideburns", "Speedboat", "Treehouse", "Water Gun", "Drink", "Hook", "Dance", "Fall", "Summer", "Autumn", "Spring", "Winter", "Night Time", "Galaxy", "Sunrise", "Sunset", "Picnic", "Snowflake", "Holding Hands", "America", "Laptop", "Anvil", "Bagel", "Bench", "Cigar", "Darts", "Muffin", "Queen", "Wheat", "Dolphin", "Scarf", "Swing", "Thumb", "Tomato", "Alcohol", "Armor", "Alien", "Beans", "Cheek", "Phone", "Keyboard", "Orange", "Calculator", "Paper", "Desk", "Disco", "Elbow", "Drool", "Giant", "Golem", "Grave", "Llama", "Moose", "Party", "Panda", "Plumber", "Salsa", "Salad", "Skunk", "Skull", "Stump", "Sugar", "Ruler", "Bookcase", "Hamster", "Soup", "Teapot", "Towel", "Waist", "Archer", "Anchor", "Bamboo", "Branch", "Booger", "Carrot", "Cereal", "Coffee", "Wolf", "Crayon", "Finger", "Forest", "Hotdog", "Burger", "Obsidian", "Pillow", "Swing", "YouTube", "Farm", "Rain", "Cloud", "Frozen", "Garbage", "Music", "Twitter", "Facebook", "Santa Hat", "Rope", "Neck", "Sponge", "Sushi", "Noodles", "Soup", "Tower", "Berry", "Capture", "Prison", "Robot", "Trash", "School", "Skype", "Snowman", "Crowd", "Bank", "Mudkip", "Joker", "Lizard", "Tiger", "Royal", "Erupt", "Wizard", "Stain", "Cinema", "Notebook", "Blanket", "Paint", "Guard", "Astronaut" , "Slime" , "Mansion" , "Radar" , "Thorn" , "Tears" , "Tiny" , "Candy" , "Pepsi" , "Flint" , "Draw My Thing" , "Rice" , "Shout" , "Prize" , "Skirt" , "Thief" , "Syrup" , "Kirby" , "Brush" , "Violin",
|
||||
};
|
||||
|
||||
{
|
||||
"Bird", "Volcano", "Sloth", "Love", "Dance", "Hair", "Glasses", "Domino", "Dice", "Computer", "Top Hat", "Beard", "Wind", "Rain", "Minecraft", "Push", "Fighting", "Juggle", "Clown", "Miner", "Creeper", "Ghast", "Spider", "Punch", "Roll", "River", "Desert", "Cold", "Pregnant", "Photo", "Quick", "Mario", "Luigi", "Bridge", "Turtle", "Door Knob", "Mineplex", "Binoculars", "Telescope", "Planet", "Mountain Bike", "Moon", "Comet", "Flower", "Squirrel", "Horse Riding", "Chef", "Elephant", "Yoshi", "Shotgun", "Pistol", "James Bond", "Money", "Salt and Pepper", "Truck", "Helicopter", "Hot Air Balloon", "Sprout", "Yelling", "Muscles", "Skinny", "Zombie", "Lava", "Snake", "Motorbike", "Whale", "Boat", "Letterbox", "Window", "Lollipop", "Handcuffs", "Police", "Uppercut", "Windmill", "Eyepatch", "Campfire", "Rainbow", "Storm", "Pikachu", "Charmander", "Tornado", "Crying", "King", "Hobo", "Worm", "Snail", "XBox", "Playstation", "Nintendo", "Duck", "Pull", "Dinosaur", "Alligator", "Ankle", "Angel", "Acorn", "Bread", "Booty", "Bacon", "Crown", "Donut", "Drill", "Leash", "Magic", "Wizard", "Igloo", "Plant", "Screw", "Rifle", "Puppy", "Stool", "Stamp", "Letter", "Witch", "Zebra", "Wagon", "Compass", "Watch", "Clock", "Time", "Cyclops", "Coconut", "Hang", "Penguin", "Confused", "Bucket", "Lion", "Rubbish", "Spaceship", "Bowl", "Shark", "Pizza", "Pyramid", "Dress", "Pants", "Shorts", "Boots", "Boy", "Girl", "Math", "Sunglasses", "Frog", "Chair", "Cake", "Grapes", "Kiss", "Snorlax", "Earth", "Spaghetti", "Couch", "Family", "Milk", "Blood", "Pig", "Giraffe", "Mouse", "Couch", "Fat", "Chocolate", "Camel", "Cheese", "Beans", "Water", "Chicken", "Cannibal", "Zipper", "Book", "Swimming", "Horse", "Paper", "Toaster", "Television", "Hammer", "Piano", "Sleeping", "Yawn", "Sheep", "Night", "Chest", "Lamp", "Redstone", "Grass", "Plane", "Ocean", "Lake", "Melon", "Pumpkin", "Gift", "Fishing", "Pirate", "Lightning", "Stomach", "Belly Button", "Fishing Rod", "Iron Ore", "Diamonds", "Emeralds", "Nether Portal", "Ender Dragon", "Rabbit", "Harry Potter", "Torch", "Light", "Battery", "Zombie Pigman", "Telephone", "Tent", "Hand", "Traffic Lights", "Anvil", "Tail", "Umbrella", "Piston", "Skeleton", "Spikes", "Bridge", "Bomb", "Spoon", "Rainbow", "Staircase", "Poop", "Dragon", "Fire", "Apple", "Shoe", "Squid", "Cookie", "Tooth", "Camera", "Sock", "Monkey", "Unicorn", "Smile", "Pool", "Rabbit", "Cupcake", "Pancake", "Princess", "Castle", "Flag", "Planet", "Stars", "Camp Fire", "Rose", "Spray", "Pencil", "Ice Cream", "Toilet", "Moose", "Bear", "Beer", "Batman", "Eggs", "Teapot", "Golf Club", "Tennis Racket", "Shield", "Crab", "Pot of Gold", "Cactus", "Television", "Pumpkin Pie", "Chimney", "Stable", "Nether", "Wither", "Beach", "Stop Sign", "Chestplate", "Pokeball", "Christmas Tree", "Present", "Snowflake", "Laptop", "Superman", "Football", "Basketball", "Creeper", "Tetris", "Jump", "Ninja", "Baby", "Troll Face", "Grim Reaper", "Temple", "Explosion", "Vomit", "Ants", "Barn", "Burn", "Baggage", "Frisbee", "Iceberg", "Sleeping", "Dream", "Snorlax", "Balloons", "Elevator", "Alligator", "Bikini", "Butterfly", "Bumblebee", "Pizza", "Jellyfish", "Sideburns", "Speedboat", "Treehouse", "Water Gun", "Drink", "Hook", "Dance", "Fall", "Summer", "Autumn", "Spring", "Winter", "Night Time", "Galaxy", "Sunrise", "Sunset", "Picnic", "Snowflake", "Holding Hands", "America", "Laptop", "Anvil", "Bagel", "Bench", "Cigar", "Darts", "Muffin", "Queen", "Wheat", "Dolphin", "Scarf", "Swing", "Thumb", "Tomato", "Alcohol", "Armor", "Alien", "Beans", "Cheek", "Phone", "Keyboard", "Orange", "Calculator", "Paper", "Desk", "Disco", "Elbow", "Drool", "Giant", "Golem", "Grave", "Llama", "Moose", "Party", "Panda", "Plumber", "Salsa", "Salad", "Skunk", "Skull", "Stump", "Sugar", "Ruler", "Bookcase", "Hamster", "Soup", "Teapot", "Towel", "Waist", "Archer", "Anchor", "Bamboo", "Branch", "Booger", "Carrot", "Cereal", "Coffee", "Wolf", "Crayon", "Finger", "Forest", "Hotdog", "Burger", "Obsidian", "Pillow", "Swing", "YouTube", "Farm", "Rain", "Cloud", "Frozen", "Garbage", "Music", "Twitter", "Facebook", "Santa Hat", "Rope", "Neck", "Sponge", "Sushi", "Noodles", "Soup", "Tower", "Berry", "Capture", "Prison", "Robot", "Trash", "School", "Skype", "Snowman", "Crowd", "Bank", "Mudkip", "Joker", "Lizard", "Tiger", "Royal", "Erupt", "Wizard", "Stain", "Cinema", "Notebook", "Blanket", "Paint", "Guard", "Astronaut" , "Slime" , "Mansion" , "Radar" , "Thorn" , "Tears" , "Tiny" , "Candy" , "Pepsi" , "Flint" , "Draw My Thing" , "Rice" , "Shout" , "Prize" , "Skirt" , "Thief" , "Syrup" , "Kirby" , "Brush" , "Violin", "Car", "Sun", "Eye", "Bow", "Axe", "Face", "Mushroom", "Guitar", "Book",
|
||||
};
|
||||
|
||||
_tools = new HashSet<Tool>();
|
||||
_tools.add(new ToolLine(this));
|
||||
_tools.add(new ToolSquare(this));
|
||||
@ -302,40 +302,42 @@ public class Draw extends SoloGame
|
||||
|
||||
String message = event.getMessage().toLowerCase();
|
||||
|
||||
if (message.contains(_round.Word.toLowerCase()))
|
||||
if (_guessers.HasPlayer(player))
|
||||
{
|
||||
int wordsInMessage = 0;
|
||||
|
||||
for (String word : _words)
|
||||
{
|
||||
if (message.contains(word))
|
||||
if (!word.equals(_round.Word) && message.contains(word.toLowerCase()))
|
||||
{
|
||||
if (++wordsInMessage >= 3)
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Game", "Multiple guesses are not allowed!"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (_guessers.HasPlayer(player))
|
||||
if (message.contains(_round.Word.toLowerCase()))
|
||||
{
|
||||
//First Guess
|
||||
// First Guess
|
||||
int score = 1;
|
||||
if (_round.Guessed.isEmpty())
|
||||
{
|
||||
score = 3;
|
||||
|
||||
//Points for Drawer
|
||||
|
||||
// Points for Drawer
|
||||
AddScore(_round.Drawer, 2);
|
||||
|
||||
|
||||
this.AddGems(_round.Drawer, 2, "Drawings Guessed", true, true);
|
||||
}
|
||||
|
||||
|
||||
if (_round.Guessed(player))
|
||||
{
|
||||
AddScore(player, score);
|
||||
Announce(C.cYellow + C.Bold + "+" + score + " " + C.cGreen + C.Bold + player.getName() + " has guessed the word!");
|
||||
|
||||
Announce(C.cYellow + C.Bold + "+" + score + " " + C.cGreen + C.Bold + player.getName()
|
||||
+ " has guessed the word!");
|
||||
|
||||
if (score == 1)
|
||||
this.AddGems(player, 1, "Words Guessed", true, true);
|
||||
else
|
||||
|
@ -14,11 +14,9 @@ import org.bukkit.Sound;
|
||||
import org.bukkit.World.Environment;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftLargeFireball;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Fireball;
|
||||
import org.bukkit.entity.Ghast;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Monster;
|
||||
@ -37,6 +35,7 @@ import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
|
||||
import org.bukkit.event.inventory.PrepareItemCraftEvent;
|
||||
import org.bukkit.event.player.PlayerChangedWorldEvent;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
import org.bukkit.event.player.PlayerItemConsumeEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerKickEvent;
|
||||
@ -44,6 +43,8 @@ import org.bukkit.event.player.PlayerPickupItemEvent;
|
||||
import org.bukkit.event.player.PlayerPortalEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||
import org.bukkit.event.world.ChunkLoadEvent;
|
||||
import org.bukkit.event.world.ChunkUnloadEvent;
|
||||
import org.bukkit.inventory.CraftingInventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.ShapedRecipe;
|
||||
@ -54,7 +55,6 @@ import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.scoreboard.DisplaySlot;
|
||||
import org.bukkit.scoreboard.Objective;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
@ -65,14 +65,11 @@ import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilEvent;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilWorld;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.common.util.UtilTextMiddle;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.packethandler.PacketPlayOutWorldBorder;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
@ -81,22 +78,30 @@ import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.combat.CombatLog;
|
||||
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import mineplex.serverdata.Utility;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.game.Game;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.TeamGame;
|
||||
import nautilus.game.arcade.game.Game.GameState;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import net.minecraft.server.v1_7_R4.EntityLargeFireball;
|
||||
|
||||
public class UHC extends TeamGame
|
||||
{
|
||||
private NautHashMap<Player, Player> _teamReqs = new NautHashMap<Player, Player>();
|
||||
|
||||
private NautHashMap<String, Long> _deathTime = new NautHashMap<String, Long>();
|
||||
// private NautHashMap<String, Long> _combatTime = new NautHashMap<String, Long>();
|
||||
|
||||
private int _yMax = 0;
|
||||
|
||||
private boolean _mapLoaded = false;
|
||||
private double _mapLoadPercent = 0;
|
||||
private int _chunksPerTick = 1;
|
||||
private int _chunkTotal;
|
||||
private Chunk _chunk = null;
|
||||
private int _chunkX = 0;
|
||||
private int _chunkZ = 0;
|
||||
@ -110,7 +115,7 @@ public class UHC extends TeamGame
|
||||
|
||||
private long _createTime;
|
||||
private long _serverTime;
|
||||
private boolean _mapLoaded = false;
|
||||
|
||||
|
||||
private boolean xrayDebug = false;
|
||||
|
||||
@ -185,7 +190,7 @@ public class UHC extends TeamGame
|
||||
this.VersionRequire1_8 = true;
|
||||
|
||||
WorldTimeSet = -1;
|
||||
|
||||
|
||||
CraftRecipes();
|
||||
|
||||
// Disable Custom Mob Drops (and EXP Disable)
|
||||
@ -211,6 +216,7 @@ public class UHC extends TeamGame
|
||||
|
||||
_chunkX = (int) -(_currentBorder / 16);
|
||||
_chunkZ = (int) -(_currentBorder / 16);
|
||||
_chunkTotal = (int) ((_currentBorder * 2 / 16) * (_currentBorder * 2 / 16));
|
||||
|
||||
WorldData.MinX = -1000;
|
||||
WorldData.MinZ = -1000;
|
||||
@ -296,9 +302,6 @@ public class UHC extends TeamGame
|
||||
|
||||
double border = (_previousBorder - 0.3D) + distanceMovedSince;
|
||||
|
||||
// 24 @ 100+ reduced to 0 at 32-
|
||||
double borderAttackDist = Math.max(8, (Math.min(100, border) - 28d) / 3d);
|
||||
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
{
|
||||
Location loc = player.getLocation();
|
||||
@ -393,19 +396,15 @@ public class UHC extends TeamGame
|
||||
|
||||
if (WorldData.World == null)
|
||||
return;
|
||||
|
||||
int chunksPerTick = 20;
|
||||
|
||||
if (GetState() != GameState.Recruit)
|
||||
return;
|
||||
|
||||
// Print Debug
|
||||
if (event.getType() == UpdateType.SLOW)
|
||||
if (event.getType() == UpdateType.SLOWER)
|
||||
{
|
||||
int chunkTotal = (int) ((_currentBorder * 2 / 16) * (_currentBorder * 2 / 16));
|
||||
|
||||
int chunksToGo = chunkTotal - _chunksLoaded;
|
||||
|
||||
Announce(C.cGreen + C.Bold + "Generating Map: " + ChatColor.RESET
|
||||
+ UtilTime.MakeStr((long) ((double) chunksToGo / (double) (20 * chunksPerTick) * 1000d), 1) + " Remaining...");
|
||||
|
||||
Announce(C.cGreen + C.Bold + "Generating Map: " + C.cWhite + getMapLoadETA() + " Remaining...", false);
|
||||
|
||||
TimingManager.endTotal("UHC Generation", true);
|
||||
return;
|
||||
}
|
||||
@ -416,11 +415,11 @@ public class UHC extends TeamGame
|
||||
// Timings
|
||||
TimingManager.startTotal("UHC Generation");
|
||||
|
||||
for (int i = 0; i < chunksPerTick; i++)
|
||||
for (int i = 0; i < _chunksPerTick ; i++)
|
||||
{
|
||||
// Unload Previous
|
||||
// if (_chunk != null)
|
||||
// _chunk.unload(true);
|
||||
// _chunk.unload(true);
|
||||
|
||||
// Load Chunks
|
||||
_chunk = WorldData.World.getChunkAt(_chunkX, _chunkZ);
|
||||
@ -438,8 +437,6 @@ public class UHC extends TeamGame
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Announce(C.cGreen + C.Bold + "Generating Map: " + ChatColor.RESET + "Complete!");
|
||||
_mapLoaded = true;
|
||||
System.out.println("Map Loading Finished!");
|
||||
generateSpawns();
|
||||
@ -448,10 +445,26 @@ public class UHC extends TeamGame
|
||||
|
||||
_chunksLoaded++;
|
||||
}
|
||||
|
||||
_mapLoadPercent = (double)_chunksLoaded / (double)_chunkTotal;
|
||||
|
||||
// Timings
|
||||
TimingManager.stopTotal("UHC Generation");
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void chunkUnload(ChunkUnloadEvent event)
|
||||
{
|
||||
//Allow unloading after players in
|
||||
if (IsLive())
|
||||
return;
|
||||
|
||||
if (WorldData.World != null && event.getWorld().equals(WorldData.World))
|
||||
{
|
||||
System.out.println("Disallowing Unload of World");
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
public void generateSpawns()
|
||||
{
|
||||
@ -473,8 +486,8 @@ public class UHC extends TeamGame
|
||||
// Dynamically scale distance requirement based on how many teams need to fit
|
||||
double dist = (2 * _currentBorder) / (Math.sqrt(this.GetPlayers(true).size()) + 3);
|
||||
|
||||
// Ensure distance between Teams
|
||||
while (true)
|
||||
// Ensure distance between Teams - 500 Attempts
|
||||
for (int i=0 ; i<500 ; i++)
|
||||
{
|
||||
boolean clash = false;
|
||||
|
||||
@ -506,8 +519,8 @@ public class UHC extends TeamGame
|
||||
// Dynamically scale distance requirement based on how many teams need to fit
|
||||
double dist = (2 * _currentBorder) / (Math.sqrt(GetTeamList().size()) + 3);
|
||||
|
||||
// Ensure distance between Teams
|
||||
while (true)
|
||||
// Ensure distance between Teams - 500 Attempts
|
||||
for (int i=0 ; i<500 ; i++)
|
||||
{
|
||||
boolean clash = false;
|
||||
|
||||
@ -1458,7 +1471,7 @@ public class UHC extends TeamGame
|
||||
// Not Loaded (but still joinable)
|
||||
if (!_mapLoaded)
|
||||
{
|
||||
return ChatColor.GOLD + "Generating Map...";
|
||||
return ChatColor.GREEN + "Generating Map (" + C.cWhite + getMapLoadETA() + C.cGreen + ")";
|
||||
}
|
||||
|
||||
return ChatColor.GREEN + "Recruiting";
|
||||
@ -1638,4 +1651,150 @@ public class UHC extends TeamGame
|
||||
{
|
||||
return _mapLoaded;
|
||||
}
|
||||
|
||||
public String getMapLoadPercent()
|
||||
{
|
||||
return (int)(_mapLoadPercent * 100) + "%";
|
||||
}
|
||||
|
||||
public String getMapLoadETA()
|
||||
{
|
||||
int chunksToGo = _chunkTotal - _chunksLoaded;
|
||||
|
||||
return UtilTime.MakeStr((long) ((double)chunksToGo / (double)(_chunksPerTick * 20) * 1000d), 1);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void teamSelectInteract(PlayerInteractEntityEvent event)
|
||||
{
|
||||
if (GetState() != GameState.Recruit)
|
||||
return;
|
||||
|
||||
if (event.getRightClicked() == null)
|
||||
return;
|
||||
|
||||
if (!(event.getRightClicked() instanceof Player))
|
||||
return;
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
//Observer
|
||||
if (Manager.IsObserver(player))
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Game", "Spectators cannot partake in games."));
|
||||
return;
|
||||
}
|
||||
|
||||
selectTeamMate(player, (Player)event.getRightClicked());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void teamSelectCommand(PlayerCommandPreprocessEvent event)
|
||||
{
|
||||
if (GetState() != GameState.Recruit)
|
||||
return;
|
||||
|
||||
if (!event.getMessage().toLowerCase().startsWith("/team "))
|
||||
return;
|
||||
|
||||
event.setCancelled(true);
|
||||
|
||||
Player target = UtilPlayer.searchOnline(event.getPlayer(), event.getMessage().split(" ")[1], true);
|
||||
if (target == null)
|
||||
return;
|
||||
|
||||
//Observer
|
||||
if (Manager.IsObserver(event.getPlayer()))
|
||||
{
|
||||
UtilPlayer.message(event.getPlayer(), F.main("Game", "Spectators cannot partake in games."));
|
||||
return;
|
||||
}
|
||||
|
||||
selectTeamMate(event.getPlayer(), target);
|
||||
}
|
||||
|
||||
public void selectTeamMate(Player player, Player ally)
|
||||
{
|
||||
//Accept Invite
|
||||
if (_teamReqs.containsKey(ally) && _teamReqs.get(ally).equals(player))
|
||||
{
|
||||
//Remove Prefs
|
||||
_teamReqs.remove(player);
|
||||
_teamReqs.remove(ally);
|
||||
|
||||
//Inform
|
||||
UtilPlayer.message(player, F.main("Game", "You accepted " + ally.getName() + "'s Team Request!"));
|
||||
UtilPlayer.message(ally, F.main("Game", player.getName() + " accepted your Team Request!"));
|
||||
|
||||
//Leave Old Teams
|
||||
if (GetTeam(player) != null)
|
||||
GetTeam(player).DisbandTeam();
|
||||
|
||||
if (GetTeam(ally) != null)
|
||||
GetTeam(ally).DisbandTeam();
|
||||
|
||||
//Get Team
|
||||
GameTeam team = getEmptyTeam();
|
||||
if (team == null)
|
||||
return;
|
||||
|
||||
//Join Team
|
||||
SetPlayerTeam(player, team, true);
|
||||
SetPlayerTeam(ally, team, true);
|
||||
|
||||
team.setDisplayName(player.getName() + " & " + ally.getName());
|
||||
}
|
||||
//Send Invite
|
||||
else
|
||||
{
|
||||
//Already on Team with Target
|
||||
if (GetTeam(player) != null)
|
||||
if (GetTeam(player).HasPlayer(ally))
|
||||
return;
|
||||
|
||||
//Inform Player
|
||||
UtilPlayer.message(player, F.main("Game", "You sent a Team Request to " + ally.getName() + "!"));
|
||||
|
||||
//Inform Target
|
||||
if (Recharge.Instance.use(player, "Team Req " + ally.getName(), 2000, false, false))
|
||||
{
|
||||
UtilPlayer.message(ally, F.main("Game", player.getName() + " sent you a Team Request!"));
|
||||
UtilPlayer.message(ally, F.main("Game", "Type " + F.elem("/team " + player.getName()) + " to accept!"));
|
||||
}
|
||||
|
||||
//Add Pref
|
||||
_teamReqs.put(player, ally);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void teamQuit(PlayerQuitEvent event)
|
||||
{
|
||||
if (GetState() != GameState.Recruit)
|
||||
return;
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (GetTeam(player) != null)
|
||||
GetTeam(player).DisbandTeam();
|
||||
|
||||
Iterator<Player> teamIter = _teamReqs.keySet().iterator();
|
||||
while (teamIter.hasNext())
|
||||
{
|
||||
Player sender = teamIter.next();
|
||||
if (sender.equals(player) || _teamReqs.get(sender).equals(player))
|
||||
teamIter.remove();
|
||||
}
|
||||
}
|
||||
|
||||
public GameTeam getEmptyTeam()
|
||||
{
|
||||
for (GameTeam team : GetTeamList())
|
||||
{
|
||||
if (team.GetPlayers(false).isEmpty())
|
||||
return team;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
@ -266,7 +266,7 @@ public enum SpellType // ❤
|
||||
|
||||
"Creates a ball of fire that grows",
|
||||
|
||||
"the longer it lives. At an large size",
|
||||
"the longer it lives. At a large size",
|
||||
|
||||
"it even burns away nearby blocks!"),
|
||||
|
||||
|
@ -684,7 +684,6 @@ public class Wizards extends SoloGame
|
||||
|
||||
_chestLoot.addLoot(Material.WHEAT, 5, 1, 2);
|
||||
_chestLoot.addLoot(Material.WOOD, 5, 1, 10);
|
||||
_chestLoot.addLoot(Material.BOAT, 5, 1, 2);
|
||||
|
||||
_chestLoot.addLoot(Material.GOLD_INGOT, 5, 1, 2);
|
||||
_chestLoot.addLoot(Material.IRON_INGOT, 5, 1, 2);
|
||||
|
@ -32,151 +32,153 @@ import nautilus.game.arcade.gui.spectatorMenu.button.SpectatorButton;
|
||||
|
||||
public class SpectatorPage extends ShopPageBase<CompassAddon, SpectatorShop>
|
||||
{
|
||||
private ArcadeManager _arcadeManager;
|
||||
private ArcadeManager _arcadeManager;
|
||||
|
||||
public SpectatorPage(CompassAddon plugin, ArcadeManager arcadeManager, SpectatorShop shop, CoreClientManager clientManager,
|
||||
DonationManager donationManager, Player player)
|
||||
{
|
||||
super(plugin, shop, clientManager, donationManager, "Spectator Menu", player);
|
||||
_arcadeManager = arcadeManager;
|
||||
buildPage();
|
||||
}
|
||||
public SpectatorPage(CompassAddon plugin, ArcadeManager arcadeManager, SpectatorShop shop, CoreClientManager clientManager,
|
||||
DonationManager donationManager, Player player)
|
||||
{
|
||||
super(plugin, shop, clientManager, donationManager, "Spectator Menu", player);
|
||||
_arcadeManager = arcadeManager;
|
||||
buildPage();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void buildPage()
|
||||
{
|
||||
int playerCount = _arcadeManager.GetGame().GetPlayers(true).size();
|
||||
List<GameTeam> teamList = _arcadeManager.GetGame().GetTeamList();
|
||||
@Override
|
||||
protected void buildPage()
|
||||
{
|
||||
int playerCount = _arcadeManager.GetGame().GetPlayers(true).size();
|
||||
List<GameTeam> teamList = _arcadeManager.GetGame().GetTeamList();
|
||||
|
||||
if (teamList.size() == 1 && playerCount < 28)
|
||||
buildSingleTeam(teamList.get(0), playerCount);
|
||||
else
|
||||
buildMultipleTeams(teamList, playerCount);
|
||||
if (teamList.size() == 1 && playerCount < 28)
|
||||
buildSingleTeam(teamList.get(0), playerCount);
|
||||
else
|
||||
buildMultipleTeams(teamList, playerCount);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void buildSingleTeam(GameTeam team, int playerCount)
|
||||
{
|
||||
setItem(13, getTeamItem(team, playerCount));
|
||||
|
||||
ArrayList<Player> players = team.GetPlayers(true);
|
||||
|
||||
Collections.sort(players, new Comparator<Player>()
|
||||
{
|
||||
private void buildSingleTeam(GameTeam team, int playerCount)
|
||||
{
|
||||
setItem(13, getTeamItem(team, playerCount));
|
||||
|
||||
@Override
|
||||
public int compare(Player o1, Player o2)
|
||||
{
|
||||
return o1.getName().compareToIgnoreCase(o2.getName());
|
||||
}
|
||||
|
||||
});
|
||||
ArrayList<Player> players = team.GetPlayers(true);
|
||||
|
||||
int slot = 19;
|
||||
Collections.sort(players, new Comparator<Player>()
|
||||
{
|
||||
|
||||
for (Player other : players)
|
||||
{
|
||||
addPlayerItem(slot, team, other);
|
||||
@Override
|
||||
public int compare(Player o1, Player o2)
|
||||
{
|
||||
return o1.getName().compareToIgnoreCase(o2.getName());
|
||||
}
|
||||
|
||||
if ((slot + 2) % 9 == 0)
|
||||
slot += 3;
|
||||
else
|
||||
slot++;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
private void buildMultipleTeams(List<GameTeam> teamList, int playerCount)
|
||||
{
|
||||
int currentRow = 0;
|
||||
int slot = 19;
|
||||
|
||||
for (GameTeam team : teamList)
|
||||
{
|
||||
ArrayList<Player> teamPlayers = team.GetPlayers(true);
|
||||
int rowsNeeded = (teamPlayers.size() / 8) + 1;
|
||||
|
||||
Collections.sort(teamPlayers, new Comparator<Player>()
|
||||
{
|
||||
for (Player other : players)
|
||||
{
|
||||
addPlayerItem(slot, team, other);
|
||||
|
||||
@Override
|
||||
public int compare(Player o1, Player o2)
|
||||
{
|
||||
return o1.getName().compareToIgnoreCase(o2.getName());
|
||||
}
|
||||
|
||||
});
|
||||
if ((slot + 2) % 9 == 0)
|
||||
slot += 3;
|
||||
else
|
||||
slot++;
|
||||
}
|
||||
}
|
||||
|
||||
for (int row = 0; row < rowsNeeded; row++)
|
||||
{
|
||||
int woolSlot = (row * 9) + (currentRow * 9);
|
||||
private void buildMultipleTeams(List<GameTeam> teamList, int playerCount)
|
||||
{
|
||||
int currentRow = 0;
|
||||
|
||||
// TODO Need to handle too many players in a better way
|
||||
if (woolSlot >= getSize())
|
||||
continue;
|
||||
for (GameTeam team : teamList)
|
||||
{
|
||||
ArrayList<Player> teamPlayers = team.GetPlayers(true);
|
||||
int rowsNeeded = (int) Math.ceil(teamPlayers.size() / 8.0);
|
||||
|
||||
setItem(woolSlot, getTeamItem(team, teamPlayers.size()));
|
||||
Collections.sort(teamPlayers, new Comparator<Player>()
|
||||
{
|
||||
|
||||
int startPlayerIndex = row * 9;
|
||||
for (int playerIndex = startPlayerIndex; playerIndex < teamPlayers.size() && playerIndex < startPlayerIndex + 9; playerIndex++)
|
||||
{
|
||||
Player other = teamPlayers.get(playerIndex);
|
||||
int slot = woolSlot + 1 + playerIndex;
|
||||
@Override
|
||||
public int compare(Player o1, Player o2)
|
||||
{
|
||||
return o1.getName().compareToIgnoreCase(o2.getName());
|
||||
}
|
||||
|
||||
// TODO Need to handle too many players in a better way
|
||||
if (slot >= getSize())
|
||||
continue;
|
||||
});
|
||||
|
||||
addPlayerItem(slot, team, other);
|
||||
}
|
||||
}
|
||||
for (int row = 0; row < rowsNeeded; row++)
|
||||
{
|
||||
int woolSlot = (row * 9) + (currentRow * 9);
|
||||
|
||||
// Add a line in between teams if the player count is low enough and there are less than 4 teams
|
||||
if (rowsNeeded == 1 && teamList.size() < 4 && playerCount <= 26)
|
||||
currentRow += 2;
|
||||
else
|
||||
currentRow += rowsNeeded;
|
||||
}
|
||||
}
|
||||
// TODO Need to handle too many players in a better way
|
||||
if (woolSlot >= getSize())
|
||||
continue;
|
||||
|
||||
private void addPlayerItem(int slot, GameTeam team, Player other)
|
||||
{
|
||||
ItemStack playerItem = getPlayerItem(team, other);
|
||||
ShopItem shopItem = new ShopItem(playerItem, other.getName(), other.getName(), 1, false, false);
|
||||
addButton(slot, shopItem, new SpectatorButton(_arcadeManager, getPlayer(), other));
|
||||
}
|
||||
setItem(woolSlot, getTeamItem(team, teamPlayers.size()));
|
||||
|
||||
private ItemStack getTeamItem(GameTeam team, int playerCount)
|
||||
{
|
||||
ItemStack item = new ItemStack(Material.WOOL, 1, (short) 0, UtilColor.chatColorToWoolData(team.GetColor()));
|
||||
int startPlayerIndex = row * 8;
|
||||
int count = 0;
|
||||
for (int playerIndex = startPlayerIndex; playerIndex < teamPlayers.size() && count < 8; playerIndex++)
|
||||
{
|
||||
count++;
|
||||
Player other = teamPlayers.get(playerIndex);
|
||||
int slot = woolSlot + 1 + playerIndex;
|
||||
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
meta.setDisplayName(team.GetFormattedName());
|
||||
meta.setLore(Arrays.asList(" ", ChatColor.RESET + C.cYellow + "Players Alive: " + C.cWhite + playerCount));
|
||||
item.setItemMeta(meta);
|
||||
// TODO Need to handle too many players in a better way
|
||||
if (slot >= getSize())
|
||||
continue;
|
||||
|
||||
return item;
|
||||
}
|
||||
addPlayerItem(slot, team, other);
|
||||
}
|
||||
}
|
||||
|
||||
private ItemStack getPlayerItem(GameTeam team, Player other)
|
||||
{
|
||||
ItemStack item = new ItemStack(Material.SKULL_ITEM, 1, (byte) 3);
|
||||
// Add a line in between teams if the player count is low enough and there are less than 4 teams
|
||||
if (rowsNeeded == 1 && teamList.size() < 4 && playerCount <= 26)
|
||||
currentRow += 2;
|
||||
else
|
||||
currentRow += rowsNeeded;
|
||||
}
|
||||
}
|
||||
|
||||
double distance = UtilMath.offset(getPlayer(), other);
|
||||
double heightDifference = other.getLocation().getY() - getPlayer().getLocation().getY();
|
||||
private void addPlayerItem(int slot, GameTeam team, Player other)
|
||||
{
|
||||
ItemStack playerItem = getPlayerItem(team, other);
|
||||
ShopItem shopItem = new ShopItem(playerItem, other.getName(), other.getName(), 1, false, false);
|
||||
addButton(slot, shopItem, new SpectatorButton(_arcadeManager, getPlayer(), other));
|
||||
}
|
||||
|
||||
ArrayList<String> lore = new ArrayList<String>();
|
||||
lore.add(" ");
|
||||
lore.add(ChatColor.RESET + C.cYellow + "Kit: " + C.cWhite + _arcadeManager.GetGame().GetKit(other).GetName());
|
||||
lore.add(ChatColor.RESET + C.cYellow + "Distance: " + C.cWhite + UtilMath.trim(1, distance));
|
||||
lore.add(ChatColor.RESET + C.cYellow + "Height Difference: " + C.cWhite + UtilMath.trim(1, heightDifference));
|
||||
lore.add(" ");
|
||||
lore.add(ChatColor.RESET + C.Line + "Click to Spectate");
|
||||
SkullMeta skullMeta = ((SkullMeta) item.getItemMeta());
|
||||
skullMeta.setOwner(other.getName());
|
||||
skullMeta.setDisplayName(team.GetColor() + other.getName());
|
||||
skullMeta.setLore(lore);
|
||||
item.setItemMeta(skullMeta);
|
||||
private ItemStack getTeamItem(GameTeam team, int playerCount)
|
||||
{
|
||||
ItemStack item = new ItemStack(Material.WOOL, 1, (short) 0, UtilColor.chatColorToWoolData(team.GetColor()));
|
||||
|
||||
return item;
|
||||
}
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
meta.setDisplayName(team.GetFormattedName());
|
||||
meta.setLore(Arrays.asList(" ", ChatColor.RESET + C.cYellow + "Players Alive: " + C.cWhite + playerCount));
|
||||
item.setItemMeta(meta);
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
private ItemStack getPlayerItem(GameTeam team, Player other)
|
||||
{
|
||||
ItemStack item = new ItemStack(Material.SKULL_ITEM, 1, (byte) 3);
|
||||
|
||||
double distance = UtilMath.offset(getPlayer(), other);
|
||||
double heightDifference = other.getLocation().getY() - getPlayer().getLocation().getY();
|
||||
|
||||
ArrayList<String> lore = new ArrayList<String>();
|
||||
lore.add(" ");
|
||||
lore.add(ChatColor.RESET + C.cYellow + "Kit: " + C.cWhite + _arcadeManager.GetGame().GetKit(other).GetName());
|
||||
lore.add(ChatColor.RESET + C.cYellow + "Distance: " + C.cWhite + UtilMath.trim(1, distance));
|
||||
lore.add(ChatColor.RESET + C.cYellow + "Height Difference: " + C.cWhite + UtilMath.trim(1, heightDifference));
|
||||
lore.add(" ");
|
||||
lore.add(ChatColor.RESET + C.Line + "Click to Spectate");
|
||||
SkullMeta skullMeta = ((SkullMeta) item.getItemMeta());
|
||||
skullMeta.setOwner(other.getName());
|
||||
skullMeta.setDisplayName(team.GetColor() + other.getName());
|
||||
skullMeta.setLore(lore);
|
||||
item.setItemMeta(skullMeta);
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
}
|
@ -35,10 +35,10 @@ import org.bukkit.event.player.PlayerVelocityEvent;
|
||||
import org.bukkit.scoreboard.DisplaySlot;
|
||||
import org.bukkit.scoreboard.Objective;
|
||||
import org.bukkit.scoreboard.Scoreboard;
|
||||
|
||||
import net.minecraft.server.v1_7_R4.Packet;
|
||||
import net.minecraft.server.v1_7_R4.PacketPlayOutEntityMetadata;
|
||||
import net.minecraft.server.v1_7_R4.WatchableObject;
|
||||
|
||||
import mineplex.core.account.CoreClient;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.C;
|
||||
@ -70,6 +70,7 @@ import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.game.Game;
|
||||
import nautilus.game.arcade.game.Game.GameState;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.games.uhc.UHC;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.kit.KitAvailability;
|
||||
import nautilus.game.arcade.kit.KitSorter;
|
||||
@ -110,6 +111,8 @@ public class GameLobbyManager implements Listener, IPacketHandler
|
||||
|
||||
private boolean _handlingPacket = false;
|
||||
private String _serverName;
|
||||
|
||||
private boolean _colorTick = false;
|
||||
|
||||
public GameLobbyManager(ArcadeManager manager, PacketHandler packetHandler)
|
||||
{
|
||||
@ -130,7 +133,7 @@ public class GameLobbyManager implements Listener, IPacketHandler
|
||||
_teamDisplay = new Location(world, 18, 101, 0);
|
||||
|
||||
Manager.getPluginManager().registerEvents(this, Manager.getPlugin());
|
||||
|
||||
|
||||
_serverName = Manager.getPlugin().getConfig().getString("serverstatus.name");
|
||||
_serverName = _serverName.substring(0, Math.min(16, _serverName.length()));
|
||||
}
|
||||
@ -327,50 +330,52 @@ public class GameLobbyManager implements Listener, IPacketHandler
|
||||
//UHC
|
||||
if (game.GetType() == GameType.UHC)
|
||||
{
|
||||
if (game.GetTeamList().size() > 1)
|
||||
{
|
||||
//Text
|
||||
WriteTeamLine("", 0, 159, (byte)15);
|
||||
WriteTeamLine("", 1, 159, (byte)4);
|
||||
|
||||
for (int i=0 ; i<game.GetTeamList().size() ; i++)
|
||||
{
|
||||
GameTeam team = game.GetTeamList().get(i);
|
||||
|
||||
//Circle Math
|
||||
double lead = i * ((2d * Math.PI)/game.GetTeamList().size());
|
||||
double sizeMod = 32;
|
||||
double oX = -Math.sin(lead) * sizeMod;
|
||||
double oZ = Math.cos(lead) * sizeMod;
|
||||
|
||||
//Location
|
||||
Location entLoc = spawn.clone().add(oX, 0, oZ);
|
||||
entLoc.setY(_teamDisplay.getY());
|
||||
|
||||
//Blocks
|
||||
SetKitTeamBlocks(entLoc.clone(), 35, team.GetColorData(), _teamBlocks);
|
||||
|
||||
entLoc.add(0, 1.5, 0);
|
||||
|
||||
entLoc.getChunk().load();
|
||||
|
||||
//NPC
|
||||
Sheep ent = (Sheep)Manager.GetCreature().SpawnEntity(entLoc, EntityType.SHEEP);
|
||||
ent.setRemoveWhenFarAway(false);
|
||||
ent.setCustomNameVisible(false);
|
||||
|
||||
ent.setColor(DyeColor.getByWoolData(team.GetColorData()));
|
||||
|
||||
UtilEnt.Vegetate(ent);
|
||||
|
||||
team.SetTeamEntity(ent);
|
||||
|
||||
_teams.put(ent, new LobbyEnt(ent, entLoc, team));
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
// if (game.GetTeamList().size() > 1)
|
||||
// {
|
||||
// //Text
|
||||
// WriteTeamLine("", 0, 159, (byte)15);
|
||||
// WriteTeamLine("", 1, 159, (byte)4);
|
||||
//
|
||||
// for (int i=0 ; i<game.GetTeamList().size() ; i++)
|
||||
// {
|
||||
// GameTeam team = game.GetTeamList().get(i);
|
||||
//
|
||||
// //Circle Math
|
||||
// double lead = i * ((2d * Math.PI)/game.GetTeamList().size());
|
||||
// double sizeMod = 32;
|
||||
// double oX = -Math.sin(lead) * sizeMod;
|
||||
// double oZ = Math.cos(lead) * sizeMod;
|
||||
//
|
||||
// //Location
|
||||
// Location entLoc = spawn.clone().add(oX, 0, oZ);
|
||||
// entLoc.setY(_teamDisplay.getY());
|
||||
//
|
||||
// //Blocks
|
||||
// SetKitTeamBlocks(entLoc.clone(), 35, team.GetColorData(), _teamBlocks);
|
||||
//
|
||||
// entLoc.add(0, 1.5, 0);
|
||||
//
|
||||
// entLoc.getChunk().load();
|
||||
//
|
||||
// //NPC
|
||||
// Sheep ent = (Sheep)Manager.GetCreature().SpawnEntity(entLoc, EntityType.SHEEP);
|
||||
// ent.setRemoveWhenFarAway(false);
|
||||
// ent.setCustomNameVisible(false);
|
||||
//
|
||||
// ent.setColor(DyeColor.getByWoolData(team.GetColorData()));
|
||||
//
|
||||
// UtilEnt.Vegetate(ent);
|
||||
//
|
||||
// team.SetTeamEntity(ent);
|
||||
//
|
||||
// _teams.put(ent, new LobbyEnt(ent, entLoc, team));
|
||||
// }
|
||||
//
|
||||
// return;
|
||||
//
|
||||
// }
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//Standard
|
||||
@ -912,11 +917,11 @@ public class GameLobbyManager implements Listener, IPacketHandler
|
||||
return;
|
||||
|
||||
if (Manager.GetGame() != null &&
|
||||
(Manager.GetGame().GetState() != GameState.Loading &&
|
||||
Manager.GetGame().GetState() != GameState.Recruit))
|
||||
(Manager.GetGame().GetState() != GameState.Loading &&
|
||||
Manager.GetGame().GetState() != GameState.Recruit))
|
||||
{
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
player.setScoreboard(Manager.GetGame().GetScoreboard().GetScoreboard());
|
||||
player.setScoreboard(Manager.GetGame().GetScoreboard().GetScoreboard()); //XXX
|
||||
}
|
||||
|
||||
else
|
||||
@ -934,8 +939,8 @@ public class GameLobbyManager implements Listener, IPacketHandler
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
||||
//this is called from above
|
||||
public void ScoreboardSet(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.FAST)
|
||||
@ -946,6 +951,8 @@ public class GameLobbyManager implements Listener, IPacketHandler
|
||||
return;
|
||||
}
|
||||
|
||||
_colorTick = !_colorTick;
|
||||
|
||||
for (Entry<Player, Scoreboard> entry : _scoreboardMap.entrySet())
|
||||
{
|
||||
Objective objective = entry.getValue().getObjective("§l" + "Lobby");
|
||||
@ -959,7 +966,14 @@ public class GameLobbyManager implements Listener, IPacketHandler
|
||||
}
|
||||
else
|
||||
{
|
||||
objective.setDisplayName(ChatColor.GREEN + "§l" + "Waiting for Players");
|
||||
if (Manager.GetGame() instanceof UHC && !((UHC)Manager.GetGame()).isMapLoaded())
|
||||
{
|
||||
objective.setDisplayName(((UHC)Manager.GetGame()).getMapLoadPercent() + " " + (_colorTick ? ChatColor.GREEN : ChatColor.YELLOW) + "§l" + "Generating Map");
|
||||
}
|
||||
else
|
||||
{
|
||||
objective.setDisplayName(ChatColor.GREEN + "§l" + "Waiting for Players");
|
||||
}
|
||||
}
|
||||
|
||||
int line = 15;
|
||||
@ -1203,21 +1217,42 @@ public class GameLobbyManager implements Listener, IPacketHandler
|
||||
rankName = Rank.ULTRA.Name;
|
||||
}
|
||||
|
||||
teamName = rankName + teamName;
|
||||
String rankTeamName = rankName + teamName;
|
||||
|
||||
for (Scoreboard scoreboard : GetScoreboards())
|
||||
{
|
||||
try
|
||||
{
|
||||
scoreboard.getTeam(teamName).addPlayer(player);
|
||||
scoreboard.getTeam(rankTeamName).addPlayer(player);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.out.println("GameLobbyManager AddPlayerToScoreboard Error");
|
||||
System.out.println("[" + rankName + teamName + "] adding [" + player.getName() + "]");
|
||||
System.out.println("Team is Null [" + (scoreboard.getTeam(rankName + teamName) == null) + "]");
|
||||
//UHC adds people to teams earlier than usual, which can case this
|
||||
if (Manager.GetGame() instanceof UHC)
|
||||
{
|
||||
try
|
||||
{
|
||||
Manager.GetGame().GetScoreboard().GetScoreboard().getTeam(teamName).addPlayer(player);
|
||||
System.out.println("GameLobbyManager UHC Team Assignment Success");
|
||||
break;
|
||||
}
|
||||
catch(Exception f)
|
||||
{
|
||||
System.out.println("GameLobbyManager AddPlayerToScoreboard UHC Error");
|
||||
System.out.println("[" + teamName + "] adding [" + player.getName() + "]");
|
||||
System.out.println("Team is Null [" + (Manager.GetGame().GetScoreboard().GetScoreboard().getTeam(teamName) == null) + "]");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
System.out.println("GameLobbyManager AddPlayerToScoreboard Error");
|
||||
System.out.println("[" + rankTeamName + "] adding [" + player.getName() + "]");
|
||||
System.out.println("Team is Null [" + (scoreboard.getTeam(rankTeamName) == null) + "]");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -239,7 +239,7 @@ public class GameManager implements Listener
|
||||
|
||||
if (force)
|
||||
game.SetCountdownForce(true);
|
||||
|
||||
|
||||
//Team Preference
|
||||
TeamPreferenceJoin(game);
|
||||
|
||||
|
@ -93,14 +93,15 @@ public class WorldData
|
||||
FileUtil.DeleteFolder(dir);
|
||||
|
||||
dir = new File(GetFolder() + "/level.dat");
|
||||
dir.delete();
|
||||
if (dir.exists())
|
||||
dir.delete();
|
||||
|
||||
//Create Fresh World with Random Seed
|
||||
WorldCreator creator = new WorldCreator(GetFolder());
|
||||
creator.seed(UtilMath.r(999999999));
|
||||
creator.environment(Environment.NORMAL);
|
||||
creator.generateStructures(true);
|
||||
World = creator.createWorld();
|
||||
World = WorldUtil.LoadWorld(creator);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user