Merge branch 'master' of ssh://184.154.0.242:7999/min/Mineplex into alex-compvanilla
This commit is contained in:
commit
31be60bdb4
@ -66,10 +66,10 @@
|
||||
</fileset>
|
||||
<fileset dir="../Mineplex.Core/bin">
|
||||
<include name="**/*.class"/>
|
||||
<include name="**/*.png"/>
|
||||
</fileset>
|
||||
<fileset dir="../Mineplex.Core.Common/bin">
|
||||
<include name="**/*.class"/>
|
||||
<include name="**/*.png"/>
|
||||
</fileset>
|
||||
<fileset dir="../Mineplex.Minecraft.Game.ClassCombat/bin">
|
||||
<include name="**/*.class"/>
|
||||
|
@ -8,6 +8,6 @@
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.ServerData"/>
|
||||
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/httpclient-4.2.jar"/>
|
||||
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/httpcore-4.2.jar"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.PlayerCache"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Cache"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
@ -5,8 +5,8 @@ import java.util.UUID;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import mineplex.bungee.playerStats.data.IpInfo;
|
||||
import mineplex.playerCache.PlayerCache;
|
||||
import mineplex.playerCache.PlayerInfo;
|
||||
import mineplex.cache.player.PlayerCache;
|
||||
import mineplex.cache.player.PlayerInfo;
|
||||
import net.md_5.bungee.api.event.PlayerDisconnectEvent;
|
||||
import net.md_5.bungee.api.event.PostLoginEvent;
|
||||
import net.md_5.bungee.api.plugin.Listener;
|
||||
|
@ -9,7 +9,7 @@ import java.sql.Statement;
|
||||
import java.util.UUID;
|
||||
|
||||
import mineplex.bungee.playerStats.data.IpInfo;
|
||||
import mineplex.playerCache.PlayerInfo;
|
||||
import mineplex.cache.player.PlayerInfo;
|
||||
|
||||
public class PlayerStatsRepository
|
||||
{
|
||||
|
@ -12,6 +12,7 @@ import java.util.Map.Entry;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import mineplex.core.common.structs.ItemContainer;
|
||||
|
||||
@ -1116,4 +1117,12 @@ public class UtilItem
|
||||
{
|
||||
return _materials.containsKey(material);
|
||||
}
|
||||
|
||||
public static ItemStack makeUnbreakable(ItemStack i)
|
||||
{
|
||||
ItemMeta im = i.getItemMeta();
|
||||
im.spigot().setUnbreakable(true);
|
||||
i.setItemMeta(im);
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,7 @@
|
||||
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/jooq-3.5.2.jar"/>
|
||||
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/craftbukkit.jar"/>
|
||||
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/NoCheatPlus.jar"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.PlayerCache"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Cache"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Core.Common"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
@ -9,6 +9,9 @@ import java.util.UUID;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
|
||||
import mineplex.cache.player.PlayerCache;
|
||||
import mineplex.cache.player.PlayerInfo;
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.account.command.TestRank;
|
||||
import mineplex.core.account.command.UpdateRank;
|
||||
@ -24,8 +27,6 @@ import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.timing.TimingManager;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.playerCache.PlayerCache;
|
||||
import mineplex.playerCache.PlayerInfo;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
|
@ -770,6 +770,48 @@ public enum Achievement
|
||||
new String[]{"Get hit by a monster and", "land on the Safe Pad"},
|
||||
new int[]{1},
|
||||
AchievementCategory.MONSTER_MAZE),
|
||||
|
||||
GLADIATORS_HARDENED_GLADIATOR("Hardened Gladiator", 1000,
|
||||
new String[]{"Gladiators.Wins"},
|
||||
new String[]{"Win 50 games of Gladiators"},
|
||||
new int[]{50},
|
||||
AchievementCategory.GLADIATORS),
|
||||
|
||||
GLADIATORS_BATTLE_BRED("Battle Bred", 1500,
|
||||
new String[]{"Gladiators.Wins"},
|
||||
new String[]{"Win 100 games of Gladiators"},
|
||||
new int[]{100},
|
||||
AchievementCategory.GLADIATORS),
|
||||
|
||||
GLADIATORS_BRAWLER("Brawler", 1000,
|
||||
new String[]{"Gladiators.Brawler"},
|
||||
new String[]{"Kill 3 Gladiators", "with your bare hands"},
|
||||
new int[]{3},
|
||||
AchievementCategory.GLADIATORS),
|
||||
|
||||
// GLADIATORS_UNTOUCHABLE("Untouchable", 1500,
|
||||
// new String[]{"Gladiators.Untouchable"},
|
||||
// new String[]{"Kill 10 Gladiators", "without taking any damage"},
|
||||
// new int[]{10},
|
||||
// AchievementCategory.GLADIATORS),
|
||||
|
||||
// GLADIATORS_FLAWLESS("Flawless", 1000,
|
||||
// new String[]{"Gladiators.Flawless"},
|
||||
// new String[]{"Win a game of gladiators", "without taking any damage"},
|
||||
// new int[]{1},
|
||||
// AchievementCategory.GLADIATORS),
|
||||
|
||||
GLADIATORS_PRECISION("Precision", 800,
|
||||
new String[]{"Gladiators.Precision"},
|
||||
new String[]{"Don't miss a single", "arrow in a game of", "Gladiators (Minimum 3)"},
|
||||
new int[]{1},
|
||||
AchievementCategory.GLADIATORS),
|
||||
|
||||
GLADIATORS_SWIFT_KILL("Swift Kill", 1000,
|
||||
new String[]{"Gladiators.SwiftKill"},
|
||||
new String[]{"Earn 15 first bloods", "in Gladiators"},
|
||||
new int[]{15},
|
||||
AchievementCategory.GLADIATORS)
|
||||
|
||||
;
|
||||
|
||||
|
@ -105,7 +105,7 @@ public enum AchievementCategory
|
||||
|
||||
ONE_IN_THE_QUIVER("One in the Quiver", null,
|
||||
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
|
||||
Material.BOW, 0, GameCategory.ARCADE, "Slam Shooter Kit"),
|
||||
Material.BOW, 0, GameCategory.ARCADE, "Ninja Kit"),
|
||||
|
||||
SUPER_PAINTBALL("Super Paintball", null,
|
||||
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
|
||||
@ -137,7 +137,7 @@ public enum AchievementCategory
|
||||
|
||||
MICRO_BATTLE("Micro Battle", null,
|
||||
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
|
||||
Material.LAVA, 0, GameCategory.ARCADE, null),
|
||||
Material.LAVA_BUCKET, 0, GameCategory.ARCADE, null),
|
||||
|
||||
BOMB_LOBBERS("Bomb Lobbers", null,
|
||||
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
|
||||
@ -150,6 +150,10 @@ public enum AchievementCategory
|
||||
MONSTER_MAZE("Monster Maze", null,
|
||||
new StatDisplay[] {StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED},
|
||||
Material.ROTTEN_FLESH, 0, GameCategory.ARCADE, "SoonTM"),
|
||||
|
||||
GLADIATORS("Gladiators", null,
|
||||
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
|
||||
Material.IRON_SWORD, 0, GameCategory.ARCADE, null)
|
||||
|
||||
;
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package mineplex.core.cosmetic.ui.page;
|
||||
|
||||
import mineplex.cache.player.PlayerCache;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.CurrencyType;
|
||||
import mineplex.core.common.util.C;
|
||||
@ -16,7 +17,6 @@ import mineplex.core.pet.repository.token.PetChangeToken;
|
||||
import mineplex.core.pet.repository.token.PetToken;
|
||||
import mineplex.core.shop.page.ConfirmationPage;
|
||||
import mineplex.core.shop.page.ShopPageBase;
|
||||
import mineplex.playerCache.PlayerCache;
|
||||
import net.minecraft.server.v1_8_R3.ItemStack;
|
||||
import net.minecraft.server.v1_8_R3.Items;
|
||||
|
||||
@ -64,7 +64,16 @@ public class PetTagPage extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
{
|
||||
_tagName = ChatColor.stripColor(_tagName);
|
||||
_tagName = _tagName.replaceAll("[^A-Za-z0-9]", "");
|
||||
|
||||
System.out.println("Pet name: " + _tagName + ".");
|
||||
if (_tagName.length() == 0)
|
||||
{
|
||||
UtilPlayer.message(getPlayer(), F.main(getPlugin().getName(), ChatColor.RED + "Supplied pet name contains invalid characters."));
|
||||
playDenySound(getPlayer());
|
||||
|
||||
getShop().openPageForPlayer(getPlayer(), new PetPage(getPlugin(), getShop(), getClientManager(), getDonationManager(), "Pets", getPlayer()));
|
||||
return;
|
||||
}
|
||||
|
||||
if (_tagName.length() > 16)
|
||||
{
|
||||
UtilPlayer.message(getPlayer(), F.main(getPlugin().getName(), ChatColor.RED + "Pet name cannot be longer than 16 characters."));
|
||||
|
@ -10,6 +10,8 @@ import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
|
||||
import mineplex.cache.player.PlayerCache;
|
||||
import mineplex.core.MiniDbClientPlugin;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.account.event.ClientWebResponseEvent;
|
||||
@ -24,7 +26,6 @@ import mineplex.core.donation.repository.token.DonorTokenWrapper;
|
||||
import mineplex.core.server.util.TransactionResponse;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.playerCache.PlayerCache;
|
||||
|
||||
public class DonationManager extends MiniDbClientPlugin<Donor>
|
||||
{
|
||||
|
@ -21,7 +21,7 @@ public class ParticleLegend extends ParticleGadget
|
||||
{
|
||||
super(manager, "Legendary Aura", new String[]
|
||||
{
|
||||
C.cWhite + "These mystic particle attach to",
|
||||
C.cWhite + "This mystic particle attaches to",
|
||||
C.cWhite + "only the most legendary of players!",
|
||||
" ",
|
||||
C.cGreen + "Unlocked with Legend Rank",
|
||||
|
@ -74,6 +74,8 @@ public enum GameDisplay
|
||||
|
||||
BouncyBalls("Bouncy Balls", Material.SLIME_BALL, (byte)0, GameCategory.ARCADE, 58),
|
||||
|
||||
Gladiators("Gladiators", Material.IRON_SWORD, (byte)0, GameCategory.ARCADE, 58),
|
||||
|
||||
Event("Mineplex Event", Material.CAKE, (byte)0, GameCategory.EVENT, 999);
|
||||
|
||||
String _name;
|
||||
|
@ -17,7 +17,7 @@ public class Ignore extends CommandBase<IgnoreManager>
|
||||
@Override
|
||||
public void Execute(final Player caller, final String[] args)
|
||||
{
|
||||
if (args == null)
|
||||
if (args == null || args.length < 1)
|
||||
{
|
||||
Plugin.showIgnores(caller);
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.cache.player.PlayerCache;
|
||||
import mineplex.core.MiniDbClientPlugin;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.util.Callback;
|
||||
@ -31,7 +32,6 @@ import mineplex.core.inventory.data.InventoryRepository;
|
||||
import mineplex.core.inventory.data.Item;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.playerCache.PlayerCache;
|
||||
|
||||
public class InventoryManager extends MiniDbClientPlugin<ClientInventory>
|
||||
{
|
||||
|
@ -128,7 +128,6 @@ public class PreferencesRepository extends RepositoryBase
|
||||
preferences.ClanTips = resultSet.getBoolean(13);
|
||||
preferences.HubMusic = resultSet.getBoolean(14);
|
||||
preferences.DisableAds = resultSet.getBoolean(15);
|
||||
System.out.println("<< " + resultSet.getBoolean(13));
|
||||
}
|
||||
|
||||
return preferences;
|
||||
|
@ -0,0 +1,29 @@
|
||||
package mineplex.core.profileCache;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.authlib.ProfileLookupCallback;
|
||||
|
||||
public class ProfileCacheLookupCallback implements ProfileLookupCallback
|
||||
{
|
||||
private ProfileCacheManager _profileCacheManager;
|
||||
private ProfileLookupCallback _profileLookupCallback;
|
||||
|
||||
public ProfileCacheLookupCallback(ProfileCacheManager profileCacheManager, ProfileLookupCallback profileLookupCallback)
|
||||
{
|
||||
_profileCacheManager = profileCacheManager;
|
||||
_profileLookupCallback = profileLookupCallback;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onProfileLookupFailed(GameProfile gameProfile, Exception exception)
|
||||
{
|
||||
_profileLookupCallback.onProfileLookupFailed(gameProfile, exception);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onProfileLookupSucceeded(GameProfile gameProfile)
|
||||
{
|
||||
_profileCacheManager.cacheProfile(gameProfile);
|
||||
_profileLookupCallback.onProfileLookupSucceeded(gameProfile);
|
||||
}
|
||||
}
|
@ -1,81 +1,134 @@
|
||||
//package mineplex.core.profileCache;
|
||||
//
|
||||
//import java.util.UUID;
|
||||
//
|
||||
//import org.bukkit.plugin.java.JavaPlugin;
|
||||
//import net.minecraft.util.com.google.gson.Gson;
|
||||
//import net.minecraft.util.com.google.gson.GsonBuilder;
|
||||
//import net.minecraft.util.com.mojang.authlib.GameProfile;
|
||||
//import net.minecraft.util.com.mojang.authlib.properties.PropertyMap;
|
||||
//import net.minecraft.util.com.mojang.authlib.yggdrasil.ProfileCache;
|
||||
//import net.minecraft.util.com.mojang.authlib.yggdrasil.YggdrasilGameProfileRepository;
|
||||
//import net.minecraft.util.com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService;
|
||||
//import net.minecraft.util.com.mojang.authlib.yggdrasil.response.ProfileSearchResultsResponse;
|
||||
//import net.minecraft.util.com.mojang.util.UUIDTypeAdapter;
|
||||
//
|
||||
//import mineplex.core.MiniPlugin;
|
||||
//import mineplex.serverdata.Region;
|
||||
//import mineplex.serverdata.redis.RedisDataRepository;
|
||||
//import mineplex.serverdata.servers.ServerManager;
|
||||
//
|
||||
//public class ProfileCacheManager extends MiniPlugin implements ProfileCache
|
||||
//{
|
||||
// private RedisDataRepository<ProfileData> _profileRepository;
|
||||
// private Gson _gson;
|
||||
//
|
||||
// public ProfileCacheManager(JavaPlugin plugin)
|
||||
// {
|
||||
// super("Profile Cache", plugin);
|
||||
//
|
||||
// _profileRepository = new RedisDataRepository<ProfileData>(ServerManager.getMasterConnection(), ServerManager.getSlaveConnection(),
|
||||
// Region.ALL, ProfileData.class, "profileCacheRepo");
|
||||
//
|
||||
// GsonBuilder builder = new GsonBuilder();
|
||||
// builder.registerTypeAdapter(PropertyMap.class, new PropertyMap.Serializer());
|
||||
// builder.registerTypeAdapter(UUID.class, new UUIDTypeAdapter());
|
||||
// builder.registerTypeAdapter(ProfileSearchResultsResponse.class, new net.minecraft.util.com.mojang.authlib.yggdrasil.response.ProfileSearchResultsResponse.Serializer());
|
||||
// _gson = builder.create();
|
||||
//
|
||||
// try
|
||||
// {
|
||||
// YggdrasilMinecraftSessionService.setProfileCache(this);
|
||||
// YggdrasilGameProfileRepository.setProfileCache(this);
|
||||
// }
|
||||
// catch (Exception e)
|
||||
// {
|
||||
// System.out.println("================================================");
|
||||
// System.out.println("Failed to load Profile Cache (Skins)");
|
||||
// System.out.println("Are you using the correct modified Craftbukkit?");
|
||||
// System.out.println("================================================");
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
// @Override
|
||||
// public GameProfile attemptToLoadProfile(String playerName)
|
||||
// {
|
||||
// ProfileData profile = _profileRepository.getElement(playerName.toLowerCase());
|
||||
//
|
||||
// if (profile != null)
|
||||
// {
|
||||
// PropertyMap propertyMap = _gson.fromJson(profile.getPropertyMap(), PropertyMap.class);
|
||||
// GameProfile gameProfile = new GameProfile(profile.getUuid(), profile.getPlayerName());
|
||||
// gameProfile.getProperties().putAll(propertyMap);
|
||||
//
|
||||
//// System.out.println("Loaded profile " + playerName + " from repository!");
|
||||
// return gameProfile;
|
||||
// }
|
||||
//
|
||||
//// System.out.println("Profile Null");
|
||||
//
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void cacheProfile(GameProfile profile)
|
||||
// {
|
||||
//// System.out.println("Cached profile: " + profile.getName());
|
||||
// ProfileData data = new ProfileData(profile.getId(), profile.getName(), _gson.toJson(profile.getProperties()));
|
||||
// _profileRepository.addElement(data, 60 * 60 * 24); // 1 day
|
||||
// }
|
||||
//}
|
||||
package mineplex.core.profileCache;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.CraftServer;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.mojang.authlib.Agent;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.authlib.GameProfileRepository;
|
||||
import com.mojang.authlib.ProfileLookupCallback;
|
||||
import com.mojang.authlib.properties.PropertyMap;
|
||||
import com.mojang.authlib.yggdrasil.YggdrasilGameProfileRepository;
|
||||
import com.mojang.authlib.yggdrasil.response.ProfileSearchResultsResponse;
|
||||
import com.mojang.util.UUIDTypeAdapter;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.serverdata.Region;
|
||||
import mineplex.serverdata.redis.RedisDataRepository;
|
||||
import mineplex.serverdata.servers.ServerManager;
|
||||
|
||||
public class ProfileCacheManager extends MiniPlugin implements GameProfileRepository
|
||||
{
|
||||
private YggdrasilGameProfileRepository _mojangProfileRepository;
|
||||
private RedisDataRepository<ProfileData> _profileRepository;
|
||||
private Gson _gson;
|
||||
|
||||
public ProfileCacheManager(JavaPlugin plugin)
|
||||
{
|
||||
super("Profile Cache", plugin);
|
||||
|
||||
_profileRepository = new RedisDataRepository<ProfileData>(ServerManager.getMasterConnection(), ServerManager.getSlaveConnection(),
|
||||
Region.ALL, ProfileData.class, "profileCacheRepo");
|
||||
|
||||
GsonBuilder builder = new GsonBuilder();
|
||||
builder.registerTypeAdapter(PropertyMap.class, new PropertyMap.Serializer());
|
||||
builder.registerTypeAdapter(UUID.class, new UUIDTypeAdapter());
|
||||
builder.registerTypeAdapter(ProfileSearchResultsResponse.class, new com.mojang.authlib.yggdrasil.response.ProfileSearchResultsResponse.Serializer());
|
||||
_gson = builder.create();
|
||||
|
||||
try
|
||||
{
|
||||
Field mojangProfileRepo = net.minecraft.server.v1_8_R3.MinecraftServer.class.getDeclaredField("Y");
|
||||
|
||||
mojangProfileRepo.setAccessible(true);
|
||||
|
||||
_mojangProfileRepository = (YggdrasilGameProfileRepository) mojangProfileRepo.get(((CraftServer)Bukkit.getServer()).getServer());
|
||||
mojangProfileRepo.set(((CraftServer)Bukkit.getServer()).getServer(), this);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
System.out.println("================================================");
|
||||
System.out.println("Failed to load Profile Cache (Skins)");
|
||||
System.out.println("Are you using the correct modified Craftbukkit?");
|
||||
System.out.println("================================================");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public GameProfile attemptToLoadProfile(String playerName)
|
||||
{
|
||||
ProfileData profile = _profileRepository.getElement(playerName.toLowerCase());
|
||||
|
||||
if (profile != null)
|
||||
{
|
||||
PropertyMap propertyMap = _gson.fromJson(profile.getPropertyMap(), PropertyMap.class);
|
||||
GameProfile gameProfile = new GameProfile(profile.getUuid(), profile.getPlayerName());
|
||||
gameProfile.getProperties().putAll(propertyMap);
|
||||
return gameProfile;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public void cacheProfile(final GameProfile profile)
|
||||
{
|
||||
if (Bukkit.isPrimaryThread())
|
||||
{
|
||||
runAsync(new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
cacheProfileSafely(profile);
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
cacheProfileSafely(profile);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void findProfilesByNames(String[] profileNames, Agent agent, ProfileLookupCallback profileLookupCallback)
|
||||
{
|
||||
List<String> uncachedProfileNames = new ArrayList<>();
|
||||
|
||||
for (String profileName : profileNames)
|
||||
{
|
||||
GameProfile profile = attemptToLoadProfile(profileName);
|
||||
|
||||
if (profile == null)
|
||||
uncachedProfileNames.add(profileName);
|
||||
else
|
||||
profileLookupCallback.onProfileLookupSucceeded(profile);
|
||||
}
|
||||
|
||||
_mojangProfileRepository.findProfilesByNames(uncachedProfileNames.toArray(new String[uncachedProfileNames.size()]), agent, new ProfileCacheLookupCallback(this, profileLookupCallback));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void clearRepository(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.MIN_10)
|
||||
return;
|
||||
|
||||
_profileRepository.clean();
|
||||
}
|
||||
|
||||
private void cacheProfileSafely(GameProfile profile)
|
||||
{
|
||||
ProfileData data = new ProfileData(profile.getId(), profile.getName(), _gson.toJson(profile.getProperties()));
|
||||
_profileRepository.addElement(data, 60 * 60 * 24); // 1 day
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.cache.player.PlayerCache;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.inventory.InventoryManager;
|
||||
import mineplex.core.pet.PetManager;
|
||||
@ -13,7 +14,6 @@ import mineplex.core.pet.repository.token.PetToken;
|
||||
import mineplex.core.reward.RewardData;
|
||||
import mineplex.core.reward.RewardRarity;
|
||||
import mineplex.core.reward.RewardType;
|
||||
import mineplex.playerCache.PlayerCache;
|
||||
|
||||
/**
|
||||
* Created by shaun on 14-09-18.
|
||||
|
@ -9,6 +9,7 @@ import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.cache.player.PlayerCache;
|
||||
import mineplex.core.MiniDbClientPlugin;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
@ -16,7 +17,6 @@ import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.stats.command.GiveStatCommand;
|
||||
import mineplex.core.stats.command.TimeCommand;
|
||||
import mineplex.core.stats.event.StatChangeEvent;
|
||||
import mineplex.playerCache.PlayerCache;
|
||||
|
||||
public class StatsManager extends MiniDbClientPlugin<PlayerStats>
|
||||
{
|
||||
|
@ -5,12 +5,12 @@ import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import mineplex.cache.player.PlayerCache;
|
||||
import mineplex.core.MiniDbClientPlugin;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.task.repository.TaskRepository;
|
||||
import mineplex.playerCache.PlayerCache;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Core"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Core.Common"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Database"/>
|
||||
|
@ -38,6 +38,7 @@ import mineplex.core.pet.PetManager;
|
||||
import mineplex.core.poll.PollManager;
|
||||
import mineplex.core.portal.Portal;
|
||||
import mineplex.core.preferences.PreferencesManager;
|
||||
import mineplex.core.profileCache.ProfileCacheManager;
|
||||
import mineplex.core.projectile.ProjectileManager;
|
||||
import mineplex.core.punish.Punish;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
@ -182,6 +183,8 @@ public class Hub extends JavaPlugin implements IRelation
|
||||
new ClassCombatShop(shopManager, clientManager, donationManager, false, "Knight", classManager.GetClass("Knight"), true);
|
||||
new ClassCombatShop(shopManager, clientManager, donationManager, false, "Assassin", classManager.GetClass("Assassin"), true);
|
||||
|
||||
new ProfileCacheManager(this);
|
||||
|
||||
//Updates
|
||||
getServer().getScheduler().scheduleSyncRepeatingTask(this, new Updater(this), 1, 1);
|
||||
}
|
||||
|
@ -15,7 +15,9 @@ import org.bukkit.inventory.meta.SkullMeta;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.game.GameDisplay;
|
||||
@ -78,17 +80,8 @@ public class ServerNpcPage extends ShopPageInventory<ServerManager, ServerNpcSho
|
||||
exception.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
if (_onMainPage)
|
||||
{
|
||||
addButton(4, ItemStackFactory.Instance.CreateStack(Material.DIAMOND_BLOCK, (byte) 0, 1, C.cGreen + "Click to join instantly!"), new IButton() {
|
||||
|
||||
@Override
|
||||
public void onClick(Player player, ClickType clickType) {
|
||||
getPlugin().selectServer(player, _serverGroupName);
|
||||
}
|
||||
});
|
||||
|
||||
buildAvailableServerPage(serverList, slotsNeeded);
|
||||
}
|
||||
else
|
||||
@ -108,7 +101,7 @@ public class ServerNpcPage extends ShopPageInventory<ServerManager, ServerNpcSho
|
||||
ChatColor.RESET + timeLeft + " Remaining...",
|
||||
ChatColor.RESET + "",
|
||||
ChatColor.RESET + C.cGreen + "Do you love playing on Mineplex?",
|
||||
ChatColor.RESET + "If you do, please consider purchasing Ultra or Hero",
|
||||
ChatColor.RESET + "If you do, please consider purchasing a premium rank",
|
||||
ChatColor.RESET + "from the store! Money goes towards running servers",
|
||||
ChatColor.RESET + "and creating exciting new games for everyone!",
|
||||
ChatColor.RESET + "",
|
||||
@ -297,15 +290,25 @@ public class ServerNpcPage extends ShopPageInventory<ServerManager, ServerNpcSho
|
||||
}
|
||||
}
|
||||
|
||||
addButton(40, new ShopItem(Material.GOLD_BLOCK, C.cAqua + yellowCount + " Game" + (yellowCount == 1 ? "" : "s") + " In Progress", new String[]{MESSAGE_SPECTATE}, yellowCount > 64 ? 64 : yellowCount, false), new IButton()
|
||||
{
|
||||
@Override
|
||||
public void onClick(Player player, ClickType clickType)
|
||||
if(showGreen) {
|
||||
addButton(40, new ShopItem(Material.GOLD_BLOCK, C.cAqua + yellowCount + " Game" + (yellowCount == 1 ? "" : "s") + " In Progress", new String[]{MESSAGE_SPECTATE}, yellowCount > 64 ? 64 : yellowCount, false), new IButton()
|
||||
{
|
||||
_onMainPage = false;
|
||||
}
|
||||
});
|
||||
|
||||
@Override
|
||||
public void onClick(Player player, ClickType clickType)
|
||||
{
|
||||
_onMainPage = false;
|
||||
}
|
||||
});
|
||||
|
||||
addButton(4, ItemStackFactory.Instance.CreateStack(Material.DIAMOND_BLOCK, (byte) 0, 1, C.cGreen + "Click to join instantly!"), new IButton() {
|
||||
|
||||
@Override
|
||||
public void onClick(Player player, ClickType clickType) {
|
||||
getPlugin().selectServer(player, _serverGroupName);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Clear empty slots
|
||||
if (showGreen)
|
||||
{
|
||||
|
@ -134,9 +134,30 @@ public class Flash extends SkillActive
|
||||
while (curRange <= maxRange)
|
||||
{
|
||||
Location newTarget = player.getLocation().add(new Vector(0,0.2,0)).add(player.getLocation().getDirection().multiply(curRange));
|
||||
|
||||
if (!UtilBlock.airFoliage(newTarget.getBlock()) ||
|
||||
!UtilBlock.airFoliage(newTarget.getBlock().getRelative(BlockFace.UP)))
|
||||
Location aboveTarget = newTarget.getBlock().getRelative(BlockFace.UP).getLocation();
|
||||
|
||||
// half-slab
|
||||
boolean newTargetIsSlab = newTarget.getBlock().getType() == Material.STEP || newTarget.getBlock().getType() == Material.WOOD_STEP;
|
||||
boolean aboveTargetIsSlab = aboveTarget.getBlock().getType() == Material.STEP || aboveTarget.getBlock().getType() == Material.WOOD_STEP;
|
||||
|
||||
boolean newTargetSlabIsBottom = false;
|
||||
boolean aboveTargetSlabIsBottom = false;
|
||||
|
||||
if(newTargetIsSlab && curRange < 0.5)
|
||||
{
|
||||
int newTargetData = (int) newTarget.getBlock().getData();
|
||||
|
||||
if(newTargetData <= 7) newTargetSlabIsBottom = true;
|
||||
}
|
||||
|
||||
if(aboveTargetIsSlab && curRange < 0.25)
|
||||
{
|
||||
int aboveTargetData = (int) aboveTarget.getBlock().getData();
|
||||
|
||||
if(aboveTargetData <= 7) aboveTargetSlabIsBottom = true;
|
||||
}
|
||||
|
||||
if ((!newTargetSlabIsBottom && UtilBlock.fullSolid(newTarget.getBlock())) || (!aboveTargetSlabIsBottom && UtilBlock.fullSolid(aboveTarget.getBlock())))
|
||||
break;
|
||||
|
||||
//Progress Forwards
|
||||
|
@ -84,6 +84,9 @@ public class ShieldSmash extends SkillActive
|
||||
|
||||
if (cur.equals(player))
|
||||
continue;
|
||||
|
||||
if (UtilPlayer.isSpectator(cur))
|
||||
continue;
|
||||
|
||||
if (UtilMath.offset(loc, cur.getLocation()) > 2.5)
|
||||
continue;
|
||||
|
@ -94,13 +94,16 @@ public class FissureData
|
||||
_loc.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getTypeId());
|
||||
|
||||
//Slow
|
||||
for (Player cur : block.getWorld().getPlayers())
|
||||
for (Player cur : block.getWorld().getPlayers()) {
|
||||
if(UtilPlayer.isSpectator(cur)) continue;
|
||||
|
||||
if (!cur.equals(_player))
|
||||
if (UtilMath.offset(block.getLocation().add(0.5, 0.5, 0.5), cur.getLocation()) < 1.5)
|
||||
{
|
||||
//Condition
|
||||
Host.Factory.Condition().Factory().Slow("Fissure", cur, _player, 1 + _level, 1, false, true, true, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -146,7 +149,10 @@ public class FissureData
|
||||
up.getWorld().playEffect(up.getLocation(), Effect.STEP_SOUND, block.getTypeId());
|
||||
|
||||
//Damage
|
||||
for (Player cur : up.getWorld().getPlayers())
|
||||
for (Player cur : up.getWorld().getPlayers()) {
|
||||
if (UtilPlayer.isSpectator(cur))
|
||||
continue;
|
||||
|
||||
if (!cur.equals(_player))
|
||||
{
|
||||
//Teleport
|
||||
@ -172,7 +178,7 @@ public class FissureData
|
||||
UtilPlayer.message(cur, F.main(Host.GetClassType().name(), F.name(_player.getName()) +" hit you with " + F.skill(Host.GetName(_level)) + "."));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
//Next Column
|
||||
if (_height >= Math.min(3, _handled/2 + 1))
|
||||
{
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>Mineplex.PlayerCache</name>
|
||||
<name>Mineplex.Cache</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
|
@ -1,4 +1,4 @@
|
||||
package mineplex.playerCache;
|
||||
package mineplex.cache.player;
|
||||
|
||||
import java.util.UUID;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package mineplex.playerCache;
|
||||
package mineplex.cache.player;
|
||||
|
||||
import java.util.UUID;
|
||||
|
@ -15,6 +15,7 @@ import mineplex.core.monitor.LagMeter;
|
||||
import mineplex.core.npc.NpcManager;
|
||||
import mineplex.core.portal.Portal;
|
||||
import mineplex.core.preferences.PreferencesManager;
|
||||
import mineplex.core.profileCache.ProfileCacheManager;
|
||||
import mineplex.core.punish.Punish;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.stats.StatsManager;
|
||||
@ -88,6 +89,8 @@ public class StaffServer extends JavaPlugin
|
||||
|
||||
((CraftServer)getServer()).getHandle().addOp(new GameProfile(UUID.fromString("377bdea3-badc-448d-81c1-65db43b17ea4"), "Strutt20"));
|
||||
((CraftServer)getServer()).getHandle().addOp(new GameProfile(UUID.fromString("efaf9a17-2304-4f42-8433-421523c308dc"), "B2_mp"));
|
||||
((CraftServer)getServer()).getHandle().addOp(new GameProfile(UUID.fromString("cf85f470-5248-4978-8208-435736fa136e"), "RustyRoo"));
|
||||
((CraftServer)getServer()).getHandle().addOp(new GameProfile(UUID.fromString("cf85f470-5248-4978-8208-435736fa136e"), "RustyRoo"));
|
||||
|
||||
new ProfileCacheManager(this);
|
||||
}
|
||||
}
|
||||
|
@ -45,6 +45,7 @@ import mineplex.core.pet.PetManager;
|
||||
import mineplex.core.poll.PollManager;
|
||||
import mineplex.core.portal.Portal;
|
||||
import mineplex.core.preferences.PreferencesManager;
|
||||
import mineplex.core.profileCache.ProfileCacheManager;
|
||||
import mineplex.core.projectile.ProjectileManager;
|
||||
import mineplex.core.punish.Punish;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
@ -160,6 +161,8 @@ public class Arcade extends JavaPlugin
|
||||
new PacketsInteractionFix(this, packetHandler);
|
||||
new FoodDupeFix(this);
|
||||
|
||||
new ProfileCacheManager(this);
|
||||
|
||||
//Updates
|
||||
getServer().getScheduler().scheduleSyncRepeatingTask(this, new Updater(this), 1, 1);
|
||||
|
||||
|
@ -26,6 +26,7 @@ import nautilus.game.arcade.game.games.dragons.DragonsTeams;
|
||||
import nautilus.game.arcade.game.games.draw.Draw;
|
||||
import nautilus.game.arcade.game.games.event.EventGame;
|
||||
import nautilus.game.arcade.game.games.evolution.Evolution;
|
||||
import nautilus.game.arcade.game.games.gladiators.Gladiators;
|
||||
import nautilus.game.arcade.game.games.gravity.Gravity;
|
||||
import nautilus.game.arcade.game.games.halloween.Halloween;
|
||||
import nautilus.game.arcade.game.games.hideseek.HideSeek;
|
||||
@ -130,6 +131,7 @@ public enum GameType
|
||||
SkywarsTeams(TeamSkywars.class, GameDisplay.SkywarsTeams, new GameType[]{GameType.Skywars}, false),
|
||||
MonsterMaze(MonsterMaze.class, GameDisplay.MonsterMaze),
|
||||
MonsterLeague(MonsterLeague.class, GameDisplay.MonsterLeague),
|
||||
Gladiators(Gladiators.class, GameDisplay.Gladiators),
|
||||
|
||||
BouncyBalls(BouncyBalls.class, GameDisplay.BouncyBalls),
|
||||
|
||||
|
@ -0,0 +1,39 @@
|
||||
package nautilus.game.arcade.events;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Created by William (WilliamTiger).
|
||||
* 10/12/15
|
||||
*/
|
||||
public class FirstBloodEvent extends Event
|
||||
{
|
||||
|
||||
private Player player;
|
||||
|
||||
public FirstBloodEvent(Player player)
|
||||
{
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
public Player getPlayer()
|
||||
{
|
||||
return player;
|
||||
}
|
||||
|
||||
private static HandlerList _handlers = new HandlerList();
|
||||
|
||||
public static HandlerList getHandlerList()
|
||||
{
|
||||
return _handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers()
|
||||
{
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
}
|
@ -36,7 +36,6 @@ import org.bukkit.event.entity.FoodLevelChangeEvent;
|
||||
import org.bukkit.event.entity.ItemSpawnEvent;
|
||||
import org.bukkit.event.hanging.HangingBreakEvent;
|
||||
import org.bukkit.event.hanging.HangingPlaceEvent;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerLoginEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
@ -73,6 +72,7 @@ import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.events.PlayerGameRespawnEvent;
|
||||
import nautilus.game.arcade.events.PlayerStateChangeEvent;
|
||||
import nautilus.game.arcade.game.GameTeam.PlayerState;
|
||||
import nautilus.game.arcade.gametutorial.GameTutorial;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.kit.KitAvailability;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
@ -303,6 +303,8 @@ public abstract class Game implements Listener
|
||||
public boolean DeadBodiesDeath = true;
|
||||
public int DeadBodiesExpire = -1;
|
||||
|
||||
public boolean EnableTutorials = false;
|
||||
|
||||
public boolean FixSpawnFacing = true;
|
||||
|
||||
private IPacketHandler _useEntityPacketHandler;
|
||||
@ -1729,21 +1731,6 @@ public abstract class Game implements Listener
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void debug(PlayerCommandPreprocessEvent event)
|
||||
{
|
||||
if (event.getMessage().equals("/debugteams"))
|
||||
{
|
||||
for (GameTeam team : GetTeamList())
|
||||
{
|
||||
event.getPlayer().sendMessage(team.GetFormattedName());
|
||||
|
||||
for (Player player : team.GetPlayers(false))
|
||||
{
|
||||
event.getPlayer().sendMessage(player.getName() + ": " + team.IsAlive(player));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void addTutorials(){}
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.visibility.VisibilityManager;
|
||||
import nautilus.game.arcade.game.GameTeam.PlayerState;
|
||||
import nautilus.game.arcade.gametutorial.GameTutorial;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.kit.KitAvailability;
|
||||
|
||||
@ -58,6 +59,8 @@ public class GameTeam
|
||||
private String _name;
|
||||
private String _displayName;
|
||||
private ChatColor _color;
|
||||
|
||||
private GameTutorial _tutorial;
|
||||
|
||||
private HashMap<Player, PlayerState> _players = new HashMap<Player, PlayerState>();
|
||||
|
||||
@ -447,4 +450,15 @@ public class GameTeam
|
||||
|
||||
return _places;
|
||||
}
|
||||
|
||||
public GameTutorial getTutorial()
|
||||
{
|
||||
return _tutorial;
|
||||
}
|
||||
|
||||
public void setTutorial(GameTutorial tutorial)
|
||||
{
|
||||
_tutorial = tutorial;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,424 @@
|
||||
package nautilus.game.arcade.game.games.gladiators;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilTextBottom;
|
||||
import mineplex.core.common.util.UtilTextMiddle;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import nautilus.game.arcade.game.games.gladiators.events.PlayerChangeArenaEvent;
|
||||
|
||||
/**
|
||||
* Created by William (WilliamTiger).
|
||||
* 07/12/15
|
||||
*/
|
||||
public class Arena
|
||||
{
|
||||
|
||||
private Gladiators _host;
|
||||
private ArenaType _colour;
|
||||
private Location _mid;
|
||||
private ArrayList<Location> _spawns;
|
||||
|
||||
private Arena _parent;
|
||||
private Arena[] _childs = new Arena[2];
|
||||
private boolean _isUsed;
|
||||
|
||||
private ArrayList<Location> _doorBlocks;
|
||||
private boolean _isOpenDoor;
|
||||
private boolean _doBye;
|
||||
|
||||
private ArrayList<Player> _pastPlayers;
|
||||
|
||||
private ArenaState _state;
|
||||
private long _stateTime;
|
||||
|
||||
private boolean _alertedAlready;
|
||||
private boolean _alertedAlready2;
|
||||
|
||||
private HashMap<Player, ArrayList<ParticleData>> _particles;
|
||||
|
||||
public Arena(Gladiators host, Location mid, ArenaType colour)
|
||||
{
|
||||
_host = host;
|
||||
_mid = mid;
|
||||
_colour = colour;
|
||||
_spawns = new ArrayList<>();
|
||||
_parent = null;
|
||||
_isUsed = false;
|
||||
_doorBlocks = new ArrayList<>();
|
||||
_isOpenDoor = false;
|
||||
_pastPlayers = new ArrayList<>();
|
||||
_state = ArenaState.EMPTY;
|
||||
_stateTime = System.currentTimeMillis();
|
||||
_particles = new HashMap<>();
|
||||
_doBye = false;
|
||||
_alertedAlready = false;
|
||||
_alertedAlready2 = false;
|
||||
|
||||
setupSpawns();
|
||||
}
|
||||
|
||||
public boolean isDoBye()
|
||||
{
|
||||
return _doBye;
|
||||
}
|
||||
|
||||
public void setDoBye(boolean doBye)
|
||||
{
|
||||
_doBye = doBye;
|
||||
}
|
||||
|
||||
public Arena getParent()
|
||||
{
|
||||
return _parent;
|
||||
}
|
||||
|
||||
public long getStateTime()
|
||||
{
|
||||
return _stateTime;
|
||||
}
|
||||
|
||||
public void setStateTime(long stateTime)
|
||||
{
|
||||
_stateTime = stateTime;
|
||||
}
|
||||
|
||||
public void setParent(Arena parent)
|
||||
{
|
||||
_parent = parent;
|
||||
}
|
||||
|
||||
public Arena getChildAt(int index)
|
||||
{
|
||||
return _childs[index];
|
||||
}
|
||||
|
||||
public Arena[] getChilds()
|
||||
{
|
||||
return _childs;
|
||||
}
|
||||
|
||||
public int getCapacity()
|
||||
{
|
||||
int cap = _childs.length;
|
||||
|
||||
for(Arena child : _childs)
|
||||
{
|
||||
if(child != null)
|
||||
if(child.isUsed()) cap--;
|
||||
}
|
||||
|
||||
return cap;
|
||||
}
|
||||
|
||||
public ArenaState getState()
|
||||
{
|
||||
return _state;
|
||||
}
|
||||
|
||||
public void setState(ArenaState state)
|
||||
{
|
||||
_state = state;
|
||||
}
|
||||
|
||||
public ArrayList<Location> getDoorBlocks()
|
||||
{
|
||||
return _doorBlocks;
|
||||
}
|
||||
|
||||
public void setChild(int index, Arena child)
|
||||
{
|
||||
_childs[index] = child;
|
||||
child.setParent(this);
|
||||
}
|
||||
|
||||
public void getUsageMap(HashMap<Arena, Integer> used)
|
||||
{
|
||||
if(isUsed()) used.put(this, getCapacity());
|
||||
|
||||
for(Arena child : _childs)
|
||||
{
|
||||
if(child != null) child.getUsageMap(used);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean areChildrenUsed()
|
||||
{
|
||||
for(Arena child : _childs)
|
||||
{
|
||||
if(child != null)
|
||||
if(!child.isUsed()) return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public Arena getUnusedChild()
|
||||
{
|
||||
for(Arena child : _childs)
|
||||
{
|
||||
if(child != null)
|
||||
if(!child.isUsed()) return child;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean isAlertedAlready()
|
||||
{
|
||||
return _alertedAlready;
|
||||
}
|
||||
|
||||
public void setAlertedAlready(boolean alertedAlready)
|
||||
{
|
||||
_alertedAlready = alertedAlready;
|
||||
}
|
||||
|
||||
private void setupSpawns()
|
||||
{
|
||||
ArrayList<Location> possible = (ArrayList<Location>) _host.WorldData.GetDataLocs("BLACK").clone();
|
||||
_mid.setY(UtilAlg.findClosest(_mid, possible).getY());
|
||||
|
||||
_spawns.add(correctFace(UtilAlg.findClosest(_mid, possible)));
|
||||
possible.remove(_spawns.get(0));
|
||||
_spawns.add(correctFace(UtilAlg.findClosest(_mid, possible)));
|
||||
}
|
||||
|
||||
private Location correctFace(Location l)
|
||||
{
|
||||
l.setPitch(UtilAlg.GetPitch(UtilAlg.getTrajectory(l, _mid)));
|
||||
l.setYaw(UtilAlg.GetYaw(UtilAlg.getTrajectory(l, _mid)));
|
||||
return l;
|
||||
}
|
||||
|
||||
public Gladiators getHost()
|
||||
{
|
||||
return _host;
|
||||
}
|
||||
|
||||
public ArenaType getColour()
|
||||
{
|
||||
return _colour;
|
||||
}
|
||||
|
||||
public Location getMid()
|
||||
{
|
||||
return _mid;
|
||||
}
|
||||
|
||||
public ArrayList<Location> getSpawns()
|
||||
{
|
||||
return _spawns;
|
||||
}
|
||||
|
||||
public ArrayList<Location> capacitySpawns()
|
||||
{
|
||||
ArrayList<Location> ret = new ArrayList<>();
|
||||
|
||||
if (getCapacity() == 0) return ret;
|
||||
if (getCapacity() == 1)
|
||||
{
|
||||
ret.add(_spawns.get(0));
|
||||
return ret;
|
||||
}
|
||||
if (getCapacity() == 2)
|
||||
{
|
||||
ret.add(_spawns.get(0));
|
||||
ret.add(_spawns.get(1));
|
||||
return ret;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
public ArrayList<Player> getPastPlayers()
|
||||
{
|
||||
return _pastPlayers;
|
||||
}
|
||||
|
||||
public boolean isUsed()
|
||||
{
|
||||
return _isUsed;
|
||||
}
|
||||
|
||||
public void setIsUsed(boolean isUsed)
|
||||
{
|
||||
_isUsed = isUsed;
|
||||
}
|
||||
|
||||
public void closeDoor()
|
||||
{
|
||||
_host.Manager.getScheduler().scheduleSyncDelayedTask(_host.Manager.getPlugin(), new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
for (Location loc : _doorBlocks)
|
||||
loc.getBlock().setType(Material.OBSIDIAN);
|
||||
|
||||
// Lag exploit check
|
||||
for (Player p : getPastPlayers())
|
||||
{
|
||||
Arena closest = _host.getArenaByMid(UtilAlg.findClosest(p.getLocation(), _host.getAllArenaMids()));
|
||||
if (closest != _host.getPlayerArenas().get(p))
|
||||
p.teleport(UtilAlg.findClosest(p.getLocation(), getSpawns()));
|
||||
}
|
||||
}
|
||||
}, 5L);
|
||||
}
|
||||
|
||||
public boolean isOpenDoor()
|
||||
{
|
||||
return _isOpenDoor;
|
||||
}
|
||||
|
||||
public void openDoor()
|
||||
{
|
||||
_isOpenDoor = true;
|
||||
|
||||
_host.Manager.getScheduler().scheduleSyncDelayedTask(_host.Manager.getPlugin(), () -> {
|
||||
|
||||
for (Location loc : _doorBlocks)
|
||||
{
|
||||
loc.getBlock().setType(Material.AIR);
|
||||
}
|
||||
|
||||
}, 5L);
|
||||
}
|
||||
|
||||
public void update()
|
||||
{
|
||||
if (getPastPlayers().size() <= 0)
|
||||
{
|
||||
setState(ArenaState.EMPTY);
|
||||
return; // Empty check.
|
||||
}
|
||||
|
||||
if (_state.equals(ArenaState.WAITING))
|
||||
{
|
||||
if (_host.getRoundState() != RoundState.FIGHTING)
|
||||
return;
|
||||
|
||||
if (_alertedAlready)
|
||||
return;
|
||||
|
||||
for (Player p : getPastPlayers())
|
||||
{
|
||||
UtilTextMiddle.display(C.cAqua + "Please Wait", "The next round will start shortly", 0, 20 * 100, 0, p);
|
||||
}
|
||||
|
||||
_alertedAlready = true;
|
||||
}
|
||||
else if (_state.equals(ArenaState.FIGHTING))
|
||||
{
|
||||
if (getPastPlayers().size() == 1)
|
||||
{
|
||||
openDoor();
|
||||
|
||||
setState(ArenaState.RUNNING);
|
||||
setStateTime(System.currentTimeMillis());
|
||||
return;
|
||||
}
|
||||
|
||||
if (!UtilTime.elapsed(_stateTime, 60000))
|
||||
return; // No poison yet.
|
||||
|
||||
for (Player p : getPastPlayers())
|
||||
{
|
||||
UtilTextBottom.display(C.cRed + C.Bold + "YOU ARE POISONED! KEEP FIGHTING!", p);
|
||||
_host.Manager.GetDamage().NewDamageEvent(p, null, null, EntityDamageEvent.DamageCause.CUSTOM, 1D, false, true, true, "Health Loss", "Health Loss");
|
||||
}
|
||||
}
|
||||
else if (_state.equals(ArenaState.RUNNING))
|
||||
{
|
||||
for (Player p : getPastPlayers())
|
||||
{
|
||||
if (_alertedAlready2)
|
||||
continue;
|
||||
|
||||
UtilTextMiddle.display(C.cGreen + "Next Battle", "Follow the particles", 0, 20 * 100, 0, p);
|
||||
}
|
||||
|
||||
_alertedAlready2 = true;
|
||||
|
||||
if (UtilTime.elapsed(_stateTime, 15000))
|
||||
handleSlowMovers();
|
||||
}
|
||||
}
|
||||
|
||||
public void updateTick()
|
||||
{
|
||||
if (_state.equals(ArenaState.RUNNING))
|
||||
{
|
||||
for (Player p : getPastPlayers())
|
||||
showParticles(p);
|
||||
}
|
||||
}
|
||||
|
||||
private void showParticles(Player p)
|
||||
{
|
||||
if (!getPastPlayers().contains(p) || !_state.equals(ArenaState.RUNNING))
|
||||
{
|
||||
_particles.remove(p);
|
||||
return;
|
||||
}
|
||||
|
||||
//New Trails
|
||||
if (Recharge.Instance.use(p, "Particle Trail", 3000, false, false))
|
||||
{
|
||||
if (!_particles.containsKey(p))
|
||||
_particles.put(p, new ArrayList<ParticleData>());
|
||||
|
||||
Location end = UtilAlg.findClosest(_mid, _host.WorldData.GetDataLocs("PINK"));
|
||||
|
||||
_particles.get(p).add(new ParticleData(p, end));
|
||||
}
|
||||
|
||||
//Old Trails
|
||||
if (_particles.containsKey(p) && !_particles.get(p).isEmpty())
|
||||
{
|
||||
Iterator<ParticleData> trailIter = _particles.get(p).iterator();
|
||||
|
||||
while (trailIter.hasNext())
|
||||
{
|
||||
ParticleData data = trailIter.next();
|
||||
|
||||
//Returns true if its hit the endpoint
|
||||
if (data.update())
|
||||
trailIter.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void handleSlowMovers()
|
||||
{
|
||||
setState(ArenaState.ENDED);
|
||||
|
||||
Arena next = _host.getArenaByMid(UtilAlg.findClosest(_mid, _host.getAllArenaMidsOfType(_host.getNextColour(_colour))));
|
||||
|
||||
for (Player p : new ArrayList<Player>(_pastPlayers))
|
||||
{
|
||||
// TP after 15 seconds of waiting.
|
||||
|
||||
p.teleport(UtilAlg.getLocationAwayFromPlayers(next.getSpawns(), _host.GetPlayers(true)).clone());
|
||||
//p.sendMessage("HANDLE SLOW MOVERS METHOD!");
|
||||
_host.Manager.getPluginManager().callEvent(new PlayerChangeArenaEvent(p, next, this));
|
||||
closeDoor();
|
||||
_host.setPlayerArena(p, next);
|
||||
UtilTextBottom.display("§c§lTELEPORTED! YOU TOOK TOO LONG!", p);
|
||||
next.setDoBye(true);
|
||||
}
|
||||
|
||||
_pastPlayers.clear(); // Clear out the un-used players.
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package nautilus.game.arcade.game.games.gladiators;
|
||||
|
||||
/**
|
||||
* Created by William (WilliamTiger).
|
||||
* 08/12/15
|
||||
*/
|
||||
public enum ArenaState
|
||||
{
|
||||
EMPTY,
|
||||
WAITING,
|
||||
FIGHTING,
|
||||
RUNNING,
|
||||
ENDED;
|
||||
}
|
@ -0,0 +1,243 @@
|
||||
package nautilus.game.arcade.game.games.gladiators;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
/**
|
||||
* Created by William (WilliamTiger).
|
||||
* 07/12/15
|
||||
*/
|
||||
public enum ArenaType
|
||||
{
|
||||
|
||||
RED(1, new Loadout()
|
||||
{
|
||||
@Override
|
||||
public ItemStack getSword()
|
||||
{
|
||||
return new ItemStack(Material.DIAMOND_SWORD, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getRod()
|
||||
{
|
||||
return new ItemStack(Material.FISHING_ROD, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getBow()
|
||||
{
|
||||
return new ItemStack(Material.BOW, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getArrows()
|
||||
{
|
||||
return new ItemStack(Material.ARROW, 10);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getHelmet()
|
||||
{
|
||||
return new ItemStack(Material.IRON_HELMET, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getChestplate()
|
||||
{
|
||||
return new ItemStack(Material.IRON_CHESTPLATE, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getLeggings()
|
||||
{
|
||||
return new ItemStack(Material.IRON_LEGGINGS, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getBoots()
|
||||
{
|
||||
return new ItemStack(Material.IRON_BOOTS, 1);
|
||||
}
|
||||
}),
|
||||
ORANGE(2, new Loadout()
|
||||
{
|
||||
@Override
|
||||
public ItemStack getSword()
|
||||
{
|
||||
return new ItemStack(Material.IRON_SWORD, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getRod()
|
||||
{
|
||||
return new ItemStack(Material.FISHING_ROD, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getBow()
|
||||
{
|
||||
return new ItemStack(Material.BOW, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getArrows()
|
||||
{
|
||||
return new ItemStack(Material.ARROW, 7);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getHelmet()
|
||||
{
|
||||
return new ItemStack(Material.CHAINMAIL_HELMET);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getChestplate()
|
||||
{
|
||||
return new ItemStack(Material.CHAINMAIL_CHESTPLATE, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getLeggings()
|
||||
{
|
||||
return new ItemStack(Material.CHAINMAIL_LEGGINGS, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getBoots()
|
||||
{
|
||||
return new ItemStack(Material.CHAINMAIL_BOOTS, 1);
|
||||
}
|
||||
}),
|
||||
YELLOW(4, new Loadout()
|
||||
{
|
||||
@Override
|
||||
public ItemStack getSword()
|
||||
{
|
||||
return new ItemStack(Material.STONE_SWORD, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getRod()
|
||||
{
|
||||
return new ItemStack(Material.FISHING_ROD, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getBow()
|
||||
{
|
||||
return new ItemStack(Material.BOW, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getArrows()
|
||||
{
|
||||
return new ItemStack(Material.ARROW, 5);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getHelmet()
|
||||
{
|
||||
return new ItemStack(Material.GOLD_HELMET, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getChestplate()
|
||||
{
|
||||
return new ItemStack(Material.GOLD_CHESTPLATE, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getLeggings()
|
||||
{
|
||||
return new ItemStack(Material.GOLD_LEGGINGS, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getBoots()
|
||||
{
|
||||
return new ItemStack(Material.GOLD_BOOTS, 1);
|
||||
}
|
||||
}),
|
||||
GREEN(8, new Loadout()
|
||||
{
|
||||
@Override
|
||||
public ItemStack getSword()
|
||||
{
|
||||
return new ItemStack(Material.WOOD_SWORD, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getRod()
|
||||
{
|
||||
return new ItemStack(Material.FISHING_ROD, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getBow()
|
||||
{
|
||||
return new ItemStack(Material.BOW, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getArrows()
|
||||
{
|
||||
return new ItemStack(Material.ARROW, 3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getHelmet()
|
||||
{
|
||||
return new ItemStack(Material.LEATHER_HELMET, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getChestplate()
|
||||
{
|
||||
return new ItemStack(Material.LEATHER_CHESTPLATE, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getLeggings()
|
||||
{
|
||||
return new ItemStack(Material.LEATHER_LEGGINGS, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getBoots()
|
||||
{
|
||||
return new ItemStack(Material.LEATHER_BOOTS, 1);
|
||||
}
|
||||
});
|
||||
|
||||
private int _endsAt;
|
||||
private Loadout _loadout;
|
||||
|
||||
ArenaType(int endsAt, Loadout loadout)
|
||||
{
|
||||
_endsAt = endsAt;
|
||||
_loadout = loadout;
|
||||
}
|
||||
|
||||
public Loadout getLoadout()
|
||||
{
|
||||
return _loadout;
|
||||
}
|
||||
|
||||
public int getEndsAt()
|
||||
{
|
||||
return _endsAt;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return toString().toLowerCase();
|
||||
}
|
||||
|
||||
public boolean furtherOut(ArenaType other)
|
||||
{
|
||||
return !(compareTo(other) <= 0);
|
||||
}
|
||||
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,22 @@
|
||||
package nautilus.game.arcade.game.games.gladiators;
|
||||
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
/**
|
||||
* Created by William (WilliamTiger).
|
||||
* 07/12/15
|
||||
*/
|
||||
public interface Loadout
|
||||
{
|
||||
|
||||
public ItemStack getSword();
|
||||
public ItemStack getRod();
|
||||
public ItemStack getBow();
|
||||
public ItemStack getArrows();
|
||||
|
||||
public ItemStack getHelmet();
|
||||
public ItemStack getChestplate();
|
||||
public ItemStack getLeggings();
|
||||
public ItemStack getBoots();
|
||||
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
package nautilus.game.arcade.game.games.gladiators;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
|
||||
/**
|
||||
* Created by William (WilliamTiger).
|
||||
* 08/12/15
|
||||
*/
|
||||
public class ParticleData
|
||||
{
|
||||
public Player Player;
|
||||
public Location CurrentLocation;
|
||||
public Vector Velocity;
|
||||
public Location Target;
|
||||
|
||||
public ParticleData(Player player, Location target)
|
||||
{
|
||||
Player = player;
|
||||
|
||||
Velocity = player.getLocation().getDirection();
|
||||
if (Velocity.getY() < 0)
|
||||
Velocity.setY(0);
|
||||
Velocity.normalize();
|
||||
|
||||
CurrentLocation = player.getLocation().add(0, 1, 0);
|
||||
Target = target;
|
||||
}
|
||||
|
||||
public boolean update()
|
||||
{
|
||||
//Turn
|
||||
Velocity.add(UtilAlg.getTrajectory(CurrentLocation, Target).multiply(0.15));
|
||||
|
||||
//Normalize Speed
|
||||
UtilAlg.Normalize(Velocity);
|
||||
|
||||
//Move
|
||||
CurrentLocation.add(Velocity.clone().multiply(0.5));
|
||||
|
||||
//Particle
|
||||
UtilParticle.PlayParticle(UtilParticle.ParticleType.HAPPY_VILLAGER, CurrentLocation, 0.03f, 0.03f, 0.03f, 0, 3,
|
||||
UtilParticle.ViewDist.LONG, Player);
|
||||
|
||||
//Sound
|
||||
CurrentLocation.getWorld().playSound(CurrentLocation, Sound.FIZZ, 0.2f, 3f);
|
||||
|
||||
return UtilMath.offset(CurrentLocation, Target) < 4;
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package nautilus.game.arcade.game.games.gladiators;
|
||||
|
||||
/**
|
||||
* Created by William (WilliamTiger).
|
||||
* 08/12/15
|
||||
*/
|
||||
public enum RoundState
|
||||
{
|
||||
WAITING("Waiting"),
|
||||
STARTING_5("Starting in 5s"),
|
||||
STARTING_4("Starting in 4s"),
|
||||
STARTING_3("Starting in 3s"),
|
||||
STARTING_2("Starting in 2s"),
|
||||
STARTING_1("Starting in 1s"),
|
||||
STARTED("FIGHT!"),
|
||||
FIGHTING("Fighting");
|
||||
|
||||
private String scoreboardText;
|
||||
|
||||
RoundState(String scoreboardText)
|
||||
{
|
||||
this.scoreboardText = scoreboardText;
|
||||
}
|
||||
|
||||
public String getScoreboardText()
|
||||
{
|
||||
return scoreboardText;
|
||||
}
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
package nautilus.game.arcade.game.games.gladiators.events;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import nautilus.game.arcade.game.games.gladiators.Arena;
|
||||
|
||||
/**
|
||||
* Created by William (WilliamTiger).
|
||||
* 08/12/15
|
||||
*/
|
||||
public class PlayerChangeArenaEvent extends Event
|
||||
{
|
||||
private static final HandlerList _handlers = new HandlerList();
|
||||
|
||||
private Player player;
|
||||
private Arena to;
|
||||
private Arena from;
|
||||
|
||||
public PlayerChangeArenaEvent(Player player, Arena to, Arena from)
|
||||
{
|
||||
this.player = player;
|
||||
this.to = to;
|
||||
this.from = from;
|
||||
}
|
||||
|
||||
public Player getPlayer()
|
||||
{
|
||||
return player;
|
||||
}
|
||||
|
||||
public Arena getTo()
|
||||
{
|
||||
return to;
|
||||
}
|
||||
|
||||
public Arena getFrom()
|
||||
{
|
||||
return from;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList()
|
||||
{
|
||||
return _handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers()
|
||||
{
|
||||
return getHandlerList();
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package nautilus.game.arcade.game.games.gladiators.events;
|
||||
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Created by William (WilliamTiger).
|
||||
* 10/12/15
|
||||
*/
|
||||
public class RoundStartEvent extends Event
|
||||
{
|
||||
private static final HandlerList _handlers = new HandlerList();
|
||||
|
||||
public static HandlerList getHandlerList()
|
||||
{
|
||||
return _handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers()
|
||||
{
|
||||
return getHandlerList();
|
||||
}
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package nautilus.game.arcade.game.games.gladiators.kits;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.kit.KitAvailability;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
|
||||
/**
|
||||
* Created by William (WilliamTiger).
|
||||
* 07/12/15
|
||||
*/
|
||||
public class KitGladiator extends Kit
|
||||
{
|
||||
public KitGladiator(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Gladiator", KitAvailability.Free,
|
||||
new String[]
|
||||
{
|
||||
"At my signal, unleash hell."
|
||||
},
|
||||
new Perk[]
|
||||
{
|
||||
|
||||
},
|
||||
EntityType.ZOMBIE, new ItemStack(Material.IRON_SWORD));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void GiveItems(Player player)
|
||||
{
|
||||
//todo: items based on loadout
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package nautilus.game.arcade.game.games.gladiators.trackers;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
||||
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
|
||||
import nautilus.game.arcade.game.games.gladiators.Gladiators;
|
||||
import nautilus.game.arcade.stats.StatTracker;
|
||||
|
||||
/**
|
||||
* Created by William (WilliamTiger).
|
||||
* 08/12/15
|
||||
*/
|
||||
public class BrawlerTracker extends StatTracker<Gladiators>
|
||||
{
|
||||
public BrawlerTracker(Gladiators game)
|
||||
{
|
||||
super(game);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void death(CombatDeathEvent e)
|
||||
{
|
||||
if (e.GetLog().GetKiller() == null)
|
||||
return;
|
||||
|
||||
if (Bukkit.getPlayerExact(e.GetLog().GetKiller().GetName()) != null)
|
||||
{
|
||||
Player p = Bukkit.getPlayerExact(e.GetLog().GetKiller().GetName());
|
||||
if (p.getItemInHand() == null)
|
||||
return;
|
||||
|
||||
if (p.getItemInHand().getType().equals(Material.AIR))
|
||||
addStat(p, "Brawler", 1, false, false);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
package nautilus.game.arcade.game.games.gladiators.trackers;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.game.Game;
|
||||
import nautilus.game.arcade.game.games.gladiators.Gladiators;
|
||||
import nautilus.game.arcade.stats.StatTracker;
|
||||
|
||||
/**
|
||||
* Created by William (WilliamTiger).
|
||||
* 08/12/15
|
||||
*/
|
||||
public class FlawlessTracker extends StatTracker<Gladiators>
|
||||
{
|
||||
|
||||
private List<String> _noWin;
|
||||
|
||||
public FlawlessTracker(Gladiators game)
|
||||
{
|
||||
super(game);
|
||||
|
||||
_noWin = new ArrayList<>();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onDmg(EntityDamageEvent e)
|
||||
{
|
||||
if (e.isCancelled())
|
||||
return;
|
||||
|
||||
System.out.println(e.getEventName() + " took damage by " + e.getCause().toString());
|
||||
|
||||
if (e.getEntity() instanceof Player)
|
||||
{
|
||||
_noWin.add(((Player)e.getEntity()).getName());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void end(GameStateChangeEvent e)
|
||||
{
|
||||
if (e.GetState() != Game.GameState.End)
|
||||
return;
|
||||
|
||||
if (getGame().getWinners() == null)
|
||||
return;
|
||||
|
||||
for (Player p : getGame().getWinners())
|
||||
{
|
||||
if (_noWin.contains(p.getName()))
|
||||
continue;
|
||||
|
||||
addStat(p, "Flawless", 1, true, false);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,79 @@
|
||||
package nautilus.game.arcade.game.games.gladiators.trackers;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityShootBowEvent;
|
||||
import org.bukkit.event.entity.ProjectileHitEvent;
|
||||
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.game.Game;
|
||||
import nautilus.game.arcade.game.games.gladiators.Gladiators;
|
||||
import nautilus.game.arcade.stats.StatTracker;
|
||||
|
||||
/**
|
||||
* Created by William (WilliamTiger).
|
||||
* 08/12/15
|
||||
*/
|
||||
public class PrecisionTracker extends StatTracker<Gladiators>
|
||||
{
|
||||
private HashMap<String, Integer> _shot;
|
||||
private HashMap<String, Integer> _hit;
|
||||
|
||||
public PrecisionTracker(Gladiators game)
|
||||
{
|
||||
super(game);
|
||||
|
||||
_shot = new HashMap<>();
|
||||
_hit = new HashMap<>();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void end(GameStateChangeEvent e)
|
||||
{
|
||||
if (e.GetState() != Game.GameState.End)
|
||||
return;
|
||||
|
||||
for (Player p : getGame().getWinners())
|
||||
{
|
||||
if (_shot.containsKey(p.getName()) && _hit.containsKey(p.getName()))
|
||||
{
|
||||
if (_shot.get(p.getName()) == _hit.get(p.getName()))
|
||||
{
|
||||
if (_shot.get(p.getName()) >= 3)
|
||||
addStat(p, "Precision", 1, true, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void shoot(EntityShootBowEvent e)
|
||||
{
|
||||
if (!(e.getEntity() instanceof Player))
|
||||
return;
|
||||
|
||||
Player p = (Player) e.getEntity();
|
||||
|
||||
if (_shot.containsKey(p.getName()))
|
||||
_shot.put(p.getName(), _shot.get(p.getName()) + 1);
|
||||
else
|
||||
_shot.put(p.getName(), 1);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void hit(ProjectileHitEvent e)
|
||||
{
|
||||
if (e.getEntity().getShooter() instanceof Player)
|
||||
{
|
||||
Player p = (Player) e.getEntity().getShooter();
|
||||
|
||||
if (_hit.containsKey(p.getName()))
|
||||
_hit.put(p.getName(), _hit.get(p.getName()) + 1);
|
||||
else
|
||||
_hit.put(p.getName(), 1);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package nautilus.game.arcade.game.games.gladiators.trackers;
|
||||
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
||||
import nautilus.game.arcade.events.FirstBloodEvent;
|
||||
import nautilus.game.arcade.game.games.gladiators.Gladiators;
|
||||
import nautilus.game.arcade.stats.StatTracker;
|
||||
|
||||
/**
|
||||
* Created by William (WilliamTiger).
|
||||
* 10/12/15
|
||||
*/
|
||||
public class SwiftKillTracker extends StatTracker<Gladiators>
|
||||
{
|
||||
public SwiftKillTracker(Gladiators game)
|
||||
{
|
||||
super(game);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void blood(FirstBloodEvent e)
|
||||
{
|
||||
addStat(e.getPlayer(), "SwiftKill", 1, false, false);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
package nautilus.game.arcade.game.games.gladiators.trackers;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
|
||||
import nautilus.game.arcade.game.games.gladiators.Gladiators;
|
||||
import nautilus.game.arcade.game.games.gladiators.events.RoundStartEvent;
|
||||
import nautilus.game.arcade.stats.StatTracker;
|
||||
|
||||
/**
|
||||
* Created by William (WilliamTiger).
|
||||
* 10/12/15
|
||||
*/
|
||||
public class UntouchableTracker extends StatTracker<Gladiators>
|
||||
{
|
||||
private List<String> _noWin;
|
||||
|
||||
public UntouchableTracker(Gladiators game)
|
||||
{
|
||||
super(game);
|
||||
|
||||
_noWin = new ArrayList<>();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onDmg(EntityDamageEvent e)
|
||||
{
|
||||
if (e.isCancelled())
|
||||
return;
|
||||
|
||||
if (e.getEntity() instanceof Player)
|
||||
{
|
||||
_noWin.add(((Player)e.getEntity()).getName());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onEnd(RoundStartEvent e)
|
||||
{
|
||||
for (Player p : getGame().GetPlayers(true))
|
||||
{
|
||||
if (_noWin.contains(p.getName()))
|
||||
continue;
|
||||
|
||||
addStat(p, "Untouchable", 1, false, false);
|
||||
}
|
||||
|
||||
_noWin.clear();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,140 @@
|
||||
package nautilus.game.arcade.game.games.gladiators.tutorial;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Zombie;
|
||||
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.game.games.gladiators.Arena;
|
||||
import nautilus.game.arcade.game.games.gladiators.Gladiators;
|
||||
import nautilus.game.arcade.gametutorial.GameTutorial;
|
||||
import nautilus.game.arcade.gametutorial.TutorialPhase;
|
||||
|
||||
/**
|
||||
* Created by William (WilliamTiger).
|
||||
* 10/12/15
|
||||
*/
|
||||
public class TutorialGladiators extends GameTutorial
|
||||
{
|
||||
|
||||
private Gladiators _host;
|
||||
|
||||
private Location _pink, _orange;
|
||||
private Zombie _zombie1, _zombie2;
|
||||
|
||||
private boolean hasHit1, hasHit2;
|
||||
|
||||
public TutorialGladiators(ArcadeManager manager)
|
||||
{
|
||||
super(manager, new TutorialPhase[]{
|
||||
new TutorialPhaseGladiators()
|
||||
});
|
||||
|
||||
TeleportOnEnd = false;
|
||||
|
||||
hasHit1 = false;
|
||||
hasHit2 = false;
|
||||
|
||||
_host = (Gladiators) manager.GetGame();
|
||||
}
|
||||
|
||||
public Location getPink()
|
||||
{
|
||||
return _pink;
|
||||
}
|
||||
|
||||
public void setPink(Location pink)
|
||||
{
|
||||
_pink = pink;
|
||||
}
|
||||
|
||||
public Location getOrange()
|
||||
{
|
||||
return _orange;
|
||||
}
|
||||
|
||||
public void setOrange(Location orange)
|
||||
{
|
||||
_orange = orange;
|
||||
}
|
||||
|
||||
public Zombie getZombie1()
|
||||
{
|
||||
return _zombie1;
|
||||
}
|
||||
|
||||
public void setZombie1(Zombie zombie1)
|
||||
{
|
||||
_zombie1 = zombie1;
|
||||
}
|
||||
|
||||
public Zombie getZombie2()
|
||||
{
|
||||
return _zombie2;
|
||||
}
|
||||
|
||||
public void setZombie2(Zombie zombie2)
|
||||
{
|
||||
_zombie2 = zombie2;
|
||||
}
|
||||
|
||||
public boolean isHasHit1()
|
||||
{
|
||||
return hasHit1;
|
||||
}
|
||||
|
||||
public void setHasHit1(boolean hasHit1)
|
||||
{
|
||||
this.hasHit1 = hasHit1;
|
||||
}
|
||||
|
||||
public boolean isHasHit2()
|
||||
{
|
||||
return hasHit2;
|
||||
}
|
||||
|
||||
public void setHasHit2(boolean hasHit2)
|
||||
{
|
||||
this.hasHit2 = hasHit2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEnd()
|
||||
{
|
||||
Gladiators game = (Gladiators) Manager.GetGame();
|
||||
|
||||
for (Player p : game.GetPlayers(true))
|
||||
{
|
||||
p.teleport(game.GetTeam(p).GetSpawn().clone());
|
||||
}
|
||||
|
||||
if (_zombie1 != null)
|
||||
_zombie1.remove();
|
||||
|
||||
if (_zombie2 != null)
|
||||
_zombie2.remove();
|
||||
|
||||
Arena gateArena = _host.getArenaByMid(getOrange());
|
||||
for (Location loc : gateArena.getDoorBlocks())
|
||||
loc.getBlock().setType(Material.FENCE); // Manual door close.
|
||||
|
||||
// Spawns
|
||||
|
||||
_host.GetTeamList().get(0).GetSpawns().clear();
|
||||
|
||||
for (Arena a : _host.getGameArenaSet())
|
||||
{
|
||||
if (a.getCapacity() <= 0)
|
||||
continue;
|
||||
|
||||
for (Location l : a.capacitySpawns())
|
||||
_host.GetTeamList().get(0).GetSpawns().add(l);
|
||||
}
|
||||
|
||||
for (Player p : _host.GetPlayers(true))
|
||||
{
|
||||
_host.GetTeam(p).SpawnTeleport(p);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package nautilus.game.arcade.game.games.gladiators.tutorial;
|
||||
|
||||
import nautilus.game.arcade.gametutorial.TutorialPhase;
|
||||
import nautilus.game.arcade.gametutorial.TutorialText;
|
||||
|
||||
/**
|
||||
* Created by William (WilliamTiger).
|
||||
* 10/12/15
|
||||
*/
|
||||
public class TutorialPhaseGladiators extends TutorialPhase
|
||||
{
|
||||
|
||||
public TutorialPhaseGladiators()
|
||||
{
|
||||
super(new TutorialText[]{
|
||||
new TutorialText("Defeat your opponent!", 20 * 4, 1),
|
||||
new TutorialText("", 20 * 2, 2),
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public int ID()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
@ -358,27 +358,6 @@ public class MonsterMaze extends SoloGame
|
||||
}
|
||||
}
|
||||
|
||||
private boolean _announced = false;
|
||||
@EventHandler
|
||||
public void sendF5Message(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.FASTEST)
|
||||
return;
|
||||
|
||||
if (GetState() != GameState.Prepare)
|
||||
return;
|
||||
|
||||
if (_announced)
|
||||
return;
|
||||
|
||||
if (!UtilTime.elapsed(GetStateTime(), 4000))
|
||||
return;
|
||||
|
||||
_announced = true;
|
||||
UtilTextMiddle.display(C.cYellow + C.Bold + "Press F5", C.cAqua + C.Bold + "Monster Maze is best in 3rd person!");
|
||||
Announce(C.cYellow + C.Scramble + "@@" + C.cAqua + C.Bold + " Monster Maze is best played in 3rd Person! (Push F5) " + C.cYellow + C.Scramble + "@@");
|
||||
}
|
||||
|
||||
@Override
|
||||
@EventHandler
|
||||
public void ScoreboardUpdate(UpdateEvent event)
|
||||
|
@ -61,7 +61,7 @@ public class KitCreeper extends SmashKit
|
||||
}));
|
||||
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SPADE, (byte)0, 1,
|
||||
C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Explosive Leap",
|
||||
C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Explode",
|
||||
new String[]
|
||||
{
|
||||
ChatColor.RESET + "You freeze in location and charge up",
|
||||
|
@ -13,10 +13,10 @@ import org.bukkit.event.player.PlayerQuitEvent;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTextMiddle;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTextMiddle;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
@ -37,10 +37,13 @@ public class PerkEndermanTeleport extends SmashPerk
|
||||
|
||||
@EventHandler
|
||||
public void update(UpdateEvent event)
|
||||
{
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
return;
|
||||
|
||||
if(!Manager.GetGame().IsLive())
|
||||
return;
|
||||
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
{
|
||||
if (!Kit.HasKit(player))
|
||||
@ -88,7 +91,7 @@ public class PerkEndermanTeleport extends SmashPerk
|
||||
}
|
||||
|
||||
player.playSound(player.getLocation(), Sound.ENDERMAN_TELEPORT, 1f, 0.5f);
|
||||
player.teleport(block.getLocation().add(0.5, 1, 0.5));
|
||||
player.teleport(block.getLocation().add(0.5, 1, 0.5).setDirection(player.getLocation().getDirection()));
|
||||
player.playSound(player.getLocation(), Sound.ENDERMAN_TELEPORT, 1f, 0.5f);
|
||||
|
||||
UtilParticle.PlayParticle(ParticleType.WITCH_MAGIC, player.getLocation().add(0, 1, 0), 1f, 1f, 1f, 0.1f, 100, ViewDist.LONG, UtilServer.getPlayers());
|
||||
|
@ -941,7 +941,7 @@ public abstract class SurvivalGames extends Game
|
||||
|
||||
for (Player alive : GetPlayers(true))
|
||||
{
|
||||
if (alive != player)
|
||||
if (alive != player && getArcadeManager().canHurt(player, alive))
|
||||
{
|
||||
double distance = alive.getLocation().distance(
|
||||
player.getLocation());
|
||||
@ -1838,6 +1838,9 @@ public abstract class SurvivalGames extends Game
|
||||
|
||||
if (!UtilInv.IsItem(player.getItemInHand(), Material.TNT, (byte) 0))
|
||||
return;
|
||||
|
||||
if(!IsAlive(player))
|
||||
return;
|
||||
|
||||
event.setCancelled(true);
|
||||
|
||||
|
@ -0,0 +1,252 @@
|
||||
package nautilus.game.arcade.gametutorial;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.visibility.VisibilityManager;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.gametutorial.events.GameTutorialEndEvent;
|
||||
import nautilus.game.arcade.gametutorial.events.GameTutorialPhaseEvent;
|
||||
import nautilus.game.arcade.gametutorial.events.GameTutorialStartEvent;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public abstract class GameTutorial
|
||||
{
|
||||
|
||||
public ArcadeManager Manager;
|
||||
|
||||
private TutorialPhase[] _phases;
|
||||
private GameTeam _team;
|
||||
private HashMap<Player, Location> _players;
|
||||
|
||||
private TutorialPhase _currentPhase;
|
||||
|
||||
private boolean _hasEnded;
|
||||
private boolean _hasStarted;
|
||||
|
||||
private int _tick;
|
||||
|
||||
private long _started;
|
||||
|
||||
public boolean SetTutorialPositions = true;
|
||||
public boolean TeleportOnEnd = true;
|
||||
public boolean RunTasksSync = true;
|
||||
public boolean PlayTutorialSounds = false;
|
||||
public boolean ShowPrepareTimer = false;
|
||||
|
||||
public long TimeBetweenPhase = 0;
|
||||
public long StartAfterTutorial = 5000;
|
||||
|
||||
public GameTutorial(ArcadeManager manager, TutorialPhase[] phases)
|
||||
{
|
||||
Manager = manager;
|
||||
_phases = phases;
|
||||
_players = new HashMap<>();
|
||||
}
|
||||
|
||||
final public void start()
|
||||
{
|
||||
_hasStarted = true;
|
||||
_tick = 0;
|
||||
for(TutorialPhase phase : _phases)
|
||||
phase.setTutorial(this);
|
||||
|
||||
//Manager.GetGame().PrepareTime = 60000;
|
||||
Manager.GetChat().Silence(60000, false);
|
||||
_started = System.currentTimeMillis();
|
||||
Manager.getPluginManager().callEvent(new GameTutorialStartEvent(this));
|
||||
onStart();
|
||||
preparePlayers();
|
||||
_currentPhase = getNextPhase();
|
||||
Manager.runSyncLater(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
nextPhase(true);
|
||||
}
|
||||
}, 40);
|
||||
_currentPhase.teleport();
|
||||
}
|
||||
|
||||
protected void nextPhase(boolean phaseOne)
|
||||
{
|
||||
TutorialPhase from = _currentPhase;
|
||||
if(!phaseOne)
|
||||
_currentPhase = getNextPhase();
|
||||
|
||||
if(_currentPhase == null)
|
||||
{
|
||||
onEnd();
|
||||
_hasEnded = true;
|
||||
endTutorial();
|
||||
final GameTutorial tutorial = this;
|
||||
Manager.runSyncLater(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
Manager.getPluginManager().callEvent(new GameTutorialEndEvent(tutorial));
|
||||
}
|
||||
}, 5);
|
||||
}
|
||||
else
|
||||
{
|
||||
Manager.GetChat().Silence(70000, false);
|
||||
onPhaseChange(_currentPhase);
|
||||
Manager.getPluginManager().callEvent(new GameTutorialPhaseEvent(this, from, _currentPhase));
|
||||
_currentPhase.start(phaseOne);
|
||||
}
|
||||
}
|
||||
|
||||
public void setTeam(GameTeam team)
|
||||
{
|
||||
_team = team;
|
||||
}
|
||||
|
||||
private void endTutorial()
|
||||
{
|
||||
for(final Player player : _players.keySet())
|
||||
{
|
||||
//VisibilityManager.Instance.setVisibility(player, true, UtilServer.getPlayers());
|
||||
Manager.runSyncLater(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
for(Player player : Manager.GetGame().GetPlayers(true))
|
||||
{
|
||||
for(Player other : Manager.GetGame().GetPlayers(true))
|
||||
{
|
||||
player.showPlayer(other);
|
||||
}
|
||||
}
|
||||
player.setAllowFlight(false);
|
||||
player.setFlying(false);
|
||||
}
|
||||
}, 5);
|
||||
if(TeleportOnEnd)
|
||||
{
|
||||
Manager.runSyncLater(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
_team.SpawnTeleport();
|
||||
}
|
||||
}, 5);
|
||||
}
|
||||
}
|
||||
Manager.GetChat().Silence(StartAfterTutorial, false);
|
||||
Manager.GetGame().PrepareTime = (System.currentTimeMillis() - Manager.GetGame().GetStateTime()) + StartAfterTutorial;
|
||||
}
|
||||
|
||||
protected TutorialPhase getNextPhase()
|
||||
{
|
||||
for(TutorialPhase phase : _phases)
|
||||
{
|
||||
if(_currentPhase == null && phase.ID() == 1)
|
||||
{
|
||||
return phase;
|
||||
}
|
||||
else if(_currentPhase != null && _currentPhase.ID() + 1 == phase.ID())
|
||||
{
|
||||
return phase;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void preparePlayers()
|
||||
{
|
||||
for(Player player : UtilServer.getPlayers())
|
||||
{
|
||||
int i = 0;
|
||||
if(Manager.GetGame().GetTeam(player) == _team)
|
||||
{
|
||||
_players.put(player, Manager.GetGame().GetTeam(player).GetSpawns().get(i));
|
||||
player.setAllowFlight(true);
|
||||
player.setFlying(true);
|
||||
// VisibilityManager.Instance.setVisibility(player, false, UtilServer.getPlayers());
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public TutorialPhase getPhase(int index)
|
||||
{
|
||||
for(TutorialPhase phase : _phases)
|
||||
{
|
||||
if(phase.ID() == index)
|
||||
return phase;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean hasEnded()
|
||||
{
|
||||
return _hasEnded;
|
||||
}
|
||||
|
||||
public boolean hasStarted()
|
||||
{
|
||||
return _hasStarted;
|
||||
}
|
||||
|
||||
public HashMap<Player, Location> getPlayers()
|
||||
{
|
||||
return _players;
|
||||
}
|
||||
|
||||
public GameTeam getTeam()
|
||||
{
|
||||
return _team;
|
||||
}
|
||||
|
||||
public void onTick(int tick){}
|
||||
|
||||
public void onStart(){}
|
||||
|
||||
public void onPhaseChange(TutorialPhase phase){}
|
||||
|
||||
public void onEnd(){}
|
||||
|
||||
public int tick()
|
||||
{
|
||||
if(!_hasEnded && hasStarted())
|
||||
{
|
||||
for(Player player : UtilServer.getPlayers())
|
||||
{
|
||||
for(Player other : _players.keySet())
|
||||
{
|
||||
player.hidePlayer(other);
|
||||
}
|
||||
}
|
||||
}
|
||||
_tick++;
|
||||
return _tick;
|
||||
}
|
||||
|
||||
public TutorialPhase[] getPhases()
|
||||
{
|
||||
return _phases;
|
||||
}
|
||||
|
||||
public long getTutorialStart()
|
||||
{
|
||||
return _started;
|
||||
}
|
||||
|
||||
public long getRunning()
|
||||
{
|
||||
return System.currentTimeMillis() - _started;
|
||||
}
|
||||
|
||||
public long getPhaseTime()
|
||||
{
|
||||
return _currentPhase.getPhaseTime();
|
||||
}
|
||||
}
|
@ -0,0 +1,237 @@
|
||||
package nautilus.game.arcade.gametutorial;
|
||||
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilTextMiddle;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public abstract class TutorialPhase
|
||||
{
|
||||
|
||||
public abstract int ID();
|
||||
|
||||
private GameTutorial _tutorial;
|
||||
private TutorialText[] _text;
|
||||
private Location _location;
|
||||
private Location _target;
|
||||
private boolean _hasEnded;
|
||||
|
||||
private long _started;
|
||||
|
||||
private TutorialText _currentText;
|
||||
|
||||
public TutorialPhase(TutorialText[] text)
|
||||
{
|
||||
_text = text;
|
||||
}
|
||||
|
||||
final public void start(boolean phaseOne)
|
||||
{
|
||||
_hasEnded = false;
|
||||
_started = System.currentTimeMillis();
|
||||
onStart();
|
||||
if(!phaseOne)
|
||||
{
|
||||
teleport();
|
||||
}
|
||||
displayText();
|
||||
}
|
||||
|
||||
final public void teleport()
|
||||
{
|
||||
if(!getTutorial().SetTutorialPositions)
|
||||
return;
|
||||
|
||||
if(_location != null && _target != null)
|
||||
{
|
||||
prepareLocations();
|
||||
updatePlayers();
|
||||
}
|
||||
}
|
||||
|
||||
private void prepareLocations()
|
||||
{
|
||||
Vector vector = new Vector(_target.getBlockX() - _location.getBlockX(), _target.getBlockY() - _location.getBlockY(), _target.getBlockZ() - _location.getBlockZ());
|
||||
float pitch = UtilAlg.GetPitch(vector);
|
||||
float yaw = UtilAlg.GetYaw(vector);
|
||||
_location.setPitch(pitch);
|
||||
_location.setYaw(yaw);
|
||||
}
|
||||
|
||||
private void updatePlayers()
|
||||
{
|
||||
new Thread(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
while(!_hasEnded && !getTutorial().hasEnded())
|
||||
{
|
||||
_tutorial.Manager.runSync(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
if(!_hasEnded && !getTutorial().hasEnded())
|
||||
{
|
||||
for(Player player : _tutorial.getPlayers().keySet())
|
||||
{
|
||||
player.setAllowFlight(true);
|
||||
player.setFlying(true);
|
||||
player.teleport(_location);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
try
|
||||
{
|
||||
Thread.sleep(50);
|
||||
} catch (InterruptedException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
public void displayText()
|
||||
{
|
||||
new Thread(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
while(true)
|
||||
{
|
||||
TutorialText text = getNextMessage();
|
||||
if(text == null)
|
||||
{
|
||||
_tutorial.Manager.runSyncLater(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
_hasEnded = true;
|
||||
onEnd();
|
||||
_tutorial.nextPhase(false);
|
||||
}
|
||||
}, getTutorial().TimeBetweenPhase);
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
Player[] players = new Player[_tutorial.getPlayers().keySet().size()];
|
||||
int i = 0;
|
||||
for(Player player : _tutorial.getPlayers().keySet())
|
||||
{
|
||||
if(_tutorial.PlayTutorialSounds)
|
||||
{
|
||||
if(text.getSound() != null)
|
||||
player.playSound(player.getLocation(), text.getSound(), 2f, 2f);
|
||||
}
|
||||
players[i] = player;
|
||||
i++;
|
||||
}
|
||||
displayMessage(text);
|
||||
UtilTextMiddle.display("", text.getText(), 0, text.getStayTime(), 0, players);
|
||||
try
|
||||
{
|
||||
Thread.sleep(text.getStayTime() * 50);
|
||||
} catch (InterruptedException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
private void displayMessage(final TutorialText text)
|
||||
{
|
||||
if(_tutorial.RunTasksSync)
|
||||
{
|
||||
_tutorial.Manager.runSync(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
onMessageDisplay(text);
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
onMessageDisplay(text);
|
||||
}
|
||||
}
|
||||
|
||||
protected TutorialText getNextMessage()
|
||||
{
|
||||
for(TutorialText text : _text)
|
||||
{
|
||||
if(_currentText == null && text.ID() == 1)
|
||||
{
|
||||
_currentText = text;
|
||||
return text;
|
||||
}
|
||||
else if(_currentText != null && _currentText.ID() + 1 == text.ID())
|
||||
{
|
||||
_currentText = text;
|
||||
return text;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public TutorialText[] getText()
|
||||
{
|
||||
return _text;
|
||||
}
|
||||
|
||||
public Location getLocation()
|
||||
{
|
||||
return _location;
|
||||
}
|
||||
|
||||
public void setTutorial(GameTutorial tutorial)
|
||||
{
|
||||
_tutorial = tutorial;
|
||||
}
|
||||
|
||||
public void setLocation(Location location)
|
||||
{
|
||||
_location = location;
|
||||
}
|
||||
|
||||
public void setTarget(Location target)
|
||||
{
|
||||
_target = target;
|
||||
}
|
||||
|
||||
public GameTutorial getTutorial()
|
||||
{
|
||||
return _tutorial;
|
||||
}
|
||||
|
||||
public Location getTarget()
|
||||
{
|
||||
return _target;
|
||||
}
|
||||
|
||||
public long getPhaseTime()
|
||||
{
|
||||
return _started;
|
||||
}
|
||||
|
||||
public void onStart(){}
|
||||
|
||||
public void onMessageDisplay(TutorialText text){}
|
||||
|
||||
public void onEnd(){}
|
||||
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
package nautilus.game.arcade.gametutorial;
|
||||
|
||||
import org.bukkit.Sound;
|
||||
|
||||
|
||||
public class TutorialText
|
||||
{
|
||||
|
||||
private String _text;
|
||||
private int _stayTime;
|
||||
private int _id;
|
||||
private Sound _sound;
|
||||
|
||||
public TutorialText(String text, int stayTime, int id, Sound sound)
|
||||
{
|
||||
_text = text;
|
||||
_id = id;
|
||||
_stayTime = stayTime;
|
||||
_sound = sound;
|
||||
}
|
||||
|
||||
public TutorialText(String text, int id)
|
||||
{
|
||||
this(text, (int) (Math.round(1.5 * text.length()) + 25), id, Sound.NOTE_PLING);
|
||||
}
|
||||
|
||||
public TutorialText(String text, int id, Sound sound)
|
||||
{
|
||||
this(text, (int) (Math.round(1.5 * text.length()) + 25), id, sound);
|
||||
}
|
||||
|
||||
public TutorialText(String text, int stayTime, int id)
|
||||
{
|
||||
this(text, stayTime, id, Sound.NOTE_PLING);
|
||||
}
|
||||
|
||||
public String getText()
|
||||
{
|
||||
return _text;
|
||||
}
|
||||
|
||||
public int ID()
|
||||
{
|
||||
return _id;
|
||||
}
|
||||
|
||||
public Sound getSound()
|
||||
{
|
||||
return _sound;
|
||||
}
|
||||
|
||||
public int getStayTime()
|
||||
{
|
||||
return _stayTime;
|
||||
}
|
||||
|
||||
public void setText(String text)
|
||||
{
|
||||
_text = text;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package nautilus.game.arcade.gametutorial.events;
|
||||
|
||||
import nautilus.game.arcade.gametutorial.GameTutorial;
|
||||
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
public class GameTutorialEndEvent extends Event
|
||||
{
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private GameTutorial _tutorial;
|
||||
|
||||
public GameTutorialEndEvent(GameTutorial tutorial)
|
||||
{
|
||||
_tutorial = tutorial;
|
||||
}
|
||||
|
||||
public HandlerList getHandlers()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public GameTutorial getTutorial()
|
||||
{
|
||||
return _tutorial;
|
||||
}
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
package nautilus.game.arcade.gametutorial.events;
|
||||
|
||||
import nautilus.game.arcade.gametutorial.GameTutorial;
|
||||
import nautilus.game.arcade.gametutorial.TutorialPhase;
|
||||
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
public class GameTutorialPhaseEvent extends Event
|
||||
{
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private GameTutorial _tutorial;
|
||||
|
||||
private TutorialPhase _from;
|
||||
private TutorialPhase _to;
|
||||
|
||||
public GameTutorialPhaseEvent(GameTutorial tutorial, TutorialPhase from, TutorialPhase to)
|
||||
{
|
||||
_tutorial = tutorial;
|
||||
_from = from;
|
||||
_to = to;
|
||||
}
|
||||
|
||||
public HandlerList getHandlers()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public GameTutorial getTutorial()
|
||||
{
|
||||
return _tutorial;
|
||||
}
|
||||
|
||||
public TutorialPhase getFrom()
|
||||
{
|
||||
return _from;
|
||||
}
|
||||
|
||||
public TutorialPhase getTo()
|
||||
{
|
||||
return _to;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package nautilus.game.arcade.gametutorial.events;
|
||||
|
||||
import nautilus.game.arcade.gametutorial.GameTutorial;
|
||||
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
public class GameTutorialStartEvent extends Event
|
||||
{
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private GameTutorial _tutorial;
|
||||
|
||||
public GameTutorialStartEvent(GameTutorial tutorial)
|
||||
{
|
||||
_tutorial = tutorial;
|
||||
}
|
||||
|
||||
public HandlerList getHandlers()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public GameTutorial getTutorial()
|
||||
{
|
||||
return _tutorial;
|
||||
}
|
||||
}
|
@ -11,7 +11,7 @@ public class GiveAdminPage extends PlayerPage
|
||||
{
|
||||
public GiveAdminPage(ArcadeManager plugin, PrivateServerShop shop, Player player)
|
||||
{
|
||||
super(plugin, shop, "Give Admin", player);
|
||||
super(plugin, shop, "Give Co-Host", player);
|
||||
buildPage();
|
||||
}
|
||||
|
||||
@ -26,12 +26,12 @@ public class GiveAdminPage extends PlayerPage
|
||||
{
|
||||
removeButton(slot);
|
||||
_manager.giveAdmin(player);
|
||||
UtilPlayer.message(getPlayer(), F.main("Server", "You gave " + F.name(player.getName()) + " admin power."));
|
||||
UtilPlayer.message(getPlayer(), F.main("Server", "You gave " + F.name(player.getName()) + " Co-Host power."));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDisplayString(Player player)
|
||||
{
|
||||
return "Click to Make Admin";
|
||||
return "Click to Make Co-Host";
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ public class RemoveAdminPage extends BasePage
|
||||
{
|
||||
public RemoveAdminPage(ArcadeManager plugin, PrivateServerShop shop, Player player)
|
||||
{
|
||||
super(plugin, shop, "Remove Admin", player);
|
||||
super(plugin, shop, "Remove Co-Host", player);
|
||||
|
||||
buildPage();
|
||||
}
|
||||
@ -36,7 +36,7 @@ public class RemoveAdminPage extends BasePage
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
String name = iterator.next();
|
||||
ItemStack head = getPlayerHead(name, C.cGreen + C.Bold + name, new String[] {ChatColor.RESET + C.cGray + "Click to Remove Admin"});
|
||||
ItemStack head = getPlayerHead(name, C.cGreen + C.Bold + name, new String[] {ChatColor.RESET + C.cGray + "Click to Remove Co-Host"});
|
||||
addButton(slot, head, getRemoveAdminButton(slot, name));
|
||||
|
||||
slot++;
|
||||
@ -52,7 +52,7 @@ public class RemoveAdminPage extends BasePage
|
||||
{
|
||||
_manager.removeAdmin(playerName);
|
||||
removeButton(slot);
|
||||
UtilPlayer.message(getPlayer(), F.main("Server", "You removed admin power from " + F.name(playerName) + "."));
|
||||
UtilPlayer.message(getPlayer(), F.main("Server", "You removed Co-Host power from " + F.name(playerName) + "."));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package nautilus.game.arcade.kit.perks;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
@ -109,7 +110,9 @@ public class PerkBaconBlast extends Perk implements IThrown
|
||||
|
||||
public void Explode(ProjectileUser data)
|
||||
{
|
||||
data.GetThrown().getWorld().createExplosion(data.GetThrown().getLocation(), 0.5f);
|
||||
// for whatever reason, you can't put a location in createExplosion if you don't want it to break blocks >.>
|
||||
Location loc = data.GetThrown().getLocation();
|
||||
data.GetThrown().getWorld().createExplosion(loc.getX(), loc.getY(), loc.getZ(), 0.5f, false, false);
|
||||
data.GetThrown().remove();
|
||||
}
|
||||
}
|
||||
|
@ -53,6 +53,10 @@ public class PerkBladeVortex extends Perk
|
||||
|
||||
if (!UtilGear.isWeapon(event.getPlayer().getItemInHand()))
|
||||
return;
|
||||
|
||||
//Dont allow usage in early game
|
||||
if (!UtilTime.elapsed(Manager.GetGame().GetStateTime(), 30000))
|
||||
return;
|
||||
|
||||
final Player player = event.getPlayer();
|
||||
|
||||
|
@ -125,7 +125,7 @@ public class PerkDoubleJump extends Perk
|
||||
if (!Recharge.Instance.usable(player, "Double Jump"))
|
||||
continue;
|
||||
|
||||
if (UtilEnt.isGrounded(player) || UtilBlock.solid(player.getLocation().getBlock().getRelative(BlockFace.DOWN)))
|
||||
if (player.isOnGround() || (UtilBlock.solid(player.getLocation().getBlock().getRelative(BlockFace.DOWN)) && UtilBlock.solid(player.getLocation().getBlock())))
|
||||
player.setAllowFlight(true);
|
||||
}
|
||||
}
|
||||
|
@ -93,7 +93,8 @@ public class PerkFlameDash extends Perk
|
||||
|
||||
_data.add(new FireflyData(player));
|
||||
|
||||
Manager.GetCondition().Factory().Invisible(GetName(), player, player, 2.5, 0, false, false, true);
|
||||
Manager.GetCondition().Factory().Cloak(GetName(), player, player, 2.5, false, false);
|
||||
//Manager.GetCondition().Factory().Invisible(GetName(), player, player, 2.5, 0, false, false, true);
|
||||
|
||||
UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + "."));
|
||||
}
|
||||
|
@ -109,6 +109,8 @@ public class PerkWitchPotion extends SmashPerk
|
||||
Manager.GetDamage().NewDamageEvent(player, thrower, null,
|
||||
DamageCause.CUSTOM, 5, true, true, false,
|
||||
UtilEnt.getName((LivingEntity)event.getEntity().getShooter()), GetName());
|
||||
|
||||
Manager.GetCondition().Factory().Slow("Witch Potion", player, null, 3, 1, true, false, false, false);
|
||||
}
|
||||
//Super Effect
|
||||
else
|
||||
@ -121,6 +123,7 @@ public class PerkWitchPotion extends SmashPerk
|
||||
DamageCause.CUSTOM, 5 + bonus, true, true, false,
|
||||
UtilEnt.getName((LivingEntity)event.getEntity().getShooter()), GetName());
|
||||
|
||||
Manager.GetCondition().Factory().Slow("Witch Potion", player, null, 7, 2, true, false, false, false);
|
||||
//Manager.GetCondition().Factory().Confuse(reason, ent, source, duration, mult, extend, showIndicator, ambient)
|
||||
}
|
||||
}
|
||||
|
@ -16,6 +16,7 @@ import mineplex.serverdata.Utility;
|
||||
import nautilus.game.arcade.ArcadeFormat;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.events.FirstBloodEvent;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.events.PlayerStateChangeEvent;
|
||||
import nautilus.game.arcade.game.Game;
|
||||
@ -77,6 +78,8 @@ public class GameGemManager implements Listener
|
||||
{
|
||||
game.AddGems(killer, 10, "First Blood", false, false);
|
||||
|
||||
Manager.getPluginManager().callEvent(new FirstBloodEvent(killer));
|
||||
|
||||
game.FirstKill = false;
|
||||
|
||||
game.Announce(F.main("Game", Manager.GetColor(killer) + killer.getName() + " drew first blood!"));
|
||||
|
@ -396,7 +396,7 @@ public class GameHostManager implements Listener
|
||||
|
||||
if (!isAdmin(event.getPlayer(), true))
|
||||
{
|
||||
event.getPlayer().sendMessage(F.main("Broadcast", "Only MPS admins can use this command."));
|
||||
event.getPlayer().sendMessage(F.main("Broadcast", "Only Co-Hosts can use this command."));
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
@ -34,6 +34,9 @@ import nautilus.game.arcade.game.Game;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.Game.GameState;
|
||||
import nautilus.game.arcade.game.games.uhc.UHC;
|
||||
import nautilus.game.arcade.gametutorial.GameTutorial;
|
||||
import nautilus.game.arcade.gametutorial.TutorialPhase;
|
||||
import nautilus.game.arcade.gametutorial.TutorialText;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
@ -183,6 +186,75 @@ public class GameManager implements Listener
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isInTutorial(boolean checkForTimer)
|
||||
{
|
||||
if (Manager.GetGame() == null || Manager.GetGame().GetState() != GameState.Prepare)
|
||||
return false;
|
||||
|
||||
Game game = Manager.GetGame();
|
||||
|
||||
boolean tutorialSet = false;
|
||||
for(GameTeam team : game.GetTeamList())
|
||||
{
|
||||
if(team.getTutorial() != null)
|
||||
tutorialSet = true;
|
||||
}
|
||||
if(!tutorialSet)
|
||||
{
|
||||
game.addTutorials();
|
||||
}
|
||||
boolean finished = true;
|
||||
if(game.EnableTutorials)
|
||||
{
|
||||
for(Player player : UtilServer.getPlayers())
|
||||
{
|
||||
if(player.getWorld() == Manager.GetLobby().GetSpawn().getWorld())
|
||||
return true;
|
||||
}
|
||||
long prepTime = 0;
|
||||
for(GameTeam team : game.GetTeamList())
|
||||
{
|
||||
long timeUsage = 0;
|
||||
if(team.getTutorial() != null)
|
||||
{
|
||||
if(!team.getTutorial().hasStarted())
|
||||
{
|
||||
team.getTutorial().setTeam(team);
|
||||
team.getTutorial().start();
|
||||
timeUsage = team.getTutorial().StartAfterTutorial;
|
||||
timeUsage = timeUsage + (team.getTutorial().TimeBetweenPhase * team.getTutorial().getPhases().length);
|
||||
for(TutorialPhase phase : team.getTutorial().getPhases())
|
||||
{
|
||||
for(TutorialText text : phase.getText())
|
||||
{
|
||||
timeUsage = timeUsage + (text.getStayTime() * 50);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!team.getTutorial().hasEnded())
|
||||
{
|
||||
finished = false;
|
||||
if(checkForTimer)
|
||||
{
|
||||
if(team.getTutorial().ShowPrepareTimer)
|
||||
finished = false;
|
||||
else
|
||||
finished = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(prepTime <= timeUsage)
|
||||
prepTime = timeUsage;
|
||||
}
|
||||
if(prepTime > 0)
|
||||
Manager.GetGame().PrepareTime = prepTime;
|
||||
|
||||
if(!finished)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void DisplayPrepareTime(UpdateEvent event)
|
||||
{
|
||||
@ -193,6 +265,9 @@ public class GameManager implements Listener
|
||||
return;
|
||||
|
||||
Game game = Manager.GetGame();
|
||||
|
||||
if(isInTutorial(true))
|
||||
return;
|
||||
|
||||
double percentage = (double) (System.currentTimeMillis() - game.GetStateTime()) / game.PrepareTime;
|
||||
|
||||
@ -200,6 +275,35 @@ public class GameManager implements Listener
|
||||
UtilTextBottom.displayProgress("Game Start", percentage,
|
||||
UtilTime.MakeStr(Math.max(0, game.PrepareTime - (System.currentTimeMillis() - game.GetStateTime()))), player);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void updateGameTutorials(UpdateEvent event)
|
||||
{
|
||||
if(event.getType() != UpdateType.TICK)
|
||||
return;
|
||||
|
||||
Game game = Manager.GetGame();
|
||||
|
||||
if(game == null)
|
||||
return;
|
||||
|
||||
if(game.GetState() != GameState.Prepare)
|
||||
return;
|
||||
|
||||
if(game.EnableTutorials)
|
||||
{
|
||||
for(GameTeam team : game.GetTeamList())
|
||||
{
|
||||
if(team.getTutorial() != null)
|
||||
{
|
||||
if(!team.getTutorial().hasEnded() && team.getTutorial().hasStarted())
|
||||
{
|
||||
team.getTutorial().onTick(team.getTutorial().tick());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void StateUpdate(UpdateEvent event)
|
||||
@ -247,6 +351,9 @@ public class GameManager implements Listener
|
||||
}
|
||||
else if (game.GetState() == GameState.Prepare)
|
||||
{
|
||||
if(isInTutorial(false))
|
||||
return;
|
||||
|
||||
if (game.CanStartPrepareCountdown())
|
||||
{
|
||||
if (UtilTime.elapsed(game.GetStateTime(), game.PrepareTime))
|
||||
|
@ -46,6 +46,11 @@ public class DeathBomberStatTracker extends StatTracker<Game>
|
||||
|
||||
if (!event.GetLog().GetPlayer().IsPlayer())
|
||||
return;
|
||||
|
||||
Player killed = UtilPlayer.searchExact(event.GetLog().GetPlayer().GetName());
|
||||
|
||||
if(killer.equals(killed))
|
||||
return;
|
||||
|
||||
if (event.GetLog().GetKiller() != null && event.GetLog().GetKiller().GetReason().contains("Throwing TNT"))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user