Browse Source

Added new Particle System and improved efficiency

master
pintux98 6 years ago
parent
commit
104a9f89ff
  1. 15
      MultiArena-TheBridge/config.yml
  2. 27
      MultiArena-TheBridge/lang.yml
  3. 57
      MultiArena-TheBridge/particles.yml
  4. 2
      MultiArena-TheBridge/plugin.yml
  5. 5
      MultiArena-TheBridge/pom.xml
  6. 33
      MultiArena-TheBridge/src/cx/sfy/TheBridge/Main.java
  7. 31
      MultiArena-TheBridge/src/cx/sfy/TheBridge/cosmetics/Particle.java
  8. 15
      MultiArena-TheBridge/src/cx/sfy/TheBridge/database/Cosmeticbase.java
  9. 5
      MultiArena-TheBridge/src/cx/sfy/TheBridge/database/PlayerStat.java
  10. 5
      MultiArena-TheBridge/src/cx/sfy/TheBridge/game/Game.java
  11. 100
      MultiArena-TheBridge/src/cx/sfy/TheBridge/listeners/PlayerListener.java
  12. 59
      MultiArena-TheBridge/src/cx/sfy/TheBridge/managers/ArrowManager.java
  13. 72
      MultiArena-TheBridge/src/cx/sfy/TheBridge/managers/ParticleManager.java
  14. 1
      MultiArena-TheBridge/src/cx/sfy/TheBridge/menus/GlassMenu.java
  15. 9
      MultiArena-TheBridge/src/cx/sfy/TheBridge/menus/ShopMenu.java
  16. 15
      MultiArena-TheBridge/src/cx/sfy/TheBridge/menus/particle/ArrowTrailMenu.java
  17. 32
      MultiArena-TheBridge/src/cx/sfy/TheBridge/menus/particle/FeetTrailMenu.java
  18. 40
      MultiArena-TheBridge/src/cx/sfy/TheBridge/menus/particle/TrailMenu.java
  19. 9
      MultiArena-TheBridge/src/cx/sfy/TheBridge/nms/GenericNMS.java
  20. 6
      MultiArena-TheBridge/src/cx/sfy/TheBridge/nms/NMS.java
  21. 226
      MultiArena-TheBridge/src/cx/sfy/TheBridge/packets/ParticleHandler.java
  22. 34
      MultiArena-TheBridge/src/cx/sfy/TheBridge/packets/Reflection.java
  23. 173
      MultiArena-TheBridge/src/cx/sfy/TheBridge/team/Team.java
  24. 32
      MultiArena-TheBridge/trails.yml

15
MultiArena-TheBridge/config.yml

@ -28,11 +28,22 @@ shop:
icon: STAINED_GLASS
data: 0
amount: 1
arrow:
trails:
slot: 5
icon: ARROW
icon: APPLE
data: 0
amount: 1
type:
arrow:
slot: 3
icon: ARROW
data: 0
amount: 1
feet:
slot: 5
icon: IRON_BOOTS
data: 0
amount: 1
close:
slot: 22
icon: BARRIER

27
MultiArena-TheBridge/lang.yml

@ -25,16 +25,27 @@ shop:
loreItem: |-
&7Click to open
&7the glass Shop.
arrow:
nameItem: '&aTrails Shop'
loreItem: |-
&7Click to open
&7the trails Shop.
close:
nameItem: '&cClose'
loreItem: |-
&7Click to close
&7this shop
trails:
nameItem: '&aTrail Shop'
loreItem: |-
&7Click to open
&7the trail Shop.
type:
arrow:
nameItem: '&aArrow particle Shop'
loreItem: |-
&7Click to open
&7the arrow particle Shop.
feet:
nameItem: '&aFeet particle Shop'
loreItem: |-
&7Click to open
&7the feet particle Shop.
holograms:
your: Your
portal:
@ -112,8 +123,10 @@ messages:
noMoney: '&cYou dont have money to do this.'
buyCage: '&aYou successfuly bought the &e<cage> cage.'
selectedCage: '&aYou have just selected the &e<cage>&a cage.'
buyTrail: '&aYou successfuly bought the &e<trail> trail.'
selectedTrail: '&aYou have just selected the &e<trail>&a trail.'
buyArrowTrail: '&aYou successfuly bought the &e<arrow_trail> trail.'
selectedArrowTrail: '&aYou have just selected the &e<arrow_trail>&a trail.'
buyFeetTrail: '&aYou successfuly bought the &e<feet_trail> trail.'
selectedFeetTrail: '&aYou have just selected the &e<feet_trail>&a trail.'
leftGame: '&cYou left the game.'
noShoot: '&cYou can not shoot the bow yet.'
archiDisabled: '&cAchievements are currently disabled.'

57
MultiArena-TheBridge/particles.yml

@ -0,0 +1,57 @@
size: 27
title: '&aThe Bridge - Particles'
unlocked:
- <description>
- '&7'
- '&eClick to select!'
noPerm:
- <description>
- '&7'
- '&aPrice: &6<price>'
- '&7'
- '&cYou dont have permission!'
locked:
- <description>
- '&7'
- '&aPrice: &6<price>'
- '&7'
- '&eClick to buy this!'
trails:
arrow:
title: '&aThe Bridge - Arrow Trails'
size: 36
effects:
default:
icon: ARROW
data: 0
amount: 1
slot: 0
price: 0
isBuy: true
name: "Default Arrow Effect"
effect:
type: CRIT
ammount: 20
permission: bridges.arrow.default
description:
- '&fDefault effect to all'
- '&fplayers'
feet:
title: '&aThe Bridge - Feet Trails'
size: 36
effects:
default:
icon: IRON_BOOTS
data: 0
amount: 1
slot: 0
price: 0
isBuy: true
name: "Default Feet Effect"
effect:
type: CRIT
ammount: 20
permission: bridges.feet.default
description:
- '&fDefault effect to all'
- '&fplayers'

2
MultiArena-TheBridge/plugin.yml

@ -1,6 +1,6 @@
main: cx.sfy.TheBridge.Main
name: TheBridge
version: 2.4.5
version: 2.4.5-BETA_3
authors: [Stefatorus, pintux98, Leonardo0013YT]
softdepend: [PlaceholderAPI, LeaderHeads, FastAsyncWorldEdit, WorldEdit]
commands:

5
MultiArena-TheBridge/pom.xml

@ -6,17 +6,14 @@
<groupId>TheBridge</groupId>
<artifactId>TheBridge</artifactId>
<version>2.4.5</version>
<version>2.4.5-BETA_3</version>
<name>TheBridge</name>
<description>TheBridge minigame by stefatorus &amp; pintux98</description>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<mainClass>cx.sfy.TheBridge.Main</mainClass>
<authors>stefatorus &amp; pintux98</authors>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>

33
MultiArena-TheBridge/src/cx/sfy/TheBridge/Main.java

@ -39,28 +39,31 @@ import cx.sfy.TheBridge.listeners.PlayerListener;
import cx.sfy.TheBridge.listeners.SetupListener;
import cx.sfy.TheBridge.listeners.SpectatorListener;
import cx.sfy.TheBridge.managers.ArchiManager;
import cx.sfy.TheBridge.managers.ArrowManager;
import cx.sfy.TheBridge.managers.CageManager;
import cx.sfy.TheBridge.managers.FileManager;
import cx.sfy.TheBridge.managers.GameManager;
import cx.sfy.TheBridge.managers.GlassManager;
import cx.sfy.TheBridge.managers.LocationManager;
import cx.sfy.TheBridge.managers.ParticleManager;
import cx.sfy.TheBridge.managers.ScoreboardManager;
import cx.sfy.TheBridge.managers.SetupManager;
import cx.sfy.TheBridge.managers.SignManager;
import cx.sfy.TheBridge.managers.TitleManager;
import cx.sfy.TheBridge.managers.TopManager;
import cx.sfy.TheBridge.menus.AchievementsMenu;
import cx.sfy.TheBridge.menus.ArrowMenu;
import cx.sfy.TheBridge.menus.GameMenu;
import cx.sfy.TheBridge.menus.GlassMenu;
import cx.sfy.TheBridge.menus.ShopMenu;
import cx.sfy.TheBridge.menus.SpectOptionsMenu;
import cx.sfy.TheBridge.menus.SpectPlayerMenu;
import cx.sfy.TheBridge.menus.TeamMenu;
import cx.sfy.TheBridge.menus.particle.ArrowTrailMenu;
import cx.sfy.TheBridge.menus.particle.FeetTrailMenu;
import cx.sfy.TheBridge.menus.particle.TrailMenu;
import cx.sfy.TheBridge.nms.GenericNMS;
import cx.sfy.TheBridge.nms.NMS;
import cx.sfy.TheBridge.packets.PacketMain;
import cx.sfy.TheBridge.packets.ParticleHandler;
import lombok.Getter;
import lombok.Setter;
@ -85,7 +88,11 @@ public class Main extends JavaPlugin {
@Getter
private GameMenu gmu;
@Getter
private ArrowMenu amu;
private TrailMenu trm;
@Getter
private ArrowTrailMenu atm;
@Getter
private FeetTrailMenu ftm;
@Getter
private WorldController wc;
@Getter
@ -99,7 +106,7 @@ public class Main extends JavaPlugin {
@Getter
private Settings achievement;
@Getter
private Settings arrow;
private Settings particles;
@Getter
private NMS nms;
@Getter
@ -133,7 +140,7 @@ public class Main extends JavaPlugin {
@Getter
private CageManager cm;
@Getter
private ArrowManager arm;
private ParticleManager pam;
@Getter
private GlassMenu glam;
@Getter
@ -152,6 +159,7 @@ public class Main extends JavaPlugin {
@Override
public void onEnable() {
refl = new PacketMain(this);
ParticleHandler.load();
instance = this;
stop = false;
getServer().getMessenger().registerOutgoingPluginChannel(Main.get(), "BungeeCord");
@ -167,7 +175,7 @@ public class Main extends JavaPlugin {
cages = new Settings(this, "cages");
sounds = new Settings(this, "sounds");
achievement = new Settings(this, "achievement");
arrow = new Settings(this, "trails");
particles = new Settings(this, "particles");
if (getServer().getPluginManager().isPluginEnabled("FastAsyncWorldEdit")) {
if (!getConfig().getBoolean("cages")) {
Bukkit.getServer().getConsoleSender().sendMessage(ChatColor.GREEN + "You have " + ChatColor.RED
@ -207,10 +215,12 @@ public class Main extends JavaPlugin {
sim = new SignManager(this);
gm = new GameManager(this);
gmu = new GameMenu(this);
amu = new ArrowMenu(this);
trm = new TrailMenu(this);
atm = new ArrowTrailMenu(this);
ftm = new FeetTrailMenu(this);
sm = new SetupManager(this);
glm = new GlassManager();
arm = new ArrowManager(this);
pam = new ParticleManager(this);
top = new TopManager(this);
tem = new TeamMenu(this);
som = new SpectOptionsMenu(this);
@ -269,8 +279,11 @@ public class Main extends JavaPlugin {
public void onDisable() {
stop = true;
getTop().removeHolo();
for (InventoryData inv : InventoryData.getInventoryData().values()) {
inv.restore();
if (InventoryData.getInventoryData() != null || !InventoryData.getInventoryData().values().isEmpty()
|| !InventoryData.getInventoryData().isEmpty()) {
for (InventoryData inv : InventoryData.getInventoryData().values()) {
inv.restore();
}
}
for (GameFour gamef : getGm().getGamesFour()) {
for (PlayerData pd : gamef.getPD().values()) {

31
MultiArena-TheBridge/src/cx/sfy/TheBridge/cosmetics/Arrow.java → MultiArena-TheBridge/src/cx/sfy/TheBridge/cosmetics/Particle.java

@ -10,7 +10,7 @@ import org.bukkit.inventory.meta.ItemMeta;
import cx.sfy.TheBridge.Main;
import lombok.Getter;
public class Arrow {
public class Particle {
Main plugin;
private ItemStack icon;
@ -23,6 +23,8 @@ public class Arrow {
@Getter
private String trail;
@Getter
private int ammount;
@Getter
private ArrayList<String> lore;
@Getter
private int price;
@ -31,21 +33,22 @@ public class Arrow {
@Getter
private boolean isBuy;
public Arrow(Main plugin, String path, String id) {
public Particle(Main plugin, String path, String id) {
this.plugin = plugin;
this.icon = new ItemStack(Material.valueOf(plugin.getArrow().get(path + ".icon")),
plugin.getArrow().getInt(path + ".amount"), (short) plugin.getArrow().getInt(path + ".data"));
this.icon = new ItemStack(Material.valueOf(plugin.getParticles().get(path + ".icon")),
plugin.getParticles().getInt(path + ".amount"), (short) plugin.getParticles().getInt(path + ".data"));
this.lore = new ArrayList<String>();
for (String l : plugin.getArrow().getList(path + ".description")) {
for (String l : plugin.getParticles().getList(path + ".description")) {
lore.add(l.replaceAll("&", "§"));
}
this.id = id;
this.name = plugin.getArrow().get(path + ".name");
this.permission = plugin.getArrow().get(path + ".permission");
this.price = plugin.getArrow().getInt(path + ".price");
this.slot = plugin.getArrow().getInt(path + ".slot");
this.isBuy = plugin.getArrow().getBoolean(path + ".isBuy");
this.trail = plugin.getArrow().get(path + ".effect");
this.name = plugin.getParticles().get(path + ".name");
this.permission = plugin.getParticles().get(path + ".permission");
this.price = plugin.getParticles().getInt(path + ".price");
this.slot = plugin.getParticles().getInt(path + ".slot");
this.isBuy = plugin.getParticles().getBoolean(path + ".isBuy");
this.trail = plugin.getParticles().get(path + ".effect.type");
this.ammount = plugin.getParticles().getInt(path + ".effect.ammount");
}
public ItemStack getHasIcon() {
@ -53,7 +56,7 @@ public class Arrow {
ItemMeta permM = perm.getItemMeta();
List<String> nLore = new ArrayList<String>();
;
for (String msg : plugin.getArrow().getList("unlocked")) {
for (String msg : plugin.getParticles().getList("unlocked")) {
if (msg.contains("<description>")) {
for (String l : lore) {
nLore.add(l);
@ -73,7 +76,7 @@ public class Arrow {
ItemMeta permM = perm.getItemMeta();
List<String> nLore = new ArrayList<String>();
;
for (String msg : plugin.getArrow().getList("noPerm")) {
for (String msg : plugin.getParticles().getList("noPerm")) {
if (msg.contains("<description>")) {
for (String l : lore) {
nLore.add(l);
@ -93,7 +96,7 @@ public class Arrow {
ItemMeta permM = perm.getItemMeta();
List<String> nLore = new ArrayList<String>();
;
for (String msg : plugin.getArrow().getList("locked")) {
for (String msg : plugin.getParticles().getList("locked")) {
if (msg.contains("<description>")) {
for (String l : lore) {
nLore.add(l);

15
MultiArena-TheBridge/src/cx/sfy/TheBridge/database/Cosmeticbase.java

@ -86,7 +86,7 @@ public class Cosmeticbase {
try {
StringBuilder queryBuilder = new StringBuilder();
queryBuilder.append("INSERT INTO `BG_Cosmetic` ");
queryBuilder.append("(`UUID`, `Name`, `Cage`, `Taunt`, `Trail`, `KillSound`) ");
queryBuilder.append("(`UUID`, `Name`, `Cage`, `Arrow_Trail`, `Feet_Trail`, `KillSound`) ");
queryBuilder.append("VALUES ");
queryBuilder.append("(?, ?, ?, ?, ?, ?);");
preparedStatement = connection.prepareStatement(queryBuilder.toString());
@ -162,7 +162,7 @@ public class Cosmeticbase {
ResultSet resultSet = null;
try {
StringBuilder queryBuilder = new StringBuilder();
queryBuilder.append("SELECT `Cage`, `Taunt`, `Trail`, `KillSound` ");
queryBuilder.append("SELECT `Cage`, `Arrow_Trail`, `Feet_Trail`, `KillSound` ");
queryBuilder.append("FROM `BG_Cosmetic` ");
queryBuilder.append("WHERE `UUID` = ? ");
queryBuilder.append("LIMIT 1;");
@ -171,7 +171,8 @@ public class Cosmeticbase {
resultSet = preparedStatement.executeQuery();
if (resultSet != null && resultSet.next()) {
stat.setCage(resultSet.getString("Cage"));
stat.setArrow(resultSet.getString("Trail"));
stat.setArrow_trail(resultSet.getString("Arrow_Trail"));
stat.setFeet_trail(resultSet.getString("Feet_Trail"));
}
} catch (SQLException sqlException) {
sqlException.printStackTrace();
@ -200,12 +201,12 @@ public class Cosmeticbase {
try {
StringBuilder queryBuilder = new StringBuilder();
queryBuilder.append("UPDATE `BG_Cosmetic` SET ");
queryBuilder.append("`Cage` = ?, `Taunt` = ?, `Trail` = ?, `KillSound` = ? ");
queryBuilder.append("`Cage` = ?, `Arrow_Trail` = ?, `Feet_Trail` = ?, `KillSound` = ? ");
queryBuilder.append("WHERE `UUID` = ?;");
preparedStatement = connection.prepareStatement(queryBuilder.toString());
preparedStatement.setString(1, stat.getCage());
preparedStatement.setString(2, "default");
preparedStatement.setString(3, stat.getArrow());
preparedStatement.setString(2, stat.getArrow_trail());
preparedStatement.setString(3, stat.getFeet_trail());
preparedStatement.setString(4, "default");
preparedStatement.setString(5, stat.getUUID());
preparedStatement.executeUpdate();
@ -232,7 +233,7 @@ public class Cosmeticbase {
Statement statement = connection.createStatement();
try {
statement.executeUpdate(
"CREATE TABLE IF NOT EXISTS BG_Cosmetic (UUID VARCHAR(60), Name VARCHAR(60), Cage TEXT, Taunt TEXT, Trail TEXT, KillSound TEXT)");
"CREATE TABLE IF NOT EXISTS BG_Cosmetic (UUID VARCHAR(60), Name VARCHAR(60), Cage TEXT, Arrow_Trail TEXT, Feet_Trail TEXT, KillSound TEXT)");
} catch (SQLException ex) {
try {
if (statement != null) {

5
MultiArena-TheBridge/src/cx/sfy/TheBridge/database/PlayerStat.java

@ -27,7 +27,10 @@ public class PlayerStat {
private String cage;
@Getter
@Setter
private String arrow;
private String arrow_trail;
@Getter
@Setter
private String feet_trail;
@Getter
@Setter
private int normalWins;

5
MultiArena-TheBridge/src/cx/sfy/TheBridge/game/Game.java

@ -1,5 +0,0 @@
package cx.sfy.TheBridge.game;
public class Game {
}

100
MultiArena-TheBridge/src/cx/sfy/TheBridge/listeners/PlayerListener.java

@ -8,6 +8,7 @@ import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
@ -56,6 +57,7 @@ import cx.sfy.TheBridge.game.GameDuo.State;
import cx.sfy.TheBridge.game.GameFour;
import cx.sfy.TheBridge.game.GameFour.FState;
import cx.sfy.TheBridge.game.InventoryData;
import cx.sfy.TheBridge.packets.ParticleHandler.ParticleType;
import cx.sfy.TheBridge.signs.GameFourSign;
import cx.sfy.TheBridge.signs.GameNormalSign;
import cx.sfy.TheBridge.utils.ItemBuilder;
@ -76,23 +78,36 @@ public class PlayerListener implements Listener {
private BukkitTask task;
public void runTask(Player p, Entity e) {
public void sendArrowParticle(Player p, Entity e) {
task = Bukkit.getServer().getScheduler().runTaskTimerAsynchronously(this.plugin, () -> {
Location loc = e.getLocation();
if (e.isOnGround()) {
if (e.isOnGround() || e.getLocation().getY() < 10) {
task.cancel();
}
createTrail(loc, plugin.getArm().getArrowByName(PlayerStat.getPlayerStat(p).getArrow()));
createTrail(loc, plugin.getPam().getParticleByName("arrow", PlayerStat.getPlayerStat(p).getArrow_trail()));
}, 0, 1);
}
public void sendFeetParticle(Player p) {
if (p.isFlying() || p.hasPotionEffect(PotionEffectType.INVISIBILITY) || p.getGameMode() == GameMode.SPECTATOR) {
return;
}
Location loc = p.getLocation();
createTrail(loc, plugin.getPam().getParticleByName("feet", PlayerStat.getPlayerStat(p).getFeet_trail()));
}
public void createTrail(Location loc, cx.sfy.TheBridge.cosmetics.Particle particle) {
plugin.getNms().sendParticle(ParticleType.valueOf(particle.getTrail()), 1, particle.getAmmount(), 0.05)
.sendToLocation(loc);
}
@EventHandler
public void onShoot(ProjectileLaunchEvent e) {
if (e.getEntity().getShooter() instanceof Player) {
if (e.getEntity() instanceof Arrow) {
Player p = (Player) e.getEntity().getShooter();
if (plugin.getGm().getGameByPlayer(p) != null || plugin.getGm().getGameFourByPlayer(p) != null)
runTask(p, e.getEntity());
sendArrowParticle(p, e.getEntity());
}
}
}
@ -105,10 +120,6 @@ public class PlayerListener implements Listener {
Utils.setPlayerExperience(p, PlayerStat.getPlayerStat(p).getXp());
}
public void createTrail(Location loc, cx.sfy.TheBridge.cosmetics.Arrow arrow) {
plugin.getNms().sendParticle(loc, arrow);
}
@EventHandler
public void onCommand(PlayerCommandPreprocessEvent e) {
if (plugin.getGm().getGameByPlayer(e.getPlayer()) != null
@ -422,7 +433,7 @@ public class PlayerListener implements Listener {
out.writeUTF("Forward");
out.writeUTF(plugin.getConfig().getString("items.lobby.server"));
out.writeShort(data.length);
out.write(data);
out.write(data);
p.sendPluginMessage(Main.get(), "BungeeCord", bo.toByteArray());
} catch (Exception ex) {
ex.printStackTrace();
@ -476,6 +487,9 @@ public class PlayerListener implements Listener {
final Player p = e.getPlayer();
if (plugin.getGm().getGameByPlayer(p) != null) {
final GameDuo game = plugin.getGm().getGameByPlayer(p);
if (e.getFrom() != e.getTo()) {
sendFeetParticle(p);
}
if (game.isState(State.WAITING) || game.isState(State.STARTING) || game.isState(State.FINISH))
if (p.getLocation().getY() < 30)
p.teleport(game.getLobby());
@ -500,6 +514,9 @@ public class PlayerListener implements Listener {
}
if (plugin.getGm().getGameFourByPlayer(p) != null) {
final GameFour game = plugin.getGm().getGameFourByPlayer(p);
if (e.getFrom() != e.getTo()) {
sendFeetParticle(p);
}
if (game.isState(FState.WAITING) || game.isState(FState.STARTING) || game.isState(FState.FINISH))
if (p.getLocation().getY() < 30)
p.teleport(game.getLobby());
@ -796,11 +813,22 @@ public class PlayerListener implements Listener {
return;
if (e.getCurrentItem().getItemMeta().getDisplayName().equals(plugin.getLang().get("shop.glass.nameItem")))
plugin.getGlam().createGlassMenu(p);
if (e.getCurrentItem().getItemMeta().getDisplayName().equals(plugin.getLang().get("shop.arrow.nameItem")))
plugin.getAmu().createArrowMenu(p);
if (e.getCurrentItem().getItemMeta().getDisplayName().equals(plugin.getLang().get("shop.trails.nameItem")))
plugin.getTrm().createTrailMenu(p);
if (e.getCurrentItem().getItemMeta().getDisplayName().equals(plugin.getLang().get("shop.close.nameItem")))
p.getOpenInventory().close();
}
if (inv.getTitle().equals(plugin.getParticles().get("title"))) {
e.setCancelled(true);
if (e.getCurrentItem() == null || e.getCurrentItem().getType() == Material.AIR)
return;
if (e.getCurrentItem().getItemMeta().getDisplayName()
.equals(plugin.getLang().get("shop.trails.type.arrow.nameItem")))
plugin.getAtm().createArrowMenu(p);
if (e.getCurrentItem().getItemMeta().getDisplayName()
.equals(plugin.getLang().get("shop.trails.type.feet.nameItem")))
plugin.getFtm().createFeetMenu(p);
}
if (inv.getTitle().equals(plugin.getCages().get("title"))) {
e.setCancelled(true);
if (e.getCurrentItem() == null || e.getCurrentItem().getType() == Material.AIR)
@ -835,11 +863,11 @@ public class PlayerListener implements Listener {
PlayerStat.getPlayerStat(p).setCage(cage.getId());
}
}
if (inv.getTitle().equals(plugin.getArrow().get("title"))) {
if (inv.getTitle().equals(plugin.getParticles().get("trails.arrow.title"))) {
e.setCancelled(true);
if (e.getCurrentItem() == null || e.getCurrentItem().getType() == Material.AIR)
return;
for (final cx.sfy.TheBridge.cosmetics.Arrow arrow : plugin.getArm().getArrows().values())
for (final cx.sfy.TheBridge.cosmetics.Particle arrow : plugin.getPam().getArrow_trails().values())
if (arrow.getSlot() == e.getSlot())
if (!p.hasPermission(arrow.getPermission())) {
if (!arrow.isBuy())
@ -855,18 +883,52 @@ public class PlayerListener implements Listener {
new BukkitRunnable() {
@Override
public void run() {
plugin.getAmu().createArrowMenu(p);
plugin.getAtm().createArrowMenu(p);
}
}.runTaskLater(plugin, 2L);
p.playSound(p.getLocation(), Sound.valueOf(plugin.getSounds().get("sounds.shop.buy")), 1.0f,
1.0f);
p.sendMessage(
plugin.getLang().get("messages.buyTrail").replaceAll("<trail>", arrow.getName()));
p.sendMessage(plugin.getLang().get("messages.buyArrowTrail").replaceAll("<arrow_trail>",
arrow.getName()));
}
} else {
p.sendMessage(
plugin.getLang().get("messages.selectedTrail").replaceAll("<trail>", arrow.getName()));
PlayerStat.getPlayerStat(p).setArrow(arrow.getId());
p.sendMessage(plugin.getLang().get("messages.selectedArrowTrail").replaceAll("<arrow_trail>",
arrow.getName()));
PlayerStat.getPlayerStat(p).setArrow_trail(arrow.getId());
}
}
if (inv.getTitle().equals(plugin.getParticles().get("trails.feet.title"))) {
e.setCancelled(true);
if (e.getCurrentItem() == null || e.getCurrentItem().getType() == Material.AIR)
return;
for (final cx.sfy.TheBridge.cosmetics.Particle feet : plugin.getPam().getFeet_trails().values())
if (feet.getSlot() == e.getSlot())
if (!p.hasPermission(feet.getPermission())) {
if (!feet.isBuy())
p.sendMessage(plugin.getLang().get("messages.noBuy"));
else if (feet.getPrice() > PlayerStat.getPlayerStat(p).getCoins())
p.sendMessage(plugin.getLang().get("messages.noMoney"));
else if (feet.isBuy() && feet.getPrice() <= PlayerStat.getPlayerStat(p).getCoins()) {
Bukkit.dispatchCommand(Bukkit.getConsoleSender(),
plugin.getConfig().getString("permFormat").replaceAll("<name>", p.getName())
.replaceAll("<permission>", feet.getPermission()));
PlayerStat.getPlayerStat(p).removeCoins(feet.getPrice());
p.getOpenInventory().close();
new BukkitRunnable() {
@Override
public void run() {
plugin.getFtm().createFeetMenu(p);
}
}.runTaskLater(plugin, 2L);
p.playSound(p.getLocation(), Sound.valueOf(plugin.getSounds().get("sounds.shop.buy")), 1.0f,
1.0f);
p.sendMessage(plugin.getLang().get("messages.buyFeetTrail").replaceAll("<feet_trail>",
feet.getName()));
}
} else {
p.sendMessage(plugin.getLang().get("messages.selectedFeetTrail").replaceAll("<feet_trail>",
feet.getName()));
PlayerStat.getPlayerStat(p).setArrow_trail(feet.getId());
}
}
if (inv.getTitle().equals(plugin.getLang().get("menus.type.title"))) {

59
MultiArena-TheBridge/src/cx/sfy/TheBridge/managers/ArrowManager.java

@ -1,59 +0,0 @@
package cx.sfy.TheBridge.managers;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import org.bukkit.configuration.ConfigurationSection;
import cx.sfy.TheBridge.Main;
import cx.sfy.TheBridge.cosmetics.Arrow;
import lombok.Getter;
public class ArrowManager {
Main plugin;
@Getter
private HashMap<String, Arrow> arrows = new HashMap<String, Arrow>();
@Getter
private List<String> unlocked = null;
@Getter
private List<String> locked = null;
@Getter
private List<String> noPerm = null;
public ArrowManager(Main plugin) {
this.plugin = plugin;
loadArrows();
}
public void loadArrows() {
List<String> un = new ArrayList<String>();
for (String u : plugin.getArrow().getList("unlocked")) {
un.add(u);
}
unlocked = un;
List<String> lo = new ArrayList<String>();
for (String l : plugin.getArrow().getList("locked")) {
lo.add(l);
}
locked = lo;
List<String> pe = new ArrayList<String>();
for (String p : plugin.getArrow().getList("noPerm")) {
pe.add(p);
}
noPerm = pe;
ConfigurationSection conf = plugin.getArrow().getConfig().getConfigurationSection("arrows");
for (String arrow : conf.getKeys(false)) {
arrows.put(arrow, new Arrow(plugin, "arrows." + arrow, arrow));
}
}
public Arrow getArrowByName(String name) {
if (arrows.containsKey(name)) {
return arrows.get(name);
}
return null;
}
}

72
MultiArena-TheBridge/src/cx/sfy/TheBridge/managers/ParticleManager.java

@ -0,0 +1,72 @@
package cx.sfy.TheBridge.managers;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import org.bukkit.configuration.ConfigurationSection;
import cx.sfy.TheBridge.Main;
import cx.sfy.TheBridge.cosmetics.Particle;
import lombok.Getter;
public class ParticleManager {
Main plugin;
@Getter
private HashMap<String, Particle> arrow_trails = new HashMap<String, Particle>();
@Getter
private HashMap<String, Particle> feet_trails = new HashMap<String, Particle>();
@Getter
private List<String> unlocked = null;
@Getter
private List<String> locked = null;
@Getter
private List<String> noPerm = null;
public ParticleManager(Main plugin) {
this.plugin = plugin;
loadParticles();
}
public void loadParticles() {
List<String> un = new ArrayList<String>();
for (String u : plugin.getParticles().getList("unlocked")) {
un.add(u);
}
unlocked = un;
List<String> lo = new ArrayList<String>();
for (String l : plugin.getParticles().getList("locked")) {
lo.add(l);
}
locked = lo;
List<String> pe = new ArrayList<String>();
for (String p : plugin.getParticles().getList("noPerm")) {
pe.add(p);
}
noPerm = pe;
ConfigurationSection conf = plugin.getParticles().getConfig().getConfigurationSection("trails.arrow.effects");
for (String arrow : conf.getKeys(false)) {
arrow_trails.put(arrow, new Particle(plugin, "trails.arrow.effects." + arrow, arrow));
}
ConfigurationSection conf1 = plugin.getParticles().getConfig().getConfigurationSection("trails.feet.effects");
for (String feet : conf1.getKeys(false)) {
feet_trails.put(feet, new Particle(plugin, "trails.feet.effects." + feet, feet));
}
}
public Particle getParticleByName(String type, String name) {
if (arrow_trails.containsKey(name) || feet_trails.containsKey(name)) {
switch (type.toUpperCase()) {
case "FEET":
return feet_trails.get(name);
case "ARROW":
return arrow_trails.get(name);
default:
return null;
}
}
return null;
}
}

1
MultiArena-TheBridge/src/cx/sfy/TheBridge/menus/GlassMenu.java

@ -19,7 +19,6 @@ public class GlassMenu {
Inventory inv = Bukkit.getServer().createInventory(null, plugin.getCages().getInt("size"),
plugin.getCages().get("title"));
for (Cage cage : plugin.getCm().getCages().values()) {
System.out.println(cage == null);
if (!cage.isBuy() && !p.hasPermission(cage.getPermission())) {
inv.setItem(cage.getSlot(), cage.getPermIcon());
} else if (cage.isBuy() && !p.hasPermission(cage.getPermission())) {

9
MultiArena-TheBridge/src/cx/sfy/TheBridge/menus/ShopMenu.java

@ -20,7 +20,6 @@ public class ShopMenu {
public void openShopMenu(Player p) {
Inventory inv = Bukkit.getServer().createInventory(null, plugin.getConfig().getInt("shop.size"),
plugin.getLang().get("shop.title"));
if (plugin.isCage()) {
ItemStack glass = ItemBuilder.item(Material.valueOf(plugin.getConfig().getString("shop.glass.icon")),
plugin.getConfig().getInt("shop.glass.amount"),
@ -28,14 +27,14 @@ public class ShopMenu {
plugin.getLang().get("shop.glass.loreItem"));
inv.setItem(plugin.getConfig().getInt("shop.glass.slot"), glass);
}
ItemStack arrow = ItemBuilder.item(Material.valueOf(plugin.getConfig().getString("shop.arrow.icon")),
plugin.getConfig().getInt("shop.arrow.amount"), (short) plugin.getConfig().getInt("shop.arrow.data"),
plugin.getLang().get("shop.arrow.nameItem"), plugin.getLang().get("shop.arrow.loreItem"));
ItemStack particle = ItemBuilder.item(Material.valueOf(plugin.getConfig().getString("shop.trails.icon")),
plugin.getConfig().getInt("shop.trails.amount"), (short) plugin.getConfig().getInt("shop.trails.data"),
plugin.getLang().get("shop.trails.nameItem"), plugin.getLang().get("shop.trails.loreItem"));
ItemStack close = ItemBuilder.item(Material.valueOf(plugin.getConfig().getString("shop.close.icon")),
plugin.getConfig().getInt("shop.close.amount"), (short) plugin.getConfig().getInt("shop.close.data"),
plugin.getLang().get("shop.close.nameItem"), plugin.getLang().get("shop.close.loreItem"));
inv.setItem(plugin.getConfig().getInt("shop.arrow.slot"), arrow);
inv.setItem(plugin.getConfig().getInt("shop.trails.slot"), particle);
inv.setItem(plugin.getConfig().getInt("shop.close.slot"), close);
p.openInventory(inv);
}

15
MultiArena-TheBridge/src/cx/sfy/TheBridge/menus/ArrowMenu.java → MultiArena-TheBridge/src/cx/sfy/TheBridge/menus/particle/ArrowTrailMenu.java

@ -1,24 +1,23 @@
package cx.sfy.TheBridge.menus;
package cx.sfy.TheBridge.menus.particle;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
import cx.sfy.TheBridge.Main;
import cx.sfy.TheBridge.cosmetics.Arrow;
import cx.sfy.TheBridge.cosmetics.Particle;
public class ArrowMenu {
public class ArrowTrailMenu {
Main plugin;
public ArrowMenu(Main plugin) {
public ArrowTrailMenu(Main plugin) {
this.plugin = plugin;
}
public void createArrowMenu(Player p) {
Inventory inv = Bukkit.getServer().createInventory(null, plugin.getArrow().getInt("size"),
plugin.getArrow().get("title"));
for (Arrow arrow : plugin.getArm().getArrows().values()) {
System.out.println(arrow == null);
Inventory inv = Bukkit.getServer().createInventory(null, plugin.getParticles().getInt("trails.arrow.size"),
plugin.getParticles().get("trails.arrow.title"));
for (Particle arrow : plugin.getPam().getArrow_trails().values()) {
if (!arrow.isBuy() && !p.hasPermission(arrow.getPermission())) {
inv.setItem(arrow.getSlot(), arrow.getPermIcon());
} else if (arrow.isBuy() && !p.hasPermission(arrow.getPermission())) {

32
MultiArena-TheBridge/src/cx/sfy/TheBridge/menus/particle/FeetTrailMenu.java

@ -0,0 +1,32 @@
package cx.sfy.TheBridge.menus.particle;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
import cx.sfy.TheBridge.Main;
import cx.sfy.TheBridge.cosmetics.Particle;
public class FeetTrailMenu {
Main plugin;
public FeetTrailMenu(Main plugin) {
this.plugin = plugin;
}
public void createFeetMenu(Player p) {
Inventory inv = Bukkit.getServer().createInventory(null, plugin.getParticles().getInt("trails.feet.size"),
plugin.getParticles().get("trails.feet.title"));
for (Particle feet : plugin.getPam().getFeet_trails().values()) {
if (!feet.isBuy() && !p.hasPermission(feet.getPermission())) {
inv.setItem(feet.getSlot(), feet.getPermIcon());
} else if (feet.isBuy() && !p.hasPermission(feet.getPermission())) {
inv.setItem(feet.getSlot(), feet.getBuyIcon());
} else {
inv.setItem(feet.getSlot(), feet.getHasIcon());
}
}
p.openInventory(inv);
}
}

40
MultiArena-TheBridge/src/cx/sfy/TheBridge/menus/particle/TrailMenu.java

@ -0,0 +1,40 @@
package cx.sfy.TheBridge.menus.particle;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import cx.sfy.TheBridge.Main;
import cx.sfy.TheBridge.utils.ItemBuilder;
public class TrailMenu {
Main plugin;
public TrailMenu(Main plugin) {
this.plugin = plugin;
}
public void createTrailMenu(Player p) {
Inventory inv = Bukkit.getServer().createInventory(null, plugin.getParticles().getInt("size"),
plugin.getParticles().get("title"));
ItemStack arrow = ItemBuilder.item(
Material.valueOf(plugin.getConfig().getString("shop.trails.type.arrow.icon")),
plugin.getConfig().getInt("shop.trails.type.arrow.amount"),
(short) plugin.getConfig().getInt("shop.trails.type.arrow.data"),
plugin.getLang().get("shop.trails.type.arrow.nameItem"),
plugin.getLang().get("shop.trails.type.arrow.loreItem"));
ItemStack feet = ItemBuilder.item(Material.valueOf(plugin.getConfig().getString("shop.trails.type.feet.icon")),
plugin.getConfig().getInt("shop.trails.type.feet.amount"),
(short) plugin.getConfig().getInt("shop.trails.type.feet.data"),
plugin.getLang().get("shop.trails.type.feet.nameItem"),
plugin.getLang().get("shop.trails.type.feet.loreItem"));
inv.setItem(plugin.getConfig().getInt("shop.trails.type.arrow.slot"), arrow);
inv.setItem(plugin.getConfig().getInt("shop.trails.type.feet.slot"), feet);
p.openInventory(inv);
}
}

9
MultiArena-TheBridge/src/cx/sfy/TheBridge/nms/GenericNMS.java

@ -13,8 +13,9 @@ import org.bukkit.entity.Player;
import org.bukkit.generator.BlockPopulator;
import org.bukkit.generator.ChunkGenerator;
import cx.sfy.TheBridge.cosmetics.Arrow;
import cx.sfy.TheBridge.packets.ParticleHandler;
import cx.sfy.TheBridge.packets.Reflection;
import cx.sfy.TheBridge.packets.ParticleHandler.ParticleType;
public class GenericNMS implements NMS {
@ -103,8 +104,8 @@ public class GenericNMS implements NMS {
}
@Override
public void sendParticle(Location loc, Arrow particle) {
Reflection.sendParticle(loc, particle.getTrail(), 50, 0.2);
public ParticleHandler sendParticle(ParticleType type, double speed, int count, double radius) {
return new ParticleHandler(type, speed, count, radius);
}
}

6
MultiArena-TheBridge/src/cx/sfy/TheBridge/nms/NMS.java

@ -1,10 +1,10 @@
package cx.sfy.TheBridge.nms;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.generator.ChunkGenerator;
import cx.sfy.TheBridge.cosmetics.Arrow;
import cx.sfy.TheBridge.packets.ParticleHandler;
import cx.sfy.TheBridge.packets.ParticleHandler.ParticleType;
public interface NMS {
@ -14,6 +14,6 @@ public interface NMS {
public void sendActionBar(Player player, String s);
public void sendParticle(Location loc, Arrow arrow);
public ParticleHandler sendParticle(ParticleType type, double speed, int count, double radius);
}

226
MultiArena-TheBridge/src/cx/sfy/TheBridge/packets/ParticleHandler.java

@ -0,0 +1,226 @@
package cx.sfy.TheBridge.packets;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.HashMap;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
@SuppressWarnings({ "unchecked", "rawtypes" })
public class ParticleHandler {
private static Class<?> packetClass = null;
private static Constructor<?> packetConstructor = null;
private static Field player_connection = null;
private static Method player_sendPacket = null;
private static HashMap<Class<? extends Entity>, Method> handles = new HashMap<Class<? extends Entity>, Method>();
private static boolean newParticlePacketConstructor = false;
private static Class<Enum> enumParticle = null;
private ParticleType type;
private double speed;
private int count;
private double radius;
private static boolean compatible = true;
public static void load() {
String vString = getVersion().replace("v", "");
double v = 0;
if (!vString.isEmpty()) {
String[] array = vString.split("_");
v = Double.parseDouble(array[0] + "." + array[1]);
}
try {
Bukkit.getLogger().info("[ParticleHandler] Hooking into Netty NMS classes");
packetClass = getNmsClass("PacketPlayOutWorldParticles");
if (v == 1.8 || v == 1.9 || v == 1.10 || v == 1.11 || v == 1.12) {
Bukkit.getLogger().info("[ParticleHandler] Version is " + v + " - using old packet constructor");
enumParticle = (Class<Enum>) getNmsClass("EnumParticle");
packetConstructor = packetClass.getDeclaredConstructor(enumParticle, boolean.class, float.class,
float.class, float.class, float.class, float.class, float.class, float.class, int.class,
int[].class);
} else {
Bukkit.getLogger().info("[ParticleHandler] Version is " + v + " - using new packet constructor");
newParticlePacketConstructor = true;
enumParticle = (Class<Enum>) getNmsClass("EnumParticle");
packetConstructor = packetClass.getDeclaredConstructor(enumParticle, boolean.class, float.class,
float.class, float.class, float.class, float.class, float.class, float.class, int.class);
}
} catch (Exception ex) {
ex.printStackTrace();
Bukkit.getLogger().severe("[ParticleHandler] Failed to initialize NMS components!");
compatible = false;
}
}
public ParticleHandler(ParticleType type, double speed, int count, double radius) {
this.type = type;
this.speed = speed;
this.count = count;
this.radius = radius;
}
public double getSpeed() {
return speed;
}
public int getCount() {
return count;
}
public double getRadius() {
return radius;
}
public void sendToLocation(Location location) {
try {
Object packet = createPacket(location);
for (Player player : Bukkit.getOnlinePlayers()) {
sendPacket(player, packet);
}
} catch (Exception e) {
e.printStackTrace();
}
}
private Object createPacket(Location location) {
try {
if (this.count <= 0) {
this.count = 1;
}
Object packet;
if (newParticlePacketConstructor) {
Object particleType = enumParticle.getEnumConstants()[type.getId()];
packet = packetConstructor.newInstance(particleType, true, (float) location.getX(),
(float) location.getY(), (float) location.getZ(), (float) this.radius, (float) this.radius,
(float) this.radius, (float) this.speed, this.count);
} else {
Object particleType = enumParticle.getEnumConstants()[type.getId()];
packet = packetConstructor.newInstance(particleType, true, (float) location.getX(),
(float) location.getY(), (float) location.getZ(), (float) this.radius, (float) this.radius,
(float) this.radius, (float) this.speed, this.count, new int[0]);
}
return packet;
} catch (IllegalAccessException ex) {
ex.printStackTrace();
Bukkit.getLogger().severe("{ParticleHandler] Failed to construct particle effect packet!");
} catch (InstantiationException ex) {
ex.printStackTrace();
Bukkit.getLogger().severe("{ParticleHandler] Failed to construct particle effect packet!");
} catch (InvocationTargetException ex) {
ex.printStackTrace();
Bukkit.getLogger().severe("{ParticleHandler] Failed to construct particle effect packet!");
}
return null;
}
private static void sendPacket(Player p, Object packet) throws IllegalArgumentException {
try {
if (player_connection == null) {
player_connection = getHandle(p).getClass().getField("playerConnection");
for (Method m : player_connection.get(getHandle(p)).getClass().getMethods()) {
if (m.getName().equalsIgnoreCase("sendPacket")) {
player_sendPacket = m;
}
}
}
player_sendPacket.invoke(player_connection.get(getHandle(p)), packet);
} catch (IllegalAccessException ex) {
ex.printStackTrace();
Bukkit.getLogger().severe("[ParticleHandler] Failed to send packet!");
} catch (InvocationTargetException ex) {
ex.printStackTrace();
Bukkit.getLogger().severe("[ParticleHandler] Failed to send packet!");
} catch (NoSuchFieldException ex) {
ex.printStackTrace();
Bukkit.getLogger().severe("[ParticleHandler] Failed to send packet!");
}
}
private static Object getHandle(Entity entity) {
try {
if (handles.get(entity.getClass()) != null)
return handles.get(entity.getClass()).invoke(entity);
else {
Method entity_getHandle = entity.getClass().getMethod("getHandle");
handles.put(entity.getClass(), entity_getHandle);
return entity_getHandle.invoke(entity);
}
} catch (Exception ex) {
ex.printStackTrace();
return null;
}
}
private static Class<?> getNmsClass(String name) {
String version = getVersion();
String className = "net.minecraft.server." + version + name;
Class<?> clazz = null;
try {
clazz = Class.forName(className);
} catch (ClassNotFoundException ex) {
ex.printStackTrace();
Bukkit.getLogger().severe("[ParticleHandler] Failed to load NMS class " + name + "!");
}
return clazz;
}
private static String getVersion() {
String[] array = Bukkit.getServer().getClass().getPackage().getName().replace(".", ",").split(",");
if (array.length == 4)
return array[3] + ".";
return "";
}
public static boolean isCompatible() {
return compatible;
}
public enum ParticleType {
EXPLOSION_NORMAL("explode", 0, 17), EXPLOSION_LARGE("largeexplode", 1, 1),
EXPLOSION_HUGE("hugeexplosion", 2, 0), FIREWORKS_SPARK("fireworksSpark", 3, 2), WATER_BUBBLE("bubble", 4, 3),
WATER_SPLASH("splash", 5, 21), WATER_WAKE("wake", 6, -1), SUSPENDED("suspended", 7, 4),
SUSPENDED_DEPTH("depthsuspend", 8, 5), CRIT("crit", 9, 7), CRIT_MAGIC("magicCrit", 10, 8),
SMOKE_NORMAL("smoke", 11, -1), SMOKE_LARGE("largesmoke", 12, 22), SPELL("spell", 13, 11),
SPELL_INSTANT("instantSpell", 14, 12), SPELL_MOB("mobSpell", 15, 9),
SPELL_MOB_AMBIENT("mobSpellAmbient", 16, 10), SPELL_WITCH("witchMagic", 17, 13),
DRIP_WATER("dripWater", 18, 27), DRIP_LAVA("dripLava", 19, 28), VILLAGER_ANGRY("angryVillager", 20, 31),
VILLAGER_HAPPY("happyVillager", 21, 32), TOWN_AURA("townaura", 22, 6), NOTE("note", 23, 24),
PORTAL("portal", 24, 15), ENCHANTMENT_TABLE("enchantmenttable", 25, 16), FLAME("flame", 26, 18),
LAVA("lava", 27, 19), FOOTSTEP("footstep", 28, 20), CLOUD("cloud", 29, 23), REDSTONE("reddust", 30, 24),
SNOWBALL("snowballpoof", 31, 25), SNOW_SHOVEL("snowshovel", 32, 28), SLIME("slime", 33, 29),
HEART("heart", 34, 30), BARRIER("barrier", 35, -1), ITEM_CRACK("iconcrack_", 36, 33),
BLOCK_CRACK("tilecrack_", 37, 34), BLOCK_DUST("blockdust_", 38, -1), WATER_DROP("droplet", 39, -1),
ITEM_TAKE("take", 40, -1), MOB_APPEARANCE("mobappearance", 41, -1);
private String name;
private int id;
private int legacyId;
ParticleType(String name, int id, int legacyId) {
this.name = name;
this.id = id;
this.legacyId = legacyId;
}
String getName() {
return name;
}
int getId() {
return id;
}
int getLegacyId() {
return legacyId;
}
}
}

34
MultiArena-TheBridge/src/cx/sfy/TheBridge/packets/Reflection.java

@ -5,8 +5,6 @@ import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.Collection;
import java.util.List;
import java.util.SplittableRandom;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.World;
@ -33,7 +31,7 @@ public class Reflection {
public enum Classes {
CraftWorld(), CraftBlock(), CraftPlayer(), Material(), MapMeta(), WorldServer(), PacketPlayOutTitle(),
IChatBaseComponent(), EnumParticle(), PacketPlayOutWorldParticles();
IChatBaseComponent();
private Class<?> type;
@ -64,8 +62,6 @@ public class Reflection {
Classes.WorldServer.type = getClass("{nms}.WorldServer");
Classes.IChatBaseComponent.type = getClass("{nms}.IChatBaseComponent");
Classes.PacketPlayOutTitle.type = getClass("{nms}.PacketPlayOutTitle");
Classes.EnumParticle.type = getClass("{nms}.EnumParticle");
Classes.PacketPlayOutWorldParticles.type = getClass("{nms}.PacketPlayOutWorldParticles");
// PUTTING METHODS IN ENUM.
Methods.setMapId.mthd = getMethod(Classes.MapMeta.getType(), "setMapId", int.class);
@ -113,34 +109,6 @@ public class Reflection {
}
}
@SuppressWarnings({ "unchecked", "rawtypes" })
public static void sendParticle(Location loc, String particle, int radius, double offset) {
int[] in = new int[1];
SplittableRandom sr = new SplittableRandom();
loc.add(sr.nextDouble(-offset, offset), sr.nextDouble(-offset, offset), sr.nextDouble(-offset, offset));
Collection<Entity> ents = loc.getWorld().getNearbyEntities(loc, radius, radius, radius);
try {
Class enumParticles = Classes.EnumParticle.getType();
Object packet = Classes.PacketPlayOutWorldParticles.getType()
.getConstructor(new Class[] { enumParticles, boolean.class, float.class, float.class, float.class,
float.class, float.class, float.class, float.class, int.class, int[].class })
.newInstance(Enum.valueOf(enumParticles, (particle != null ? particle.toUpperCase() : "FLAME")),
true, (float) loc.getX(), (float) loc.getY(), (float) loc.getZ(), 0F, 0F, 0F, 1F, 15, in);
for (Entity p : ents) {
if (!(p instanceof Player)) {
continue;
}
sendPlayerPacket((Player) p, packet);
}
} catch (Exception e) {
e.printStackTrace();
}
}
@SuppressWarnings("unchecked")
static JSONObject convert(String text) {
final JSONObject json = new JSONObject();

173
MultiArena-TheBridge/src/cx/sfy/TheBridge/team/Team.java

@ -1,173 +0,0 @@
package cx.sfy.TheBridge.team;
import java.util.ArrayList;
import org.bukkit.ChatColor;
import org.bukkit.Color;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import com.sk89q.worldedit.EditSession;
import cx.sfy.TheBridge.cosmetics.Cage;
public abstract class Team {
private ArrayList<Player> players;
private ArrayList<Location> portal;
private Location hologram;
private Location teamSpawn;
private Location teamRespawn;
private int life;
private boolean death;
private ChatColor color;
private Color fcolor;
private String teamName;
private String ally;
private boolean cage;
private EditSession editSessionRed;
private EditSession editSessionBlue;
private EditSession editSessionYellow;
private EditSession editSessionGreen;
private Cage cages;
abstract void createCage(Cage cage);
abstract void removeCage();
public ArrayList<Player> getPlayers() {
return players;
}
public void setPlayers(ArrayList<Player> players) {
this.players = players;
}
public ArrayList<Location> getPortal() {
return portal;
}
public void setPortal(ArrayList<Location> portal) {
this.portal = portal;
}
public Location getHologram() {
return hologram;
}
public void setHologram(Location hologram) {
this.hologram = hologram;
}
public Location getTeamSpawn() {
return teamSpawn;
}
public void setTeamSpawn(Location teamSpawn) {
this.teamSpawn = teamSpawn;
}
public Location getTeamRespawn() {
return teamRespawn;
}
public void setTeamRespawn(Location teamRespawn) {
this.teamRespawn = teamRespawn;
}
public int getLife() {
return life;
}
public void setLife(int life) {
this.life = life;
}
public boolean isDeath() {
return death;
}
public void setDeath(boolean death) {
this.death = death;
}
public ChatColor getColor() {
return color;
}
public void setColor(ChatColor color) {
this.color = color;
}
public Color getFcolor() {
return fcolor;
}
public void setFcolor(Color fcolor) {
this.fcolor = fcolor;
}
public String getTeamName() {
return teamName;
}
public void setTeamName(String teamName) {
this.teamName = teamName;
}
public String getAlly() {
return ally;
}
public void setAlly(String ally) {
this.ally = ally;
}
public boolean isCage() {
return cage;
}
public void setCage(boolean cage) {
this.cage = cage;
}
public EditSession getEditSessionRed() {
return editSessionRed;
}
public void setEditSessionRed(EditSession editSessionRed) {
this.editSessionRed = editSessionRed;
}
public EditSession getEditSessionBlue() {
return editSessionBlue;
}
public void setEditSessionBlue(EditSession editSessionBlue) {
this.editSessionBlue = editSessionBlue;
}
public EditSession getEditSessionYellow() {
return editSessionYellow;
}
public void setEditSessionYellow(EditSession editSessionYellow) {
this.editSessionYellow = editSessionYellow;
}
public EditSession getEditSessionGreen() {
return editSessionGreen;
}
public void setEditSessionGreen(EditSession editSessionGreen) {
this.editSessionGreen = editSessionGreen;
}
public Cage getCages() {
return cages;
}
public void setCages(Cage cages) {
this.cages = cages;
}
}

32
MultiArena-TheBridge/trails.yml

@ -1,32 +0,0 @@
size: 36
title: '&aThe Bridge - Arrows'
unlocked:
- <description>
- '&7'
- '&eClick to select!'
noPerm:
- <description>
- '&7'
- '&aPrice: &6<price>'
- '&7'
- '&cYou dont have permission!'
locked:
- <description>
- '&7'
- '&aPrice: &6<price>'
- '&7'
- '&eClick to buy this!'
arrows:
default:
icon: ARROW
data: 0
amount: 1
slot: 0
price: 0
isBuy: true
name: "Default Arrow Effect"
effect: FLAME
permission: bridges.arrow.default
description:
- '&fDefault arrow effect to all'
- '&fplayers'
Loading…
Cancel
Save