Merge branch 'develop' of ssh://184.154.0.242:25565/min/mineplex into feature/player-data
This commit is contained in:
commit
c2e88c2794
@ -51,13 +51,13 @@ public abstract class DnsMadeEasyApiCallBase
|
||||
try
|
||||
{
|
||||
String timeStamp = getServerTime();
|
||||
SecretKeySpec keySpec = new SecretKeySpec("35bb3b97-3815-4b63-b60b-eb1882c07b40".getBytes(), "HmacSHA1");
|
||||
SecretKeySpec keySpec = new SecretKeySpec("9041bc01-5cbc-49cf-ae09-a23b98350c62".getBytes(), "HmacSHA1");
|
||||
Mac mac = Mac.getInstance("HmacSHA1");
|
||||
mac.init(keySpec);
|
||||
byte[] hashBytes = mac.doFinal((timeStamp + "").getBytes());
|
||||
Hex.encodeHexString(hashBytes);
|
||||
|
||||
request.addHeader("x-dnsme-apiKey", "a9750980-b7df-4a7e-a047-2ade43628f0d");
|
||||
request.addHeader("x-dnsme-apiKey", "2039c697-6ca9-412f-abda-0aef659a382a");
|
||||
request.addHeader("x-dnsme-requestDate", timeStamp + "");
|
||||
request.addHeader("x-dnsme-hmac", Hex.encodeHexString(hashBytes));
|
||||
request.addHeader("Content-Type", "application/json");
|
||||
|
@ -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.Cache"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Core.Common"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Cache"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
@ -46,7 +46,7 @@ public class AccountRepository extends RepositoryBase
|
||||
|
||||
public AccountRepository(JavaPlugin plugin, String webAddress)
|
||||
{
|
||||
super(plugin, DBPool.ACCOUNT);
|
||||
super(plugin, DBPool.getAccount());
|
||||
|
||||
_webAddress = webAddress;
|
||||
}
|
||||
|
@ -2,6 +2,10 @@ package mineplex.core.achievement;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.C;
|
||||
@ -10,10 +14,6 @@ import mineplex.core.game.GameDisplay;
|
||||
import mineplex.core.stats.PlayerStats;
|
||||
import mineplex.core.stats.StatsManager;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public enum AchievementCategory
|
||||
{
|
||||
GLOBAL("Global", null,
|
||||
@ -109,7 +109,7 @@ public enum AchievementCategory
|
||||
|
||||
SUPER_PAINTBALL("Super Paintball", null,
|
||||
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
|
||||
Material.ENDER_PEARL, 0, GameCategory.ARCADE, null),
|
||||
Material.ENDER_PEARL, 0, GameCategory.ARCADE, "Sniper Kit"),
|
||||
|
||||
TURF_WARS("Turf Wars", null,
|
||||
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
|
||||
|
@ -33,7 +33,7 @@ public class AntiHackRepository
|
||||
{
|
||||
PreparedStatement preparedStatement = null;
|
||||
|
||||
try (Connection connection = DBPool.STATS_MINEPLEX.getConnection())
|
||||
try (Connection connection = DBPool.getStats().getConnection())
|
||||
{
|
||||
preparedStatement = connection.prepareStatement(UPDATE_PLAYER_OFFENSES);
|
||||
|
||||
|
@ -19,7 +19,7 @@ public class BenefitManagerRepository extends RepositoryBase
|
||||
|
||||
public BenefitManagerRepository(JavaPlugin plugin)
|
||||
{
|
||||
super(plugin, DBPool.ACCOUNT);
|
||||
super(plugin, DBPool.getAccount());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -789,7 +789,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
||||
{
|
||||
try
|
||||
{
|
||||
final int newTickets = DSL.using(DBPool.ACCOUNT, SQLDialect.MYSQL).update(Tables.bonus).set(Tables.bonus.tickets, Tables.bonus.tickets.add(tickets)).
|
||||
final int newTickets = DSL.using(DBPool.getAccount(), SQLDialect.MYSQL).update(Tables.bonus).set(Tables.bonus.tickets, Tables.bonus.tickets.add(tickets)).
|
||||
where(Tables.bonus.accountId.eq(accountId)).returning(Tables.bonus.tickets).fetchOne().getTickets();
|
||||
runSync(new Runnable()
|
||||
{
|
||||
|
@ -36,7 +36,7 @@ public class BonusRepository extends RepositoryBase
|
||||
|
||||
public BonusRepository(JavaPlugin plugin, BonusManager bonusManager, DonationManager donationManager)
|
||||
{
|
||||
super(plugin, DBPool.ACCOUNT);
|
||||
super(plugin, DBPool.getAccount());
|
||||
_manager = bonusManager;
|
||||
_donationManager = donationManager;
|
||||
}
|
||||
@ -145,7 +145,7 @@ public class BonusRepository extends RepositoryBase
|
||||
{
|
||||
try
|
||||
{
|
||||
DSLContext create = DSL.using(DBPool.ACCOUNT, SQLDialect.MYSQL);
|
||||
DSLContext create = DSL.using(DBPool.getAccount(), SQLDialect.MYSQL);
|
||||
create.update(Tables.bonus).set(Tables.bonus.tickets, Tables.bonus.tickets.add(tickets)).
|
||||
where(Tables.bonus.accountId.eq(accountId)).execute();
|
||||
final int newTickets = create.select(Tables.bonus.tickets).from(Tables.bonus).where(Tables.bonus.accountId.eq(accountId)).fetchOne().value1();
|
||||
|
@ -24,7 +24,7 @@ public class BotSpamRepository extends RepositoryBase
|
||||
|
||||
public BotSpamRepository(JavaPlugin plugin)
|
||||
{
|
||||
super(plugin, DBPool.ACCOUNT);
|
||||
super(plugin, DBPool.getAccount());
|
||||
}
|
||||
|
||||
public ArrayList<SpamText> getSpamText()
|
||||
|
@ -35,7 +35,7 @@ public class CustomDataRepository extends RepositoryBase
|
||||
|
||||
public CustomDataRepository(JavaPlugin plugin, CoreClientManager clientManager, CustomDataManager customDataManager)
|
||||
{
|
||||
super(plugin, DBPool.ACCOUNT);
|
||||
super(plugin, DBPool.getAccount());
|
||||
|
||||
_clientManager = clientManager;
|
||||
_customDataManager = customDataManager;
|
||||
|
@ -1,16 +1,26 @@
|
||||
package mineplex.core.database;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.file.Files;
|
||||
import java.sql.Connection;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.dbcp2.BasicDataSource;
|
||||
|
||||
import mineplex.serverdata.redis.RedisConfig;
|
||||
import mineplex.serverdata.servers.ConnectionData;
|
||||
import mineplex.serverdata.servers.ConnectionData.ConnectionType;
|
||||
|
||||
public final class DBPool
|
||||
{
|
||||
public static final DataSource ACCOUNT = openDataSource("jdbc:mysql://db.mineplex.com/Account", "MilitaryPolice", "CUPr6Wuw2Rus$qap");
|
||||
public static final DataSource QUEUE = openDataSource("jdbc:mysql://db.mineplex.com/Queue", "MilitaryPolice", "CUPr6Wuw2Rus$qap");
|
||||
public static final DataSource MINEPLEX = openDataSource("jdbc:mysql://db.mineplex.com:3306/Mineplex", "MilitaryPolice", "CUPr6Wuw2Rus$qap");
|
||||
public static final DataSource STATS_MINEPLEX = openDataSource("jdbc:mysql://sqlstats.mineplex.com:3306/Mineplex", "root", "tAbechAk3wR7tuTh");
|
||||
private static DataSource ACCOUNT;
|
||||
private static DataSource QUEUE;
|
||||
private static DataSource MINEPLEX;
|
||||
private static DataSource STATS_MINEPLEX;
|
||||
|
||||
private static DataSource openDataSource(String url, String username, String password)
|
||||
{
|
||||
@ -30,8 +40,86 @@ public final class DBPool
|
||||
return source;
|
||||
}
|
||||
|
||||
private DBPool()
|
||||
public static DataSource getAccount()
|
||||
{
|
||||
if (ACCOUNT == null)
|
||||
loadDataSources();
|
||||
|
||||
return ACCOUNT;
|
||||
}
|
||||
|
||||
public static DataSource getQueue()
|
||||
{
|
||||
if (QUEUE == null)
|
||||
loadDataSources();
|
||||
|
||||
return QUEUE;
|
||||
}
|
||||
|
||||
public static DataSource getMineplex()
|
||||
{
|
||||
if (MINEPLEX == null)
|
||||
loadDataSources();
|
||||
|
||||
return MINEPLEX;
|
||||
}
|
||||
|
||||
public static DataSource getStats()
|
||||
{
|
||||
if (STATS_MINEPLEX == null)
|
||||
loadDataSources();
|
||||
|
||||
return STATS_MINEPLEX;
|
||||
}
|
||||
|
||||
private static void loadDataSources()
|
||||
{
|
||||
try
|
||||
{
|
||||
File configFile = new File("database-config.dat");
|
||||
|
||||
if (configFile.exists())
|
||||
{
|
||||
List<String> lines = Files.readAllLines(configFile.toPath(), Charset.defaultCharset());
|
||||
|
||||
for (String line : lines)
|
||||
{
|
||||
deserializeConnection(line);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
System.out.println("database-config.dat not found at " + configFile.toPath().toString());
|
||||
}
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
exception.printStackTrace();
|
||||
System.out.println("---Unable To Parse DBPOOL Configuration File---");
|
||||
}
|
||||
}
|
||||
|
||||
private static void deserializeConnection(String line)
|
||||
{
|
||||
String[] args = line.split(" ");
|
||||
|
||||
if (args.length == 4)
|
||||
{
|
||||
String dbSource = args[0];
|
||||
String dbHost = args[1];
|
||||
String userName = args[2];
|
||||
String password = args[3];
|
||||
|
||||
System.out.println(dbSource + " " + dbHost + " " + userName + " " + password);
|
||||
|
||||
if (dbSource.toUpperCase().equalsIgnoreCase("ACCOUNT"))
|
||||
ACCOUNT = openDataSource("jdbc:mysql://" + dbHost, userName, password);
|
||||
else if (dbSource.toUpperCase().equalsIgnoreCase("QUEUE"))
|
||||
QUEUE = openDataSource("jdbc:mysql://" + dbHost, userName, password);
|
||||
else if (dbSource.toUpperCase().equalsIgnoreCase("MINEPLEX"))
|
||||
MINEPLEX = openDataSource("jdbc:mysql://" + dbHost, userName, password);
|
||||
else if (dbSource.toUpperCase().equalsIgnoreCase("STATS"))
|
||||
STATS_MINEPLEX = openDataSource("jdbc:mysql://" + dbHost, userName, password);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ public abstract class RepositoryBase implements Listener
|
||||
|
||||
protected DSLContext jooq()
|
||||
{
|
||||
return DSL.using(DBPool.ACCOUNT, SQLDialect.MYSQL);
|
||||
return DSL.using(DBPool.getAccount(), SQLDialect.MYSQL);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -37,7 +37,7 @@ public class DonationRepository extends RepositoryBase
|
||||
|
||||
public DonationRepository(JavaPlugin plugin, String webAddress)
|
||||
{
|
||||
super(plugin, DBPool.ACCOUNT);
|
||||
super(plugin, DBPool.getAccount());
|
||||
|
||||
_webAddress = webAddress;
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ public class EloRepository extends RepositoryBase
|
||||
|
||||
public EloRepository(JavaPlugin plugin)
|
||||
{
|
||||
super(plugin, DBPool.ACCOUNT);
|
||||
super(plugin, DBPool.getAccount());
|
||||
|
||||
initialize();
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ public class FriendRepository extends RepositoryBase
|
||||
|
||||
public FriendRepository(JavaPlugin plugin)
|
||||
{
|
||||
super(plugin, DBPool.ACCOUNT);
|
||||
super(plugin, DBPool.getAccount());
|
||||
|
||||
_repository = new RedisDataRepository<PlayerStatus>(ServerManager.getMasterConnection(), ServerManager.getSlaveConnection(),
|
||||
Region.currentRegion(), PlayerStatus.class, "playerStatus");
|
||||
|
@ -26,7 +26,7 @@ public class GiveawayRepository extends RepositoryBase
|
||||
|
||||
public GiveawayRepository(JavaPlugin plugin)
|
||||
{
|
||||
super(plugin, DBPool.ACCOUNT);
|
||||
super(plugin, DBPool.getAccount());
|
||||
}
|
||||
|
||||
public boolean canGiveaway(int accountId, String giveawayName, String cooldownName)
|
||||
|
@ -4,11 +4,14 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import net.minecraft.server.v1_8_R3.DataWatcher;
|
||||
import net.minecraft.server.v1_8_R3.Packet;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutEntity;
|
||||
@ -16,8 +19,6 @@ import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityMetadata;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityTeleport;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
|
||||
public class Hologram
|
||||
{
|
||||
@ -313,7 +314,7 @@ public class Hologram
|
||||
*/
|
||||
public Hologram removePlayer(Player player)
|
||||
{
|
||||
return addPlayer(player.getName());
|
||||
return removePlayer(player.getName());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -17,7 +17,7 @@ public class IgnoreRepository extends RepositoryBase
|
||||
|
||||
public IgnoreRepository(JavaPlugin plugin)
|
||||
{
|
||||
super(plugin, DBPool.ACCOUNT);
|
||||
super(plugin, DBPool.getAccount());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -29,7 +29,7 @@ public class InventoryRepository extends RepositoryBase
|
||||
|
||||
public InventoryRepository(JavaPlugin plugin)
|
||||
{
|
||||
super(plugin, DBPool.ACCOUNT);
|
||||
super(plugin, DBPool.getAccount());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -36,7 +36,7 @@ public class StatEventsRepository extends RepositoryBase
|
||||
*/
|
||||
public StatEventsRepository(JavaPlugin plugin)
|
||||
{
|
||||
super(plugin, DBPool.ACCOUNT);
|
||||
super(plugin, DBPool.getAccount());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -268,7 +268,7 @@ public class NpcManager extends MiniPlugin
|
||||
|
||||
public Entity addNpc(Player player, EntityType entityType, double radius, boolean adult, String name, String entityMeta) throws SQLException
|
||||
{
|
||||
try (Connection connection = DBPool.ACCOUNT.getConnection())
|
||||
try (Connection connection = DBPool.getAccount().getConnection())
|
||||
{
|
||||
String helmet = itemStackToYaml(player.getInventory().getHelmet());
|
||||
String chestplate = itemStackToYaml(player.getInventory().getChestplate());
|
||||
@ -386,7 +386,7 @@ public class NpcManager extends MiniPlugin
|
||||
|
||||
if (npc != null)
|
||||
{
|
||||
try (Connection connection = DBPool.ACCOUNT.getConnection())
|
||||
try (Connection connection = DBPool.getAccount().getConnection())
|
||||
{
|
||||
npc.getDatabaseRecord().attach(DSL.using(connection).configuration());
|
||||
npc.getDatabaseRecord().delete();
|
||||
@ -493,7 +493,7 @@ public class NpcManager extends MiniPlugin
|
||||
{
|
||||
String serverType = getServerName();
|
||||
|
||||
try (Connection connection = DBPool.ACCOUNT.getConnection())
|
||||
try (Connection connection = DBPool.getAccount().getConnection())
|
||||
{
|
||||
Result<NpcsRecord> result = DSL.using(connection)
|
||||
.selectFrom(Tables.npcs)
|
||||
@ -519,7 +519,7 @@ public class NpcManager extends MiniPlugin
|
||||
{
|
||||
String serverType = getServerName();
|
||||
|
||||
try (Connection connection = DBPool.ACCOUNT.getConnection())
|
||||
try (Connection connection = DBPool.getAccount().getConnection())
|
||||
{
|
||||
DSL.using(connection)
|
||||
.delete(Tables.npcs)
|
||||
|
@ -22,7 +22,7 @@ public class PetRepository extends RepositoryBase
|
||||
|
||||
public PetRepository(JavaPlugin plugin, String webAddress)
|
||||
{
|
||||
super(plugin, DBPool.ACCOUNT);
|
||||
super(plugin, DBPool.getAccount());
|
||||
|
||||
_webAddress = webAddress;
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ public class PollRepository extends RepositoryBase
|
||||
|
||||
public PollRepository(JavaPlugin plugin)
|
||||
{
|
||||
super(plugin, DBPool.ACCOUNT);
|
||||
super(plugin, DBPool.getAccount());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -28,7 +28,7 @@ public class PreferencesRepository extends RepositoryBase
|
||||
|
||||
public PreferencesRepository(JavaPlugin plugin)
|
||||
{
|
||||
super(plugin, DBPool.ACCOUNT);
|
||||
super(plugin, DBPool.getAccount());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -41,7 +41,7 @@ This will be used to determine if staff are handling
|
||||
|
||||
public ReportRepository(JavaPlugin plugin, String connectionString)
|
||||
{
|
||||
super(plugin, DBPool.ACCOUNT);
|
||||
super(plugin, DBPool.getAccount());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -23,7 +23,7 @@ public class SpawnRepository extends RepositoryBase
|
||||
|
||||
public SpawnRepository(JavaPlugin plugin, String serverName)
|
||||
{
|
||||
super(plugin, DBPool.ACCOUNT);
|
||||
super(plugin, DBPool.getAccount());
|
||||
_serverName = serverName;
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ public class StatsRepository extends RepositoryBase
|
||||
|
||||
public StatsRepository(JavaPlugin plugin)
|
||||
{
|
||||
super(plugin, DBPool.ACCOUNT);
|
||||
super(plugin, DBPool.getAccount());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -24,7 +24,7 @@ public class TaskRepository extends RepositoryBase
|
||||
|
||||
public TaskRepository(JavaPlugin plugin)
|
||||
{
|
||||
super(plugin, DBPool.ACCOUNT);
|
||||
super(plugin, DBPool.getAccount());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -20,7 +20,7 @@ public class TitanGiveawayRepository extends RepositoryBase
|
||||
|
||||
public TitanGiveawayRepository(JavaPlugin plugin)
|
||||
{
|
||||
super(plugin, DBPool.ACCOUNT);
|
||||
super(plugin, DBPool.getAccount());
|
||||
_titanCount = 0;
|
||||
}
|
||||
|
||||
|
@ -86,7 +86,7 @@ public class ClanRepository extends RepositoryBase
|
||||
|
||||
public ClanRepository(JavaPlugin plugin, String serverName, boolean isClansServer)
|
||||
{
|
||||
super(plugin, DBPool.ACCOUNT);
|
||||
super(plugin, DBPool.getAccount());
|
||||
|
||||
_serverName = serverName;
|
||||
_serverId = -1;
|
||||
|
@ -34,7 +34,7 @@ public class FieldRepository extends RepositoryBase
|
||||
|
||||
public FieldRepository(JavaPlugin plugin)
|
||||
{
|
||||
super(plugin, DBPool.ACCOUNT);
|
||||
super(plugin, DBPool.getAccount());
|
||||
}
|
||||
|
||||
public List<FieldBlockToken> getFieldBlocks(String server)
|
||||
|
@ -41,7 +41,7 @@ public class HubRepository
|
||||
PreparedStatement preparedStatement = null;
|
||||
HashMap<String, String> newsEntries = new HashMap<String, String>();
|
||||
|
||||
try (Connection connection = DBPool.MINEPLEX.getConnection())
|
||||
try (Connection connection = DBPool.getMineplex().getConnection())
|
||||
{
|
||||
preparedStatement = connection.prepareStatement(RETRIEVE_NEWS_ENTRIES);
|
||||
|
||||
@ -91,7 +91,7 @@ public class HubRepository
|
||||
int result = 0;
|
||||
PreparedStatement preparedStatement = null;
|
||||
|
||||
try (Connection connection = DBPool.MINEPLEX.getConnection())
|
||||
try (Connection connection = DBPool.getMineplex().getConnection())
|
||||
{
|
||||
preparedStatement = connection.prepareStatement(SET_NEWS_ENTRY);
|
||||
preparedStatement.setString(1, newsEntry);
|
||||
@ -127,7 +127,7 @@ public class HubRepository
|
||||
ResultSet resultSet = null;
|
||||
PreparedStatement preparedStatement = null;
|
||||
|
||||
try (Connection connection = DBPool.MINEPLEX.getConnection())
|
||||
try (Connection connection = DBPool.getMineplex().getConnection())
|
||||
{
|
||||
preparedStatement = connection.prepareStatement(RETRIEVE_MAX_NEWS_POSITION);
|
||||
resultSet = preparedStatement.executeQuery();
|
||||
@ -165,7 +165,7 @@ public class HubRepository
|
||||
int maxPos = retrieveMaxNewsPosition();
|
||||
PreparedStatement preparedStatement = null;
|
||||
|
||||
try (Connection connection = DBPool.MINEPLEX.getConnection())
|
||||
try (Connection connection = DBPool.getMineplex().getConnection())
|
||||
{
|
||||
preparedStatement = connection.prepareStatement(ADD_NEWS_ENTRY);
|
||||
preparedStatement.setString(1, newsEntry);
|
||||
@ -201,7 +201,7 @@ public class HubRepository
|
||||
int maxPos = retrieveMaxNewsPosition();
|
||||
PreparedStatement preparedStatement = null;
|
||||
|
||||
try (Connection connection = DBPool.MINEPLEX.getConnection())
|
||||
try (Connection connection = DBPool.getMineplex().getConnection())
|
||||
{
|
||||
//preparedStatement = connection.prepareStatement(DELETE_RECALC_NEWS_ENTRY);
|
||||
preparedStatement = connection.prepareStatement(DELETE_NEWS_ENTRY);
|
||||
|
@ -21,7 +21,7 @@ public class MailRepository extends RepositoryBase
|
||||
|
||||
public MailRepository(JavaPlugin plugin, MailManager manager)
|
||||
{
|
||||
super(plugin, DBPool.ACCOUNT);
|
||||
super(plugin, DBPool.getAccount());
|
||||
|
||||
_manager = manager;
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ public class QueueRepository
|
||||
{
|
||||
PreparedStatement preparedStatement = null;
|
||||
|
||||
try (Connection connection = DBPool.QUEUE.getConnection())
|
||||
try (Connection connection = DBPool.getQueue().getConnection())
|
||||
{
|
||||
preparedStatement = connection.prepareStatement(DELETE_QUEUE_RECORD);
|
||||
|
||||
@ -71,7 +71,7 @@ public class QueueRepository
|
||||
{
|
||||
PreparedStatement preparedStatement = null;
|
||||
|
||||
try (Connection connection = DBPool.QUEUE.getConnection())
|
||||
try (Connection connection = DBPool.getQueue().getConnection())
|
||||
{
|
||||
preparedStatement = connection.prepareStatement(SAVE_STATE_VALUE);
|
||||
preparedStatement.setString(1, matchStatus.State);
|
||||
@ -108,7 +108,7 @@ public class QueueRepository
|
||||
PreparedStatement preparedStatement = null;
|
||||
PlayerMatchStatus matchStatus = new PlayerMatchStatus();
|
||||
|
||||
try (Connection connection = DBPool.QUEUE.getConnection())
|
||||
try (Connection connection = DBPool.getQueue().getConnection())
|
||||
{
|
||||
preparedStatement = connection.prepareStatement(INSERT_ACCOUNT, Statement.RETURN_GENERATED_KEYS);
|
||||
preparedStatement.setString(1, playerList);
|
||||
@ -165,7 +165,7 @@ public class QueueRepository
|
||||
PreparedStatement preparedStatement = null;
|
||||
PlayerMatchStatus matchStatus = null;
|
||||
|
||||
try (Connection connection = DBPool.QUEUE.getConnection())
|
||||
try (Connection connection = DBPool.getQueue().getConnection())
|
||||
{
|
||||
preparedStatement = connection.prepareStatement(RETRIEVE_MATCH_STATUS);
|
||||
preparedStatement.setInt(1, id);
|
||||
@ -220,7 +220,7 @@ public class QueueRepository
|
||||
ResultSet resultSet = null;
|
||||
PreparedStatement preparedStatement = null;
|
||||
|
||||
try (Connection connection = DBPool.QUEUE.getConnection())
|
||||
try (Connection connection = DBPool.getQueue().getConnection())
|
||||
{
|
||||
preparedStatement = connection.prepareStatement(RETRIEVE_OTHER_MATCH_STATUS);
|
||||
preparedStatement.setInt(1, matchStatus.AssignedMatch);
|
||||
|
@ -3,8 +3,6 @@ package mineplex.minecraft.game.core.damage;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
@ -15,6 +13,8 @@ import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
|
||||
public class CustomDamageEvent extends Event implements Cancellable
|
||||
{
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
@ -43,6 +43,7 @@ public class CustomDamageEvent extends Event implements Cancellable
|
||||
private boolean _knockback = true;
|
||||
private boolean _damageeBrute = false;
|
||||
private boolean _damageToLevel = true;
|
||||
private boolean _arrowShow = true;
|
||||
|
||||
public CustomDamageEvent(LivingEntity damagee, LivingEntity damager, Projectile projectile, Location knockbackOrigin,
|
||||
DamageCause cause, double damage, boolean knockback, boolean ignoreRate, boolean ignoreArmor, String initialSource,
|
||||
@ -167,6 +168,16 @@ public class CustomDamageEvent extends Event implements Cancellable
|
||||
{
|
||||
return _projectile;
|
||||
}
|
||||
|
||||
public void setShowArrows(boolean show)
|
||||
{
|
||||
_arrowShow = show;
|
||||
}
|
||||
|
||||
public boolean getShowArrows()
|
||||
{
|
||||
return _arrowShow;
|
||||
}
|
||||
|
||||
public DamageCause GetCause()
|
||||
{
|
||||
|
@ -378,7 +378,7 @@ public class DamageManager extends MiniPlugin
|
||||
event.GetDamageeEntity().playEffect(EntityEffect.HURT);
|
||||
|
||||
//Sticky Arrow
|
||||
if (event.GetCause() == DamageCause.PROJECTILE && event.GetProjectile() != null && event.GetProjectile() instanceof Arrow)
|
||||
if (event.GetCause() == DamageCause.PROJECTILE && event.GetProjectile() != null && event.GetProjectile() instanceof Arrow && event.getShowArrows())
|
||||
((CraftLivingEntity)event.GetDamageeEntity()).getHandle().o(((CraftLivingEntity)event.GetDamageeEntity()).getHandle().bv() + 1);
|
||||
|
||||
//Knockback
|
||||
|
@ -1,17 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>Mineplex.Cache</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
@ -406,30 +406,40 @@ public class ServerMonitor
|
||||
if (deadServer.getUptime() <= 10 || ignoreServer(deadServer.getGroup()))
|
||||
continue;
|
||||
|
||||
if (_count == 0 || deadServers.contains(deadServer.getName()))
|
||||
try
|
||||
{
|
||||
copyServerLog(deadServer);
|
||||
killServer(deadServer.getName(), deadServer.getPublicAddress(), deadServer.getPlayerCount(), "[KILLED] [DEAD] " + deadServer.getName() + ":" + deadServer.getPublicAddress(), true);
|
||||
|
||||
handleUserServerGroup(_serverGroupMap.get(deadServer.getGroup()));
|
||||
}
|
||||
else if (!_delayedKill.contains(deadServer.getName()))
|
||||
{
|
||||
startTimingReport(deadServer);
|
||||
|
||||
_timer.schedule(new TimerTask()
|
||||
if (_count == 0 || deadServers.contains(deadServer.getName()))
|
||||
{
|
||||
public void run()
|
||||
if (_count != 0)
|
||||
copyServerLog(deadServer);
|
||||
|
||||
killServer(deadServer.getName(), deadServer.getPublicAddress(), deadServer.getPlayerCount(), "[KILLED] [DEAD] " + deadServer.getName() + ":" + deadServer.getPublicAddress(), true);
|
||||
|
||||
handleUserServerGroup(_serverGroupMap.get(deadServer.getGroup()));
|
||||
}
|
||||
else if (!_delayedKill.contains(deadServer.getName()))
|
||||
{
|
||||
startTimingReport(deadServer);
|
||||
|
||||
_timer.schedule(new TimerTask()
|
||||
{
|
||||
_deadServers.add(deadServer.getName());
|
||||
_delayedKill.remove(deadServer.getName());
|
||||
|
||||
stopTimingReport(deadServer);
|
||||
log("[IMPENDING DEATH] : " + deadServer.getName() + ":" + deadServer.getPublicAddress());
|
||||
}
|
||||
}, 20 * 1000);
|
||||
|
||||
_delayedKill.add(deadServer.getName());
|
||||
public void run()
|
||||
{
|
||||
_deadServers.add(deadServer.getName());
|
||||
_delayedKill.remove(deadServer.getName());
|
||||
|
||||
stopTimingReport(deadServer);
|
||||
log("[IMPENDING DEATH] : " + deadServer.getName() + ":" + deadServer.getPublicAddress());
|
||||
}
|
||||
}, 20 * 1000);
|
||||
|
||||
_delayedKill.add(deadServer.getName());
|
||||
}
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
log("[ERROR] : Trying to delete " + deadServer.getName() + ":" + deadServer.getPublicAddress());
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -105,6 +105,7 @@ public class CustomerSupport extends MiniPlugin
|
||||
int oldChestsReceived = 0;
|
||||
int ancientChestsReceived = 0;
|
||||
int mythicalChestsReceived = 0;
|
||||
int winterChestsReceived = 0;
|
||||
|
||||
for (CoinTransactionToken transaction : donor.getCoinTransactions())
|
||||
{
|
||||
@ -150,12 +151,24 @@ public class CustomerSupport extends MiniPlugin
|
||||
}
|
||||
|
||||
}
|
||||
if (transaction.SalesPackageName.startsWith("Winter Chest"))
|
||||
{
|
||||
if (transaction.Coins == 0 && transaction.Gems == 0)
|
||||
{
|
||||
if (transaction.SalesPackageName.split(" ").length == 3)
|
||||
winterChestsReceived += Integer.parseInt(transaction.SalesPackageName.split(" ")[2]);
|
||||
else if (transaction.SalesPackageName.split(" ").length == 2)
|
||||
winterChestsReceived += 1;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
caller.sendMessage(C.cBlue + "Enjin Coin Total Received : " + C.cYellow + enjinCoinsReceived);
|
||||
caller.sendMessage(C.cBlue + "Old Chests Received : " + C.cYellow + oldChestsReceived);
|
||||
caller.sendMessage(C.cBlue + "Ancient Chests Received : " + C.cYellow + ancientChestsReceived);
|
||||
caller.sendMessage(C.cBlue + "Mythical Chests Received : " + C.cYellow + mythicalChestsReceived);
|
||||
caller.sendMessage(C.cBlue + "Winter Chests Received : " + C.cYellow + winterChestsReceived);
|
||||
|
||||
caller.sendMessage(C.cDGreen + C.Strike + "=============================================");
|
||||
_salesPackageManager.displaySalesPackages(caller, playerName);
|
||||
|
@ -179,7 +179,7 @@ public class VotifierManager extends MiniPlugin
|
||||
|
||||
private void awardBonus(final String playerName, final UUID uuid, final Callback<Integer> onComplete)
|
||||
{
|
||||
DSLContext create = DSL.using(DBPool.ACCOUNT, SQLDialect.MYSQL);
|
||||
DSLContext create = DSL.using(DBPool.getAccount(), SQLDialect.MYSQL);
|
||||
|
||||
Record1<Integer> idRecord = create.select(Tables.accounts.id).from(Tables.accounts).where(Tables.accounts.uuid.eq(uuid.toString())).fetchOne();
|
||||
if (idRecord != null)
|
||||
|
@ -6,6 +6,39 @@ import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.block.BlockBurnEvent;
|
||||
import org.bukkit.event.block.BlockFadeEvent;
|
||||
import org.bukkit.event.block.BlockSpreadEvent;
|
||||
import org.bukkit.event.block.LeavesDecayEvent;
|
||||
import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||
import org.bukkit.event.inventory.InventoryType;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerLoginEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.event.player.PlayerResourcePackStatusEvent;
|
||||
import org.bukkit.event.player.PlayerResourcePackStatusEvent.Status;
|
||||
import org.bukkit.event.server.ServerListPingEvent;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.achievement.AchievementManager;
|
||||
@ -40,7 +73,6 @@ import mineplex.core.hologram.HologramManager;
|
||||
import mineplex.core.inventory.InventoryManager;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.movement.Movement;
|
||||
import mineplex.core.notifier.NotificationManager;
|
||||
import mineplex.core.npc.NpcManager;
|
||||
import mineplex.core.packethandler.PacketHandler;
|
||||
import mineplex.core.party.PartyManager;
|
||||
@ -99,6 +131,7 @@ import nautilus.game.arcade.managers.GameManager;
|
||||
import nautilus.game.arcade.managers.GamePlayerManager;
|
||||
import nautilus.game.arcade.managers.GameSpectatorManager;
|
||||
import nautilus.game.arcade.managers.GameStatManager;
|
||||
import nautilus.game.arcade.managers.GameTestingManager;
|
||||
import nautilus.game.arcade.managers.GameTournamentManager;
|
||||
import nautilus.game.arcade.managers.GameWorldManager;
|
||||
import nautilus.game.arcade.managers.HolidayManager;
|
||||
@ -106,39 +139,6 @@ import nautilus.game.arcade.managers.IdleManager;
|
||||
import nautilus.game.arcade.managers.MiscManager;
|
||||
import nautilus.game.arcade.player.ArcadePlayer;
|
||||
import nautilus.game.arcade.shop.ArcadeShop;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.block.BlockBurnEvent;
|
||||
import org.bukkit.event.block.BlockFadeEvent;
|
||||
import org.bukkit.event.block.BlockSpreadEvent;
|
||||
import org.bukkit.event.block.LeavesDecayEvent;
|
||||
import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||
import org.bukkit.event.inventory.InventoryType;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerLoginEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.event.player.PlayerResourcePackStatusEvent;
|
||||
import org.bukkit.event.player.PlayerResourcePackStatusEvent.Status;
|
||||
import org.bukkit.event.server.ServerListPingEvent;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
|
||||
public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
{
|
||||
@ -303,6 +303,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
_idleManager = new IdleManager(this);
|
||||
TitanGiveawayManager titanGiveaway = new TitanGiveawayManager(getPlugin(), clientManager, serverStatusManager);
|
||||
new HolidayManager(this, titanGiveaway);
|
||||
new GameTestingManager(this);
|
||||
|
||||
// Game Addons
|
||||
new CompassAddon(plugin, this);
|
||||
|
@ -5,14 +5,15 @@ import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.game.SoloGame;
|
||||
import nautilus.game.arcade.game.games.baconbrawl.kits.*;
|
||||
import nautilus.game.arcade.game.games.baconbrawl.kits.KitMamaPig;
|
||||
import nautilus.game.arcade.game.games.baconbrawl.kits.KitPig;
|
||||
import nautilus.game.arcade.game.games.baconbrawl.kits.KitSheepPig;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
|
||||
public class BaconBrawl extends SoloGame
|
||||
@ -34,9 +35,9 @@ public class BaconBrawl extends SoloGame
|
||||
"Last pig in the arena wins!"
|
||||
});
|
||||
|
||||
this.DamageTeamSelf = true;
|
||||
this.HungerSet = 20;
|
||||
this.PrepareFreeze = false;
|
||||
DamageTeamSelf = true;
|
||||
HungerSet = 20;
|
||||
PrepareFreeze = false;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -11,7 +11,6 @@ import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.disguise.disguises.DisguisePig;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
|
@ -13,7 +13,6 @@ import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.kit.KitAvailability;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
import nautilus.game.arcade.kit.perks.PerkBodySlam;
|
||||
import nautilus.game.arcade.kit.perks.PerkJump;
|
||||
|
||||
public class KitPig extends Kit
|
||||
{
|
||||
|
@ -1,6 +1,5 @@
|
||||
package nautilus.game.arcade.game.games.baconbrawl.kits;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
|
@ -0,0 +1,6 @@
|
||||
package nautilus.game.arcade.game.games.bridge;
|
||||
|
||||
public class BattleCryManager
|
||||
{
|
||||
|
||||
}
|
@ -26,6 +26,7 @@ public class BridgePart
|
||||
Velocity = velocity;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public boolean Update()
|
||||
{
|
||||
if (!Entity.isValid())
|
||||
|
@ -4,12 +4,55 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.entity.EnderPearl;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Snowball;
|
||||
import org.bukkit.entity.ThrownPotion;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.entity.EntityRegainHealthEvent;
|
||||
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
|
||||
import org.bukkit.event.entity.ProjectileHitEvent;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.player.PlayerInteractAtEntityEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.LeatherArmorMeta;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.scoreboard.NameTagVisibility;
|
||||
import org.bukkit.scoreboard.Team;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilEvent;
|
||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||
import mineplex.core.common.util.UtilGear;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.hologram.Hologram.HologramTarget;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
|
||||
@ -21,111 +64,56 @@ import nautilus.game.arcade.events.PlayerPrepareTeleportEvent;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.GameTeam.PlayerState;
|
||||
import nautilus.game.arcade.game.TeamGame;
|
||||
import nautilus.game.arcade.game.games.paintball.events.PaintballEvent;
|
||||
import nautilus.game.arcade.game.games.paintball.events.ReviveEvent;
|
||||
import nautilus.game.arcade.game.games.paintball.kits.KitMachineGun;
|
||||
import nautilus.game.arcade.game.games.paintball.kits.KitRifle;
|
||||
import nautilus.game.arcade.game.games.paintball.kits.KitShotgun;
|
||||
import nautilus.game.arcade.game.games.paintball.kits.KitSniper;
|
||||
import nautilus.game.arcade.game.games.paintball.trackers.KillingSpreeTracker;
|
||||
import nautilus.game.arcade.game.games.paintball.trackers.LastStandStatTracker;
|
||||
import nautilus.game.arcade.game.games.paintball.trackers.MedicStatTracker;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.stats.KillFastStatTracker;
|
||||
import nautilus.game.arcade.stats.LastStandStatTracker;
|
||||
import nautilus.game.arcade.stats.MedicStatTracker;
|
||||
import nautilus.game.arcade.stats.WinFastStatTracker;
|
||||
import nautilus.game.arcade.stats.WinWithoutLosingTeammateStatTracker;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||
import org.bukkit.entity.EnderPearl;
|
||||
import org.bukkit.entity.HumanEntity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Snowball;
|
||||
import org.bukkit.entity.ThrownPotion;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.entity.EntityRegainHealthEvent;
|
||||
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
|
||||
import org.bukkit.event.entity.ProjectileHitEvent;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.player.PlayerEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.LeatherArmorMeta;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.util.Vector;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy;
|
||||
|
||||
public class Paintball extends TeamGame
|
||||
{
|
||||
public static class ReviveEvent extends PlayerEvent
|
||||
{
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
public static HandlerList getHandlerList()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers()
|
||||
{
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
private final Player _revivedPlayer;
|
||||
|
||||
public ReviveEvent(Player who, Player revivedPlayer)
|
||||
{
|
||||
super(who);
|
||||
|
||||
_revivedPlayer = revivedPlayer;
|
||||
}
|
||||
|
||||
public Player getRevivedPlayer()
|
||||
{
|
||||
return _revivedPlayer;
|
||||
}
|
||||
}
|
||||
|
||||
private HashMap<Player, PlayerCopy> _doubles = new HashMap<Player, PlayerCopy>();
|
||||
private HashMap<Player, PlayerCopyPaintball> _doubles = new HashMap<Player, PlayerCopyPaintball>();
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public Paintball(ArcadeManager manager)
|
||||
{
|
||||
super(manager, GameType.Paintball,
|
||||
super(manager, GameType.Paintball, new Kit[]
|
||||
{
|
||||
new KitRifle(manager),
|
||||
new KitShotgun(manager),
|
||||
new KitMachineGun(manager),
|
||||
new KitSniper(manager),
|
||||
|
||||
}, new String[]
|
||||
{
|
||||
"Shoot enemies to paint them",
|
||||
"Revive/heal with Water Bombs",
|
||||
"Last team alive wins!"
|
||||
});
|
||||
|
||||
new Kit[]
|
||||
{
|
||||
new KitRifle(manager),
|
||||
new KitShotgun(manager),
|
||||
new KitMachineGun(manager),
|
||||
},
|
||||
StrictAntiHack = true;
|
||||
|
||||
new String[]
|
||||
{
|
||||
"Shoot enemies to paint them",
|
||||
"Revive/heal with Water Bombs",
|
||||
"Last team alive wins!"
|
||||
});
|
||||
|
||||
this.StrictAntiHack = true;
|
||||
HungerSet = 20;
|
||||
|
||||
this.HungerSet = 20;
|
||||
InventoryClick = false;
|
||||
|
||||
TeamArmorHotbar = true;
|
||||
|
||||
registerStatTrackers(
|
||||
new KillFastStatTracker(this, 4, 5, "KillingSpree"),
|
||||
new KillingSpreeTracker(this),
|
||||
new WinWithoutLosingTeammateStatTracker(this, "FlawlessVictory"),
|
||||
new MedicStatTracker(this),
|
||||
new WinFastStatTracker(this, 30, "Speedrunner"),
|
||||
new LastStandStatTracker(this)
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -140,6 +128,14 @@ public class Paintball extends TeamGame
|
||||
this.GetTeamList().get(1).SetColor(ChatColor.RED);
|
||||
this.GetTeamList().get(1).SetName("Nether");
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onNameTag(GameStateChangeEvent event)
|
||||
{
|
||||
if (event.GetState() == GameState.Prepare)
|
||||
for (Team team : Scoreboard.GetScoreboard().getTeams())
|
||||
team.setNameTagVisibility(NameTagVisibility.HIDE_FOR_OTHER_TEAMS);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void ColorArmor(PlayerPrepareTeleportEvent event)
|
||||
@ -160,47 +156,63 @@ public class Paintball extends TeamGame
|
||||
if (event.getCause() == TeleportCause.ENDER_PEARL)
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@EventHandler
|
||||
public void Paint(ProjectileHitEvent event)
|
||||
public void Paint(final ProjectileHitEvent event)
|
||||
{
|
||||
// Fixed projectile wool painting in waiting lobby.
|
||||
|
||||
if (IsLive() || GetState() == GameState.End)
|
||||
{
|
||||
if (event.getEntity() instanceof ThrownPotion)
|
||||
return;
|
||||
|
||||
byte color = 3;
|
||||
if (event.getEntity() instanceof EnderPearl)
|
||||
color = 14;
|
||||
final byte color = (byte) (event.getEntity() instanceof EnderPearl || (event.getEntity() instanceof Arrow && event.getEntity().hasMetadata("color") && ChatColor.values()[event.getEntity().getMetadata("color").get(0).asInt()] == ChatColor.RED) ? 14 : 3);
|
||||
|
||||
Location loc = event.getEntity().getLocation().add(event.getEntity().getVelocity());
|
||||
event.getEntity().setVelocity(event.getEntity().getVelocity().normalize().multiply(1.2));
|
||||
|
||||
for (Block block : UtilBlock.getInRadius(loc, 1.5d).keySet())
|
||||
{
|
||||
if (block.getType() != Material.WOOL && block.getType() != Material.STAINED_CLAY)
|
||||
continue;
|
||||
PacketPlayOutEntityDestroy destroy = new PacketPlayOutEntityDestroy(new int[]{event.getEntity().getEntityId()});
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
UtilPlayer.sendPacket(player, destroy);
|
||||
|
||||
block.setData(color);
|
||||
}
|
||||
Manager.runSyncLater(new Runnable() // Stupid thing I have to do to make sure the arrow's location is accounted for. Stupid mojang. - Myst
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
Location loc = event.getEntity().getLocation();
|
||||
// loc.add(event.getEntity().getVelocity().clone().normalize().multiply(.5));
|
||||
|
||||
if (color == 3) loc.getWorld().playEffect(loc, Effect.STEP_SOUND, 8);
|
||||
else loc.getWorld().playEffect(loc, Effect.STEP_SOUND, 10);
|
||||
for (Block block : UtilBlock.getInRadius(loc, 1.5d).keySet())
|
||||
{
|
||||
if (block.getType() != Material.WOOL && block.getType() != Material.STAINED_CLAY && block.getType() != Material.HARD_CLAY)
|
||||
continue;
|
||||
|
||||
if (block.getType() == Material.HARD_CLAY)
|
||||
block.setType(Material.STAINED_CLAY);
|
||||
|
||||
block.setData(color);
|
||||
}
|
||||
|
||||
if (color == 3) loc.getWorld().playEffect(loc, Effect.STEP_SOUND, 8);
|
||||
else loc.getWorld().playEffect(loc, Effect.STEP_SOUND, 10);
|
||||
|
||||
event.getEntity().remove();
|
||||
}
|
||||
}, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void PlayerQuit(PlayerQuitEvent event)
|
||||
public void onQuit(PlayerQuitEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (_doubles.containsKey(player))
|
||||
{
|
||||
PlayerCopy copy = _doubles.get(player);
|
||||
PlayerCopyPaintball copy = _doubles.remove(player);
|
||||
copy.GetEntity().remove();
|
||||
_doubles.remove(player);
|
||||
copy.GetHolo().stop();
|
||||
copy.GetSaveMe().stop();
|
||||
}
|
||||
}
|
||||
|
||||
@ -216,7 +228,7 @@ public class Paintball extends TeamGame
|
||||
event.SetCancelled("No Projectile");
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
public void PaintballDamage(CustomDamageEvent event)
|
||||
{
|
||||
if (!IsLive())
|
||||
@ -225,7 +237,7 @@ public class Paintball extends TeamGame
|
||||
if (event.GetProjectile() == null)
|
||||
return;
|
||||
|
||||
if (!(event.GetProjectile() instanceof Snowball) && !(event.GetProjectile() instanceof EnderPearl))
|
||||
if (!(event.GetProjectile() instanceof Snowball) && !(event.GetProjectile() instanceof EnderPearl) && !(event.GetProjectile() instanceof Arrow))
|
||||
return;
|
||||
|
||||
//Negate
|
||||
@ -234,6 +246,8 @@ public class Paintball extends TeamGame
|
||||
|
||||
event.AddMod("Paintball", "Paintball", 2, true);
|
||||
event.AddKnockback("Paintball", 2);
|
||||
|
||||
event.setShowArrows(false);
|
||||
|
||||
Player damagee = event.GetDamageePlayer();
|
||||
if (damagee == null)
|
||||
@ -262,6 +276,13 @@ public class Paintball extends TeamGame
|
||||
{
|
||||
count = 3;
|
||||
}
|
||||
if (GetKit(damager) instanceof KitSniper && event.GetProjectile() instanceof Arrow)
|
||||
{
|
||||
count = ((KitSniper) GetKit(damager)).getPaintDamage((Arrow) event.GetProjectile());
|
||||
|
||||
if (count == -1)
|
||||
count = 1;
|
||||
}
|
||||
}
|
||||
|
||||
//Out
|
||||
@ -271,12 +292,14 @@ public class Paintball extends TeamGame
|
||||
UtilPlayer.message(player, damageeTeam.GetColor() + damagee.getName() + ChatColor.RESET + " was painted by " +
|
||||
damagerTeam.GetColor() + damager.getName() + ChatColor.RESET + "!");
|
||||
|
||||
PlayerOut(damagee);
|
||||
PlayerOut(damagee, damager);
|
||||
|
||||
AddGems(damager, 2, "Kills", true, true);
|
||||
|
||||
AddStat(damager, "Kills", 1, false, false);
|
||||
AddStat(damagee, "Deaths", 1, false, false);
|
||||
|
||||
Bukkit.getPluginManager().callEvent(new PaintballEvent(damagee, damager));
|
||||
}
|
||||
|
||||
//Hit Sound
|
||||
@ -288,14 +311,8 @@ public class Paintball extends TeamGame
|
||||
@EventHandler
|
||||
public void ArmorRemoveCancel(InventoryClickEvent event)
|
||||
{
|
||||
HumanEntity player = event.getWhoClicked();
|
||||
|
||||
// Fixed armor being taken off while spectating after being painted.
|
||||
|
||||
if (!IsAlive(player))
|
||||
{
|
||||
if (!IsAlive(event.getWhoClicked()))
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean Color(Player player, int amount)
|
||||
@ -331,8 +348,8 @@ public class Paintball extends TeamGame
|
||||
return nonColored.isEmpty();
|
||||
}
|
||||
|
||||
public void PlayerOut(Player player)
|
||||
{
|
||||
public void PlayerOut(Player player, Player killer)
|
||||
{
|
||||
//State
|
||||
SetPlayerState(player, PlayerState.OUT);
|
||||
player.setHealth(20);
|
||||
@ -341,15 +358,15 @@ public class Paintball extends TeamGame
|
||||
Manager.GetCondition().Factory().Blind("Hit", player, player, 1.5, 0, false, false, false);
|
||||
Manager.GetCondition().Factory().Cloak("Hit", player, player, 9999, false, false);
|
||||
|
||||
_doubles.put(player, new PlayerCopyPaintball(this, player, killer, GetTeam(player).GetColor()));
|
||||
|
||||
//Settings
|
||||
player.setAllowFlight(true);
|
||||
player.setFlying(true);
|
||||
((CraftPlayer)player).getHandle().spectating = true;
|
||||
((CraftPlayer)player).getHandle().k = false;
|
||||
|
||||
|
||||
UtilAction.velocity(player, new Vector(0,1.2,0));
|
||||
|
||||
_doubles.put(player, new PlayerCopy(this, player, GetTeam(player).GetColor()));
|
||||
}
|
||||
|
||||
// @EventHandler
|
||||
@ -402,10 +419,10 @@ public class Paintball extends TeamGame
|
||||
if (throwerTeam == null) return;
|
||||
|
||||
//Revive
|
||||
Iterator<PlayerCopy> copyIterator = _doubles.values().iterator();
|
||||
Iterator<PlayerCopyPaintball> copyIterator = _doubles.values().iterator();
|
||||
while (copyIterator.hasNext())
|
||||
{
|
||||
PlayerCopy copy = copyIterator.next();
|
||||
PlayerCopyPaintball copy = copyIterator.next();
|
||||
|
||||
GameTeam otherTeam = GetTeam(copy.GetPlayer());
|
||||
if (otherTeam == null || !otherTeam.equals(throwerTeam))
|
||||
@ -414,7 +431,8 @@ public class Paintball extends TeamGame
|
||||
if (UtilMath.offset(copy.GetEntity().getLocation().add(0,1,0), event.getEntity().getLocation()) > 3)
|
||||
continue;
|
||||
|
||||
PlayerIn(copy.GetPlayer(), copy.GetEntity());
|
||||
PlayerIn(copy.GetPlayer(), copy);
|
||||
|
||||
copyIterator.remove();
|
||||
|
||||
AddGems(thrower, 3, "Revived Ally", true, true);
|
||||
@ -436,7 +454,7 @@ public class Paintball extends TeamGame
|
||||
}
|
||||
}
|
||||
|
||||
public void PlayerIn(final Player player, final LivingEntity copy)
|
||||
public void PlayerIn(final Player player, final PlayerCopyPaintball copy)
|
||||
{
|
||||
//State
|
||||
SetPlayerState(player, PlayerState.IN);
|
||||
@ -446,9 +464,9 @@ public class Paintball extends TeamGame
|
||||
if (copy != null)
|
||||
{
|
||||
Location loc = player.getLocation();
|
||||
loc.setX(copy.getLocation().getX());
|
||||
loc.setY(copy.getLocation().getY());
|
||||
loc.setZ(copy.getLocation().getZ());
|
||||
loc.setX(copy.GetEntity().getLocation().getX());
|
||||
loc.setY(copy.GetEntity().getLocation().getY());
|
||||
loc.setZ(copy.GetEntity().getLocation().getZ());
|
||||
player.teleport(loc);
|
||||
}
|
||||
|
||||
@ -480,7 +498,9 @@ public class Paintball extends TeamGame
|
||||
Manager.GetCondition().EndCondition(player, ConditionType.CLOAK, null);
|
||||
|
||||
//Remove Copy
|
||||
copy.remove();
|
||||
copy.GetEntity().remove();
|
||||
copy.GetHolo().stop();
|
||||
copy.GetSaveMe().stop();
|
||||
}
|
||||
}, 4);
|
||||
}
|
||||
@ -512,4 +532,128 @@ public class Paintball extends TeamGame
|
||||
for (Player player : GetPlayers(true))
|
||||
player.removePotionEffect(PotionEffectType.WATER_BREATHING);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onHeal(PlayerInteractEvent event)
|
||||
{
|
||||
if (!UtilEvent.isAction(event, ActionType.R))
|
||||
return;
|
||||
|
||||
LaunchPotion(event.getPlayer(), event);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onHeal(PlayerInteractEntityEvent event)
|
||||
{
|
||||
LaunchPotion(event.getPlayer(), event);
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = false)
|
||||
public void onHeal(PlayerInteractAtEntityEvent event)
|
||||
{
|
||||
LaunchPotion(event.getPlayer(), event);
|
||||
}
|
||||
|
||||
public void LaunchPotion(Player player, Cancellable event)
|
||||
{
|
||||
if (!IsLive())
|
||||
return;
|
||||
|
||||
if (!UtilGear.isMat(player.getItemInHand(), Material.POTION))
|
||||
return;
|
||||
|
||||
event.setCancelled(true);
|
||||
|
||||
if (!IsAlive(player) || UtilPlayer.isSpectator(player))
|
||||
return;
|
||||
|
||||
if (!Recharge.Instance.use(player, "Water Potion", 250, false, false))
|
||||
return;
|
||||
|
||||
UtilInv.UseItemInHand(player);
|
||||
|
||||
ThrownPotion potion = player.launchProjectile(ThrownPotion.class);
|
||||
potion.getEffects().clear();
|
||||
potion.getEffects().add(new PotionEffect(PotionEffectType.WATER_BREATHING, 100, 100));
|
||||
|
||||
Manager.runAsync(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
UtilInv.Update(player);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onInteract(PlayerInteractAtEntityEvent event)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void updateCloneHolograms(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.FAST)
|
||||
return;
|
||||
|
||||
for (PlayerCopyPaintball clone : _doubles.values())
|
||||
{
|
||||
if (clone.GetHolo().getHologramTarget() == HologramTarget.WHITELIST)
|
||||
{
|
||||
//Other team blacklist
|
||||
clone.GetHolo().setHologramTarget(HologramTarget.BLACKLIST);
|
||||
|
||||
for (Player cur : GetPlayers(false))
|
||||
{
|
||||
if (!IsAlive(cur))
|
||||
{
|
||||
if (clone.GetHolo().containsPlayer(cur))
|
||||
clone.GetHolo().removePlayer(cur);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GetTeam(cur) != GetTeam(clone.GetPlayer()))
|
||||
{
|
||||
if (!clone.GetHolo().containsPlayer(cur))
|
||||
clone.GetHolo().addPlayer(cur);
|
||||
}
|
||||
else if (clone.GetHolo().containsPlayer(cur))
|
||||
{
|
||||
clone.GetHolo().removePlayer(cur);
|
||||
}
|
||||
}
|
||||
}
|
||||
clone.GetHolo().start();
|
||||
}
|
||||
|
||||
clone.setSaveMeFlop(!clone.getSaveMeFlop());
|
||||
clone.GetSaveMe().setText((clone.getSaveMeFlop() ? C.cRedB : C.cWhiteB) + "SAVE ME!");
|
||||
|
||||
for (Player player : GetTeam(clone.GetPlayer()).GetPlayers(false))
|
||||
{
|
||||
if (!IsAlive(player)) // Remove if it's not alive
|
||||
{
|
||||
if (clone.GetSaveMe().containsPlayer(player))
|
||||
clone.GetSaveMe().removePlayer(player);
|
||||
}
|
||||
else
|
||||
{
|
||||
boolean hasPotion = UtilInv.contains(player, Material.POTION, (byte) -1, 1);
|
||||
if (clone.GetSaveMe().containsPlayer(player))
|
||||
{
|
||||
if (!hasPotion) // No potions left
|
||||
{
|
||||
clone.GetSaveMe().removePlayer(player);
|
||||
}
|
||||
}
|
||||
else if (hasPotion)
|
||||
{
|
||||
clone.GetSaveMe().addPlayer(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,119 @@
|
||||
package nautilus.game.arcade.game.games.paintball;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.ArmorStand;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.SkullMeta;
|
||||
import org.bukkit.util.EulerAngle;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.hologram.Hologram;
|
||||
import mineplex.core.hologram.Hologram.HologramTarget;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import nautilus.game.arcade.game.Game;
|
||||
|
||||
public class PlayerCopyPaintball
|
||||
{
|
||||
private Game Host;
|
||||
|
||||
private Player _owner;
|
||||
|
||||
private ArmorStand _ent;
|
||||
private Hologram _holo;
|
||||
private Hologram _saveMe;
|
||||
|
||||
private boolean _saveMeFlop = false;
|
||||
|
||||
public PlayerCopyPaintball(Game host, Player owner, Player paintedBy, ChatColor nameColor)
|
||||
{
|
||||
Host = host;
|
||||
|
||||
_owner = owner;
|
||||
|
||||
Location entLoc = owner.getLocation();
|
||||
entLoc.setPitch(0F);
|
||||
|
||||
Host.CreatureAllowOverride = true;
|
||||
_ent = owner.getWorld().spawn(owner.getLocation(), ArmorStand.class);
|
||||
Host.CreatureAllowOverride = false;
|
||||
|
||||
UtilEnt.ghost(_ent, true, false);
|
||||
|
||||
UtilEnt.Vegetate(_ent);
|
||||
|
||||
_ent.setArms(true);
|
||||
_ent.setBasePlate(false);
|
||||
_ent.setVisible(false);
|
||||
|
||||
//Rand pose
|
||||
int rA = UtilMath.r(20) - 3;
|
||||
int lA = UtilMath.r(20) - 3;
|
||||
int rL = UtilMath.r(20) - 3;
|
||||
int lL = UtilMath.r(20) - 3;
|
||||
_ent.setRightArmPose(new EulerAngle(Math.toRadians(rA < 0 ? 360 - rA : rA), 0, Math.toRadians(Math.abs(rA))));
|
||||
_ent.setRightLegPose(new EulerAngle(Math.toRadians(rL < 0 ? 360 - rL : rL), 0, Math.toRadians(Math.abs(rL))));
|
||||
_ent.setLeftArmPose(new EulerAngle(Math.toRadians(lA < 0 ? 360 - lA : lA), 0, Math.toRadians(360 - Math.abs(lA))));
|
||||
_ent.setLeftLegPose(new EulerAngle(Math.toRadians(lL < 0 ? 360 - lL : rA), 0, Math.toRadians(360 - Math.abs(lL))));
|
||||
|
||||
//Armor
|
||||
_ent.getEquipment().setArmorContents(owner.getInventory().getArmorContents());
|
||||
_ent.setItemInHand(owner.getItemInHand());
|
||||
|
||||
//Player skull
|
||||
ItemStack skull = ItemStackFactory.Instance.CreateStack(Material.SKULL_ITEM, (byte) 3, 1);
|
||||
SkullMeta meta = (SkullMeta) skull.getItemMeta();
|
||||
meta.setOwner(owner.getName());
|
||||
skull.setItemMeta(meta);
|
||||
_ent.setHelmet(skull);
|
||||
|
||||
//Name
|
||||
_holo = new Hologram(host.Manager.getHologramManager(), _ent.getLocation().clone().add(0, 2.2, 0));
|
||||
_holo.setText(C.cWhite + C.Bold + C.Scramble + "XX" + ChatColor.RESET + " " + nameColor + owner.getName() + " " + C.cWhite + C.Bold + C.Scramble + "XX", C.cWhite + "Painted by " + host.GetTeam(paintedBy).GetColor() + paintedBy.getName());
|
||||
_holo.setHologramTarget(HologramTarget.WHITELIST);
|
||||
_holo.setFollowEntity(_ent);
|
||||
_holo.start();
|
||||
|
||||
//Save me
|
||||
_saveMe = new Hologram(host.Manager.getHologramManager(), _ent.getLocation().clone().add(0, 2.8, 0));
|
||||
_saveMe.setText(C.cRedB + "SAVE ME!");
|
||||
_saveMe.setHologramTarget(HologramTarget.WHITELIST);
|
||||
_saveMe.setFollowEntity(_ent);
|
||||
_saveMe.start();
|
||||
}
|
||||
|
||||
public LivingEntity GetEntity()
|
||||
{
|
||||
return _ent;
|
||||
}
|
||||
|
||||
public Player GetPlayer()
|
||||
{
|
||||
return _owner;
|
||||
}
|
||||
|
||||
public Hologram GetHolo()
|
||||
{
|
||||
return _holo;
|
||||
}
|
||||
|
||||
public Hologram GetSaveMe()
|
||||
{
|
||||
return _saveMe;
|
||||
}
|
||||
|
||||
public boolean getSaveMeFlop()
|
||||
{
|
||||
return _saveMeFlop;
|
||||
}
|
||||
|
||||
public void setSaveMeFlop(boolean flop)
|
||||
{
|
||||
_saveMeFlop = flop;
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package nautilus.game.arcade.game.games.paintball.events;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.player.PlayerEvent;
|
||||
|
||||
public class PaintballEvent extends PlayerEvent
|
||||
{
|
||||
/**
|
||||
* Created by: Mysticate
|
||||
* Timestamp: November 19, 2015
|
||||
*/
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
public static HandlerList getHandlerList()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers()
|
||||
{
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
private Player _revivedPlayer;
|
||||
|
||||
public PaintballEvent(Player who, Player revivedPlayer)
|
||||
{
|
||||
super(who);
|
||||
|
||||
_revivedPlayer = revivedPlayer;
|
||||
}
|
||||
|
||||
public Player getKiller()
|
||||
{
|
||||
return _revivedPlayer;
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package nautilus.game.arcade.game.games.paintball.events;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.player.PlayerEvent;
|
||||
|
||||
public class ReviveEvent extends PlayerEvent
|
||||
{
|
||||
/**
|
||||
* Created by: Mysticate
|
||||
* Timestamp: November 19, 2015
|
||||
*/
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
public static HandlerList getHandlerList()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers()
|
||||
{
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
private Player _revivedPlayer;
|
||||
|
||||
public ReviveEvent(Player who, Player revivedPlayer)
|
||||
{
|
||||
super(who);
|
||||
|
||||
_revivedPlayer = revivedPlayer;
|
||||
}
|
||||
|
||||
public Player getRevivedPlayer()
|
||||
{
|
||||
return _revivedPlayer;
|
||||
}
|
||||
}
|
@ -1,21 +1,23 @@
|
||||
package nautilus.game.arcade.game.games.paintball.kits;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.game.games.paintball.kits.perks.PerkPaintballMachineGun;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.kit.KitAvailability;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.LeatherArmorMeta;
|
||||
import org.bukkit.inventory.meta.PotionMeta;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.kit.KitAvailability;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
import nautilus.game.arcade.kit.perks.*;
|
||||
|
||||
public class KitMachineGun extends Kit
|
||||
{
|
||||
public KitMachineGun(ArcadeManager manager)
|
||||
@ -39,36 +41,17 @@ public class KitMachineGun extends Kit
|
||||
@Override
|
||||
public void GiveItems(Player player)
|
||||
{
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.DIAMOND_BARDING, (byte)0, 1, "Paintball Machine Gun"));
|
||||
UtilInv.insert(player, ItemStackFactory.Instance.CreateStack(Material.DIAMOND_BARDING, (byte)0, 1, F.item("Paintball Machine Gun")));
|
||||
|
||||
ItemStack potion = new ItemStack(Material.POTION, 3, (short)16429); // 16422
|
||||
PotionMeta potionMeta = (PotionMeta)potion.getItemMeta();
|
||||
potionMeta.setDisplayName("Water Bomb");
|
||||
potionMeta.setDisplayName(F.item("Water Bomb"));
|
||||
potion.setItemMeta(potionMeta);
|
||||
player.getInventory().addItem(potion);
|
||||
|
||||
ItemStack helm = new ItemStack(Material.LEATHER_HELMET);
|
||||
LeatherArmorMeta metaHelm = (LeatherArmorMeta)helm.getItemMeta();
|
||||
metaHelm.setColor(Color.WHITE);
|
||||
helm.setItemMeta(metaHelm);
|
||||
player.getInventory().setHelmet(helm);
|
||||
UtilInv.insert(player, potion);
|
||||
|
||||
ItemStack armor = new ItemStack(Material.LEATHER_CHESTPLATE);
|
||||
LeatherArmorMeta meta = (LeatherArmorMeta)armor.getItemMeta();
|
||||
meta.setColor(Color.WHITE);
|
||||
armor.setItemMeta(meta);
|
||||
player.getInventory().setChestplate(armor);
|
||||
|
||||
ItemStack legs = new ItemStack(Material.LEATHER_LEGGINGS);
|
||||
LeatherArmorMeta metaLegs = (LeatherArmorMeta)armor.getItemMeta();
|
||||
metaLegs.setColor(Color.WHITE);
|
||||
legs.setItemMeta(metaLegs);
|
||||
player.getInventory().setLeggings(legs);
|
||||
|
||||
ItemStack boots = new ItemStack(Material.LEATHER_BOOTS);
|
||||
LeatherArmorMeta metaBoots = (LeatherArmorMeta)armor.getItemMeta();
|
||||
metaBoots.setColor(Color.WHITE);
|
||||
boots.setItemMeta(metaBoots);
|
||||
player.getInventory().setBoots(boots);
|
||||
player.getInventory().setHelmet(new ItemBuilder(Material.LEATHER_HELMET).setUnbreakable(true).setColor(Color.WHITE).build());
|
||||
player.getInventory().setChestplate(new ItemBuilder(Material.LEATHER_CHESTPLATE).setUnbreakable(true).setColor(Color.WHITE).build());
|
||||
player.getInventory().setLeggings(new ItemBuilder(Material.LEATHER_LEGGINGS).setUnbreakable(true).setColor(Color.WHITE).build());
|
||||
player.getInventory().setBoots(new ItemBuilder(Material.LEATHER_BOOTS).setUnbreakable(true).setColor(Color.WHITE).build());
|
||||
}
|
||||
}
|
||||
|
@ -1,21 +1,23 @@
|
||||
package nautilus.game.arcade.game.games.paintball.kits;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.game.games.paintball.kits.perks.PerkPaintballRifle;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.kit.KitAvailability;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
import nautilus.game.arcade.kit.perks.PerkSpeed;
|
||||
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.LeatherArmorMeta;
|
||||
import org.bukkit.inventory.meta.PotionMeta;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.kit.KitAvailability;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
import nautilus.game.arcade.kit.perks.*;
|
||||
|
||||
public class KitRifle extends Kit
|
||||
{
|
||||
@ -41,37 +43,17 @@ public class KitRifle extends Kit
|
||||
@Override
|
||||
public void GiveItems(Player player)
|
||||
{
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_BARDING, (byte)0, 1, "Paintball Rifle"));
|
||||
|
||||
//Potion
|
||||
UtilInv.insert(player, ItemStackFactory.Instance.CreateStack(Material.IRON_BARDING, (byte)0, 1, F.item("Paintball Rifle")));
|
||||
|
||||
ItemStack potion = new ItemStack(Material.POTION, 3, (short)16429); // 16422
|
||||
PotionMeta potionMeta = (PotionMeta)potion.getItemMeta();
|
||||
potionMeta.setDisplayName("Water Bomb");
|
||||
potionMeta.setDisplayName(F.item("Water Bomb"));
|
||||
potion.setItemMeta(potionMeta);
|
||||
player.getInventory().addItem(potion);
|
||||
|
||||
ItemStack helm = new ItemStack(Material.LEATHER_HELMET);
|
||||
LeatherArmorMeta metaHelm = (LeatherArmorMeta)helm.getItemMeta();
|
||||
metaHelm.setColor(Color.WHITE);
|
||||
helm.setItemMeta(metaHelm);
|
||||
player.getInventory().setHelmet(helm);
|
||||
UtilInv.insert(player, potion);
|
||||
|
||||
ItemStack armor = new ItemStack(Material.LEATHER_CHESTPLATE);
|
||||
LeatherArmorMeta meta = (LeatherArmorMeta)armor.getItemMeta();
|
||||
meta.setColor(Color.WHITE);
|
||||
armor.setItemMeta(meta);
|
||||
player.getInventory().setChestplate(armor);
|
||||
|
||||
ItemStack legs = new ItemStack(Material.LEATHER_LEGGINGS);
|
||||
LeatherArmorMeta metaLegs = (LeatherArmorMeta)armor.getItemMeta();
|
||||
metaLegs.setColor(Color.WHITE);
|
||||
legs.setItemMeta(metaLegs);
|
||||
player.getInventory().setLeggings(legs);
|
||||
|
||||
ItemStack boots = new ItemStack(Material.LEATHER_BOOTS);
|
||||
LeatherArmorMeta metaBoots = (LeatherArmorMeta)armor.getItemMeta();
|
||||
metaBoots.setColor(Color.WHITE);
|
||||
boots.setItemMeta(metaBoots);
|
||||
player.getInventory().setBoots(boots);
|
||||
player.getInventory().setHelmet(new ItemBuilder(Material.LEATHER_HELMET).setUnbreakable(true).setColor(Color.WHITE).build());
|
||||
player.getInventory().setChestplate(new ItemBuilder(Material.LEATHER_CHESTPLATE).setUnbreakable(true).setColor(Color.WHITE).build());
|
||||
player.getInventory().setLeggings(new ItemBuilder(Material.LEATHER_LEGGINGS).setUnbreakable(true).setColor(Color.WHITE).build());
|
||||
player.getInventory().setBoots(new ItemBuilder(Material.LEATHER_BOOTS).setUnbreakable(true).setColor(Color.WHITE).build());
|
||||
}
|
||||
}
|
||||
|
@ -1,21 +1,24 @@
|
||||
package nautilus.game.arcade.game.games.paintball.kits;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.game.games.paintball.kits.perks.PerkPaintballShotgun;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.kit.KitAvailability;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
import nautilus.game.arcade.kit.perks.PerkSpeed;
|
||||
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.LeatherArmorMeta;
|
||||
import org.bukkit.inventory.meta.PotionMeta;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.kit.KitAvailability;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
import nautilus.game.arcade.kit.perks.*;
|
||||
|
||||
public class KitShotgun extends Kit
|
||||
{
|
||||
public KitShotgun(ArcadeManager manager)
|
||||
@ -40,36 +43,17 @@ public class KitShotgun extends Kit
|
||||
@Override
|
||||
public void GiveItems(Player player)
|
||||
{
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.GOLD_BARDING, (byte)0, 1, "Paintball Shotgun"));
|
||||
UtilInv.insert(player, ItemStackFactory.Instance.CreateStack(Material.GOLD_BARDING, (byte)0, 1, F.item("Paintball Shotgun")));
|
||||
|
||||
ItemStack potion = new ItemStack(Material.POTION, 3, (short)16429); // 16422
|
||||
PotionMeta potionMeta = (PotionMeta)potion.getItemMeta();
|
||||
potionMeta.setDisplayName("Water Bomb");
|
||||
potionMeta.setDisplayName(F.item("Water Bomb"));
|
||||
potion.setItemMeta(potionMeta);
|
||||
player.getInventory().addItem(potion);
|
||||
UtilInv.insert(player, potion);
|
||||
|
||||
ItemStack helm = new ItemStack(Material.LEATHER_HELMET);
|
||||
LeatherArmorMeta metaHelm = (LeatherArmorMeta)helm.getItemMeta();
|
||||
metaHelm.setColor(Color.WHITE);
|
||||
helm.setItemMeta(metaHelm);
|
||||
player.getInventory().setHelmet(helm);
|
||||
|
||||
ItemStack armor = new ItemStack(Material.LEATHER_CHESTPLATE);
|
||||
LeatherArmorMeta meta = (LeatherArmorMeta)armor.getItemMeta();
|
||||
meta.setColor(Color.WHITE);
|
||||
armor.setItemMeta(meta);
|
||||
player.getInventory().setChestplate(armor);
|
||||
|
||||
ItemStack legs = new ItemStack(Material.LEATHER_LEGGINGS);
|
||||
LeatherArmorMeta metaLegs = (LeatherArmorMeta)armor.getItemMeta();
|
||||
metaLegs.setColor(Color.WHITE);
|
||||
legs.setItemMeta(metaLegs);
|
||||
player.getInventory().setLeggings(legs);
|
||||
|
||||
ItemStack boots = new ItemStack(Material.LEATHER_BOOTS);
|
||||
LeatherArmorMeta metaBoots = (LeatherArmorMeta)armor.getItemMeta();
|
||||
metaBoots.setColor(Color.WHITE);
|
||||
boots.setItemMeta(metaBoots);
|
||||
player.getInventory().setBoots(boots);
|
||||
player.getInventory().setHelmet(new ItemBuilder(Material.LEATHER_HELMET).setUnbreakable(true).setColor(Color.WHITE).build());
|
||||
player.getInventory().setChestplate(new ItemBuilder(Material.LEATHER_CHESTPLATE).setUnbreakable(true).setColor(Color.WHITE).build());
|
||||
player.getInventory().setLeggings(new ItemBuilder(Material.LEATHER_LEGGINGS).setUnbreakable(true).setColor(Color.WHITE).build());
|
||||
player.getInventory().setBoots(new ItemBuilder(Material.LEATHER_BOOTS).setUnbreakable(true).setColor(Color.WHITE).build());
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,81 @@
|
||||
package nautilus.game.arcade.game.games.paintball.kits;
|
||||
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.PotionMeta;
|
||||
|
||||
import mineplex.core.achievement.Achievement;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.game.games.paintball.kits.perks.PerkPaintballSniper;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.kit.KitAvailability;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
|
||||
public class KitSniper extends Kit
|
||||
{
|
||||
public KitSniper(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Sniper", KitAvailability.Achievement,
|
||||
|
||||
new String[]
|
||||
{
|
||||
"Long range sniper rifle",
|
||||
C.cGold + "Higher damage the longer scoped"
|
||||
},
|
||||
|
||||
new Perk[]
|
||||
{
|
||||
new PerkPaintballSniper(),
|
||||
},
|
||||
EntityType.ZOMBIE,
|
||||
new ItemStack(Material.STONE_HOE));
|
||||
|
||||
setAchievementRequirements(new Achievement[]
|
||||
{
|
||||
Achievement.SUPER_PAINTBALL_FLAWLESS_VICTORY,
|
||||
Achievement.SUPER_PAINTBALL_KILLING_SPREE,
|
||||
Achievement.SUPER_PAINTBALL_LAST_STAND,
|
||||
Achievement.SUPER_PAINTBALL_MEDIC,
|
||||
Achievement.SUPER_PAINTBALL_SPEEDRUNNER,
|
||||
Achievement.SUPER_PAINTBALL_WINS
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void GiveItems(Player player)
|
||||
{
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.STONE_HOE, (byte)0, 1, F.item("Paintball Sniper Rifle")));
|
||||
|
||||
ItemStack potion = new ItemStack(Material.POTION, 2, (short)16429); // 16422
|
||||
PotionMeta potionMeta = (PotionMeta)potion.getItemMeta();
|
||||
potionMeta.setDisplayName(F.item("Water Bomb"));
|
||||
potion.setItemMeta(potionMeta);
|
||||
UtilInv.insert(player, potion);
|
||||
|
||||
player.getInventory().setHelmet(new ItemBuilder(Material.LEATHER_HELMET).setUnbreakable(true).setColor(Color.WHITE).build());
|
||||
player.getInventory().setChestplate(new ItemBuilder(Material.LEATHER_CHESTPLATE).setUnbreakable(true).setColor(Color.WHITE).build());
|
||||
player.getInventory().setLeggings(new ItemBuilder(Material.LEATHER_LEGGINGS).setUnbreakable(true).setColor(Color.WHITE).build());
|
||||
player.getInventory().setBoots(new ItemBuilder(Material.LEATHER_BOOTS).setUnbreakable(true).setColor(Color.WHITE).build());
|
||||
}
|
||||
|
||||
public int getPaintDamage(Arrow proj)
|
||||
{
|
||||
for (Perk perk : GetPerks())
|
||||
{
|
||||
if (perk instanceof PerkPaintballSniper)
|
||||
{
|
||||
return ((PerkPaintballSniper) perk).getPaintDamage(proj);
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package nautilus.game.arcade.kit.perks;
|
||||
package nautilus.game.arcade.game.games.paintball.kits.perks;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
@ -51,6 +51,9 @@ public class PerkPaintballMachineGun extends Perk
|
||||
@EventHandler
|
||||
public void Shoot(PlayerInteractEvent event)
|
||||
{
|
||||
if (!Manager.GetGame().IsLive())
|
||||
return;
|
||||
|
||||
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK)
|
||||
return;
|
||||
|
||||
@ -95,7 +98,8 @@ public class PerkPaintballMachineGun extends Perk
|
||||
//Energy
|
||||
if (player.getExp() >= 0.97)
|
||||
return;
|
||||
player.setExp((float) (player.getExp() + 0.025));
|
||||
|
||||
player.setExp((float) Math.min(.999, player.getExp() + 0.025));
|
||||
|
||||
//Shoot
|
||||
Vector rand = new Vector(Math.random() - 0.5, Math.random() - 0.5, Math.random() - 0.5);
|
@ -1,4 +1,4 @@
|
||||
package nautilus.game.arcade.kit.perks;
|
||||
package nautilus.game.arcade.game.games.paintball.kits.perks;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
@ -39,6 +39,9 @@ public class PerkPaintballRifle extends Perk
|
||||
@EventHandler
|
||||
public void Shoot(PlayerInteractEvent event)
|
||||
{
|
||||
if (!Manager.GetGame().IsLive())
|
||||
return;
|
||||
|
||||
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK)
|
||||
return;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package nautilus.game.arcade.kit.perks;
|
||||
package nautilus.game.arcade.game.games.paintball.kits.perks;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
@ -42,6 +42,9 @@ public class PerkPaintballShotgun extends Perk
|
||||
@EventHandler
|
||||
public void Shoot(PlayerInteractEvent event)
|
||||
{
|
||||
if (!Manager.GetGame().IsLive())
|
||||
return;
|
||||
|
||||
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK)
|
||||
return;
|
||||
|
@ -0,0 +1,350 @@
|
||||
package nautilus.game.arcade.game.games.paintball.kits.perks;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Projectile;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilEvent;
|
||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||
import mineplex.core.common.util.UtilGear;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.packethandler.IPacketHandler;
|
||||
import mineplex.core.packethandler.PacketInfo;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.recharge.RechargedEvent;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.game.Game.GameState;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
import net.minecraft.server.v1_8_R3.EntityArrow;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntity;
|
||||
|
||||
public class PerkPaintballSniper extends Perk implements IPacketHandler
|
||||
{
|
||||
/**
|
||||
* Created by: Mysticate
|
||||
* Timestamp: October 27, 2015
|
||||
*/
|
||||
|
||||
private static class Bullet
|
||||
{
|
||||
public Player Shooter;
|
||||
public int Damage;
|
||||
public Location LastSeen;
|
||||
}
|
||||
|
||||
private HashSet<Player> _crouching = new HashSet<Player>();
|
||||
private NautHashMap<Arrow, Bullet> _fired = new NautHashMap<Arrow, Bullet>();
|
||||
|
||||
private double _velocity = 15;
|
||||
|
||||
private boolean _spawning = false;
|
||||
|
||||
public PerkPaintballSniper()
|
||||
{
|
||||
super("Sniper Rifle", new String[]
|
||||
{
|
||||
C.cYellow + "Crouch" + C.cGray + " to use " + C.cGreen + "Scope",
|
||||
C.cYellow + "Right-Click" + C.cGray + " to use " + C.cGreen + "Sniper Rifle",
|
||||
"Experience Bar represents damage."
|
||||
});
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void registeredEvents()
|
||||
{
|
||||
Manager.getPacketHandler().addPacketHandler(this, PacketPlayOutSpawnEntity.class);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void Recharge(RechargedEvent event)
|
||||
{
|
||||
if (!event.GetAbility().equals(GetName()))
|
||||
return;
|
||||
|
||||
event.GetPlayer().playSound(event.GetPlayer().getLocation(), Sound.NOTE_STICKS, 2f, 1f);
|
||||
event.GetPlayer().playSound(event.GetPlayer().getLocation(), Sound.NOTE_STICKS, 2f, 1.5f);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void Shoot(PlayerInteractEvent event)
|
||||
{
|
||||
if (!Manager.GetGame().IsLive())
|
||||
return;
|
||||
|
||||
if (!UtilEvent.isAction(event, ActionType.R))
|
||||
return;
|
||||
|
||||
if (UtilBlock.usable(event.getClickedBlock()))
|
||||
return;
|
||||
|
||||
if (!UtilGear.isMat(event.getItem(), Material.STONE_HOE))
|
||||
return;
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (!Manager.IsAlive(player))
|
||||
return;
|
||||
|
||||
if (UtilPlayer.isSpectator(player))
|
||||
return;
|
||||
|
||||
if (!Kit.HasKit(player))
|
||||
return;
|
||||
|
||||
event.setCancelled(true);
|
||||
|
||||
if (!Recharge.Instance.use(player, GetName(), 1000, true, true))
|
||||
return;
|
||||
|
||||
net.minecraft.server.v1_8_R3.World world = ((CraftWorld) player.getWorld()).getHandle();
|
||||
EntityArrow launch = new EntityArrow(world, ((CraftPlayer) player).getHandle(), 0F);
|
||||
Location location = player.getEyeLocation();
|
||||
|
||||
launch.projectileSource = player;
|
||||
launch.setPositionRotation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
|
||||
|
||||
((Projectile) launch.getBukkitEntity()).setVelocity(player.getEyeLocation().getDirection().clone().multiply(_velocity));
|
||||
|
||||
_spawning = true;
|
||||
world.addEntity(launch);
|
||||
_spawning = false;
|
||||
|
||||
Arrow proj = (Arrow) launch.getBukkitEntity();
|
||||
|
||||
proj.setMetadata("color", new FixedMetadataValue(Manager.getPlugin(), Manager.GetGame().GetTeam(player).GetColor().ordinal()));
|
||||
|
||||
Bullet bullet = new Bullet();
|
||||
bullet.Shooter = player;
|
||||
bullet.Damage = getPaintDamage(player);
|
||||
bullet.LastSeen = proj.getLocation();
|
||||
|
||||
_fired.put(proj, bullet);
|
||||
|
||||
//Sound
|
||||
player.getWorld().playSound(player.getLocation(), Sound.CHICKEN_EGG_POP, 0.8f, 1f);
|
||||
|
||||
player.setSneaking(false);
|
||||
|
||||
//Effects
|
||||
removeEffects(player);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onUpdate(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
return;
|
||||
|
||||
if (!Manager.GetGame().IsLive())
|
||||
return;
|
||||
|
||||
//Cleanup check
|
||||
for (Player player : new HashSet<Player>(_crouching))
|
||||
{
|
||||
boolean remove = false;
|
||||
if (!player.isOnline())
|
||||
remove = true;
|
||||
|
||||
if (!Manager.GetGame().IsAlive(player))
|
||||
remove = true;
|
||||
|
||||
if (UtilPlayer.isSpectator(player))
|
||||
remove = true;
|
||||
|
||||
if (!player.isSneaking())
|
||||
remove = true;
|
||||
|
||||
if (!UtilInv.IsItem(player.getItemInHand(), Material.STONE_HOE, (byte) -1))
|
||||
remove = true;
|
||||
|
||||
if (!Recharge.Instance.usable(player, GetName()))
|
||||
remove = true;
|
||||
|
||||
if (remove)
|
||||
{
|
||||
if (_crouching.contains(player))
|
||||
_crouching.remove(player);
|
||||
|
||||
player.setExp(0F);
|
||||
player.setSneaking(false);
|
||||
|
||||
// Zoom
|
||||
removeEffects(player);
|
||||
}
|
||||
}
|
||||
|
||||
//Add check
|
||||
for (Player player : Manager.GetGame().GetPlayers(true))
|
||||
{
|
||||
if (UtilPlayer.isSpectator(player))
|
||||
continue;
|
||||
|
||||
if (!Kit.HasKit(player))
|
||||
continue;
|
||||
|
||||
if (!player.isSneaking())
|
||||
continue;
|
||||
|
||||
if (!UtilInv.IsItem(player.getItemInHand(), Material.STONE_HOE, (byte) -1))
|
||||
continue;
|
||||
|
||||
if (_crouching.contains(player))
|
||||
continue;
|
||||
|
||||
_crouching.add(player);
|
||||
|
||||
// Zoom
|
||||
addEffects(player);
|
||||
}
|
||||
|
||||
// Exp check
|
||||
|
||||
for (Player player : Manager.GetGame().GetPlayers(true))
|
||||
{
|
||||
if (UtilPlayer.isSpectator(player))
|
||||
continue;
|
||||
|
||||
if (!Kit.HasKit(player))
|
||||
continue;
|
||||
|
||||
if (!_crouching.contains(player))
|
||||
continue;
|
||||
|
||||
player.setExp((float) Math.min(.999F, player.getExp() + .03332));
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void doArrowEffects(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
return;
|
||||
|
||||
if (!Manager.GetGame().IsLive())
|
||||
return;
|
||||
|
||||
for (Arrow proj : new ArrayList<Arrow>(_fired.keySet()))
|
||||
{
|
||||
Bullet bullet = _fired.get(proj);
|
||||
|
||||
double curRange = 0;
|
||||
double distance = Math.abs(UtilMath.offset(proj.getLocation(), bullet.LastSeen));
|
||||
|
||||
while (curRange <= distance)
|
||||
{
|
||||
Location newTarget = bullet.LastSeen.add(UtilAlg.getTrajectory(bullet.LastSeen, proj.getLocation()).multiply(curRange));
|
||||
|
||||
//Progress Forwards
|
||||
curRange += 0.8;
|
||||
|
||||
if (UtilMath.offset(bullet.Shooter.getLocation(), newTarget) < 2)
|
||||
continue;
|
||||
|
||||
ChatColor color = ChatColor.values()[proj.getMetadata("color").get(0).asInt()];
|
||||
if (color == ChatColor.BLUE || color == ChatColor.AQUA)
|
||||
{
|
||||
UtilParticle.PlayParticle(ParticleType.RED_DUST, newTarget, -1, 1, 1, 1, 0,
|
||||
ViewDist.NORMAL, UtilServer.getPlayers());
|
||||
}
|
||||
else
|
||||
{
|
||||
UtilParticle.PlayParticle(ParticleType.RED_DUST, newTarget, 0, 0, 0, 0, 1,
|
||||
ViewDist.NORMAL, UtilServer.getPlayers());
|
||||
}
|
||||
}
|
||||
|
||||
if (!proj.isValid())
|
||||
{
|
||||
_fired.remove(proj);
|
||||
continue;
|
||||
}
|
||||
|
||||
bullet.LastSeen = proj.getLocation();
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||
public void clean(GameStateChangeEvent event)
|
||||
{
|
||||
if (event.GetState() != GameState.End)
|
||||
return;
|
||||
|
||||
for (Player player : _crouching)
|
||||
{
|
||||
removeEffects(player);
|
||||
}
|
||||
|
||||
_crouching.clear();
|
||||
|
||||
Manager.getPacketHandler().removePacketHandler(this);
|
||||
}
|
||||
|
||||
private void removeEffects(Player player)
|
||||
{
|
||||
// Zoom
|
||||
if (Manager.GetCondition().HasCondition(player, ConditionType.SLOW, GetName()))
|
||||
Manager.GetCondition().EndCondition(player, ConditionType.SLOW, GetName());
|
||||
|
||||
// if (Manager.GetCondition().HasCondition(player, ConditionType.JUMP, GetName()))
|
||||
// Manager.GetCondition().EndCondition(player, ConditionType.JUMP, GetName());
|
||||
}
|
||||
|
||||
private void addEffects(Player player)
|
||||
{
|
||||
// Zoom
|
||||
if (!Manager.GetCondition().HasCondition(player, ConditionType.SLOW, GetName()))
|
||||
Manager.GetCondition().Factory().Slow(GetName(), player, null, Double.MAX_VALUE, 8, false, false, false, true);
|
||||
}
|
||||
|
||||
public int getPaintDamage(Arrow proj)
|
||||
{
|
||||
if (!_fired.containsKey(proj))
|
||||
return 1;
|
||||
|
||||
return _fired.get(proj).Damage;
|
||||
}
|
||||
|
||||
private int getPaintDamage(Player player)
|
||||
{
|
||||
if (!_crouching.contains(player))
|
||||
return 1;
|
||||
|
||||
return 1 + (int) Math.floor(player.getExp() * 10 / 3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle(PacketInfo packetInfo)
|
||||
{
|
||||
if (!_spawning)
|
||||
return;
|
||||
|
||||
packetInfo.setCancelled(true);
|
||||
}
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
package nautilus.game.arcade.game.games.paintball.trackers;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
||||
import nautilus.game.arcade.game.Game;
|
||||
import nautilus.game.arcade.game.games.paintball.Paintball;
|
||||
import nautilus.game.arcade.game.games.paintball.events.PaintballEvent;
|
||||
import nautilus.game.arcade.stats.StatTracker;
|
||||
|
||||
public class KillingSpreeTracker extends StatTracker<Paintball>
|
||||
{
|
||||
private final Map<UUID, Integer> _killCount = new HashMap<>();
|
||||
private final Map<UUID, Long> _lastKillTime = new HashMap<>();
|
||||
|
||||
public KillingSpreeTracker(Paintball game)
|
||||
{
|
||||
super(game);
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||
public void onCombatDeath(PaintballEvent event)
|
||||
{
|
||||
if (getGame().GetState() != Game.GameState.Live)
|
||||
return;
|
||||
|
||||
Long lastTime = _lastKillTime.get(event.getKiller().getUniqueId());
|
||||
|
||||
long now = System.currentTimeMillis();
|
||||
|
||||
Integer killCount;
|
||||
if (lastTime == null || now - lastTime > 5000)
|
||||
killCount = 0;
|
||||
else
|
||||
{
|
||||
killCount = _killCount.get(event.getKiller().getUniqueId());
|
||||
if (killCount == null)
|
||||
killCount = 0;
|
||||
}
|
||||
|
||||
killCount++;
|
||||
|
||||
_killCount.put(event.getKiller().getUniqueId(), killCount);
|
||||
_lastKillTime.put(event.getKiller().getUniqueId(), now);
|
||||
|
||||
_killCount.remove(event.getPlayer().getUniqueId());
|
||||
_lastKillTime.remove(event.getPlayer().getUniqueId());
|
||||
|
||||
if (killCount >= 4)
|
||||
addStat(event.getKiller(), "KillingSpree", 1, true, false);
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package nautilus.game.arcade.game.games.paintball.trackers;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import nautilus.game.arcade.game.games.paintball.Paintball;
|
||||
import nautilus.game.arcade.game.games.paintball.events.PaintballEvent;
|
||||
import nautilus.game.arcade.stats.StatTracker;
|
||||
|
||||
public class LastStandStatTracker extends StatTracker<Paintball>
|
||||
{
|
||||
private final NautHashMap<UUID, Integer> _kills = new NautHashMap<UUID, Integer>();
|
||||
|
||||
public LastStandStatTracker(Paintball game)
|
||||
{
|
||||
super(game);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPaintball(PaintballEvent event)
|
||||
{
|
||||
if (!getGame().IsLive())
|
||||
return;
|
||||
|
||||
if (getGame().GetTeam(event.getKiller()).GetPlayers(true).size() == 1)
|
||||
{
|
||||
if (!_kills.containsKey(event.getKiller().getUniqueId()))
|
||||
_kills.put(event.getKiller().getUniqueId(), 0);
|
||||
|
||||
int kills = _kills.get(event.getKiller().getUniqueId()) + 1;
|
||||
|
||||
if (kills >= 3)
|
||||
addStat(event.getKiller(), "LastStand", 1, true, false);
|
||||
|
||||
_kills.put(event.getKiller().getUniqueId(), kills);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package nautilus.game.arcade.game.games.paintball.trackers;
|
||||
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
||||
import nautilus.game.arcade.game.games.paintball.Paintball;
|
||||
import nautilus.game.arcade.game.games.paintball.events.ReviveEvent;
|
||||
import nautilus.game.arcade.stats.StatTracker;
|
||||
|
||||
public class MedicStatTracker extends StatTracker<Paintball>
|
||||
{
|
||||
public MedicStatTracker(Paintball game)
|
||||
{
|
||||
super(game);
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||
public void onCombatDeath(ReviveEvent event)
|
||||
{
|
||||
if (!getGame().IsLive())
|
||||
return;
|
||||
|
||||
addStat(event.getPlayer(), "Medic", 1, false, false);
|
||||
}
|
||||
}
|
@ -1,24 +1,22 @@
|
||||
package nautilus.game.arcade.game.games.paintball;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.disguise.disguises.DisguisePlayer;
|
||||
import nautilus.game.arcade.game.Game;
|
||||
package nautilus.game.arcade.game.games.wither;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.EntityEffect;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Skeleton;
|
||||
|
||||
public class PlayerCopy
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import nautilus.game.arcade.game.Game;
|
||||
|
||||
public class PlayerCopyWither
|
||||
{
|
||||
private Game Host;
|
||||
|
||||
private Skeleton _ent;
|
||||
private Player _owner;
|
||||
|
||||
public PlayerCopy(Game host, Player owner, ChatColor nameColor)
|
||||
public PlayerCopyWither(Game host, Player owner, ChatColor nameColor)
|
||||
{
|
||||
Host = host;
|
||||
|
@ -1,55 +1,11 @@
|
||||
package nautilus.game.arcade.game.games.wither;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
|
||||
import mineplex.core.common.block.BlockData;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTextMiddle;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.GameTeam.PlayerState;
|
||||
import nautilus.game.arcade.game.TeamGame;
|
||||
import nautilus.game.arcade.game.games.paintball.PlayerCopy;
|
||||
import nautilus.game.arcade.game.games.wither.events.HumanReviveEvent;
|
||||
import nautilus.game.arcade.game.games.wither.kit.KitHumanArcher;
|
||||
import nautilus.game.arcade.game.games.wither.kit.KitHumanMedic;
|
||||
import nautilus.game.arcade.game.games.wither.kit.KitHumanEditor;
|
||||
import nautilus.game.arcade.game.games.wither.kit.KitWitherMinion;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.kit.NullKit;
|
||||
import nautilus.game.arcade.kit.perks.data.IBlockRestorer;
|
||||
import nautilus.game.arcade.stats.BloodThirstyStatTracker;
|
||||
import nautilus.game.arcade.stats.KingDamageStatTracker;
|
||||
import nautilus.game.arcade.stats.KingSlayerStatTracker;
|
||||
import nautilus.game.arcade.stats.TeamDeathsStatTracker;
|
||||
import nautilus.game.arcade.stats.TeamKillsStatTracker;
|
||||
import nautilus.game.arcade.stats.WinAsTeamStatTracker;
|
||||
import nautilus.game.arcade.stats.WitherAssaultReviveTracker;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.EntityEffect;
|
||||
@ -74,13 +30,45 @@ import org.bukkit.event.entity.ProjectileHitEvent;
|
||||
import org.bukkit.event.entity.ProjectileLaunchEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerPickupItemEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.core.common.block.BlockData;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTextMiddle;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.GameTeam.PlayerState;
|
||||
import nautilus.game.arcade.game.TeamGame;
|
||||
import nautilus.game.arcade.game.games.wither.events.HumanReviveEvent;
|
||||
import nautilus.game.arcade.game.games.wither.kit.KitHumanArcher;
|
||||
import nautilus.game.arcade.game.games.wither.kit.KitHumanEditor;
|
||||
import nautilus.game.arcade.game.games.wither.kit.KitHumanMedic;
|
||||
import nautilus.game.arcade.game.games.wither.kit.KitWitherMinion;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.kit.NullKit;
|
||||
import nautilus.game.arcade.kit.perks.data.IBlockRestorer;
|
||||
import nautilus.game.arcade.stats.TeamDeathsStatTracker;
|
||||
import nautilus.game.arcade.stats.TeamKillsStatTracker;
|
||||
|
||||
public class WitherGame extends TeamGame implements IBlockRestorer
|
||||
{
|
||||
private GameTeam _runners;
|
||||
@ -93,7 +81,7 @@ public class WitherGame extends TeamGame implements IBlockRestorer
|
||||
|
||||
private long _gameTime = 300000;
|
||||
|
||||
private HashMap<Player, PlayerCopy> _doubles = new HashMap<Player, PlayerCopy>();
|
||||
private HashMap<Player, PlayerCopyWither> _doubles = new HashMap<Player, PlayerCopyWither>();
|
||||
|
||||
// private int _livesPerPlayer = 3;
|
||||
// private HashMap<Player, Integer> _lives = new HashMap<Player, Integer>();
|
||||
@ -456,7 +444,7 @@ public class WitherGame extends TeamGame implements IBlockRestorer
|
||||
{
|
||||
if(!players.isOnline())
|
||||
{
|
||||
PlayerCopy pc = _doubles.get(players);
|
||||
PlayerCopyWither pc = _doubles.get(players);
|
||||
pc.GetEntity().remove();
|
||||
_doubles.remove(players);
|
||||
}
|
||||
@ -803,7 +791,7 @@ public class WitherGame extends TeamGame implements IBlockRestorer
|
||||
|
||||
player.setVelocity(new Vector(0, 1.2, 0));
|
||||
|
||||
_doubles.put(player, new PlayerCopy(this, player, ChatColor.YELLOW));
|
||||
_doubles.put(player, new PlayerCopyWither(this, player, ChatColor.YELLOW));
|
||||
}
|
||||
|
||||
public void playerIn(final Player player, final LivingEntity copy, Player revivedBy)
|
||||
@ -888,10 +876,10 @@ public class WitherGame extends TeamGame implements IBlockRestorer
|
||||
return;
|
||||
|
||||
// Revive a copy
|
||||
Iterator<PlayerCopy> copyIterator = _doubles.values().iterator();
|
||||
Iterator<PlayerCopyWither> copyIterator = _doubles.values().iterator();
|
||||
while (copyIterator.hasNext())
|
||||
{
|
||||
PlayerCopy copy = copyIterator.next();
|
||||
PlayerCopyWither copy = copyIterator.next();
|
||||
|
||||
GameTeam otherTeam = GetTeam(copy.GetPlayer());
|
||||
if (otherTeam == null || !otherTeam.equals(throwerTeam))
|
||||
@ -937,7 +925,7 @@ public class WitherGame extends TeamGame implements IBlockRestorer
|
||||
@EventHandler
|
||||
public void skeletonDamage(CustomDamageEvent event)
|
||||
{
|
||||
for (PlayerCopy copy : _doubles.values())
|
||||
for (PlayerCopyWither copy : _doubles.values())
|
||||
{
|
||||
if (copy.GetEntity().equals(event.GetDamageeEntity()))
|
||||
{
|
||||
@ -950,7 +938,7 @@ public class WitherGame extends TeamGame implements IBlockRestorer
|
||||
@EventHandler
|
||||
public void skeletonCombust(EntityCombustEvent event)
|
||||
{
|
||||
for (PlayerCopy copy : _doubles.values())
|
||||
for (PlayerCopyWither copy : _doubles.values())
|
||||
{
|
||||
if (copy.GetEntity().equals(event.getEntity()))
|
||||
{
|
||||
|
@ -4,10 +4,8 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -57,7 +55,7 @@ public class SpectatorPage extends
|
||||
_buttons = new IButton[54];
|
||||
_items = new ItemStack[54];
|
||||
|
||||
List<GameTeam> teamList = _arcadeManager.GetGame().GetTeamList();
|
||||
List<GameTeam> teamList = new ArrayList<GameTeam>(_arcadeManager.GetGame().GetTeamList());
|
||||
|
||||
int playerCount = _arcadeManager.GetGame().GetPlayers(true).size();
|
||||
|
||||
@ -153,9 +151,8 @@ public class SpectatorPage extends
|
||||
|
||||
int rowsNeeded = (int) Math.ceil(teamPlayers.size() / 8.0);
|
||||
|
||||
_buttons = Arrays.copyOf(_buttons, _buttons.length
|
||||
+ (rowsNeeded * 9));
|
||||
_items = Arrays.copyOf(_items, _items.length + (rowsNeeded * 9) + rowsNeeded);
|
||||
_buttons = Arrays.copyOf(_buttons, _buttons.length + (rowsNeeded * 9));
|
||||
_items = Arrays.copyOf(_items, _items.length + (rowsNeeded * 9));
|
||||
|
||||
for (int row = 0; row < rowsNeeded; row++)
|
||||
{
|
||||
@ -178,6 +175,9 @@ public class SpectatorPage extends
|
||||
if (rowsNeeded == 1 && teamList.size() < 4 && playerCount <= 26)
|
||||
{
|
||||
currentRow += 2;
|
||||
|
||||
_buttons = Arrays.copyOf(_buttons, _buttons.length + 9);
|
||||
_items = Arrays.copyOf(_items, _items.length + 9);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -16,6 +16,7 @@ import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilGear;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
@ -48,10 +49,7 @@ public class PerkBaconBlast extends Perk implements IThrown
|
||||
if (UtilBlock.usable(event.getClickedBlock()))
|
||||
return;
|
||||
|
||||
if (event.getPlayer().getItemInHand() == null)
|
||||
return;
|
||||
|
||||
if (!event.getPlayer().getItemInHand().getType().toString().contains("_AXE"))
|
||||
if (!UtilGear.isAxe(event.getItem()))
|
||||
return;
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
@ -2,7 +2,6 @@ package nautilus.game.arcade.kit.perks;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
@ -11,7 +11,10 @@ import org.bukkit.event.player.PlayerInteractEvent;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilEvent;
|
||||
import mineplex.core.common.util.UtilGear;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
@ -31,10 +34,10 @@ public class PerkPigCloak extends Perk
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK)
|
||||
if (!UtilEvent.isAction(event, ActionType.R))
|
||||
return;
|
||||
|
||||
if (!event.getPlayer().getItemInHand().getType().toString().contains("_AXE"))
|
||||
if (!UtilGear.isAxe(event.getItem()))
|
||||
return;
|
||||
|
||||
if (!Kit.HasKit(player))
|
||||
|
@ -0,0 +1,293 @@
|
||||
package nautilus.game.arcade.managers;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.event.player.PlayerLoginEvent;
|
||||
import org.bukkit.event.player.PlayerLoginEvent.Result;
|
||||
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
|
||||
public class GameTestingManager implements Listener
|
||||
{
|
||||
/**
|
||||
* Created by: Mysticate
|
||||
* Timestamp: November 25, 2015
|
||||
*/
|
||||
|
||||
private ArcadeManager _manager;
|
||||
|
||||
private boolean _enabled;
|
||||
|
||||
private boolean _capped = false;
|
||||
private int _cap = 16;
|
||||
private String _capMessage = "";
|
||||
|
||||
private boolean _whitelisted = false;
|
||||
private Set<String> _whitelistAdded = new HashSet<String>();
|
||||
private String _whitelistMessage = "";
|
||||
|
||||
public GameTestingManager(ArcadeManager manager)
|
||||
{
|
||||
_manager = manager;
|
||||
|
||||
_manager.getPluginManager().registerEvents(this, _manager.getPlugin());
|
||||
|
||||
_enabled = _manager.getPlugin().getConfig().getString("serverstatus.group").equalsIgnoreCase("Testing");
|
||||
}
|
||||
|
||||
public ArcadeManager getManager()
|
||||
{
|
||||
return _manager;
|
||||
}
|
||||
|
||||
public void setCapped(boolean cap)
|
||||
{
|
||||
_capped = cap;
|
||||
}
|
||||
|
||||
public boolean isCapped()
|
||||
{
|
||||
return _capped;
|
||||
}
|
||||
|
||||
public void setCap(int cap)
|
||||
{
|
||||
_cap = cap;
|
||||
}
|
||||
|
||||
public int getCap()
|
||||
{
|
||||
return _cap;
|
||||
}
|
||||
|
||||
public boolean isWhitelisted(String name)
|
||||
{
|
||||
return _whitelistAdded.contains(new String(name).toLowerCase());
|
||||
}
|
||||
|
||||
public void setWhitelisted(String name, boolean whitelist)
|
||||
{
|
||||
if (isWhitelisted(name))
|
||||
{
|
||||
_whitelistAdded.remove(name.toLowerCase());
|
||||
}
|
||||
else
|
||||
{
|
||||
_whitelistAdded.add(new String(name).toLowerCase());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onLogin(PlayerLoginEvent event)
|
||||
{
|
||||
if (!_enabled)
|
||||
return;
|
||||
|
||||
if (_capped)
|
||||
{
|
||||
if (UtilServer.getPlayers().length >= _cap)
|
||||
{
|
||||
if (!isWhitelisted(event.getPlayer().getName()))
|
||||
{
|
||||
event.disallow(Result.KICK_FULL, C.cGray + "That server has a set cap!\n"
|
||||
+ C.cGray + "Current players " + C.cYellow + UtilServer.getPlayers().length + "/" + _cap + "\n"
|
||||
+ C.cGreen + _capMessage);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (_whitelisted)
|
||||
{
|
||||
if (!isWhitelisted(event.getPlayer().getName()))
|
||||
{
|
||||
event.disallow(Result.KICK_FULL, C.cGray + "That server has a testing whitelist!\n"
|
||||
+ C.cGray + "Current players " + C.cYellow + UtilServer.getPlayers().length + "/" + _cap + "\n"
|
||||
+ C.cGreen + _capMessage);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onCommandTesting(PlayerCommandPreprocessEvent event)
|
||||
{
|
||||
if (!_enabled)
|
||||
return;
|
||||
|
||||
String[] args = event.getMessage().split(" ");
|
||||
String cmd = args[0];
|
||||
|
||||
if (!cmd.equalsIgnoreCase("/testing"))
|
||||
return;
|
||||
|
||||
event.setCancelled(true);
|
||||
|
||||
if (!_manager.GetClients().Get(event.getPlayer()).GetRank().has(event.getPlayer(), Rank.JNR_DEV, true))
|
||||
return;
|
||||
|
||||
if (args.length == 1) // Help
|
||||
{
|
||||
sendGlobalHelp(event.getPlayer());
|
||||
return;
|
||||
}
|
||||
else if (args[1].equalsIgnoreCase("cap"))
|
||||
{
|
||||
if (args.length == 2)
|
||||
{
|
||||
sendCapHelp(event.getPlayer());
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.length == 3) // No cap arguments
|
||||
{
|
||||
if (args[2].equalsIgnoreCase("toggle"))
|
||||
{
|
||||
_capped = !_capped;
|
||||
UtilPlayer.message(event.getPlayer(), F.main("Testing", "Testing cap enabled " + F.tf(_capped) + "."));
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
_cap = Integer.valueOf(args[2]);
|
||||
UtilPlayer.message(event.getPlayer(), F.main("Testing", "Testing cap set to " + F.elem("" + _cap) + "."));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
sendCapHelp(event.getPlayer());
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.length >= 4)
|
||||
{
|
||||
if (args[2].equalsIgnoreCase("message"))
|
||||
{
|
||||
String message = "";
|
||||
for (int i = 3 ; i < args.length ; i++)
|
||||
message += (args[i] + " ");
|
||||
|
||||
_capMessage = message.trim();
|
||||
UtilPlayer.message(event.getPlayer(), F.main("Testing", "Testing cap message set to " + F.elem(_capMessage) + "."));
|
||||
return;
|
||||
}
|
||||
|
||||
sendCapHelp(event.getPlayer());
|
||||
return;
|
||||
}
|
||||
|
||||
sendCapHelp(event.getPlayer());
|
||||
return;
|
||||
}
|
||||
else if (args[1].equalsIgnoreCase("whitelist"))
|
||||
{
|
||||
if (args.length == 2)
|
||||
{
|
||||
sendWhitelistHelp(event.getPlayer());
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.length == 3) // No cap arguments
|
||||
{
|
||||
if (args[2].equalsIgnoreCase("toggle"))
|
||||
{
|
||||
_whitelisted = !_whitelisted;
|
||||
UtilPlayer.message(event.getPlayer(), F.main("Testing", "Testing whitelist enabled " + F.tf(_whitelisted) + "."));
|
||||
return;
|
||||
}
|
||||
|
||||
sendWhitelistHelp(event.getPlayer());
|
||||
return;
|
||||
}
|
||||
|
||||
if (args.length == 4)
|
||||
{
|
||||
if (args[2].equalsIgnoreCase("add"))
|
||||
{
|
||||
String playerName = args[3];
|
||||
|
||||
if (isWhitelisted(playerName))
|
||||
{
|
||||
UtilPlayer.message(event.getPlayer(), F.main("Testing", "That player is already whitelisted!"));
|
||||
}
|
||||
else
|
||||
{
|
||||
setWhitelisted(playerName, true);
|
||||
UtilPlayer.message(event.getPlayer(), F.main("Testing", "You have whitelisted " + F.name(playerName) + "."));
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (args[2].equalsIgnoreCase("remove"))
|
||||
{
|
||||
String playerName = args[3];
|
||||
|
||||
if (!isWhitelisted(playerName))
|
||||
{
|
||||
UtilPlayer.message(event.getPlayer(), F.main("Testing", "That player is not whitelisted!"));
|
||||
}
|
||||
else
|
||||
{
|
||||
setWhitelisted(playerName, false);
|
||||
UtilPlayer.message(event.getPlayer(), F.main("Testing", "You have removed " + F.name(playerName) + " from the whitelist."));
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (args.length >= 4)
|
||||
{
|
||||
if (args[2].equalsIgnoreCase("message"))
|
||||
{
|
||||
String message = "";
|
||||
for (int i = 3 ; i < args.length ; i++)
|
||||
message += (args[i] + " ");
|
||||
|
||||
_whitelistMessage = message.trim();
|
||||
UtilPlayer.message(event.getPlayer(), F.main("Testing", "Testing whitelist message set to " + F.elem(_whitelistMessage) + "."));
|
||||
return;
|
||||
}
|
||||
|
||||
sendWhitelistHelp(event.getPlayer());
|
||||
return;
|
||||
}
|
||||
|
||||
sendWhitelistHelp(event.getPlayer());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private void sendGlobalHelp(Player player)
|
||||
{
|
||||
UtilPlayer.message(player, "");
|
||||
UtilPlayer.message(player, F.main("Testing", "/testing cap"));
|
||||
UtilPlayer.message(player, F.main("Testing", "/testing whitelist"));
|
||||
}
|
||||
|
||||
private void sendCapHelp(Player player)
|
||||
{
|
||||
UtilPlayer.message(player, "");
|
||||
UtilPlayer.message(player, F.main("Testing", "/testing cap toggle"));
|
||||
UtilPlayer.message(player, F.main("Testing", "/testing cap <cap>"));
|
||||
UtilPlayer.message(player, F.main("Testing", "/testing cap message <message>"));
|
||||
}
|
||||
|
||||
private void sendWhitelistHelp(Player player)
|
||||
{
|
||||
UtilPlayer.message(player, "");
|
||||
UtilPlayer.message(player, F.main("Testing", "/testing whitelist toggle"));
|
||||
UtilPlayer.message(player, F.main("Testing", "/testing whitelist add <name>"));
|
||||
UtilPlayer.message(player, F.main("Testing", "/testing whitelist remove <name>"));
|
||||
UtilPlayer.message(player, F.main("Testing", "/testing whitelist message <message>"));
|
||||
}
|
||||
}
|
@ -15,7 +15,7 @@ public class TitanGiveawayRepository extends RepositoryBase
|
||||
|
||||
public TitanGiveawayRepository(JavaPlugin plugin)
|
||||
{
|
||||
super(plugin, DBPool.ACCOUNT);
|
||||
super(plugin, DBPool.getAccount());
|
||||
_titanGiveawayCount = 0;
|
||||
}
|
||||
|
||||
|
@ -1,63 +0,0 @@
|
||||
package nautilus.game.arcade.stats;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
|
||||
import nautilus.game.arcade.game.Game;
|
||||
import nautilus.game.arcade.game.TeamGame;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
||||
public class LastStandStatTracker extends StatTracker<TeamGame>
|
||||
{
|
||||
private final Map<UUID, Integer> _kills = new HashMap<>();
|
||||
|
||||
public LastStandStatTracker(TeamGame game)
|
||||
{
|
||||
super(game);
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||
public void onCombatDeath(CombatDeathEvent event)
|
||||
{
|
||||
if (getGame().GetState() != Game.GameState.Live)
|
||||
return;
|
||||
|
||||
if (event.GetLog().GetKiller() == null)
|
||||
return;
|
||||
|
||||
if (!event.GetLog().GetKiller().IsPlayer())
|
||||
return;
|
||||
|
||||
Player killer = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName());
|
||||
if (killer == null)
|
||||
return;
|
||||
|
||||
if (event.GetLog().GetPlayer() == null)
|
||||
return;
|
||||
|
||||
if (!event.GetLog().GetPlayer().IsPlayer())
|
||||
return;
|
||||
|
||||
Player player = UtilPlayer.searchExact(event.GetLog().GetPlayer().GetName());
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
if (getGame().GetTeam(killer).GetPlayers(true).size() == 1)
|
||||
{
|
||||
Integer kills = _kills.get(killer.getUniqueId());
|
||||
|
||||
kills = (kills == null ? 0 : kills) + 1;
|
||||
|
||||
_kills.put(killer.getUniqueId(), kills);
|
||||
|
||||
if (kills >= 3)
|
||||
addStat(killer, "LastStand", 1, true, false);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
package nautilus.game.arcade.stats;
|
||||
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
||||
import nautilus.game.arcade.game.Game;
|
||||
import nautilus.game.arcade.game.games.paintball.Paintball;
|
||||
|
||||
public class MedicStatTracker extends StatTracker<Game>
|
||||
{
|
||||
public MedicStatTracker(Game game)
|
||||
{
|
||||
super(game);
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||
public void onCombatDeath(Paintball.ReviveEvent event)
|
||||
{
|
||||
if (getGame().GetState() != Game.GameState.Live)
|
||||
return;
|
||||
|
||||
addStat(event.getPlayer(), "Medic", 1, false, false);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user