Browse Source

Code cleaned, added trailes to arrow, fixed bugs, added new lobby items

master
pintux98 5 years ago
parent
commit
81604945be
  1. 20
      MultiArena-TheBridge/.classpath
  2. 1
      MultiArena-TheBridge/.gitignore
  3. 6
      MultiArena-TheBridge/.project
  4. 2
      MultiArena-TheBridge/.settings/org.eclipse.core.resources.prefs
  5. 1
      MultiArena-TheBridge/.settings/org.eclipse.jdt.core.prefs
  6. 4
      MultiArena-TheBridge/.settings/org.eclipse.m2e.core.prefs
  7. 297
      MultiArena-TheBridge/config.yml
  8. 798
      MultiArena-TheBridge/lang.yml
  9. 37
      MultiArena-TheBridge/pom.xml
  10. 659
      MultiArena-TheBridge/src/cx/sfy/TheBridge/Main.java
  11. 169
      MultiArena-TheBridge/src/cx/sfy/TheBridge/Settings.java
  12. 2
      MultiArena-TheBridge/src/cx/sfy/TheBridge/archievements/Archi.java
  13. 1844
      MultiArena-TheBridge/src/cx/sfy/TheBridge/cmds/SetupCMD.java
  14. 4
      MultiArena-TheBridge/src/cx/sfy/TheBridge/controllers/WorldController.java
  15. 110
      MultiArena-TheBridge/src/cx/sfy/TheBridge/cosmetics/Arrow.java
  16. 14
      MultiArena-TheBridge/src/cx/sfy/TheBridge/cosmetics/Cage.java
  17. 443
      MultiArena-TheBridge/src/cx/sfy/TheBridge/database/Cosmeticbase.java
  18. 988
      MultiArena-TheBridge/src/cx/sfy/TheBridge/database/Database.java
  19. 187
      MultiArena-TheBridge/src/cx/sfy/TheBridge/database/PlayerStat.java
  20. 54
      MultiArena-TheBridge/src/cx/sfy/TheBridge/game/GameDuo.java
  21. 44
      MultiArena-TheBridge/src/cx/sfy/TheBridge/game/GameFour.java
  22. 26
      MultiArena-TheBridge/src/cx/sfy/TheBridge/game/PlayerData.java
  23. 8
      MultiArena-TheBridge/src/cx/sfy/TheBridge/hooks/PlaceholderHook.java
  24. 2
      MultiArena-TheBridge/src/cx/sfy/TheBridge/kit/Hotbar.java
  25. 401
      MultiArena-TheBridge/src/cx/sfy/TheBridge/listeners/PlayerListener.java
  26. 38
      MultiArena-TheBridge/src/cx/sfy/TheBridge/listeners/SetupListener.java
  27. 38
      MultiArena-TheBridge/src/cx/sfy/TheBridge/listeners/SpectatorListener.java
  28. 59
      MultiArena-TheBridge/src/cx/sfy/TheBridge/managers/ArrowManager.java
  29. 333
      MultiArena-TheBridge/src/cx/sfy/TheBridge/managers/GameManager.java
  30. 2
      MultiArena-TheBridge/src/cx/sfy/TheBridge/managers/LocationManager.java
  31. 250
      MultiArena-TheBridge/src/cx/sfy/TheBridge/managers/ScoreboardManager.java
  32. 147
      MultiArena-TheBridge/src/cx/sfy/TheBridge/managers/SignManager.java
  33. 12
      MultiArena-TheBridge/src/cx/sfy/TheBridge/managers/TitleManager.java
  34. 61
      MultiArena-TheBridge/src/cx/sfy/TheBridge/managers/TopManager.java
  35. 144
      MultiArena-TheBridge/src/cx/sfy/TheBridge/menus/AchievementsMenu.java
  36. 33
      MultiArena-TheBridge/src/cx/sfy/TheBridge/menus/ArrowMenu.java
  37. 51
      MultiArena-TheBridge/src/cx/sfy/TheBridge/menus/GameMenu.java
  38. 11
      MultiArena-TheBridge/src/cx/sfy/TheBridge/menus/GlassMenu.java
  39. 30
      MultiArena-TheBridge/src/cx/sfy/TheBridge/menus/ShopMenu.java
  40. 39
      MultiArena-TheBridge/src/cx/sfy/TheBridge/menus/SpectOptionsMenu.java
  41. 64
      MultiArena-TheBridge/src/cx/sfy/TheBridge/menus/SpectPlayerMenu.java
  42. 76
      MultiArena-TheBridge/src/cx/sfy/TheBridge/menus/TeamMenu.java
  43. 8
      MultiArena-TheBridge/src/cx/sfy/TheBridge/nms/GenericNMS.java
  44. 9
      MultiArena-TheBridge/src/cx/sfy/TheBridge/nms/NMS.java
  45. 42
      MultiArena-TheBridge/src/cx/sfy/TheBridge/packets/Reflection.java
  46. 6
      MultiArena-TheBridge/src/cx/sfy/TheBridge/team/TeamDuo.java
  47. 16
      MultiArena-TheBridge/src/cx/sfy/TheBridge/tops/Top.java
  48. 32
      MultiArena-TheBridge/trails.yml

20
MultiArena-TheBridge/.classpath

@ -1,7 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/classes" path="src">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="C:/Users/pintu/Desktop/pindev/spigot-related/FastAsyncWorldEdit-bukkit-19.04.22-57c85d0-1271-22.0.6.jar"/>
<classpathentry kind="lib" path="C:/Users/pintu/Desktop/pindev/spigot-related/LeaderHeads.jar"/>
<classpathentry kind="lib" path="C:/Users/pintu/Desktop/pindev/spigot-related/PlaceholderAPI-2.9.2.jar"/>
@ -13,5 +22,10 @@
<classpathentry kind="lib" path="C:/Users/pintu/Desktop/pindev/spigot-related/spigot-1.13.2.jar"/>
<classpathentry kind="lib" path="C:/Users/pintu/Desktop/pindev/spigot-related/worldedit-bukkit-6.1.9.jar"/>
<classpathentry kind="lib" path="C:/Users/pintu/Desktop/pindev/spigot-related/spigot-1.14.jar"/>
<classpathentry kind="output" path="bin"/>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>

1
MultiArena-TheBridge/.gitignore

@ -0,0 +1 @@
/target/

6
MultiArena-TheBridge/.project

@ -10,8 +10,14 @@
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

2
MultiArena-TheBridge/.settings/org.eclipse.core.resources.prefs

@ -8,3 +8,5 @@ encoding//src/cx/sfy/TheBridge/packets/PacketMain.java=UTF-8
encoding//src/cx/sfy/TheBridge/packets/Reflection.java=UTF-8
encoding//src/cx/sfy/TheBridge/team/TeamFour.java=UTF-8
encoding//src/cx/sfy/TheBridge/utils/ScoreboardUtil.java=UTF-8
encoding/<project>=UTF-8
encoding/src=UTF-8

1
MultiArena-TheBridge/.settings/org.eclipse.jdt.core.prefs

@ -9,5 +9,6 @@ org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.8

4
MultiArena-TheBridge/.settings/org.eclipse.m2e.core.prefs

@ -0,0 +1,4 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1

297
MultiArena-TheBridge/config.yml

@ -1,136 +1,163 @@
mainLobby: null
server: ServerName
update: true
cages: false
permFormat: pex user <name> add <permission>
defaultCage: "default"
chat:
enabled: true
lobby: "&b[TheBridge] &e<player>: &7<msg>"
ingame: "<teamColor>[<teamName>] <player>: &7<msg>"
global: "&6[GLOBAL] <teamColor> <teamName> <player>: &7<msg>"
commands:
whitelist: true
list:
- /myCommand
archievements:
disable: false
remove:
absorption: false
regeneration: false
bow:
seconds: 3
shop:
size: 27
glass:
slot: 4
icon: STAINED_GLASS
data: 0
amount: 1
close:
slot: 22
icon: BARRIER
data: 0
amount: 1
coins:
normal:
kill: 2
win: 50
goals: 0
four:
kill: 2
win: 50
goals: 0
xp:
normal:
kill: 1
win: 10
goals: 0
four:
kill: 1
win: 10
goals: 0
items:
shop:
enabled: false
material: DIAMOND
data: 0
amount: 1
slot: 3
nameItem: "&aThe Bridge | Shop"
loreItem: |-
&7Click to open
&7shop of the bridge.
hotbar:
enabled: false
material: CHEST
data: 0
amount: 1
slot: 5
nameItem: "&aHotbar Editor"
loreItem: |-
&7Click to open
&7hotbar editor.
menu:
enabled: false
material: BOOK
data: 0
amount: 1
slot: 4
nameItem: "&aGame Selector"
loreItem: |-
&7Click to open
&7menu of select games.
random:
enabled: false
material: FEATHER
data: 0
amount: 1
slot: 8
nameItem: "&eRandom Join"
loreItem: |-
&7Click to random
&7join a game.
names:
red: "Red"
blue: "Blue"
yellow: "Yellow"
green: "Green"
signs:
waiting: 5
starting: 4
pregame: 6
ingame: 14
finish: 11
restart: 15
MySQL:
enabled: false
username: Insider
password: spigot
database: Martu
host: 127.0.0.1
port: 3306
stats: null
tops:
normal:
kills: null
wins: null
goals: null
four:
kills: null
wins: null
goals: null
title:
prestart:
fadein: 0
stayin: 21
fadeout: 0
start:
fadein: 0
stayin: 21
fadeout: 0
restart:
fadein: 0
stayin: 21
fadeout: 0
mainLobby: null
server: ServerName
update: true
cages: false
permFormat: pex user <name> add <permission>
defaultCage: default
defaultArrow: default
chat:
enabled: true
lobby: '&b[TheBridge] &e<player>: &7<msg>'
ingame: '<teamColor>[<teamName>] <player>: &7<msg>'
global: '&6[GLOBAL] <teamColor> <teamName> <player>: &7<msg>'
commands:
whitelist: true
list:
- /myCommand
archievements:
disable: false
remove:
absorption: false
regeneration: false
bow:
seconds: 3
shop:
size: 27
glass:
slot: 3
icon: STAINED_GLASS
data: 0
amount: 1
arrow:
slot: 5
icon: ARROW
data: 0
amount: 1
close:
slot: 22
icon: BARRIER
data: 0
amount: 1
coins:
normal:
kill: 2
win: 50
goals: 0
four:
kill: 2
win: 50
goals: 0
xp:
normal:
kill: 1
win: 10
goals: 0
four:
kill: 1
win: 10
goals: 0
items:
shop:
enabled: false
material: DIAMOND
data: 0
amount: 1
slot: 3
nameItem: '&aThe Bridge | Shop'
loreItem: |-
&7Click to open
&7shop of the bridge.
hotbar:
enabled: false
material: CHEST
data: 0
amount: 1
slot: 5
nameItem: '&aHotbar Editor'
loreItem: |-
&7Click to open
&7hotbar editor.
menu:
enabled: false
material: BOOK
data: 0
amount: 1
slot: 4
nameItem: '&aGame Selector'
loreItem: |-
&7Click to open
&7menu of select games.
random:
enabled: false
material: FEATHER
data: 0
amount: 1
slot: 0
nameItem: '&eRandom Join'
loreItem: |-
&7Click to random
&7join a game.
lobby:
enabled: false
material: REDSTONE
data: 0
amount: 1
slot: 8
server: lobby
nameItem: '&eReturn to Lobby'
loreItem: |-
&7Click to return
&7to lobby.
archievements:
enabled: false
material: NOTEBLOCK
data: 0
amount: 1
slot: 7
nameItem: '&eArchievements Menu'
loreItem: |-
&7Click to return
&7open archevements menu.
names:
red: Red
blue: Blue
yellow: Yellow
green: Green
signs:
waiting: 5
starting: 4
pregame: 6
ingame: 14
finish: 11
restart: 15
MySQL:
enabled: false
username: Insider
password: spigot
database: Martu
host: 127.0.0.1
port: 3306
stats: null
tops:
normal:
kills: null
wins: null
goals: null
four:
kills: null
wins: null
goals: null
title:
prestart:
fadein: 0
stayin: 21
fadeout: 0
start:
fadein: 0
stayin: 21
fadeout: 0
restart:
fadein: 0
stayin: 21
fadeout: 0
kit: null

798
MultiArena-TheBridge/lang.yml

@ -1,396 +1,404 @@
prefix: "&6&lTheBridge &7:"
error: "&c&lERROR!"
signs:
normal:
line-1: "&lTheBridge Normal"
line-2: <state>
line-3: "Map: <name>"
line-4: "&7<players>/<max>"
four:
line-1: "&lTheBridge Four"
line-2: <state>
line-3: "Map: <name>"
line-4: "&7<players>/<max>"
states:
waiting: "&aWaiting..."
starting: "&eStarting"
pregame: "&cPre-Game"
ingame: "&4In-Game"
finish: "&9Finishing"
restarting: "&5Restarting"
shop:
title: "&aThe Bridge | Shop"
glass:
nameItem: "&aCage Shop"
loreItem: |-
&7Click to open
&7the cage Shop.
close:
nameItem: "&cClose"
loreItem: |-
&7Click to close
&7this shop
holograms:
your: "Your"
portal:
you:
- "<color>&l<team> Goal"
- "&7Defend!"
enemy:
- "<color>&l<team> Goal"
- "&eJump in to score!"
tops:
normal:
kills:
- "&b&lTop TheBridge Kills"
- "&aNormal mode"
- <top>
wins:
- "&b&lTop TheBridge Winners"
- "&aNormal mode"
- <top>
goals:
- "&b&lTop TheBridge Goal scorers"
- "&aNormal mode"
- <top>
four:
kills:
- "&b&lTop TheBridge Kills"
- "&aFour mode"
- <top>
wins:
- "&b&lTop TheBridge Winners"
- "&aFour mode"
- <top>
goals:
- "&b&lTop TheBridge Goal scorers"
- "&aFour mode"
- <top>
stats:
- "&a%player_name% &6&lThe Bridge &astatistics"
- "&aNormal Kills: &6%bridges_normal_kills%"
- "&aNormal Wins: &6%bridges_normal_wins%"
- "&aNormal Goals: &6%bridges_normal_goals%"
- "&aFour Kills: &6%bridges_four_kills%"
- "&aFour Wins: &6%bridges_four_wins%"
- "&aFour Goals: &6%bridges_four_goals%"
- "&aBlocks Placed: &6%bridges_blocks_placed%"
- "&aBlocks Broken: &6%bridges_blocks_broken%"
- "&aCoins: &6%bridges_coins%"
- "&aXP: &6%bridges_xp%"
deathMessages:
void: <TDColor><death> &7was thrown into the void
damage: <TDColor><death> &7was killed
custom: <TDColor><death> &7was death
player: "&7 by <TKColor><player>&7."
none: .
messages:
noPermission: "&cYou dont have permissions to run this command."
noBreak: "&cYou can only break blocks allowed blocks."
noPlace: "&cYou are not allowed to build here."
starting: "&eThe game starts in &b<time> &e<units>."
prestart: "&eCages are opening in &b<time> &e<units>."
restart: "&eCages are reopening in &b<time> &e<units>."
alreadyGame: "&cThis player is already in a game."
noGame: "&cYou are not in any game."
join: "&7<player> &ehas joined the game &b(&e<players>&b/&e<max>&b)!"
quit: "&7<player> &ehas left the game &b(&e<players>&b/&e<max>&b)!"
eliminated: <color>&l<player> &c&lhas been eliminated.
gameFull: "&cThis game is already full."
gameAlreadyStart: "&cThis game has already started."
joinedTeam: "&eYou joined a team <team>&e."
unbalancedTeam: "&cThat team is full. Try joining another one"
noHaveKit: "&cYou haven't set up the main kit yet."
noGames: "&cThere are no free games available."
hotbarSaved: "&aYour hotbar has been saved."
noBuy: "&cYou are not allowed to buy this."
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."
leftGame: "&cYou left the game."
noShoot: "&cYou can not shoot the bow yet."
archiDisabled: "&cAchievements are currently disabled."
noEnabedGlass: "&cCages are currently not enabled. Please use FastAsyncWorldEdit to enable them."
start:
- "&a&m&l---------------------------------------------"
- "&7&f&lThe Bridge"
- "&7"
- "&e&lThe only goal is to enter the portal of the"
- "&e&lAnother team in order to score a goal."
- "&e&lThe team that bequeath 5 goals first"
- "&e&lwin the game."
- "&7"
- "&a&m&l---------------------------------------------"
startFour:
- "&a&m&l---------------------------------------------"
- "&7&f&lThe Bridge"
- "&7"
- "&eCross bridges to score goals on enemy teams,"
- "&egoals you steal. Each team starts with &a2<heart> (lifes)&e."
- "&eScoring &a+1<heart> &efor your computer while allowing you to"
- "&ethose affected lose &c-1<heart> &eof your team."
- "&7"
- "&eWhen there are 2 teams left, you can not"
- "&eregaining lives! The last team on foot wins!"
- "&7"
- "&a&m&l---------------------------------------------"
goal:
- "&a&m&l---------------------------------------------"
- "&7"
- "&7<color>&l<player> &7(&a<health>&c<heart>&7) &ehas scored! &7(&6<goals> Gol<s>&7)"
- "&7"
- "&7<color>&l<team> GOAL!!"
- "&7&c&l<redGoals> &e&l- &9&l<blueGoals> "
- "&7"
- "&a&m&l---------------------------------------------"
stole:
- "&a&m&l---------------------------------------------"
- "&7"
- <color>&l<player> &7(&a<health>&c<heart>&7) scored &c<teamStole>&7! (&6<goals> Gol<es>&7)
- <teamOther> &7stolen <color>1<heart> &7of <teamStole>&7!
- "&7"
- <green> &8- <greenLife>
- <blue> &8- <blueLife>
- <red> &8- <redLife>
- <yellow> &8- <yellowLife>
- "&7"
- "&a&m&l---------------------------------------------"
final:
- "&a&m&l---------------------------------------------"
- "&7"
- <color>&l<player> &7(&a<health>&c<heart>&7) scored &c<teamStole>&7! (&6<goals> Gol<es>&7)
- <teamStole> &7lost &c-1<heart>&7!
- "&7"
- <green> &8- <greenLife>
- <blue> &8- <blueLife>
- <red> &8- <redLife>
- <yellow> &8- <yellowLife>
- "&7"
- "&a&m&l---------------------------------------------"
win:
- "&a&m&l---------------------------------------------"
- "&7&f&lThe Bridge"
- "&7"
- "&7<color>&l<team> WIN!"
- "&7<color>&l<player> &7(&a<health>&c<heart>&7) &ehas scored! &7(&6<goals> Gol<s>&7)"
- "&7"
- "&c&l<redGoals> &7&l- &9&l<blueGoals>"
- "&7"
- "&a&m&l---------------------------------------------"
winFour:
- "&a&m&l---------------------------------------------"
- "&7&f&lThe Bridge"
- "&7"
- <color>&l<team> WIN!
- <color>&l<player> &7(&a<health>&c<heart>&7) scored &c<teamStole>&7! (&6<goals> Gol<es>&7)
- "&7"
- <green> &8- <greenLife>
- <blue> &8- <blueLife>
- <red> &8- <redLife>
- <yellow> &8- <yellowLife>
- "&7"
- "&a&m&l---------------------------------------------"
setup:
worldCreated: "&aThe world &e<name> &ahas been created."
minSet: "&aMinimum established. At location: &e<world> - <x>, <y>, <z>, <yaw>, <pitch>&a."
maxSet: "&aMaximum established. At location: &e<world> - <x>, <y>, <z>, <yaw>, <pitch>&a."
menus:
team:
title: "&eTeam Selector"
team:
nameItem: "Team <#>"
loreItem:
- "&bPlayers:"
- "&7"
- "<teamPlayers>"
teamFour:
title: "&eTeam Four Selector"
team:
nameItem: "Team Four <#>"
loreItem:
- "&bPlayers:"
- "&7"
- "<teamPlayers>"
options:
title: "Spectator Options"
enable: "&aEnable"
disable: "&cDisable"
velocidad:
nameItem: "&aSpeed <#>"
loreItem: |-
&7Click to change your
&7speed leve <#>.
vision:
nameItem: "<type> Night Vision"
loreItem: |-
&7Click to <type> the
&7night vission.
teleport:
title: "Teleporter"
team:
nameItem: "<color>Team <team>"
loreItem: |-
&7Show the players with
&7life of team.
player:
nameItem: "&7<player>"
loreItem: |-
&7
&eLife: &b<health>
&7
&aClick to teleport!
save:
nameItem: "&aSave Layout"
loreItem: |-
&7Click to save
&7in to default layout
close:
nameItem: "&cClose"
loreItem: |-
&7Click to close
&7this menu.
hotbar:
title: "&8Editor Hotbar - TheBridge"
type:
title: "&aSelect Type - Menu"
normal:
nameItem: "&aGame Normal"
loreItem: |-
&7Click to select
&7normal game menu.
four:
nameItem: "&aGame Four"
loreItem: |-
&7Click to select
&7four game menu.
game:
title: "&aNormal Game Menu"
generalDesc: |-
&7
&ePlayers: &b<players>/<max>
&eMode: &b<mode>
&eState: <state>
&e
&eClick to enter!
gameFour:
title: "&aFour Game Menu"
generalDesc: |-
&7
&ePlayers: &b<players>/<max>
&eMode: &b<mode>
&eState: <state>
&e
&eClick to enter!
items:
leave:
nameItem: "&cLeave &7(Right Click)"
loreItem: |-
&7Click to exit and
&7finish the fun.
teams:
nameItem: "&aTeam Selector &7(Right Click)"
loreItem: |-
&7Click to select computers
&7and play with friends.
spectate:
nameItem: "&aSpect Players &7(Right Click)"
loreItem: |-
&7Click to expect the
&7players per team.
config:
nameItem: "&bSpectator settings &7(Right Click)"
loreItem: |-
&7Set up your way of seeing
&7in game.
titles:
start:
title: <time>
subtitle: <none>
prestart:
title: <none>
subtitle: "&7Open cages in &a<time><s>&7..."
restart:
title: <color><player> scored!
subtitle: "&7Open cages in &a<time><s>&7..."
goalNormal:
title: <color><player> &7scored in <teamStole>&7!
subtitle: <teamOther> &7stole <color>1<heart> &7of &c<teamStole>&7!
goalFinal:
title: <color><player> &7scored in <teamStole>&7!
subtitle: <teamStole> &c&lhas eliminated!
win:
title: <color>&l<team> WIN!
subtitle: "&c&l<redGoals> &7&l- &9&l<blueGoals>"
winFour:
title: <color>&l<team> WIN!
subtitle: <color><life>
scoreboards:
main-title: "&e&lTHE BRIDGE LOBBY"
main: |-
&f
&fName: &a<player>
&f
&fLobby: &a#1
&f
&fOnline: &a<online>/100
&f
&6www.servername.net
lobby-title: "&e&lTHE BRIDGE"
lobby: |-
&f
&fPlayers: &e<players>/<max>
&f
&fMode: &a<mode>
&fMap: &e<map>
&f
&fServer: &e<server>
&f
&6www.servername.net
starting-title: "&e&lTHE BRIDGE"
starting: |-
&f
&fPlayers: &e<players>/<max>
&f
&fStarting in: &e<time><s>
&f
&fMode: &a<mode>
&fMap: &e<map>
&f
&fServer: &e<server>
&f
&6www.servername.net
game-normal-title: "&e&lTHE BRIDGE"
game-normal: |-
&7<date>
&f
&cRed Color Team: &e<redGoals>&7/5
&9Blue Color Team: &e<blueGoals>&7/5
&f
&fKills: &e<kills>
&fGoals: &c<goals>
&f
&fMode: &e<mode>
&fMap: &e<map>
&f
&6www.servername.net
game-four-title: "&e&lTHE BRIDGE"
game-four: |-
&7<date>
&7
<red>&7: <redLife>
<blue>&7: <blueLife>
<yellow>&7: <yellowLife>
<green>&7: <greenLife>
&7
&fKills: &a<kills>
&fGoals: &a<goals>
&7
&fMode: &e<mode>
&fMap: &a<map>
&f
&6mc.servername.net
units:
minutes: minutes
minute: minute
seconds: seconds
prefix: '&6&lTheBridge &7:'
error: '&c&lERROR!'
signs:
normal:
line-1: '&lTheBridge Normal'
line-2: <state>
line-3: 'Map: <name>'
line-4: '&7<players>/<max>'
four:
line-1: '&lTheBridge Four'
line-2: <state>
line-3: 'Map: <name>'
line-4: '&7<players>/<max>'
states:
waiting: '&aWaiting...'
starting: '&eStarting'
pregame: '&cPre-Game'
ingame: '&4In-Game'
finish: '&9Finishing'
restarting: '&5Restarting'
shop:
title: '&aThe Bridge | Shop'
glass:
nameItem: '&aGlass 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
holograms:
your: Your
portal:
you:
- <color>&l<team> Goal
- '&7Defend!'
enemy:
- <color>&l<team> Goal
- '&eJump in to score!'
tops:
normal:
kills:
- '&b&lTop TheBridge Kills'
- '&aNormal mode'
- <top>
wins:
- '&b&lTop TheBridge Winners'
- '&aNormal mode'
- <top>
goals:
- '&b&lTop TheBridge Goal scorers'
- '&aNormal mode'
- <top>
four:
kills:
- '&b&lTop TheBridge Kills'
- '&aFour mode'
- <top>
wins:
- '&b&lTop TheBridge Winners'
- '&aFour mode'
- <top>
goals:
- '&b&lTop TheBridge Goal scorers'
- '&aFour mode'
- <top>
stats:
- '&a%player_name% &6&lThe Bridge &astatistics'
- '&aNormal Kills: &6%bridges_normal_kills%'
- '&aNormal Wins: &6%bridges_normal_wins%'
- '&aNormal Goals: &6%bridges_normal_goals%'
- '&aFour Kills: &6%bridges_four_kills%'
- '&aFour Wins: &6%bridges_four_wins%'
- '&aFour Goals: &6%bridges_four_goals%'
- '&aBlocks Placed: &6%bridges_blocks_placed%'
- '&aBlocks Broken: &6%bridges_blocks_broken%'
- '&aCoins: &6%bridges_coins%'
- '&aXP: &6%bridges_xp%'
deathMessages:
void: <TDColor><death> &7was thrown into the void
damage: <TDColor><death> &7was killed
custom: <TDColor><death> &7was death
player: '&7 by <TKColor><player>&7.'
none: .
messages:
noPermission: '&cYou dont have permissions to run this command.'
noBreak: '&cYou can only break blocks allowed blocks.'
noPlace: '&cYou are not allowed to build here.'
starting: '&eThe game starts in &b<time> &e<units>.'
prestart: '&eCages are opening in &b<time> &e<units>.'
restart: '&eCages are reopening in &b<time> &e<units>.'
alreadyGame: '&cThis player is already in a game.'
noGame: '&cYou are not in any game.'
join: '&7<player> &ehas joined the game &b(&e<players>&b/&e<max>&b)!'
quit: '&7<player> &ehas left the game &b(&e<players>&b/&e<max>&b)!'
eliminated: <color>&l<player> &c&lhas been eliminated.
gameFull: '&cThis game is already full.'
gameAlreadyStart: '&cThis game has already started.'
joinedTeam: '&eYou joined a team <team>&e.'
unbalancedTeam: '&cThat team is full. Try joining another one'
noHaveKit: '&cYou haven''t set up the main kit yet.'
noGames: '&cThere are no free games available.'
hotbarSaved: '&aYour hotbar has been saved.'
noBuy: '&cYou are not allowed to buy this.'
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.'
leftGame: '&cYou left the game.'
noShoot: '&cYou can not shoot the bow yet.'
archiDisabled: '&cAchievements are currently disabled.'
noEnabedGlass: '&cCages are currently not enabled. Please use FastAsyncWorldEdit
to enable them.'
start:
- '&a&m&l---------------------------------------------'
- '&7&f&lThe Bridge'
- '&7'
- '&e&lThe only goal is to enter the portal of the'
- '&e&lAnother team in order to score a goal.'
- '&e&lThe team that bequeath 5 goals first'
- '&e&lwin the game.'
- '&7'
- '&a&m&l---------------------------------------------'
startFour:
- '&a&m&l---------------------------------------------'
- '&7&f&lThe Bridge'
- '&7'
- '&eCross bridges to score goals on enemy teams,'
- '&egoals you steal. Each team starts with &a2<heart> (lifes)&e.'
- '&eScoring &a+1<heart> &efor your computer while allowing you to'
- '&ethose affected lose &c-1<heart> &eof your team.'
- '&7'
- '&eWhen there are 2 teams left, you can not'
- '&eregaining lives! The last team on foot wins!'
- '&7'
- '&a&m&l---------------------------------------------'
goal:
- '&a&m&l---------------------------------------------'
- '&7'
- '&7<color>&l<player> &7(&a<health>&c<heart>&7) &ehas scored! &7(&6<goals> Gol<s>&7)'
- '&7'
- '&7<color>&l<team> GOAL!!'
- '&7&c&l<redGoals> &e&l- &9&l<blueGoals> '
- '&7'
- '&a&m&l---------------------------------------------'
stole:
- '&a&m&l---------------------------------------------'
- '&7'
- <color>&l<player> &7(&a<health>&c<heart>&7) scored &c<teamStole>&7! (&6<goals> Gol<es>&7)
- <teamOther> &7stolen <color>1<heart> &7of <teamStole>&7!
- '&7'
- <green> &8- <greenLife>
- <blue> &8- <blueLife>
- <red> &8- <redLife>
- <yellow> &8- <yellowLife>
- '&7'
- '&a&m&l---------------------------------------------'
final:
- '&a&m&l---------------------------------------------'
- '&7'
- <color>&l<player> &7(&a<health>&c<heart>&7) scored &c<teamStole>&7! (&6<goals> Gol<es>&7)
- <teamStole> &7lost &c-1<heart>&7!
- '&7'
- <green> &8- <greenLife>
- <blue> &8- <blueLife>
- <red> &8- <redLife>
- <yellow> &8- <yellowLife>
- '&7'
- '&a&m&l---------------------------------------------'
win:
- '&a&m&l---------------------------------------------'
- '&7&f&lThe Bridge'
- '&7'
- '&7<color>&l<team> WIN!'
- '&7<color>&l<player> &7(&a<health>&c<heart>&7) &ehas scored! &7(&6<goals> Gol<s>&7)'
- '&7'
- '&c&l<redGoals> &7&l- &9&l<blueGoals>'
- '&7'
- '&a&m&l---------------------------------------------'
winFour:
- '&a&m&l---------------------------------------------'
- '&7&f&lThe Bridge'
- '&7'
- <color>&l<team> WIN!
- <color>&l<player> &7(&a<health>&c<heart>&7) scored &c<teamStole>&7! (&6<goals> Gol<es>&7)
- '&7'
- <green> &8- <greenLife>
- <blue> &8- <blueLife>
- <red> &8- <redLife>
- <yellow> &8- <yellowLife>
- '&7'
- '&a&m&l---------------------------------------------'
setup:
worldCreated: '&aThe world &e<name> &ahas been created.'
minSet: '&aMinimum established. At location: &e<world> - <x>, <y>, <z>, <yaw>, <pitch>&a.'
maxSet: '&aMaximum established. At location: &e<world> - <x>, <y>, <z>, <yaw>, <pitch>&a.'
menus:
team:
title: '&eTeam Selector'
team:
nameItem: Team <#>
loreItem:
- '&bPlayers:'
- '&7'
- <teamPlayers>
teamFour:
title: '&eTeam Four Selector'
team:
nameItem: Team Four <#>
loreItem:
- '&bPlayers:'
- '&7'
- <teamPlayers>
options:
title: Spectator Options
enable: '&aEnable'
disable: '&cDisable'
velocidad:
nameItem: '&aSpeed <#>'
loreItem: |-
&7Click to change your
&7speed leve <#>.
vision:
nameItem: <type> Night Vision
loreItem: |-
&7Click to <type> the
&7night vission.
teleport:
title: Teleporter
team:
nameItem: <color>Team <team>
loreItem: |-
&7Show the players with
&7life of team.
player:
nameItem: '&7<player>'
loreItem: |-
&7
&eLife: &b<health>
&7
&aClick to teleport!
save:
nameItem: '&aSave Layout'
loreItem: |-
&7Click to save
&7in to default layout
close:
nameItem: '&cClose'
loreItem: |-
&7Click to close
&7this menu.
hotbar:
title: '&8Editor Hotbar - TheBridge'
type:
title: '&aSelect Type - Menu'
normal:
nameItem: '&aGame Normal'
loreItem: |-
&7Click to select
&7normal game menu.
four:
nameItem: '&aGame Four'
loreItem: |-
&7Click to select
&7four game menu.
game:
title: '&aNormal Game Menu'
generalDesc: |-
&7
&ePlayers: &b<players>/<max>
&eMode: &b<mode>
&eState: <state>
&e
&eClick to enter!
gameFour:
title: '&aFour Game Menu'
generalDesc: |-
&7
&ePlayers: &b<players>/<max>
&eMode: &b<mode>
&eState: <state>
&e
&eClick to enter!
items:
leave:
nameItem: '&cLeave &7(Right Click)'
loreItem: |-
&7Click to exit and
&7finish the fun.
teams:
nameItem: '&aTeam Selector &7(Right Click)'
loreItem: |-
&7Click to select computers
&7and play with friends.
spectate:
nameItem: '&aSpect Players &7(Right Click)'
loreItem: |-
&7Click to expect the
&7players per team.
config:
nameItem: '&bSpectator settings &7(Right Click)'
loreItem: |-
&7Set up your way of seeing
&7in game.
titles:
start:
title: <time>
subtitle: <none>
prestart:
title: <none>
subtitle: '&7Open cages in &a<time><s>&7...'
restart:
title: <color><player> scored!
subtitle: '&7Open cages in &a<time><s>&7...'
goalNormal:
title: <color><player> &7scored in <teamStole>&7!
subtitle: <teamOther> &7stole <color>1<heart> &7of &c<teamStole>&7!
goalFinal:
title: <color><player> &7scored in <teamStole>&7!
subtitle: <teamStole> &c&lhas eliminated!
win:
title: <color>&l<team> WIN!
subtitle: '&c&l<redGoals> &7&l- &9&l<blueGoals>'
winFour:
title: <color>&l<team> WIN!
subtitle: <color><life>
scoreboards:
main-title: '&e&lTHE BRIDGE LOBBY'
main: |-
&f
&fName: &a<player>
&f
&fLobby: &a#1
&f
&fOnline: &a<online>/100
&f
&6www.servername.net
lobby-title: '&e&lTHE BRIDGE'
lobby: |-
&f
&fPlayers: &e<players>/<max>
&f
&fMode: &a<mode>
&fMap: &e<map>
&f
&fServer: &e<server>
&f
&6www.servername.net
starting-title: '&e&lTHE BRIDGE'
starting: |-
&f
&fPlayers: &e<players>/<max>
&f
&fStarting in: &e<time><s>
&f
&fMode: &a<mode>
&fMap: &e<map>
&f
&fServer: &e<server>
&f
&6www.servername.net
game-normal-title: '&e&lTHE BRIDGE'
game-normal: |-
&7<date>
&f
&cRed Color Team: &e<redGoals>&7/5
&9Blue Color Team: &e<blueGoals>&7/5
&f
&fKills: &e<kills>
&fGoals: &c<goals>
&f
&fMode: &e<mode>
&fMap: &e<map>
&f
&6www.servername.net
game-four-title: '&e&lTHE BRIDGE'
game-four: |-
&7<date>
&7
<red>&7: <redLife>
<blue>&7: <blueLife>
<yellow>&7: <yellowLife>
<green>&7: <greenLife>
&7
&fKills: &a<kills>
&fGoals: &a<goals>
&7
&fMode: &e<mode>
&fMap: &a<map>
&f
&6mc.servername.net
units:
minutes: minutes
minute: minute
seconds: seconds
second: second

37
MultiArena-TheBridge/pom.xml

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>TheBridge</groupId>
<artifactId>TheBridge</artifactId>
<version>2.4.1</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>
<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.6</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<defaultGoal>clean package install</defaultGoal>
<finalName>${project.artifactId}-${project.version}</finalName>
<sourceDirectory>${basedir}/src/</sourceDirectory>
</build>
</project>

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

@ -39,6 +39,7 @@ 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;
@ -50,6 +51,7 @@ 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;
@ -59,404 +61,303 @@ import cx.sfy.TheBridge.menus.TeamMenu;
import cx.sfy.TheBridge.nms.GenericNMS;
import cx.sfy.TheBridge.nms.NMS;
import cx.sfy.TheBridge.packets.PacketMain;
import lombok.Getter;
import lombok.Setter;
public class Main extends JavaPlugin {
private static Main instance;
private PacketMain refl;
private SpectOptionsMenu som;
private SpectPlayerMenu spm;
private TeamMenu tem;
private boolean placeholder;
private TitleManager tm;
private GameManager gm;
private GameMenu gmu;
private WorldController wc;
private Settings lang;
private Settings cages;
private Settings signs;
private Settings sounds;
private Settings achievement;
private NMS nms;
private FileManager fm;
private SetupManager sm;
private GlassManager glm;
private LocationManager lm;
private Location mainLobby;
private Kit kit;
private Database db;
private TopManager top;
private SignManager sim;
private Hotbar hotbar;
private boolean stop;
private ScoreboardManager sb;
private ArchiManager am;
private AchievementsMenu archimenu;
private CageManager cm;
private GlassMenu glam;
private boolean isCage = false;
private boolean archiDisabled = false;
private ShopMenu shop;
private Cosmeticbase cb;
public static Main get() {
return instance;
}
private static Main instance;
@Getter
@Setter
private PacketMain refl;
@Getter
private SpectOptionsMenu som;
@Getter
private SpectPlayerMenu spm;
@Getter
private TeamMenu tem;
@Getter
private boolean placeholder;
@Getter
private TitleManager tm;
@Getter
private GameManager gm;
@Getter
private GameMenu gmu;
@Getter
private ArrowMenu amu;
@Getter
private WorldController wc;
@Getter
private Settings lang;
@Getter
private Settings cages;
@Getter
private Settings signs;
@Getter
private Settings sounds;
@Getter
private Settings achievement;
@Getter
private Settings arrow;
@Getter
private NMS nms;
@Getter
private FileManager fm;
@Getter
private SetupManager sm;
@Getter
private GlassManager glm;
@Getter
private LocationManager lm;
@Getter
private Location mainLobby;
@Getter
private Kit kit;
@Getter
private Database db;
@Getter
private TopManager top;
@Getter
private SignManager sim;
@Getter
private Hotbar hotbar;
@Getter
private boolean stop;
@Getter
private ScoreboardManager sb;
@Getter
private ArchiManager am;
@Getter
private AchievementsMenu archimenu;
@Getter
private CageManager cm;
@Getter
private ArrowManager arm;
@Getter
private GlassMenu glam;
@Getter
private boolean isCage = false;
@Getter
private boolean archiDisabled = false;
@Getter
private ShopMenu shop;
@Getter
private Cosmeticbase cb;
public static Main get() {
return instance;
}
@Override
public void onEnable() {
refl = new PacketMain(this);
instance = this;
stop = false;
getConfig().options().copyDefaults(true);
saveConfig();
File s = new File(getDataFolder() + "/cages");
if (!s.exists()) {
public void onEnable() {
refl = new PacketMain(this);
instance = this;
stop = false;
getConfig().options().copyDefaults(true);
saveConfig();
File s = new File(getDataFolder() + "/cages");
if (!s.exists()) {
s.mkdirs();
}
saveResources();
lang = new Settings(this, "lang");
signs = new Settings(this, "signs");
cages = new Settings(this, "cages");
sounds = new Settings(this, "sounds");
achievement = new Settings(this, "achievement");
if (getServer().getPluginManager().isPluginEnabled("FastAsyncWorldEdit")) {
if (!getConfig().getBoolean("cages")) {
Bukkit.getServer().getConsoleSender().sendMessage(ChatColor.GREEN + "You have " + ChatColor.RED + "FAWE installed." + ChatColor.GREEN + "Cage System Enabled");
} else {
cm = new CageManager(this);
isCage = true;
}
} else {
if (getConfig().getBoolean("cages")) {
Bukkit.getServer().getConsoleSender().sendMessage(ChatColor.RED + "You don't have " + ChatColor.YELLOW + "FAWE installed." + ChatColor.RED + "Cage System Disabled");
isCage = false;
}
}
archiDisabled = getConfig().getBoolean("archievements.disable");
if (getServer().getPluginManager().isPluginEnabled("PlaceholderAPI")) {
placeholder = true;
new PlaceholderHook(this).register();
}
loadNMS();
File a = new File(getDataFolder() + "/arenas");
if (!a.exists()) {
saveResources();
lang = new Settings(this, "lang");
signs = new Settings(this, "signs");
cages = new Settings(this, "cages");
sounds = new Settings(this, "sounds");
achievement = new Settings(this, "achievement");
arrow = new Settings(this, "trails");
if (getServer().getPluginManager().isPluginEnabled("FastAsyncWorldEdit")) {
if (!getConfig().getBoolean("cages")) {
Bukkit.getServer().getConsoleSender().sendMessage(ChatColor.GREEN + "You have " + ChatColor.RED
+ "FAWE installed." + ChatColor.GREEN + "Cage System Enabled");
} else {
cm = new CageManager(this);
isCage = true;
}
} else {
if (getConfig().getBoolean("cages")) {
Bukkit.getServer().getConsoleSender().sendMessage(ChatColor.RED + "You don't have " + ChatColor.YELLOW
+ "FAWE installed." + ChatColor.RED + "Cage System Disabled");
isCage = false;
}
}
archiDisabled = getConfig().getBoolean("archievements.disable");
if (getServer().getPluginManager().isPluginEnabled("PlaceholderAPI")) {
placeholder = true;
new PlaceholderHook(this).register();
}
loadNMS();
File a = new File(getDataFolder() + "/arenas");
if (!a.exists()) {
a.mkdirs();
}
File a1 = new File(getDataFolder() + "/maps");
if (!a1.exists()) {
File a1 = new File(getDataFolder() + "/maps");
if (!a1.exists()) {
a1.mkdirs();
}
db = new Database(this);
cb = new Cosmeticbase(this);
kit = new Kit();
lm = new LocationManager(this);
fm = new FileManager(this);
wc = new WorldController(this);
tm = new TitleManager(this);
sim = new SignManager(this);
gm = new GameManager(this);
gmu = new GameMenu(this);
sm = new SetupManager(this);
glm = new GlassManager();
top = new TopManager(this);
tem = new TeamMenu(this);
som = new SpectOptionsMenu(this);
spm = new SpectPlayerMenu(this);
hotbar = new Hotbar(this);
sb = new ScoreboardManager(this);
am = new ArchiManager(this);
archimenu = new AchievementsMenu(this);
glam = new GlassMenu(this);
shop = new ShopMenu(this);
lm.reloadLocations();
top.updateTops();
if (getConfig().getString("mainLobby") == null) {
Bukkit.getConsoleSender().sendMessage(ChatColor.RED + "The main lobby hasn't been set up. Please use " + ChatColor.YELLOW + "/bridges setmainlobby");
} else {
mainLobby = getStringLocation(getConfig().getString("mainLobby"));
}
getCommand("bridges").setExecutor(new SetupCMD(this));
Bukkit.getServer().getPluginManager().registerEvents(new SetupListener(this), this);
Bukkit.getServer().getPluginManager().registerEvents(new PlayerListener(this), this);
Bukkit.getServer().getPluginManager().registerEvents(new SpectatorListener(this), this);
new BukkitRunnable() {
@Override
public void run() {
top.updateTops();
}
}.runTaskTimer(this, 6000, 6000);
new BukkitRunnable() {
@Override
public void run() {
for (GameDuo game : getGM().getGames()) {
if (game.isState(State.WAITING) || game.isState(State.STARTING) || game.isState(State.PREGAME)) {
game.updateGame();
}
}
for (GameFour game : getGM().getGamesFour()) {
if (game.isState(FState.WAITING) || game.isState(FState.STARTING) || game.isState(FState.PREGAME)) {
game.updateGame();
}
}
}
}.runTaskTimer(this, 20, 20);
if (getServer().getPluginManager().isPluginEnabled("LeaderHeads")) {
new TheBridgeNormalKills();
new TheBridgeNormalWins();
new TheBridgeNormalGoals();
new TheBridgeFourKills();
new TheBridgeFourWins();
new TheBridgeFourGoals();
}
}
db = new Database(this);
cb = new Cosmeticbase(this);
kit = new Kit();
lm = new LocationManager(this);
fm = new FileManager(this);
wc = new WorldController(this);
tm = new TitleManager(this);
sim = new SignManager(this);
gm = new GameManager(this);
gmu = new GameMenu(this);
amu = new ArrowMenu(this);
sm = new SetupManager(this);
glm = new GlassManager();
arm = new ArrowManager(this);
top = new TopManager(this);
tem = new TeamMenu(this);
som = new SpectOptionsMenu(this);
spm = new SpectPlayerMenu(this);
hotbar = new Hotbar(this);
sb = new ScoreboardManager(this);
am = new ArchiManager(this);
archimenu = new AchievementsMenu(this);
glam = new GlassMenu(this);
shop = new ShopMenu(this);
@Override
public void onDisable() {
stop = true;
getTOP().removeHolo();
getServer().getScheduler().cancelTasks(this);
for (InventoryData inv : InventoryData.getInventoryData().values()) {
inv.restore();
}
for (GameFour gamef : getGM().getGamesFour()) {
for (PlayerData pd : gamef.getPD().values()) {
pd.restore();
}
}
for (GameDuo gamef : getGM().getGames()) {
for (PlayerData pd : gamef.getPD().values()) {
pd.restore();
}
}
for (Player on : Bukkit.getOnlinePlayers()) {
getDB().saveData(PlayerStat.getPlayerStat(on));
getCB().saveData(PlayerStat.getPlayerStat(on));
}
}
public boolean isArchiDisabled() {
return archiDisabled;
}
public Settings getSounds() {
return sounds;
}
public Cosmeticbase getCB() {
return cb;
}
public boolean isCage() {
return isCage;
}
public ShopMenu getShop() {
return shop;
}
public GlassMenu getGLAM() {
return glam;
}
public CageManager getCM() {
return cm;
}
public boolean isStop() {
return stop;
}
public AchievementsMenu getArchiMenu() {
return archimenu;
}
public ArchiManager getAM() {
return am;
}
public Hotbar getHotbar() {
return hotbar;
}
public ScoreboardManager getSB() {
return sb;
}
public SpectPlayerMenu getSPM() {
return spm;
}
public SpectOptionsMenu getSOM() {
return som;
}
public TeamMenu getTEM() {
return tem;
}
public void loadNMS() {
// Replaced with reflection.
nms = new GenericNMS();
lm.reloadLocations();
top.updateTops();
if (getConfig().getString("mainLobby") == null) {
Bukkit.getConsoleSender().sendMessage(ChatColor.RED + "The main lobby hasn't been set up. Please use "
+ ChatColor.YELLOW + "/bridges setmainlobby");
} else {
mainLobby = getStringLocation(getConfig().getString("mainLobby"));
}
getCommand("bridges").setExecutor(new SetupCMD(this));
Bukkit.getServer().getPluginManager().registerEvents(new SetupListener(this), this);
Bukkit.getServer().getPluginManager().registerEvents(new PlayerListener(this), this);
Bukkit.getServer().getPluginManager().registerEvents(new SpectatorListener(this), this);
new BukkitRunnable() {
@Override
public void run() {
top.updateTops();
}
}.runTaskTimer(this, 6000, 6000);
new BukkitRunnable() {
@Override
public void run() {
for (GameDuo game : getGm().getGames()) {
if (game.isState(State.WAITING) || game.isState(State.STARTING) || game.isState(State.PREGAME)) {
game.updateGame();
}
}
for (GameFour game : getGm().getGamesFour()) {
if (game.isState(FState.WAITING) || game.isState(FState.STARTING) || game.isState(FState.PREGAME)) {
game.updateGame();
}
}
}
}.runTaskTimer(this, 20, 20);
if (getServer().getPluginManager().isPluginEnabled("LeaderHeads")) {
new TheBridgeNormalKills();
new TheBridgeNormalWins();
new TheBridgeNormalGoals();
new TheBridgeFourKills();
new TheBridgeFourWins();
new TheBridgeFourGoals();
}
}
public void saveResources() {
saveResource("clear.schematic", false);
saveResource("normal-red.schematic", false);
saveResource("normal-blue.schematic", false);
saveResource("normal-green.schematic", false);
saveResource("normal-yellow.schematic", false);
File cage = new File(getDataFolder(), "cages");
File c = new File(getDataFolder(), "clear.schematic");
File r = new File(getDataFolder(), "normal-red.schematic");
File b = new File(getDataFolder(), "normal-blue.schematic");
File g = new File(getDataFolder(), "normal-green.schematic");
File y = new File(getDataFolder(), "normal-yellow.schematic");
copyFiles(c, new File(cage, "clear.schematic"));
copyFiles(r, new File(cage, "normal-red.schematic"));
copyFiles(b, new File(cage, "normal-blue.schematic"));
copyFiles(g, new File(cage, "normal-green.schematic"));
copyFiles(y, new File(cage, "normal-yellow.schematic"));
c.delete();
r.delete();
g.delete();
b.delete();
y.delete();
}
public void copyFiles(File file, File file2) {
try {
if (!new ArrayList<String>(Arrays.asList("uid.dat", "session.dat")).contains(file.getName())) {
if (file.isDirectory()) {
if (!file2.exists()) {
file2.mkdirs();
}
String[] list;
for (int length = (list = file.list()).length, i = 0; i < length; ++i) {
String s = list[i];
copyFiles(new File(file, s), new File(file2, s));
}
}
else {
FileOutputStream fileOutputStream;
try (FileInputStream fileInputStream = new FileInputStream(file)) {
fileOutputStream = new FileOutputStream(file2);
byte[] array = new byte[1024];
int read;
while ((read = fileInputStream.read(array)) > 0) {
fileOutputStream.write(array, 0, read);
}
}
fileOutputStream.close();
}
}
}
catch (IOException ex) {}
}
/*public boolean isOnePointNine() {
return onepointnine;
}*/
public SignManager getSIM() {
return sim;
}
public Settings getSigns() {
return signs;
}
public TopManager getTOP() {
return top;
}
public Kit getKit() {
return kit;
}
public void reloadMainLobby() {
mainLobby = getStringLocation(getConfig().getString("mainLobby"));
}
public Database getDB() {
return db;
}
public LocationManager getLM() {
return lm;
}
public Location getMainLobby() {
return mainLobby;
}
public GlassManager getGLM() {
return glm;
}
public FileManager getFM() {
return fm;
}
public SetupManager getSM() {
return sm;
}
public WorldController getWC() {
return wc;
}
public NMS getNMS() {
return nms;
}
public GameMenu getGMU() {
return gmu;
}
public GameManager getGM() {
return gm;
}
public TitleManager getTM() {
return tm;
}
public Settings getAchievement() {
return achievement;
}
public Settings getLang() {
return lang;
}
@Override
public void onDisable() {
stop = true;
getTop().removeHolo();
for (InventoryData inv : InventoryData.getInventoryData().values()) {
inv.restore();
}
for (GameFour gamef : getGm().getGamesFour()) {
for (PlayerData pd : gamef.getPD().values()) {
pd.restore();
}
}
for (GameDuo gamef : getGm().getGames()) {
for (PlayerData pd : gamef.getPD().values()) {
pd.restore();
}
}
for (Player on : Bukkit.getOnlinePlayers()) {
getDb().saveData(PlayerStat.getPlayerStat(on));
getCb().saveData(PlayerStat.getPlayerStat(on));
}
getServer().getScheduler().cancelTasks(this);
}
public Settings getCages() {
return cages;
}
public boolean getPlaceholder() {
return placeholder;
}
public void loadNMS() {
nms = new GenericNMS();
}
public Location getStringLocation(String location) {
String[] l = location.split(";");
World world = Bukkit.getWorld(l[0]);
double x = Double.parseDouble(l[1]);
double y = Double.parseDouble(l[2]);
double z = Double.parseDouble(l[3]);
float yaw = Float.parseFloat(l[4]);
float pitch = Float.parseFloat(l[5]);
return new Location(world, x, y, z, yaw, pitch);
}
public void saveResources() {
saveResource("clear.schematic", false);
saveResource("normal-red.schematic", false);
saveResource("normal-blue.schematic", false);
saveResource("normal-green.schematic", false);
saveResource("normal-yellow.schematic", false);
File cage = new File(getDataFolder(), "cages");
File c = new File(getDataFolder(), "clear.schematic");
File r = new File(getDataFolder(), "normal-red.schematic");
File b = new File(getDataFolder(), "normal-blue.schematic");
File g = new File(getDataFolder(), "normal-green.schematic");
File y = new File(getDataFolder(), "normal-yellow.schematic");
copyFiles(c, new File(cage, "clear.schematic"));
copyFiles(r, new File(cage, "normal-red.schematic"));
copyFiles(b, new File(cage, "normal-blue.schematic"));
copyFiles(g, new File(cage, "normal-green.schematic"));
copyFiles(y, new File(cage, "normal-yellow.schematic"));
c.delete();
r.delete();
g.delete();
b.delete();
y.delete();
}
public void copyFiles(File file, File file2) {
try {
if (!new ArrayList<String>(Arrays.asList("uid.dat", "session.dat")).contains(file.getName())) {
if (file.isDirectory()) {
if (!file2.exists()) {
file2.mkdirs();
}
String[] list;
for (int length = (list = file.list()).length, i = 0; i < length; ++i) {
String s = list[i];
copyFiles(new File(file, s), new File(file2, s));
}
} else {
FileOutputStream fileOutputStream;
try (FileInputStream fileInputStream = new FileInputStream(file)) {
fileOutputStream = new FileOutputStream(file2);
byte[] array = new byte[1024];
int read;
while ((read = fileInputStream.read(array)) > 0) {
fileOutputStream.write(array, 0, read);
}
}
fileOutputStream.close();
}
}
} catch (IOException ex) {
}
}
public PacketMain getRefl() {
return refl;
public void reloadMainLobby() {
mainLobby = getStringLocation(getConfig().getString("mainLobby"));
}
public void setRefl(PacketMain refl) {
this.refl = refl;
public Location getStringLocation(String location) {
String[] l = location.split(";");
World world = Bukkit.getWorld(l[0]);
double x = Double.parseDouble(l[1]);
double y = Double.parseDouble(l[2]);
double z = Double.parseDouble(l[3]);
float yaw = Float.parseFloat(l[4]);
float pitch = Float.parseFloat(l[5]);
return new Location(world, x, y, z, yaw, pitch);
}
}

169
MultiArena-TheBridge/src/cx/sfy/TheBridge/Settings.java

@ -15,88 +15,89 @@ import java.util.List;
public class Settings {
private FileConfiguration config;
private File file;
private Main u;
public Settings(Main u, String s) {
this.u = u;
this.file = new File(this.u.getDataFolder(), s + ".yml");
this.config = YamlConfiguration.loadConfiguration(this.file);
Reader reader = new InputStreamReader(u.getResource(String.valueOf(String.valueOf(String.valueOf(s))) + ".yml"));
YamlConfiguration loadConfiguration = YamlConfiguration.loadConfiguration(reader);
try {
if (!this.file.exists()) {
this.config.addDefaults((Configuration) loadConfiguration);
this.config.options().copyDefaults(true);
this.config.save(this.file);
} else {
this.config.addDefaults((Configuration) loadConfiguration);
this.config.options().copyDefaults(true);
this.config.save(this.file);
this.config.load(this.file);
}
} catch (IOException | InvalidConfigurationException ex) {
}
}
protected void sDefault(String s, String s2) {
if (!this.config.contains(s)) {
this.config.set(s, (Object) s2);
this.save();
}
}
public void save() {
try {
this.config.save(this.file);
} catch (IOException ex) {
}
}
public FileConfiguration getConfig() {
return this.config;
}
protected File getFile() {
return this.file;
}
public String get(String s) {
return this.config.getString(s).replaceAll("&", "§");
}
public String get(Player p, String s) {
if (u.getPlaceholder()) {
return PlaceholderAPI.setPlaceholders(p, config.getString(s).replaceAll("&", "§"));
}
return config.getString(s).replaceAll("&", "§");
}
public int getInt(String s) {
return this.config.getInt(s);
}
public List<String> getList(String s) {
return (List<String>) this.config.getStringList(s);
}
public List<String> getList(Player p, String s) {
if (u.getPlaceholder()) {
return PlaceholderAPI.setPlaceholders(p, (List<String>) config.getStringList(s));
}
return (List<String>) config.getStringList(s);
}
public boolean isSet(String s) {
return this.config.isSet(s);
}
public void set(String s, Object o) {
this.config.set(s, o);
}
public boolean getBoolean(String s) {
return this.config.getBoolean(s);
}
private FileConfiguration config;
private File file;
private Main u;
public Settings(Main u, String s) {
this.u = u;
this.file = new File(this.u.getDataFolder(), s + ".yml");
this.config = YamlConfiguration.loadConfiguration(this.file);
Reader reader = new InputStreamReader(
u.getResource(String.valueOf(String.valueOf(String.valueOf(s))) + ".yml"));
YamlConfiguration loadConfiguration = YamlConfiguration.loadConfiguration(reader);
try {
if (!this.file.exists()) {
this.config.addDefaults((Configuration) loadConfiguration);
this.config.options().copyDefaults(true);
this.config.save(this.file);
} else {
this.config.addDefaults((Configuration) loadConfiguration);
this.config.options().copyDefaults(true);
this.config.save(this.file);
this.config.load(this.file);
}
} catch (IOException | InvalidConfigurationException ex) {
}
}
protected void sDefault(String s, String s2) {
if (!this.config.contains(s)) {
this.config.set(s, (Object) s2);
this.save();
}
}
public void save() {
try {
this.config.save(this.file);
} catch (IOException ex) {
}
}
public FileConfiguration getConfig() {
return this.config;
}
protected File getFile() {
return this.file;
}
public String get(String s) {
return this.config.getString(s).replaceAll("&", "§");
}
public String get(Player p, String s) {
if (u.isPlaceholder()) {
return PlaceholderAPI.setPlaceholders(p, config.getString(s).replaceAll("&", "§"));
}
return config.getString(s).replaceAll("&", "§");
}
public int getInt(String s) {
return this.config.getInt(s);
}
public List<String> getList(String s) {
return (List<String>) this.config.getStringList(s);
}
public List<String> getList(Player p, String s) {
if (u.isPlaceholder()) {
return PlaceholderAPI.setPlaceholders(p, (List<String>) config.getStringList(s));
}
return (List<String>) config.getStringList(s);
}
public boolean isSet(String s) {
return this.config.isSet(s);
}
public void set(String s, Object o) {
this.config.set(s, o);
}
public boolean getBoolean(String s) {
return this.config.getBoolean(s);
}
}

2
MultiArena-TheBridge/src/cx/sfy/TheBridge/archievements/Archi.java

@ -49,7 +49,7 @@ public class Archi {
ps.addXP(xp);
p.playSound(p.getLocation(), Sound.valueOf(plugin.getSounds().get("sounds.archievement.reward")), 1.0f, 1.0f);
for (String msg : message) {
p.sendMessage(msg.replaceAll("&", "§"));
p.sendMessage(msg.replaceAll("&", "§"));
}
}

1844
MultiArena-TheBridge/src/cx/sfy/TheBridge/cmds/SetupCMD.java

File diff suppressed because it is too large

4
MultiArena-TheBridge/src/cx/sfy/TheBridge/controllers/WorldController.java

@ -79,7 +79,7 @@ public class WorldController {
final WorldCreator worldCreator = new WorldCreator(worldName);
worldCreator.environment(environment);
worldCreator.generateStructures(false);
worldCreator.generator(plugin.getNMS().getChunkGenerator());
worldCreator.generator(plugin.getNms().getChunkGenerator());
final World world = worldCreator.createWorld();
world.setDifficulty(Difficulty.NORMAL);
world.setSpawnFlags(true, true);
@ -116,7 +116,7 @@ public class WorldController {
copyFileStructure(originalWorld, new File(Bukkit.getWorldContainer(), newWorldName));
final WorldCreator worldc = new WorldCreator(newWorldName);
worldc.generateStructures(false);
worldc.generator(plugin.getNMS().getChunkGenerator());
worldc.generator(plugin.getNms().getChunkGenerator());
worldc.createWorld();
final World world = Bukkit.getWorld(newWorldName);
world.setTime(500);

110
MultiArena-TheBridge/src/cx/sfy/TheBridge/cosmetics/Arrow.java

@ -1,5 +1,115 @@
package cx.sfy.TheBridge.cosmetics;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import cx.sfy.TheBridge.Main;
import lombok.Getter;
public class Arrow {
Main plugin;
private ItemStack icon;
@Getter
private String id;
@Getter
private String name;
@Getter
private String permission;
@Getter
private String trail;
@Getter
private ArrayList<String> lore;
@Getter
private int price;
@Getter
private int slot;
@Getter
private boolean isBuy;
public Arrow(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.lore = new ArrayList<String>();
for (String l : plugin.getArrow().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");
}
public ItemStack getHasIcon() {
ItemStack perm = icon;
ItemMeta permM = perm.getItemMeta();
List<String> nLore = new ArrayList<String>();
;
for (String msg : plugin.getArrow().getList("unlocked")) {
if (msg.contains("<description>")) {
for (String l : lore) {
nLore.add(l);
}
} else {
nLore.add(msg.replaceAll("&", "§").replaceAll("<price>", String.valueOf(price)));
}
}
permM.setLore(nLore);
permM.setDisplayName("§a" + name);
perm.setItemMeta(permM);
return perm;
}
public ItemStack getPermIcon() {
ItemStack perm = icon;
ItemMeta permM = perm.getItemMeta();
List<String> nLore = new ArrayList<String>();
;
for (String msg : plugin.getArrow().getList("noPerm")) {
if (msg.contains("<description>")) {
for (String l : lore) {
nLore.add(l);
}
} else {
nLore.add(msg.replaceAll("&", "§").replaceAll("<price>", String.valueOf(price)));
}
}
permM.setLore(nLore);
permM.setDisplayName("§c" + name);
perm.setItemMeta(permM);
return perm;
}
public ItemStack getBuyIcon() {
ItemStack perm = icon;
ItemMeta permM = perm.getItemMeta();
List<String> nLore = new ArrayList<String>();
;
for (String msg : plugin.getArrow().getList("locked")) {
if (msg.contains("<description>")) {
for (String l : lore) {
nLore.add(l);
}
} else {
nLore.add(msg.replaceAll("&", "§").replaceAll("<price>", String.valueOf(price)));
}
}
permM.setLore(nLore);
permM.setDisplayName("§c" + name);
perm.setItemMeta(permM);
return perm;
}
public ItemStack getNormalIcon() {
return icon;
}
}

14
MultiArena-TheBridge/src/cx/sfy/TheBridge/cosmetics/Cage.java

@ -32,7 +32,7 @@ public class Cage {
this.icon = new ItemStack(Material.valueOf(plugin.getCages().get(path + ".icon")), plugin.getCages().getInt(path + ".amount"), (short)plugin.getCages().getInt(path + ".data"));
this.lore = new ArrayList<String>();
for (String l : plugin.getCages().getList(path + ".description")) {
lore.add(l.replaceAll("&", "§"));
lore.add(l.replaceAll("&", "§"));
}
this.filered = new File(plugin.getDataFolder(), "cages/" + plugin.getCages().get(path + ".files.red"));
this.fileblue = new File(plugin.getDataFolder(), "cages/" + plugin.getCages().get(path + ".files.blue"));
@ -81,11 +81,11 @@ public class Cage {
nLore.add(l);
}
} else {
nLore.add(msg.replaceAll("&", "§").replaceAll("<price>", String.valueOf(price)));
nLore.add(msg.replaceAll("&", "§").replaceAll("<price>", String.valueOf(price)));
}
}
permM.setLore(nLore);
permM.setDisplayName("§a" + name);
permM.setDisplayName("§a" + name);
perm.setItemMeta(permM);
return perm;
}
@ -100,11 +100,11 @@ public class Cage {
nLore.add(l);
}
} else {
nLore.add(msg.replaceAll("&", "§").replaceAll("<price>", String.valueOf(price)));
nLore.add(msg.replaceAll("&", "§").replaceAll("<price>", String.valueOf(price)));
}
}
permM.setLore(nLore);
permM.setDisplayName("§c" + name);
permM.setDisplayName("§c" + name);
perm.setItemMeta(permM);
return perm;
}
@ -119,11 +119,11 @@ public class Cage {
nLore.add(l);
}
} else {
nLore.add(msg.replaceAll("&", "§").replaceAll("<price>", String.valueOf(price)));
nLore.add(msg.replaceAll("&", "§").replaceAll("<price>", String.valueOf(price)));
}
}
permM.setLore(nLore);
permM.setDisplayName("§c" + name);
permM.setDisplayName("§c" + name);
perm.setItemMeta(permM);
return perm;
}

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

@ -21,235 +21,242 @@ public class Cosmeticbase {
public Main plugin;
private Connection connection;
public Cosmeticbase(Main plugin) {
this.plugin = plugin;
conectar();
}
public Cosmeticbase(Main plugin) {
this.plugin = plugin;
conectar();
}
public void conectar() {
if (plugin.getConfig().getBoolean("MySQL.enabled")){
try {
Class.forName("com.mysql.jdbc.Driver");
connection = DriverManager.getConnection("jdbc:mysql://" + (plugin.getConfig().getString("MySQL.host") +":"+ plugin.getConfig().getString("MySQL.port")) + "/" + plugin.getConfig().getString("MySQL.database") + "?serverTimezone=" + TimeZone.getDefault().getID() + "&autoReconnect=true&wait_timeout=31536000&interactive_timeout=31536000", plugin.getConfig().getString("MySQL.username"), plugin.getConfig().getString("MySQL.password"));
Bukkit.getConsoleSender().sendMessage(ChatColor.GREEN + "[TheBridge] MySQL connected.");
newTables();
} catch (Exception e) {
e.printStackTrace();
}
} else {
File DataFile = new File(plugin.getDataFolder(), "/TheBridge.db");
if (!DataFile.exists()) {
try {
DataFile.createNewFile();
} catch (IOException ex) {
ex.printStackTrace();
Bukkit.getPluginManager().disablePlugin(plugin);
}
}
try {
Class.forName("org.sqlite.JDBC");
try {
connection = DriverManager.getConnection("jdbc:sqlite:" + DataFile);
Bukkit.getConsoleSender().sendMessage(ChatColor.GREEN + "[TheBridge] SQLLite connected.");
newTables();
} catch (SQLException ex2) {
ex2.printStackTrace();
Bukkit.getPluginManager().disablePlugin(plugin);
}
} catch (ClassNotFoundException ex3) {
ex3.printStackTrace();
Bukkit.getPluginManager().disablePlugin(plugin);
}
}
if (plugin.getConfig().getBoolean("MySQL.enabled")) {
try {
Class.forName("com.mysql.jdbc.Driver");
connection = DriverManager.getConnection(
"jdbc:mysql://"
+ (plugin.getConfig().getString("MySQL.host") + ":"
+ plugin.getConfig().getString("MySQL.port"))
+ "/" + plugin.getConfig().getString("MySQL.database") + "?serverTimezone="
+ TimeZone.getDefault().getID()
+ "&autoReconnect=true&wait_timeout=31536000&interactive_timeout=31536000",
plugin.getConfig().getString("MySQL.username"), plugin.getConfig().getString("MySQL.password"));
Bukkit.getConsoleSender().sendMessage(ChatColor.GREEN + "[TheBridge] MySQL connected.");
newTables();
} catch (Exception e) {
e.printStackTrace();
}
} else {
File DataFile = new File(plugin.getDataFolder(), "/TheBridge.db");
if (!DataFile.exists()) {
try {
DataFile.createNewFile();
} catch (IOException ex) {
ex.printStackTrace();
Bukkit.getPluginManager().disablePlugin(plugin);
}
}
try {
Class.forName("org.sqlite.JDBC");
try {
connection = DriverManager.getConnection("jdbc:sqlite:" + DataFile);
Bukkit.getConsoleSender().sendMessage(ChatColor.GREEN + "[TheBridge] SQLLite connected.");
newTables();
} catch (SQLException ex2) {
ex2.printStackTrace();
Bukkit.getPluginManager().disablePlugin(plugin);
}
} catch (ClassNotFoundException ex3) {
ex3.printStackTrace();
Bukkit.getPluginManager().disablePlugin(plugin);
}
}
}
public void checkConnection() {
try {
if (connection.isClosed() || connection == null){
try {
if (connection.isClosed() || connection == null) {
conectar();
}
} catch (SQLException e) {
e.printStackTrace();
}
}
public void createNewPlayer(String fId, String name) {
PreparedStatement preparedStatement = null;
try {
StringBuilder queryBuilder = new StringBuilder();
queryBuilder.append("INSERT INTO `BG_Cosmetic` ");
queryBuilder.append("(`UUID`, `Name`, `Cage`, `Taunt`, `Trail`, `KillSound`) ");
queryBuilder.append("VALUES ");
queryBuilder.append("(?, ?, ?, ?, ?, ?);");
preparedStatement = connection.prepareStatement(queryBuilder.toString());
preparedStatement.setString(1, fId);
preparedStatement.setString(2, name);
preparedStatement.setString(3, "default");
preparedStatement.setString(4, "default");
preparedStatement.setString(5, "default");
preparedStatement.setString(6, "default");
preparedStatement.executeUpdate();
} catch (final SQLException sqlException) {
sqlException.printStackTrace();
} finally {
if (preparedStatement != null) {
try {
preparedStatement.close();
} catch (final SQLException ignored) {
}
}
}
}
public void createNewPlayer(String fId, String name) {
PreparedStatement preparedStatement = null;
try {
StringBuilder queryBuilder = new StringBuilder();
queryBuilder.append("INSERT INTO `BG_Cosmetic` ");
queryBuilder.append("(`UUID`, `Name`, `Cage`, `Taunt`, `Trail`, `KillSound`) ");
queryBuilder.append("VALUES ");
queryBuilder.append("(?, ?, ?, ?, ?, ?);");
preparedStatement = connection.prepareStatement(queryBuilder.toString());
preparedStatement.setString(1, fId);
preparedStatement.setString(2, name);
preparedStatement.setString(3, "default");
preparedStatement.setString(4, "default");
preparedStatement.setString(5, "default");
preparedStatement.setString(6, "default");
preparedStatement.executeUpdate();
} catch (final SQLException sqlException) {
sqlException.printStackTrace();
} finally {
if (preparedStatement != null) {
try {
preparedStatement.close();
} catch (final SQLException ignored) {
}
}
}
}
public boolean hasPlayer(Player p, String uuid) {
PreparedStatement statement = null;
try {
statement = this.connection.prepareStatement("SELECT UUID FROM BG_Cosmetic WHERE UUID ='" + uuid + "'");
ResultSet result = statement.executeQuery();
if (result.next()) {
return true;
}
} catch (SQLException e) {
e.printStackTrace();
if (statement != null) {
try {
statement.close();
}
catch (SQLException e2) {
e2.printStackTrace();
}
return false;
}
return false;
} finally {
if (statement != null) {
try {
statement.close();
}
catch (SQLException e2) {
e2.printStackTrace();
}
}
}
if (statement != null) {
try {
statement.close();
}
catch (SQLException e2) {
e2.printStackTrace();
}
}
return false;
}
public void loadData(PlayerStat stat) {
new BukkitRunnable() {
PreparedStatement statement = null;
try {
statement = this.connection.prepareStatement("SELECT UUID FROM BG_Cosmetic WHERE UUID ='" + uuid + "'");
ResultSet result = statement.executeQuery();
if (result.next()) {
return true;
}
} catch (SQLException e) {
e.printStackTrace();
if (statement != null) {
try {
statement.close();
} catch (SQLException e2) {
e2.printStackTrace();
}
return false;
}
return false;
} finally {
if (statement != null) {
try {
statement.close();
} catch (SQLException e2) {
e2.printStackTrace();
}
}
}
if (statement != null) {
try {
statement.close();
} catch (SQLException e2) {
e2.printStackTrace();
}
}
return false;
}
public void loadData(PlayerStat stat) {
new BukkitRunnable() {
@Override
public void run() {
Connection connection = getConnection();
if (!hasPlayer(stat.getPlayer(), stat.getUUID())) {
createNewPlayer(stat.getUUID(), stat.getPlayer().getName());
loadData(stat);
return;
}
PreparedStatement preparedStatement = null;
ResultSet resultSet = null;
try {
StringBuilder queryBuilder = new StringBuilder();
queryBuilder.append("SELECT `Cage`, `Taunt`, `Trail`, `KillSound` ");
queryBuilder.append("FROM `BG_Cosmetic` ");
queryBuilder.append("WHERE `UUID` = ? ");
queryBuilder.append("LIMIT 1;");
preparedStatement = connection.prepareStatement(queryBuilder.toString());
preparedStatement.setString(1, stat.getUUID().toString());
resultSet = preparedStatement.executeQuery();
if (resultSet != null && resultSet.next()) {
public void run() {
Connection connection = getConnection();
if (!hasPlayer(stat.getPlayer(), stat.getUUID())) {
createNewPlayer(stat.getUUID(), stat.getPlayer().getName());
loadData(stat);
return;
}
PreparedStatement preparedStatement = null;
ResultSet resultSet = null;
try {
StringBuilder queryBuilder = new StringBuilder();
queryBuilder.append("SELECT `Cage`, `Taunt`, `Trail`, `KillSound` ");
queryBuilder.append("FROM `BG_Cosmetic` ");
queryBuilder.append("WHERE `UUID` = ? ");
queryBuilder.append("LIMIT 1;");
preparedStatement = connection.prepareStatement(queryBuilder.toString());
preparedStatement.setString(1, stat.getUUID().toString());
resultSet = preparedStatement.executeQuery();
if (resultSet != null && resultSet.next()) {
stat.setCage(resultSet.getString("Cage"));
}
} catch (SQLException sqlException) {
sqlException.printStackTrace();
} finally {
if (resultSet != null) {
try {
resultSet.close();
} catch (SQLException ignored) {
}
}
if (preparedStatement != null) {
try {
preparedStatement.close();
} catch (SQLException ignored) {
}
}
}
}
}.runTaskAsynchronously(plugin);
}
public void saveData(PlayerStat stat) {
checkConnection();
Connection connection = getConnection();
PreparedStatement preparedStatement = null;
try {
StringBuilder queryBuilder = new StringBuilder();
queryBuilder.append("UPDATE `BG_Cosmetic` SET ");
queryBuilder.append("`Cage` = ?, `Taunt` = ?, `Trail` = ?, `KillSound` = ? ");
queryBuilder.append("WHERE `UUID` = ?;");
preparedStatement = connection.prepareStatement(queryBuilder.toString());
preparedStatement.setString(1, stat.getCage());
preparedStatement.setString(2, "default");
preparedStatement.setString(3, "default");
preparedStatement.setString(4, "default");
preparedStatement.setString(5, stat.getUUID());
preparedStatement.executeUpdate();
} catch (SQLException sqlException) {
sqlException.printStackTrace();
} finally {
if (preparedStatement != null) {
try {
preparedStatement.close();
} catch (SQLException ignored) {
}
}
}
}
public Connection getConnection() {
return connection;
}
public void newTables() {
Connection connection = getConnection();
try {
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)");
} catch (SQLException ex) {
try {
if (statement != null) {
statement.close();
}
} catch (SQLException ex2) {
}
return;
} finally {
try {
if (statement != null) {
statement.close();
}
} catch (SQLException ex3) {
}
} try {
if (statement != null) {
statement.close();
}
} catch (SQLException ex4) {
}
} catch (SQLException ex5) {
}
}
stat.setArrow(resultSet.getString("Trail"));
}
} catch (SQLException sqlException) {
sqlException.printStackTrace();
} finally {
if (resultSet != null) {
try {
resultSet.close();
} catch (SQLException ignored) {
}
}
if (preparedStatement != null) {
try {
preparedStatement.close();
} catch (SQLException ignored) {
}
}
}
}
}.runTaskAsynchronously(plugin);
}
public void saveData(PlayerStat stat) {
checkConnection();
Connection connection = getConnection();
PreparedStatement preparedStatement = null;
try {
StringBuilder queryBuilder = new StringBuilder();
queryBuilder.append("UPDATE `BG_Cosmetic` SET ");
queryBuilder.append("`Cage` = ?, `Taunt` = ?, `Trail` = ?, `KillSound` = ? ");
queryBuilder.append("WHERE `UUID` = ?;");
preparedStatement = connection.prepareStatement(queryBuilder.toString());
preparedStatement.setString(1, stat.getCage());
preparedStatement.setString(2, "default");
preparedStatement.setString(3, "default");
preparedStatement.setString(4, "default");
preparedStatement.setString(5, stat.getUUID());
preparedStatement.executeUpdate();
} catch (SQLException sqlException) {
sqlException.printStackTrace();
} finally {
if (preparedStatement != null) {
try {
preparedStatement.close();
} catch (SQLException ignored) {
}
}
}
}
public Connection getConnection() {
return connection;
}
public void newTables() {
Connection connection = getConnection();
try {
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)");
} catch (SQLException ex) {
try {
if (statement != null) {
statement.close();
}
} catch (SQLException ex2) {
}
return;
} finally {
try {
if (statement != null) {
statement.close();
}
} catch (SQLException ex3) {
}
}
try {
if (statement != null) {
statement.close();
}
} catch (SQLException ex4) {
}
} catch (SQLException ex5) {
}
}
}

988
MultiArena-TheBridge/src/cx/sfy/TheBridge/database/Database.java

File diff suppressed because it is too large

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

@ -8,34 +8,69 @@ import org.bukkit.inventory.ItemStack;
import cx.sfy.TheBridge.Main;
import cx.sfy.TheBridge.archievements.ArchiType;
import lombok.Getter;
import lombok.Setter;
public class PlayerStat {
public static HashMap<Player, PlayerStat> players = new HashMap<Player, PlayerStat>();
private Player p;
@Getter
private Player player;
private UUID uuid;
@Getter
private String name;
@Getter
@Setter
private ItemStack[] hotbar;
@Getter
@Setter
private String cage;
@Getter
@Setter
private String arrow;
@Getter
@Setter
private int normalWins;
@Getter
@Setter
private int fourWins;
@Getter
@Setter
private int normalKills;
@Getter
@Setter
private int fourKills;
@Getter
@Setter
private int normalDeaths;
@Getter
@Setter
private int fourDeaths;
@Getter
@Setter
private int normalGoals;
@Getter
@Setter
private int fourGoals;
@Getter
@Setter
private int coins;
@Getter
@Setter
private int xp;
@Getter
@Setter
private int broken;
@Getter
@Setter
private int placed;
public PlayerStat(Player p) {
this.p = p;
this.player = p;
this.uuid = p.getUniqueId();
this.name = p.getName();
Main.get().getDB().loadData(this);
Main.get().getCB().loadData(this);
Main.get().getDb().loadData(this);
Main.get().getCb().loadData(this);
players.put(p, this);
}
@ -43,70 +78,26 @@ public class PlayerStat {
return players.get(p);
}
public String getCage() {
return cage;
}
public void setCage(String cage) {
this.cage = cage;
}
public void addBroken() {
broken = broken + 1;
if (!Main.get().isArchiDisabled()) {
Main.get().getAM().check(p, broken, ArchiType.BLOCKS_BROKEN);
Main.get().getAm().check(player, broken, ArchiType.BLOCKS_BROKEN);
}
}
public void addPlaced() {
placed = placed + 1;
if (!Main.get().isArchiDisabled()) {
Main.get().getAM().check(p, placed, ArchiType.BLOCKS_PLACED);
Main.get().getAm().check(player, placed, ArchiType.BLOCKS_PLACED);
}
}
public int getBroken() {
return broken;
}
public void setBroken(int broken) {
this.broken = broken;
}
public int getPlaced() {
return placed;
}
public void setPlaced(int placed) {
this.placed = placed;
}
public Player getPlayer() {
return p;
}
public String getUUID() {
return uuid.toString();
}
public String getName() {
return name;
}
public ItemStack[] getHotbar() {
return hotbar;
}
public void setHotbar(ItemStack[] hotbar) {
this.hotbar = hotbar;
}
public void addNormalKills() {
normalKills = normalKills + 1;
xp += Main.get().getConfig().getInt("xp.normal.kill");
coins += Main.get().getConfig().getInt("coins.normal.kill");
if (!Main.get().isArchiDisabled()) {
Main.get().getAM().check(p, normalKills + fourKills, ArchiType.KILLS);
Main.get().getAm().check(player, normalKills + fourKills, ArchiType.KILLS);
}
}
@ -115,7 +106,7 @@ public class PlayerStat {
xp += Main.get().getConfig().getInt("xp.normal.win");
coins += Main.get().getConfig().getInt("coins.normal.win");
if (!Main.get().isArchiDisabled()) {
Main.get().getAM().check(p, normalWins + fourWins, ArchiType.WINS);
Main.get().getAm().check(player, normalWins + fourWins, ArchiType.WINS);
}
}
@ -124,7 +115,7 @@ public class PlayerStat {
xp += Main.get().getConfig().getInt("xp.normal.goals");
coins += Main.get().getConfig().getInt("coins.normal.goals");
if (!Main.get().isArchiDisabled()) {
Main.get().getAM().check(p, normalGoals + fourGoals, ArchiType.GOALS);
Main.get().getAm().check(player, normalGoals + fourGoals, ArchiType.GOALS);
}
}
@ -133,7 +124,7 @@ public class PlayerStat {
xp += Main.get().getConfig().getInt("xp.four.kill");
coins += Main.get().getConfig().getInt("coins.four.kill");
if (!Main.get().isArchiDisabled()) {
Main.get().getAM().check(p, normalKills + fourKills, ArchiType.KILLS);
Main.get().getAm().check(player, normalKills + fourKills, ArchiType.KILLS);
}
}
@ -142,7 +133,7 @@ public class PlayerStat {
xp += Main.get().getConfig().getInt("coins.four.win");
coins += Main.get().getConfig().getInt("coins.four.win");
if (!Main.get().isArchiDisabled()) {
Main.get().getAM().check(p, normalWins + fourWins, ArchiType.WINS);
Main.get().getAm().check(player, normalWins + fourWins, ArchiType.WINS);
}
}
@ -151,10 +142,14 @@ public class PlayerStat {
xp += coins + Main.get().getConfig().getInt("xp.four.goals");
coins += Main.get().getConfig().getInt("coins.four.goals");
if (!Main.get().isArchiDisabled()) {
Main.get().getAM().check(p, normalGoals + fourGoals, ArchiType.GOALS);
Main.get().getAm().check(player, normalGoals + fourGoals, ArchiType.GOALS);
}
}
public String getUUID() {
return uuid.toString();
}
public void addCoins(int coins) {
this.coins = this.coins + coins;
}
@ -171,84 +166,4 @@ public class PlayerStat {
this.xp = this.xp - xp;
}
public int getNormalWins() {
return normalWins;
}
public int getFourWins() {
return fourWins;
}
public int getNormalKills() {
return normalKills;
}
public int getFourKills() {
return fourKills;
}
public int getNormalDeaths() {
return normalDeaths;
}
public int getFourDeaths() {
return fourDeaths;
}
public int getNormalGoals() {
return normalGoals;
}
public int getFourGoals() {
return fourGoals;
}
public int getCoins() {
return coins;
}
public int getXP() {
return xp;
}
public void setNormalWins(int normalWins) {
this.normalWins = normalWins;
}
public void setFourWins(int fourWins) {
this.fourWins = fourWins;
}
public void setNormalKills(int normalKills) {
this.normalKills = normalKills;
}
public void setFourKills(int fourKills) {
this.fourKills = fourKills;
}
public void setNormalDeaths(int normalDeaths) {
this.normalDeaths = normalDeaths;
}
public void setFourDeaths(int fourDeaths) {
this.fourDeaths = fourDeaths;
}
public void setNormalGoals(int normalGoals) {
this.normalGoals = normalGoals;
}
public void setFourGoals(int fourGoals) {
this.fourGoals = fourGoals;
}
public void setCoins(int coins) {
this.coins = coins;
}
public void setXP(int xp) {
this.xp = xp;
}
}

54
MultiArena-TheBridge/src/cx/sfy/TheBridge/game/GameDuo.java

@ -88,8 +88,8 @@ public class GameDuo {
final Location location3 = new Location(buildMin.getWorld(), i, j, k);
build.add(location3);
}
this.teams.put(ChatColor.BLUE, new TeamDuo(plugin.getConfig().getString("names.blue"), ChatColor.BLUE, Color.BLUE,
respawnsBlue, spawnsBlue, portalBlue, hBlue));
this.teams.put(ChatColor.BLUE, new TeamDuo(plugin.getConfig().getString("names.blue"), ChatColor.BLUE,
Color.BLUE, respawnsBlue, spawnsBlue, portalBlue, hBlue));
this.teams.put(ChatColor.RED, new TeamDuo(plugin.getConfig().getString("names.red"), ChatColor.RED, Color.RED,
respawnsRed, spawnsRed, portalRed, hRed));
setState(State.WAITING);
@ -111,11 +111,11 @@ public class GameDuo {
}
public void updateSB(Player p) {
plugin.getSB().update(p);
plugin.getSb().update(p);
}
public void updateSign() {
plugin.getSIM().updateGameSign(this);
plugin.getSim().updateGameSign(this);
}
public void addPlayer(Player p) {
@ -175,7 +175,7 @@ public class GameDuo {
for (final Player p : players) {
p.teleport(lobby);
updateSB(p);
plugin.getNMS().sendTitle(p, 0, 60, 0,
plugin.getNms().sendTitle(p, 0, 60, 0,
plugin.getLang().get("titles.win.title")
.replaceAll("<blueGoals>", String.valueOf(teams.get(ChatColor.BLUE).getGoals()))
.replaceAll("<redGoals>", String.valueOf(teams.get(ChatColor.RED).getGoals()))
@ -202,7 +202,7 @@ public class GameDuo {
th.delete();
for (final Player p : spect.getWorld().getPlayers())
if (pd.containsKey(p))
plugin.getGM().removePlayerAllGames(p);
plugin.getGm().removePlayerAllGames(p);
else
p.teleport(plugin.getMainLobby());
}
@ -210,7 +210,7 @@ public class GameDuo {
new BukkitRunnable() {
@Override
public void run() {
plugin.getGM().resetNormalGame(getName());
plugin.getGm().resetNormalGame(getName());
}
}.runTaskLater(plugin, 20 * 12);
updateSign();
@ -224,7 +224,7 @@ public class GameDuo {
PlayerStat.getPlayerStat(r).addNormalWins();
for (final Player p : players) {
p.teleport(lobby);
plugin.getNMS().sendTitle(p, 0, 60, 0,
plugin.getNms().sendTitle(p, 0, 60, 0,
plugin.getLang().get("titles.win.title")
.replaceAll("<blueGoals>", String.valueOf(teams.get(ChatColor.BLUE).getGoals()))
.replaceAll("<redGoals>", String.valueOf(teams.get(ChatColor.RED).getGoals()))
@ -249,7 +249,7 @@ public class GameDuo {
public void run() {
for (final Player p : spect.getWorld().getPlayers())
if (pd.containsKey(p))
plugin.getGM().removePlayerAllGames(p);
plugin.getGm().removePlayerAllGames(p);
else
p.teleport(plugin.getMainLobby());
}
@ -257,7 +257,7 @@ public class GameDuo {
new BukkitRunnable() {
@Override
public void run() {
plugin.getGM().resetNormalGame(getName());
plugin.getGm().resetNormalGame(getName());
}
}.runTaskLater(plugin, 20 * 12);
updateSign();
@ -278,16 +278,16 @@ public class GameDuo {
for (final TeamDuo te : teams.values())
if (!te.isCage())
if (te.getTeamPlayers().get(0) != null) {
te.createCage(plugin.getCM()
te.createCage(plugin.getCm()
.getCageByName(PlayerStat.getPlayerStat(te.getTeamPlayers().get(0)).getCage()));
te.setCage(true);
} else {
te.createCage(plugin.getCM().getCageByName(plugin.getConfig().getString("defaultCage")));
te.createCage(plugin.getCm().getCageByName(plugin.getConfig().getString("defaultCage")));
te.setCage(true);
}
} else
for (final ChatColor color : teams.keySet())
plugin.getGLM().createCage(teams.get(color).getTeamSpawn(), color);
plugin.getGlm().createCage(teams.get(color).getTeamSpawn(), color);
for (final Player p : players) {
p.teleport(getTeamPlayer(p).getTeamSpawn().clone().add(0, 1, 0));
updateSB(p);
@ -344,7 +344,7 @@ public class GameDuo {
.replaceAll("<units>", plugin.getLang().get(p, "units.seconds")));
p.playSound(p.getLocation(), Sound.valueOf(plugin.getSounds().get("sounds.game.restart")), 1.0f,
1.0f);
plugin.getTM().sendReStartTitle(e, p, restart, true);
plugin.getTm().sendReStartTitle(e, p, restart, true);
}
if (restart == 1)
for (final Player p : players) {
@ -353,7 +353,7 @@ public class GameDuo {
.replaceAll("<s>", "").replaceAll("<units>", plugin.getLang().get(p, "units.second")));
p.playSound(p.getLocation(), Sound.valueOf(plugin.getSounds().get("sounds.game.restart")), 1.0f,
1.0f);
plugin.getTM().sendReStartTitle(e, p, restart, false);
plugin.getTm().sendReStartTitle(e, p, restart, false);
}
if (restart == 0) {
if (plugin.isCage()) {
@ -364,7 +364,7 @@ public class GameDuo {
}
} else
for (final ChatColor color : teams.keySet())
plugin.getGLM().removeGlass(teams.get(color).getTeamSpawn());
plugin.getGlm().removeGlass(teams.get(color).getTeamSpawn());
for (final Player p : players)
p.setGameMode(GameMode.SURVIVAL);
cancel();
@ -393,7 +393,7 @@ public class GameDuo {
.replaceAll("<units>", plugin.getLang().get(p, "units.minutes")));
p.playSound(p.getLocation(), Sound.valueOf(plugin.getSounds().get("sounds.game.starting")), 1.0f,
1.0f);
plugin.getTM().sendStartTitle(p, starting, true);
plugin.getTm().sendStartTitle(p, starting, true);
}
else if (starting == 60)
for (final Player p : players) {
@ -402,7 +402,7 @@ public class GameDuo {
.replaceAll("<units>", plugin.getLang().get(p, "units.minute")));
p.playSound(p.getLocation(), Sound.valueOf(plugin.getSounds().get("sounds.game.starting")), 1.0f,
1.0f);
plugin.getTM().sendStartTitle(p, starting, true);
plugin.getTm().sendStartTitle(p, starting, true);
}
else if (starting == 30 || starting == 15 || starting == 10 || starting == 5 || starting == 4
|| starting == 3 || starting == 2)
@ -412,7 +412,7 @@ public class GameDuo {
.replaceAll("<units>", plugin.getLang().get(p, "units.seconds")));
p.playSound(p.getLocation(), Sound.valueOf(plugin.getSounds().get("sounds.game.starting")), 1.0f,
1.0f);
plugin.getTM().sendStartTitle(p, starting, true);
plugin.getTm().sendStartTitle(p, starting, true);
}
else if (starting == 1) {
setState(State.PREGAME);
@ -423,7 +423,7 @@ public class GameDuo {
.replaceAll("<units>", plugin.getLang().get(p, "units.second")));
p.playSound(p.getLocation(), Sound.valueOf(plugin.getSounds().get("sounds.game.starting")), 1.0f,
1.0f);
plugin.getTM().sendStartTitle(p, starting, false);
plugin.getTm().sendStartTitle(p, starting, false);
if (getTeamPlayer(p) == null)
addRandomTeam(p);
p.getInventory().clear();
@ -432,17 +432,17 @@ public class GameDuo {
for (final TeamDuo team : teams.values())
if (!team.isCage())
if (team.getTeamPlayers().get(0) != null) {
team.createCage(plugin.getCM().getCageByName(
team.createCage(plugin.getCm().getCageByName(
PlayerStat.getPlayerStat(team.getTeamPlayers().get(0)).getCage()));
team.setCage(true);
} else {
team.createCage(
plugin.getCM().getCageByName(plugin.getConfig().getString("defaultCage")));
plugin.getCm().getCageByName(plugin.getConfig().getString("defaultCage")));
team.setCage(true);
}
} else
for (final ChatColor color : teams.keySet())
plugin.getGLM().createCage(teams.get(color).getTeamSpawn(), color);
plugin.getGlm().createCage(teams.get(color).getTeamSpawn(), color);
for (final Player p : players) {
p.teleport(getTeamPlayer(p).getTeamSpawn().clone().add(0, 1, 0));
giveKit(p, getTeamPlayer(p));
@ -500,7 +500,7 @@ public class GameDuo {
.replaceAll("<units>", plugin.getLang().get(p, "units.seconds")));
p.playSound(p.getLocation(), Sound.valueOf(plugin.getSounds().get("sounds.game.prestart")), 1.0f,
1.0f);
plugin.getTM().sendPreTitle(p, prestart, true);
plugin.getTm().sendPreTitle(p, prestart, true);
updateSB(p);
}
else if (prestart == 1)
@ -510,7 +510,7 @@ public class GameDuo {
.replaceAll("<units>", plugin.getLang().get(p, "units.second")));
p.playSound(p.getLocation(), Sound.valueOf(plugin.getSounds().get("sounds.game.prestart")), 1.0f,
1.0f);
plugin.getTM().sendPreTitle(p, prestart, false);
plugin.getTm().sendPreTitle(p, prestart, false);
for (final String msg : plugin.getLang().getList("messages.start"))
CenterMessage.sendCenteredMessage(p, msg.replaceAll("&", "§"));
updateSB(p);
@ -526,7 +526,7 @@ public class GameDuo {
}
} else
for (final ChatColor color : teams.keySet())
plugin.getGLM().removeGlass(teams.get(color).getTeamSpawn());
plugin.getGlm().removeGlass(teams.get(color).getTeamSpawn());
for (final Player p : players) {
updateSB(p);
p.setGameMode(GameMode.SURVIVAL);
@ -670,7 +670,7 @@ public class GameDuo {
p.getInventory().setLeggings(panta);
p.getInventory().setBoots(boots);
if (PlayerStat.getPlayerStat(p).getHotbar() == null) {
final ItemStack[] items = plugin.getGM().getKit().getContents();
final ItemStack[] items = plugin.getGm().getKit().getContents();
for (int slot = 0; slot < 35; slot++) {
final ItemStack item = items[slot];
if (item == null || item.getType() == Material.BARRIER) {

44
MultiArena-TheBridge/src/cx/sfy/TheBridge/game/GameFour.java

@ -117,11 +117,11 @@ public class GameFour {
}
public void updateSB(Player p) {
plugin.getSB().update(p);
plugin.getSb().update(p);
}
public void updateSign() {
plugin.getSIM().updateGameFourSign(this);
plugin.getSim().updateGameFourSign(this);
}
public String getMode() {
@ -129,7 +129,7 @@ public class GameFour {
}
public boolean checkWin(TeamFour win, TeamFour death, Player e) {
if (getTeamsAlive() <= 1 && !isState(FState.FINISH)) {
setState(FState.FINISH);
updateSign();
@ -138,7 +138,7 @@ public class GameFour {
PlayerStat.getPlayerStat(w).addFourWins();
}
for (Player p : players) {
plugin.getNMS().sendTitle(p, 0, 60, 0,
plugin.getNms().sendTitle(p, 0, 60, 0,
plugin.getLang().get("titles.winFour.title").replaceAll("<life>", win.getLifeString())
.replaceAll("<team>", win.getTeamName()).replaceAll("<color>", win.getColor() + ""),
plugin.getLang().get("titles.winFour.subtitle").replaceAll("<life>", win.getLifeString())
@ -173,7 +173,7 @@ public class GameFour {
on.showPlayer(p);
p.showPlayer(on);
}
plugin.getGM().removePlayerFourGames(p);
plugin.getGm().removePlayerFourGames(p);
} else {
p.teleport(plugin.getMainLobby());
}
@ -183,7 +183,7 @@ public class GameFour {
new BukkitRunnable() {
@Override
public void run() {
plugin.getGM().resetFourGame(getName());
plugin.getGm().resetFourGame(getName());
}
}.runTaskLater(plugin, 20 * 12);
return true;
@ -205,7 +205,7 @@ public class GameFour {
return;
}
for (Player p : players) {
plugin.getNMS().sendTitle(p, 0, 20, 0,
plugin.getNms().sendTitle(p, 0, 20, 0,
plugin.getLang().get("titles.goalFinal.title").replaceAll("<player>", e.getName())
.replaceAll("<heart>", "❤").replaceAll("<teamOther>", team.getTeamName())
.replaceAll("<teamStole>", death.getTeamName())
@ -217,13 +217,13 @@ public class GameFour {
}
} else {
for (Player p : players) {
plugin.getNMS().sendTitle(p, 0, 20, 0,
plugin.getNms().sendTitle(p, 0, 20, 0,
plugin.getLang().get("titles.goalNormal.title").replaceAll("<player>", e.getName())
.replaceAll("<heart>", "❤").replaceAll("<teamOther>", team.getTeamName())
.replaceAll("<teamStole>", death.getTeamName())
.replaceAll("<color>", team.getColor() + ""),
plugin.getLang().get("titles.goalNormal.subtitle").replaceAll("<player>", e.getName())
.replaceAll("<heart>", ¤").replaceAll("<teamOther>", team.getTeamName())
.replaceAll("<heart>", §¤").replaceAll("<teamOther>", team.getTeamName())
.replaceAll("<teamStole>", death.getTeamName())
.replaceAll("<color>", team.getColor() + ""));
}
@ -259,7 +259,7 @@ public class GameFour {
return;
}
for (Player p : players) {
plugin.getNMS().sendTitle(p, 0, 20, 0,
plugin.getNms().sendTitle(p, 0, 20, 0,
plugin.getLang().get("titles.goalFinal.title").replaceAll("<player>", e.getName())
.replaceAll("<heart>", "❤").replaceAll("<teamOther>", team.getTeamName())
.replaceAll("<teamStole>", death.getTeamName())
@ -272,7 +272,7 @@ public class GameFour {
} else {
for (Player p : players) {
plugin.getNMS().sendTitle(p, 0, 20, 0,
plugin.getNms().sendTitle(p, 0, 20, 0,
plugin.getLang().get("titles.goalNormal.title").replaceAll("<player>", e.getName())
.replaceAll("<heart>", "❤").replaceAll("<teamOther>", team.getTeamName())
.replaceAll("<teamStole>", death.getTeamName())
@ -400,7 +400,7 @@ public class GameFour {
.replaceAll("<units>", plugin.getLang().get(p, "units.minutes")));
p.playSound(p.getLocation(), Sound.valueOf(plugin.getSounds().get("sounds.game.starting")), 1.0f,
1.0f);
plugin.getTM().sendStartTitle(p, starting, true);
plugin.getTm().sendStartTitle(p, starting, true);
}
}
if (starting == 60) {
@ -410,7 +410,7 @@ public class GameFour {
.replaceAll("<units>", plugin.getLang().get(p, "units.minute")));
p.playSound(p.getLocation(), Sound.valueOf(plugin.getSounds().get("sounds.game.starting")), 1.0f,
1.0f);
plugin.getTM().sendStartTitle(p, starting, true);
plugin.getTm().sendStartTitle(p, starting, true);
}
}
if (starting == 30 || starting == 15 || starting == 10 || starting == 5 || starting == 4 || starting == 3
@ -421,7 +421,7 @@ public class GameFour {
.replaceAll("<units>", plugin.getLang().get(p, "units.seconds")));
p.playSound(p.getLocation(), Sound.valueOf(plugin.getSounds().get("sounds.game.starting")), 1.0f,
1.0f);
plugin.getTM().sendStartTitle(p, starting, true);
plugin.getTm().sendStartTitle(p, starting, true);
}
}
if (starting == 1) {
@ -435,7 +435,7 @@ public class GameFour {
1.0f);
p.getInventory().clear();
p.getOpenInventory().close();
plugin.getTM().sendStartTitle(p, starting, false);
plugin.getTm().sendStartTitle(p, starting, false);
if (getTeamPlayer(p) == null) {
addRandomTeam(p);
}
@ -444,19 +444,19 @@ public class GameFour {
for (TeamFour team : teams.values()) {
if (!team.isCage()) {
if (team.getTeamPlayers().size() > 0 && team.getTeamPlayers().get(0) != null) {
team.createCage(plugin.getCM().getCageByName(
team.createCage(plugin.getCm().getCageByName(
PlayerStat.getPlayerStat(team.getTeamPlayers().get(0)).getCage()));
team.setCage(true);
} else {
team.createCage(
plugin.getCM().getCageByName(plugin.getConfig().getString("defaultCage")));
plugin.getCm().getCageByName(plugin.getConfig().getString("defaultCage")));
team.setCage(true);
}
}
}
} else {
for (ChatColor color : teams.keySet()) {
plugin.getGLM().createCage(teams.get(color).getTeamSpawn(), color);
plugin.getGlm().createCage(teams.get(color).getTeamSpawn(), color);
}
}
for (Player p : players) {
@ -639,7 +639,7 @@ public class GameFour {
.replaceAll("<units>", plugin.getLang().get(p, "units.seconds")));
p.playSound(p.getLocation(), Sound.valueOf(plugin.getSounds().get("sounds.game.prestart")), 1.0f,
1.0f);
plugin.getTM().sendPreTitle(p, prestart, true);
plugin.getTm().sendPreTitle(p, prestart, true);
}
}
if (prestart == 1) {
@ -649,7 +649,7 @@ public class GameFour {
.replaceAll("<units>", plugin.getLang().get(p, "units.second")));
p.playSound(p.getLocation(), Sound.valueOf(plugin.getSounds().get("sounds.game.prestart")), 1.0f,
1.0f);
plugin.getTM().sendPreTitle(p, prestart, false);
plugin.getTm().sendPreTitle(p, prestart, false);
for (String msg : plugin.getLang().getList("messages.startFour")) {
CenterMessage.sendCenteredMessage(p, msg.replaceAll("&", "§").replaceAll("<heart>", "❤"));
}
@ -670,7 +670,7 @@ public class GameFour {
}
} else {
for (ChatColor color : teams.keySet()) {
plugin.getGLM().removeGlass(teams.get(color).getTeamSpawn());
plugin.getGlm().removeGlass(teams.get(color).getTeamSpawn());
}
}
}
@ -873,7 +873,7 @@ public class GameFour {
p.getInventory().setLeggings(panta);
p.getInventory().setBoots(boots);
if (PlayerStat.getPlayerStat(p).getHotbar() == null) {
final ItemStack[] items = plugin.getGM().getKit().getContents();
final ItemStack[] items = plugin.getGm().getKit().getContents();
for (int slot = 0; slot < 35; slot++) {
final ItemStack item = items[slot];
if (item == null || item.getType() == Material.BARRIER) {

26
MultiArena-TheBridge/src/cx/sfy/TheBridge/game/PlayerData.java

@ -28,7 +28,7 @@ public class PlayerData {
private GameMode gm;
private boolean restored;
private float flySpeed;
public PlayerData(Player p) {
this.uuid = p.getUniqueId();
this.sb = p.getScoreboard();
@ -42,7 +42,7 @@ public class PlayerData {
this.inv = Bukkit.createInventory(null, InventoryType.PLAYER, p.getName());
this.inv.setContents(p.getInventory().getContents());
}
public void restore() {
if (!restored) {
Player p = this.getPlayer();
@ -61,23 +61,23 @@ public class PlayerData {
p.resetPlayerWeather();
p.setFlySpeed(flySpeed);
p.setAllowFlight(fly);
p.setFireTicks(0);
p.setScoreboard(sb);
Location respawn = Main.get().getMainLobby();
p.teleport(respawn, TeleportCause.END_PORTAL);
Utils.setPlayerExperience(p, PlayerStat.getPlayerStat(p).getXP());
if (!Main.get().isStop()) {
Main.get().getTOP().createInfo(p);
}
p.setFireTicks(0);
p.setScoreboard(sb);
Location respawn = Main.get().getMainLobby();
p.teleport(respawn, TeleportCause.END_PORTAL);
Utils.setPlayerExperience(p, PlayerStat.getPlayerStat(p).getXp());
if (!Main.get().isStop()) {
Main.get().getTop().createInfo(p);
}
}
}
public Player getPlayer() {
return Bukkit.getPlayer(uuid);
}
public UUID getUUID() {
return uuid;
}
}

8
MultiArena-TheBridge/src/cx/sfy/TheBridge/hooks/PlaceholderHook.java

@ -9,11 +9,11 @@ import me.clip.placeholderapi.expansion.PlaceholderExpansion;
public class PlaceholderHook extends PlaceholderExpansion {
private Plugin p;
public PlaceholderHook(Plugin p) {
this.p = p;
}
@Override
public String getAuthor() {
return "Stefatorus";
@ -36,7 +36,7 @@ public class PlaceholderHook extends PlaceholderExpansion {
@Override
public String onPlaceholderRequest(Player p, String id) {
if (p == null || !p.isOnline()){
if (p == null || !p.isOnline()) {
return null;
}
PlayerStat ps = PlayerStat.getPlayerStat(p);
@ -71,7 +71,7 @@ public class PlaceholderHook extends PlaceholderExpansion {
return String.valueOf(ps.getCoins());
}
if (id.equals("xp")) {
return String.valueOf(ps.getXP());
return String.valueOf(ps.getXp());
}
if (id.equals("blocks_placed")) {
return String.valueOf(ps.getPlaced());

2
MultiArena-TheBridge/src/cx/sfy/TheBridge/kit/Hotbar.java

@ -26,7 +26,7 @@ public class Hotbar {
public void createHotbarMenu(Player p) {
Inventory inv = Bukkit.getServer().createInventory(null, 54, plugin.getLang().get("menus.hotbar.title"));
ItemStack [] items = plugin.getGM().getKit().getContents();
ItemStack [] items = plugin.getGm().getKit().getContents();
ItemStack glass = new ItemStack(Material.STAINED_GLASS_PANE, 1, (short)7);
ItemMeta glassM = glass.getItemMeta();
glassM.setDisplayName("§a↑ §eInventory");

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

@ -6,9 +6,12 @@ import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.World;
import org.bukkit.block.Sign;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Item;
import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
@ -22,6 +25,7 @@ import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.EntityShootBowEvent;
import org.bukkit.event.entity.FoodLevelChangeEvent;
import org.bukkit.event.entity.ProjectileLaunchEvent;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryCloseEvent;
@ -39,8 +43,12 @@ import org.bukkit.inventory.InventoryView;
import org.bukkit.inventory.ItemStack;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.projectiles.ProjectileSource;
import org.bukkit.scheduler.BukkitRunnable;
import com.google.common.io.ByteArrayDataOutput;
import com.google.common.io.ByteStreams;
import cx.sfy.TheBridge.Main;
import cx.sfy.TheBridge.cosmetics.Cage;
import cx.sfy.TheBridge.database.PlayerStat;
@ -67,18 +75,54 @@ public class PlayerListener implements Listener {
this.plugin = plugin;
}
public void runTask() {
Bukkit.getScheduler().runTaskTimer(this.plugin, () -> {
for (GameDuo gd : plugin.getGm().getGames()) {
for (Location loc : gd.getBuild()) {
World world = loc.getWorld();
if (world == null) {
continue;
}
for (Projectile proj : world.getEntitiesByClass(Projectile.class)) {
ProjectileSource p = proj.getShooter();
if (!(p instanceof Player)) {
continue;
}
createTrail(proj.getLocation(),
plugin.getArm().getArrowByName(PlayerStat.getPlayerStat((Player) p).getArrow()));
}
}
}
}, 5, 5);
}
@EventHandler
public void onShoot(ProjectileLaunchEvent e) {
if (e.getEntity() instanceof Arrow) {
runTask();
}
}
@EventHandler
public void onJoin(PlayerJoinEvent e) {
final Player p = e.getPlayer();
new PlayerStat(p);
givePlayerItems(p);
Utils.setPlayerExperience(p, PlayerStat.getPlayerStat(p).getXP());
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
|| plugin.getGM().getGameFourByPlayer(e.getPlayer()) != null) {
if (plugin.getGm().getGameByPlayer(e.getPlayer()) != null
|| plugin.getGm().getGameFourByPlayer(e.getPlayer()) != null) {
final List<String> cmds = plugin.getConfig().getStringList("commands.list");
if (e.getMessage().contains("/bridges"))
return;
@ -112,6 +156,16 @@ public class PlayerListener implements Listener {
plugin.getConfig().getInt("items.shop.amount"), (short) plugin.getConfig().getInt("items.shop.data"),
plugin.getConfig().getString("items.shop.nameItem").replaceAll("&", "§"),
plugin.getConfig().getString("items.shop.loreItem").replaceAll("&", "§"));
final ItemStack lobby = ItemBuilder.item(Material.valueOf(plugin.getConfig().getString("items.lobby.material")),
plugin.getConfig().getInt("items.lobby.amount"), (short) plugin.getConfig().getInt("items.lobby.data"),
plugin.getConfig().getString("items.lobby.nameItem").replaceAll("&", "§"),
plugin.getConfig().getString("items.lobby.loreItem").replaceAll("&", "§"));
final ItemStack archievements = ItemBuilder.item(
Material.valueOf(plugin.getConfig().getString("items.archievements.material")),
plugin.getConfig().getInt("items.archievements.amount"),
(short) plugin.getConfig().getInt("items.archievements.data"),
plugin.getConfig().getString("items.archievements.nameItem").replaceAll("&", "§"),
plugin.getConfig().getString("items.archievements.loreItem").replaceAll("&", "§"));
if (plugin.getConfig().getBoolean("items.menu.enabled"))
p.getInventory().setItem(plugin.getConfig().getInt("items.menu.slot"), select);
if (plugin.getConfig().getBoolean("items.random.enabled"))
@ -120,6 +174,10 @@ public class PlayerListener implements Listener {
p.getInventory().setItem(plugin.getConfig().getInt("items.hotbar.slot"), hotbar);
if (plugin.getConfig().getBoolean("items.shop.enabled"))
p.getInventory().setItem(plugin.getConfig().getInt("items.shop.slot"), shop);
if (plugin.getConfig().getBoolean("items.lobby.enabled"))
p.getInventory().setItem(plugin.getConfig().getInt("items.lobby.slot"), lobby);
if (plugin.getConfig().getBoolean("items.archievements.enabled"))
p.getInventory().setItem(plugin.getConfig().getInt("items.archievements.slot"), archievements);
}
@EventHandler
@ -131,11 +189,11 @@ public class PlayerListener implements Listener {
e.getItemDrop().remove();
e.setCancelled(true);
}
if (plugin.getGM().getGameFourByPlayer(p) != null) {
if (plugin.getGm().getGameFourByPlayer(p) != null) {
e.setCancelled(true);
return;
}
if (plugin.getGM().getGameByPlayer(p) != null) {
if (plugin.getGm().getGameByPlayer(p) != null) {
e.setCancelled(true);
return;
}
@ -179,12 +237,32 @@ public class PlayerListener implements Listener {
if (item.getItemStack().equals(random))
e.setCancelled(true);
}
if (plugin.getConfig().getBoolean("items.lobby.enabled")) {
final ItemStack random = ItemBuilder.item(
Material.valueOf(plugin.getConfig().getString("items.lobby.material")),
plugin.getConfig().getInt("items.lobby.amount"),
(short) plugin.getConfig().getInt("items.lobby.data"),
plugin.getConfig().getString("items.lobby.nameItem").replaceAll("&", "§"),
plugin.getConfig().getString("items.lobby.loreItem").replaceAll("&", "§"));
if (item.getItemStack().equals(random))
e.setCancelled(true);
}
if (plugin.getConfig().getBoolean("items.archievements.enabled")) {
final ItemStack random = ItemBuilder.item(
Material.valueOf(plugin.getConfig().getString("items.archievements.material")),
plugin.getConfig().getInt("items.archievements.amount"),
(short) plugin.getConfig().getInt("items.archievements.data"),
plugin.getConfig().getString("items.archievements.nameItem").replaceAll("&", "§"),
plugin.getConfig().getString("items.archievements.loreItem").replaceAll("&", "§"));
if (item.getItemStack().equals(random))
e.setCancelled(true);
}
}
@EventHandler
public void onInteract(PlayerInteractEvent e) {
final Player p = e.getPlayer();
if (plugin.getGM().getGameByPlayer(p) != null) {
if (plugin.getGm().getGameByPlayer(p) != null) {
if (p.getItemInHand() == null || p.getItemInHand().getType() == Material.AIR)
return;
final ItemStack item = p.getItemInHand();
@ -193,10 +271,10 @@ public class PlayerListener implements Listener {
if (item.getType().equals(Material.PAPER)
&& item.getItemMeta().getDisplayName().equals(plugin.getLang().get("items.teams.nameItem"))) {
e.setCancelled(true);
plugin.getTEM().openTeamNormalMenu(p);
plugin.getTem().openTeamNormalMenu(p);
}
}
if (plugin.getGM().getGameFourByPlayer(p) != null) {
if (plugin.getGm().getGameFourByPlayer(p) != null) {
if (p.getItemInHand() == null || p.getItemInHand().getType() == Material.AIR)
return;
final ItemStack item = p.getItemInHand();
@ -210,18 +288,18 @@ public class PlayerListener implements Listener {
if (item.getType().equals(Material.COMPASS)
&& item.getItemMeta().getDisplayName().equals(plugin.getLang().get("items.spectate.nameItem"))) {
e.setCancelled(true);
plugin.getSPM().openSpectPlayerMenu(p);
plugin.getSpm().openSpectPlayerMenu(p);
}
if (item.getType().equals(Material.PAPER)
&& item.getItemMeta().getDisplayName().equals(plugin.getLang().get("items.teams.nameItem"))) {
e.setCancelled(true);
plugin.getTEM().openTeamFourMenu(p);
plugin.getTem().openTeamFourMenu(p);
}
if (item.getType().equals(Material.REDSTONE_COMPARATOR)
|| item.getType().equals(Material.REDSTONE_COMPARATOR_OFF) && item.getItemMeta().getDisplayName()
.equals(plugin.getLang().get("items.config.nameItem"))) {
e.setCancelled(true);
plugin.getSOM().openOptionsMenu(p);
plugin.getSom().openOptionsMenu(p);
}
if (item.getType().equals(Material.BED)
&& item.getItemMeta().getDisplayName().equals(plugin.getLang().get("items.leave.nameItem"))) {
@ -240,7 +318,7 @@ public class PlayerListener implements Listener {
}
}
}
if (plugin.getGM().getGameByPlayer(p) != null) {
if (plugin.getGm().getGameByPlayer(p) != null) {
final ItemStack item = p.getItemInHand();
if (item.getType().equals(Material.BOW))
if (bow.contains(p)) {
@ -266,7 +344,7 @@ public class PlayerListener implements Listener {
}
}
}
if (plugin.getGM().getGameFourByPlayer(p) == null && plugin.getGM().getGameByPlayer(p) == null) {
if (plugin.getGm().getGameFourByPlayer(p) == null && plugin.getGm().getGameByPlayer(p) == null) {
if (p.getItemInHand() != null && p.getItemInHand().getType() != Material.AIR) {
final ItemStack item = p.getItemInHand();
if (item.hasItemMeta()) {
@ -278,7 +356,7 @@ public class PlayerListener implements Listener {
plugin.getConfig().getString("items.menu.nameItem").replaceAll("&", "§"),
plugin.getConfig().getString("items.menu.loreItem").replaceAll("&", "§"));
if (item.equals(select))
plugin.getGMU().openSelectTypeMenu(p);
plugin.getGmu().openSelectTypeMenu(p);
}
if (plugin.getConfig().getBoolean("items.random.enabled"))
if (!leaving.contains(p)) {
@ -291,7 +369,7 @@ public class PlayerListener implements Listener {
if (item.equals(random)) {
GameDuo g = null;
int alto = 0;
for (final GameDuo game : plugin.getGM().getGames()) {
for (final GameDuo game : plugin.getGm().getGames()) {
if (game.isState(State.FINISH) || game.isState(State.INGAME)
|| game.isState(State.RESTARTING) || game.isState(State.PREGAME))
continue;
@ -303,7 +381,7 @@ public class PlayerListener implements Listener {
}
}
if (g != null)
plugin.getGM().addPlayerGame(p, g);
plugin.getGm().addPlayerGame(p, g);
else
p.sendMessage(plugin.getLang().get("messages.noGames"));
}
@ -328,6 +406,38 @@ public class PlayerListener implements Listener {
if (item.equals(random))
plugin.getShop().openShopMenu(p);
}
if (plugin.getConfig().getBoolean("items.archievements.enabled")) {
final ItemStack random = ItemBuilder.item(
Material.valueOf(plugin.getConfig().getString("items.archievements.material")),
plugin.getConfig().getInt("items.archievements.amount"),
(short) plugin.getConfig().getInt("items.archievements.data"),
plugin.getConfig().getString("items.archievements.nameItem").replaceAll("&", "§"),
plugin.getConfig().getString("items.archievements.loreItem").replaceAll("&", "§"));
if (item.equals(random))
plugin.getArchimenu().createArchievementsMenu(p, 1);
}
if (plugin.getConfig().getBoolean("items.lobby.enabled")) {
final ItemStack random = ItemBuilder.item(
Material.valueOf(plugin.getConfig().getString("items.lobby.material")),
plugin.getConfig().getInt("items.lobby.amount"),
(short) plugin.getConfig().getInt("items.lobby.data"),
plugin.getConfig().getString("items.lobby.nameItem").replaceAll("&", "§"),
plugin.getConfig().getString("items.lobby.loreItem").replaceAll("&", "§"));
if (item.equals(random)) {
ByteArrayDataOutput out = ByteStreams.newDataOutput();
out.writeUTF("Connect");
out.writeUTF(plugin.getConfig().getString("items.lobby.server"));
try {
p.sendPluginMessage(Main.get(), "BungeeCord", out.toByteArray());
} catch (Exception ex) {
e.setCancelled(true);
plugin.getServer().getConsoleSender()
.sendMessage(ChatColor.RED + "Server " + ChatColor.YELLOW
+ plugin.getConfig().getString("items.lobby.server") + ChatColor.RED
+ " not found... Please check you config!");
}
}
}
}
}
if (e.getAction().equals(Action.RIGHT_CLICK_BLOCK) || e.getAction().equals(Action.LEFT_CLICK_BLOCK))
@ -336,27 +446,27 @@ public class PlayerListener implements Listener {
return;
if (leaving.contains(p))
return;
if (plugin.getSIM().getSigns().keySet().contains(e.getClickedBlock().getLocation())) {
final GameNormalSign sign = plugin.getSIM().getSigns().get(e.getClickedBlock().getLocation());
final GameDuo game = plugin.getGM().getGameByName(sign.getGame());
if (plugin.getSim().getSigns().keySet().contains(e.getClickedBlock().getLocation())) {
final GameNormalSign sign = plugin.getSim().getSigns().get(e.getClickedBlock().getLocation());
final GameDuo game = plugin.getGm().getGameByName(sign.getGame());
if (game.isState(State.WAITING) || game.isState(State.STARTING)) {
if (game.getPlayers() >= game.getMax()) {
p.sendMessage(plugin.getLang().get("messages.gameFull"));
return;
}
plugin.getGM().addPlayerGame(p, game);
plugin.getGm().addPlayerGame(p, game);
return;
} else
p.sendMessage(plugin.getLang().get("messages.gameAlreadyStart"));
} else if (plugin.getSIM().getFourSigns().keySet().contains(e.getClickedBlock().getLocation())) {
final GameFourSign sign = plugin.getSIM().getFourSigns().get(e.getClickedBlock().getLocation());
final GameFour game = plugin.getGM().getGameFourByName(sign.getGame());
} else if (plugin.getSim().getFourSigns().keySet().contains(e.getClickedBlock().getLocation())) {
final GameFourSign sign = plugin.getSim().getFourSigns().get(e.getClickedBlock().getLocation());
final GameFour game = plugin.getGm().getGameFourByName(sign.getGame());
if (game.isState(FState.WAITING) || game.isState(FState.STARTING)) {
if (game.getPlayers().size() >= game.getMax()) {
p.sendMessage(plugin.getLang().get("messages.gameFull"));
return;
}
plugin.getGM().addPlayerGameFour(p, game);
plugin.getGm().addPlayerGameFour(p, game);
return;
} else
p.sendMessage(plugin.getLang().get("messages.gameAlreadyStart"));
@ -369,8 +479,8 @@ public class PlayerListener implements Listener {
public void onMove(PlayerMoveEvent e) {
boolean wait = false;
final Player p = e.getPlayer();
if (plugin.getGM().getGameByPlayer(p) != null) {
final GameDuo game = plugin.getGM().getGameByPlayer(p);
if (plugin.getGm().getGameByPlayer(p) != null) {
final GameDuo game = plugin.getGm().getGameByPlayer(p);
if (game.isState(State.WAITING) || game.isState(State.STARTING) || game.isState(State.FINISH))
if (p.getLocation().getY() < 30)
p.teleport(game.getLobby());
@ -393,8 +503,8 @@ public class PlayerListener implements Listener {
}
return;
}
if (plugin.getGM().getGameFourByPlayer(p) != null) {
final GameFour game = plugin.getGM().getGameFourByPlayer(p);
if (plugin.getGm().getGameFourByPlayer(p) != null) {
final GameFour game = plugin.getGm().getGameFourByPlayer(p);
if (game.isState(FState.WAITING) || game.isState(FState.STARTING) || game.isState(FState.FINISH))
if (p.getLocation().getY() < 30)
p.teleport(game.getLobby());
@ -445,11 +555,11 @@ public class PlayerListener implements Listener {
public void onFood(FoodLevelChangeEvent e) {
if (e.getEntity() instanceof Player) {
final Player p = (Player) e.getEntity();
if (plugin.getGM().getGameByPlayer(p) != null) {
if (plugin.getGm().getGameByPlayer(p) != null) {
e.setCancelled(true);
return;
}
if (plugin.getGM().getGameFourByPlayer(p) != null) {
if (plugin.getGm().getGameFourByPlayer(p) != null) {
e.setCancelled(true);
return;
}
@ -461,8 +571,8 @@ public class PlayerListener implements Listener {
final Player p = e.getPlayer();
if (!plugin.getConfig().getBoolean("chat.enabled"))
return;
if (plugin.getGM().getGameByPlayer(p) != null) {
final GameDuo game = plugin.getGM().getGameByPlayer(p);
if (plugin.getGm().getGameByPlayer(p) != null) {
final GameDuo game = plugin.getGm().getGameByPlayer(p);
e.setCancelled(true);
if (game.isState(State.WAITING) || game.isState(State.STARTING) || game.isState(State.FINISH)
|| game.isState(State.RESTARTING)) {
@ -488,8 +598,8 @@ public class PlayerListener implements Listener {
return;
}
}
if (plugin.getGM().getGameFourByPlayer(p) != null) {
final GameFour game = plugin.getGM().getGameFourByPlayer(p);
if (plugin.getGm().getGameFourByPlayer(p) != null) {
final GameFour game = plugin.getGm().getGameFourByPlayer(p);
e.setCancelled(true);
if (game.isState(FState.WAITING) || game.isState(FState.STARTING) || game.isState(FState.FINISH)
|| game.isState(FState.RESTARTING)) {
@ -521,8 +631,8 @@ public class PlayerListener implements Listener {
public void onDamage(EntityDamageEvent e) {
if (e.getEntity() instanceof Player) {
final Player p = (Player) e.getEntity();
if (plugin.getGM().getGameByPlayer(p) != null) {
final GameDuo game = plugin.getGM().getGameByPlayer(p);
if (plugin.getGm().getGameByPlayer(p) != null) {
final GameDuo game = plugin.getGm().getGameByPlayer(p);
if (e.getCause().equals(DamageCause.FALL)) {
e.setCancelled(true);
return;
@ -532,8 +642,8 @@ public class PlayerListener implements Listener {
e.setCancelled(true);
return;
}
if (plugin.getGM().getGameFourByPlayer(p) != null) {
final GameFour game = plugin.getGM().getGameFourByPlayer(p);
if (plugin.getGm().getGameFourByPlayer(p) != null) {
final GameFour game = plugin.getGm().getGameFourByPlayer(p);
if (e.getCause().equals(DamageCause.FALL)) {
e.setCancelled(true);
return;
@ -565,7 +675,7 @@ public class PlayerListener implements Listener {
if (inv.getTitle() == null)
return;
if (plugin.getGM().getGameFourByPlayer(p) != null || plugin.getGM().getGameByPlayer(p) != null) {
if (plugin.getGm().getGameFourByPlayer(p) != null || plugin.getGm().getGameByPlayer(p) != null) {
if (e.getSlotType().equals(SlotType.ARMOR))
e.setCancelled(true);
if (e.getCurrentItem() == null || e.getCurrentItem().getType() == Material.AIR)
@ -574,7 +684,7 @@ public class PlayerListener implements Listener {
.equals(plugin.getLang().get("items.leave.nameItem")))
e.setCancelled(true);
}
if (plugin.getGM().getGameFourByPlayer(p) == null && plugin.getGM().getGameByPlayer(p) == null) {
if (plugin.getGm().getGameFourByPlayer(p) == null && plugin.getGm().getGameByPlayer(p) == null) {
if (p.getOpenInventory() != null)
if (p.getOpenInventory().getTitle().equals(plugin.getLang().get("menus.hotbar.title"))) {
if (p.getOpenInventory() != null && e.getClickedInventory() != null
@ -639,10 +749,29 @@ public class PlayerListener implements Listener {
if (item.equals(random))
e.setCancelled(true);
}
if (plugin.getConfig().getBoolean("items.lobby.enabled")) {
final ItemStack random = ItemBuilder.item(
Material.valueOf(plugin.getConfig().getString("items.lobby.material")),
plugin.getConfig().getInt("items.lobby.amount"),
(short) plugin.getConfig().getInt("items.lobby.data"),
plugin.getConfig().getString("items.lobby.nameItem").replaceAll("&", "§"),
plugin.getConfig().getString("items.lobby.loreItem").replaceAll("&", "§"));
if (item.equals(random))
e.setCancelled(true);
}
if (plugin.getConfig().getBoolean("items.archievements.enabled")) {
final ItemStack random = ItemBuilder.item(
Material.valueOf(plugin.getConfig().getString("items.archievements.material")),
plugin.getConfig().getInt("items.archievements.amount"),
(short) plugin.getConfig().getInt("items.archievements.data"),
plugin.getConfig().getString("items.archievements.nameItem").replaceAll("&", "§"),
plugin.getConfig().getString("items.archievements.loreItem").replaceAll("&", "§"));
if (item.equals(random))
e.setCancelled(true);
}
}
}
if (inv.getTitle()
.equals(plugin.getAchievement().get("title").replaceAll("<player>", p.getName()))) {
if (inv.getTitle().equals(plugin.getAchievement().get("title").replaceAll("<player>", p.getName()))) {
e.setCancelled(true);
if (e.getCurrentItem() == null || e.getCurrentItem().getType() == Material.AIR)
return;
@ -656,13 +785,13 @@ public class PlayerListener implements Listener {
page.put(p, 2);
else
page.put(p, page.get(p) + 1);
plugin.getArchiMenu().createArchievementsMenu(p, page.get(p));
plugin.getArchimenu().createArchievementsMenu(p, page.get(p));
e.setCancelled(true);
}
if (e.getCurrentItem().getItemMeta().getDisplayName()
.equals(plugin.getAchievement().get("back").replaceAll("<back>", "?"))) {
.equals(plugin.getAchievement().get("back").replaceAll("<back>", "§?"))) {
page.put(p, page.get(p) - 1);
plugin.getArchiMenu().createArchievementsMenu(p, page.get(p));
plugin.getArchimenu().createArchievementsMenu(p, page.get(p));
e.setCancelled(true);
}
}
@ -671,7 +800,9 @@ public class PlayerListener implements Listener {
if (e.getCurrentItem() == null || e.getCurrentItem().getType() == Material.AIR)
return;
if (e.getCurrentItem().getItemMeta().getDisplayName().equals(plugin.getLang().get("shop.glass.nameItem")))
plugin.getGLAM().createGlassMenu(p);
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.close.nameItem")))
p.getOpenInventory().close();
}
@ -679,7 +810,7 @@ public class PlayerListener implements Listener {
e.setCancelled(true);
if (e.getCurrentItem() == null || e.getCurrentItem().getType() == Material.AIR)
return;
for (final Cage cage : plugin.getCM().getCages().values())
for (final Cage cage : plugin.getCm().getCages().values())
if (cage.getSlot() == e.getSlot())
if (!p.hasPermission(cage.getPermission())) {
if (!cage.isBuy())
@ -695,7 +826,7 @@ public class PlayerListener implements Listener {
new BukkitRunnable() {
@Override
public void run() {
plugin.getGLAM().createGlassMenu(p);
plugin.getGlam().createGlassMenu(p);
}
}.runTaskLater(plugin, 2L);
p.playSound(p.getLocation(), Sound.valueOf(plugin.getSounds().get("sounds.shop.buy")), 1.0f,
@ -709,16 +840,50 @@ public class PlayerListener implements Listener {
PlayerStat.getPlayerStat(p).setCage(cage.getId());
}
}
if (inv.getTitle().equals(plugin.getArrow().get("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())
if (arrow.getSlot() == e.getSlot())
if (!p.hasPermission(arrow.getPermission())) {
if (!arrow.isBuy())
p.sendMessage(plugin.getLang().get("messages.noBuy"));
else if (arrow.getPrice() > PlayerStat.getPlayerStat(p).getCoins())
p.sendMessage(plugin.getLang().get("messages.noMoney"));
else if (arrow.isBuy() && arrow.getPrice() <= PlayerStat.getPlayerStat(p).getCoins()) {
Bukkit.dispatchCommand(Bukkit.getConsoleSender(),
plugin.getConfig().getString("permFormat").replaceAll("<name>", p.getName())
.replaceAll("<permission>", arrow.getPermission()));
PlayerStat.getPlayerStat(p).removeCoins(arrow.getPrice());
p.getOpenInventory().close();
new BukkitRunnable() {
@Override
public void run() {
plugin.getAmu().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()));
}
} else {
p.sendMessage(
plugin.getLang().get("messages.selectedTrail").replaceAll("<trail>", arrow.getName()));
PlayerStat.getPlayerStat(p).setArrow(arrow.getId());
}
}
if (inv.getTitle().equals(plugin.getLang().get("menus.type.title"))) {
e.setCancelled(true);
if (e.getCurrentItem() == null || e.getCurrentItem().getType() == Material.AIR)
return;
if (e.getCurrentItem().getItemMeta().getDisplayName()
.equals(plugin.getLang().get("menus.type.normal.nameItem")))
plugin.getGMU().openGameMenu(p);
plugin.getGmu().openGameMenu(p);
if (e.getCurrentItem().getItemMeta().getDisplayName()
.equals(plugin.getLang().get("menus.type.four.nameItem")))
plugin.getGMU().openGameFourMenu(p);
plugin.getGmu().openGameFourMenu(p);
}
if (inv.getTitle().equals(plugin.getLang().get("menus.hotbar.title"))) {
if (e.getCurrentItem() == null || e.getCurrentItem().getType() == Material.AIR) {
@ -746,16 +911,16 @@ public class PlayerListener implements Listener {
|| e.getSlotType().equals(SlotType.OUTSIDE))
return;
e.setCancelled(true);
if (plugin.getGM().getGameByPlayer(p) == null)
if (plugin.getGm().getGameByPlayer(p) == null)
if (e.getCurrentItem().getItemMeta().getDisplayName().contains("§a")) {
final String arena = e.getCurrentItem().getItemMeta().getDisplayName().replaceAll("§a", "");
final GameDuo game = plugin.getGM().getGameByName(arena);
final GameDuo game = plugin.getGm().getGameByName(arena);
if (game.getPlayers() >= game.getMax()) {
p.sendMessage(plugin.getLang().get("messages.gameFull"));
return;
}
if (game.isState(State.WAITING) || game.isState(State.STARTING))
plugin.getGM().addPlayerGame(p, game);
plugin.getGm().addPlayerGame(p, game);
else
p.sendMessage(plugin.getLang().get("messages.gameAlreadyStart"));
}
@ -765,10 +930,10 @@ public class PlayerListener implements Listener {
|| e.getSlotType().equals(SlotType.OUTSIDE))
return;
e.setCancelled(true);
if (plugin.getGM().getGameFourByPlayer(p) == null)
if (plugin.getGm().getGameFourByPlayer(p) == null)
if (e.getCurrentItem().getItemMeta().getDisplayName().contains("§a")) {
final String arena = e.getCurrentItem().getItemMeta().getDisplayName().replaceAll("§a", "");
final GameFour game = plugin.getGM().getGameFourByName(arena);
final GameFour game = plugin.getGm().getGameFourByName(arena);
if (game == null)
return;
if (game.getPlayers().size() >= game.getMax()) {
@ -776,15 +941,15 @@ public class PlayerListener implements Listener {
return;
}
if (game.isState(FState.WAITING) || game.isState(FState.STARTING))
plugin.getGM().addPlayerGameFour(p, game);
plugin.getGm().addPlayerGameFour(p, game);
else
p.sendMessage(plugin.getLang().get("messages.gameAlreadyStart"));
}
}
if (plugin.getGM().getGameByPlayer(p) != null)
if (plugin.getGm().getGameByPlayer(p) != null)
if (inv.getTitle().equals(plugin.getLang().get("menus.team.title"))) {
e.setCancelled(true);
final GameDuo game = plugin.getGM().getGameByPlayer(p);
final GameDuo game = plugin.getGm().getGameByPlayer(p);
if (e.getCurrentItem().getItemMeta().getDisplayName().contains("§9")) {
if (p.hasPermission("bridges.bypass")) {
if (game.getTeamPlayer(p) != null)
@ -792,7 +957,7 @@ public class PlayerListener implements Listener {
game.addPlayerTeam(p, game.getTeams().get(ChatColor.BLUE));
p.sendMessage(plugin.getLang().get("messages.joinedTeam").replaceAll("<team>",
"§9" + plugin.getConfig().getString("names.blue")));
plugin.getTEM().openTeamNormalMenu(p);
plugin.getTem().openTeamNormalMenu(p);
return;
}
if (game.getTeamPlayer(p) != null)
@ -802,7 +967,7 @@ public class PlayerListener implements Listener {
game.addPlayerTeam(p, game.getTeams().get(ChatColor.BLUE));
p.sendMessage(plugin.getLang().get("messages.joinedTeam").replaceAll("<team>",
"§9" + plugin.getConfig().getString("names.blue")));
plugin.getTEM().openTeamNormalMenu(p);
plugin.getTem().openTeamNormalMenu(p);
} else
p.sendMessage(plugin.getLang().get("messages.unbalancedTeam"));
}
@ -813,7 +978,7 @@ public class PlayerListener implements Listener {
game.addPlayerTeam(p, game.getTeams().get(ChatColor.RED));
p.sendMessage(plugin.getLang().get("messages.joinedTeam").replaceAll("<team>",
"§c" + plugin.getConfig().getString("names.red")));
plugin.getTEM().openTeamNormalMenu(p);
plugin.getTem().openTeamNormalMenu(p);
return;
}
if (game.getTeamPlayer(p) != null)
@ -823,12 +988,12 @@ public class PlayerListener implements Listener {
game.addPlayerTeam(p, game.getTeams().get(ChatColor.RED));
p.sendMessage(plugin.getLang().get("messages.joinedTeam").replaceAll("<team>",
"§c" + plugin.getConfig().getString("names.red")));
plugin.getTEM().openTeamNormalMenu(p);
plugin.getTem().openTeamNormalMenu(p);
} else
p.sendMessage(plugin.getLang().get("messages.unbalancedTeam"));
}
}
if (plugin.getGM().getGameFourByPlayer(p) != null) {
if (plugin.getGm().getGameFourByPlayer(p) != null) {
if (inv.getTitle().equals(plugin.getLang().get("menus.options.title"))) {
e.setCancelled(true);
if (Bukkit.getPlayer(e.getCurrentItem().getItemMeta().getDisplayName().replaceAll("§7", "")) == null)
@ -856,20 +1021,20 @@ public class PlayerListener implements Listener {
p.setFlySpeed(1.0f);
if (e.getCurrentItem().getItemMeta().getDisplayName().equals(
plugin.getLang().get("menus.options.vision.nameItem").replaceAll("<type>", "§aActivar"))) {
plugin.getSOM().settings.put(p, true);
plugin.getSom().settings.put(p, true);
p.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION, 9999, 1, true));
plugin.getSOM().openOptionsMenu(p);
plugin.getSom().openOptionsMenu(p);
}
if (e.getCurrentItem().getItemMeta().getDisplayName().equals(
plugin.getLang().get("menus.options.vision.nameItem").replaceAll("<type>", "§cDesactivar"))) {
plugin.getSOM().settings.put(p, false);
plugin.getSom().settings.put(p, false);
p.removePotionEffect(PotionEffectType.NIGHT_VISION);
plugin.getSOM().openOptionsMenu(p);
plugin.getSom().openOptionsMenu(p);
}
}
if (inv.getTitle().equals(plugin.getLang().get("menus.teamFour.title"))) {
e.setCancelled(true);
final GameFour game = plugin.getGM().getGameFourByPlayer(p);
final GameFour game = plugin.getGm().getGameFourByPlayer(p);
if (e.getCurrentItem().getItemMeta().getDisplayName().contains("§9")) {
if (p.hasPermission("bridges.bypass")) {
if (game.getTeamPlayer(p) != null)
@ -877,7 +1042,7 @@ public class PlayerListener implements Listener {
game.addPlayerTeam(p, game.getTeams().get(ChatColor.BLUE));
p.sendMessage(plugin.getLang().get("messages.joinedTeam").replaceAll("<team>",
"§9" + plugin.getConfig().getString("names.blue")));
plugin.getTEM().openTeamFourMenu(p);
plugin.getTem().openTeamFourMenu(p);
return;
}
if (game.getTeamPlayer(p) != null)
@ -892,7 +1057,7 @@ public class PlayerListener implements Listener {
game.addPlayerTeam(p, game.getTeams().get(ChatColor.BLUE));
p.sendMessage(plugin.getLang().get("messages.joinedTeam").replaceAll("<team>",
"§9" + plugin.getConfig().getString("names.blue")));
plugin.getTEM().openTeamFourMenu(p);
plugin.getTem().openTeamFourMenu(p);
} else
p.sendMessage(plugin.getLang().get("messages.unbalancedTeam"));
}
@ -903,7 +1068,7 @@ public class PlayerListener implements Listener {
game.addPlayerTeam(p, game.getTeams().get(ChatColor.RED));
p.sendMessage(plugin.getLang().get("messages.joinedTeam").replaceAll("<team>",
"§c" + plugin.getConfig().getString("names.red")));
plugin.getTEM().openTeamFourMenu(p);
plugin.getTem().openTeamFourMenu(p);
return;
}
if (game.getTeamPlayer(p) != null)
@ -918,7 +1083,7 @@ public class PlayerListener implements Listener {
game.addPlayerTeam(p, game.getTeams().get(ChatColor.RED));
p.sendMessage(plugin.getLang().get("messages.joinedTeam").replaceAll("<team>",
"§c" + plugin.getConfig().getString("names.red")));
plugin.getTEM().openTeamFourMenu(p);
plugin.getTem().openTeamFourMenu(p);
} else
p.sendMessage(plugin.getLang().get("messages.unbalancedTeam"));
}
@ -929,7 +1094,7 @@ public class PlayerListener implements Listener {
game.addPlayerTeam(p, game.getTeams().get(ChatColor.GREEN));
p.sendMessage(plugin.getLang().get("messages.joinedTeam").replaceAll("<team>",
"§a" + plugin.getConfig().getString("names.green")));
plugin.getTEM().openTeamFourMenu(p);
plugin.getTem().openTeamFourMenu(p);
return;
}
if (game.getTeamPlayer(p) != null)
@ -944,7 +1109,7 @@ public class PlayerListener implements Listener {
game.addPlayerTeam(p, game.getTeams().get(ChatColor.GREEN));
p.sendMessage(plugin.getLang().get("messages.joinedTeam").replaceAll("<team>",
"§a" + plugin.getConfig().getString("names.green")));
plugin.getTEM().openTeamFourMenu(p);
plugin.getTem().openTeamFourMenu(p);
} else
p.sendMessage(plugin.getLang().get("messages.unbalancedTeam"));
}
@ -955,7 +1120,7 @@ public class PlayerListener implements Listener {
game.addPlayerTeam(p, game.getTeams().get(ChatColor.YELLOW));
p.sendMessage(plugin.getLang().get("messages.joinedTeam").replaceAll("<team>",
"§e" + plugin.getConfig().getString("names.yellow")));
plugin.getTEM().openTeamFourMenu(p);
plugin.getTem().openTeamFourMenu(p);
return;
}
if (game.getTeamPlayer(p) != null)
@ -970,7 +1135,7 @@ public class PlayerListener implements Listener {
game.addPlayerTeam(p, game.getTeams().get(ChatColor.YELLOW));
p.sendMessage(plugin.getLang().get("messages.joinedTeam").replaceAll("<team>",
"§e" + plugin.getConfig().getString("names.yellow")));
plugin.getTEM().openTeamFourMenu(p);
plugin.getTem().openTeamFourMenu(p);
} else
p.sendMessage(plugin.getLang().get("messages.unbalancedTeam"));
}
@ -1028,8 +1193,8 @@ public class PlayerListener implements Listener {
if (e.getDamager() instanceof Player) {
final Player p = (Player) e.getEntity();
final Player d = (Player) e.getDamager();
if (plugin.getGM().getGameByPlayer(p) != null) {
final GameDuo game = plugin.getGM().getGameByPlayer(p);
if (plugin.getGm().getGameByPlayer(p) != null) {
final GameDuo game = plugin.getGm().getGameByPlayer(p);
if (game.isState(State.WAITING) || game.isState(State.STARTING) || game.isState(State.PREGAME)) {
e.setCancelled(true);
return;
@ -1044,8 +1209,8 @@ public class PlayerListener implements Listener {
respawn(p, Tagged.getTag(p));
}
}
if (plugin.getGM().getGameFourByPlayer(p) != null) {
final GameFour game = plugin.getGM().getGameFourByPlayer(p);
if (plugin.getGm().getGameFourByPlayer(p) != null) {
final GameFour game = plugin.getGm().getGameFourByPlayer(p);
if (game.isState(FState.WAITING) || game.isState(FState.STARTING) || game.isState(FState.PREGAME)) {
e.setCancelled(true);
return;
@ -1066,8 +1231,8 @@ public class PlayerListener implements Listener {
if (proj.getShooter() instanceof Player) {
final Player p = (Player) e.getEntity();
final Player d = (Player) proj.getShooter();
if (plugin.getGM().getGameByPlayer(p) != null) {
final GameDuo game = plugin.getGM().getGameByPlayer(p);
if (plugin.getGm().getGameByPlayer(p) != null) {
final GameDuo game = plugin.getGm().getGameByPlayer(p);
if (game.isState(State.WAITING) || game.isState(State.STARTING)
|| game.isState(State.PREGAME)) {
e.setCancelled(true);
@ -1083,8 +1248,8 @@ public class PlayerListener implements Listener {
respawn(p, Tagged.getTag(p));
}
}
if (plugin.getGM().getGameFourByPlayer(p) != null) {
final GameFour game = plugin.getGM().getGameFourByPlayer(p);
if (plugin.getGm().getGameFourByPlayer(p) != null) {
final GameFour game = plugin.getGm().getGameFourByPlayer(p);
if (game.isState(FState.WAITING) || game.isState(FState.STARTING)
|| game.isState(FState.PREGAME)) {
e.setCancelled(true);
@ -1108,7 +1273,7 @@ public class PlayerListener implements Listener {
@EventHandler
public void onConsume(PlayerItemConsumeEvent e) {
final Player p = e.getPlayer();
if (plugin.getGM().getGameByPlayer(p) != null)
if (plugin.getGm().getGameByPlayer(p) != null)
if (e.getItem().getType().equals(Material.GOLDEN_APPLE)) {
p.setHealth(p.getMaxHealth());
if (plugin.getConfig().getBoolean("remove.absorption") == true)
@ -1126,7 +1291,7 @@ public class PlayerListener implements Listener {
}
}.runTaskLater(plugin, 1);
}
if (plugin.getGM().getGameFourByPlayer(p) != null)
if (plugin.getGm().getGameFourByPlayer(p) != null)
if (e.getItem().getType().equals(Material.GOLDEN_APPLE)) {
p.setHealth(p.getMaxHealth());
if (plugin.getConfig().getBoolean("remove.absorption") == true)
@ -1149,62 +1314,62 @@ public class PlayerListener implements Listener {
@EventHandler
public void onQuit(PlayerQuitEvent e) {
final Player p = e.getPlayer();
if (plugin.getGM().getGameByPlayer(p) != null) {
final GameDuo game = plugin.getGM().getGameByPlayer(p);
if (plugin.getGm().getGameByPlayer(p) != null) {
final GameDuo game = plugin.getGm().getGameByPlayer(p);
game.removePlayer(p);
if (game.getTeamsAlive() == 1)
game.checkWin(p, game.getLastTeam(), game.getLastTeam().getGoals());
}
if (plugin.getGM().getGameFourByPlayer(p) != null) {
final GameFour game = plugin.getGM().getGameFourByPlayer(p);
if (plugin.getGm().getGameFourByPlayer(p) != null) {
final GameFour game = plugin.getGm().getGameFourByPlayer(p);
game.removePlayer(p);
if (game.getTeamsAlive() == 1)
game.checkWin(game.getLastTeam(), game.getTeamPlayer(p), game.getLastTeam().getTeamPlayers().get(0));
}
for (final Player on : plugin.getSB().getSB().keySet())
plugin.getSB().update(on);
for (final Player on : plugin.getSb().getSB().keySet())
plugin.getSb().update(on);
if (InventoryData.getInventoryData(p) != null) {
InventoryData.getInventoryData(p).restore();
InventoryData.remove(p);
}
plugin.getSB().remove(p);
plugin.getTOP().removeHolo(p);
plugin.getDB().saveData(PlayerStat.getPlayerStat(p));
plugin.getCB().saveData(PlayerStat.getPlayerStat(p));
plugin.getSb().remove(p);
plugin.getTop().removeHolo(p);
plugin.getDb().saveData(PlayerStat.getPlayerStat(p));
plugin.getCb().saveData(PlayerStat.getPlayerStat(p));
}
@EventHandler
public void onKick(PlayerKickEvent e) {
final Player p = e.getPlayer();
if (plugin.getGM().getGameByPlayer(p) != null) {
final GameDuo game = plugin.getGM().getGameByPlayer(p);
if (plugin.getGm().getGameByPlayer(p) != null) {
final GameDuo game = plugin.getGm().getGameByPlayer(p);
game.removePlayer(p);
if (game.getTeamsAlive() == 1)
game.checkWin(p, game.getLastTeam(), game.getLastTeam().getGoals());
}
if (plugin.getGM().getGameFourByPlayer(p) != null) {
final GameFour game = plugin.getGM().getGameFourByPlayer(p);
if (plugin.getGm().getGameFourByPlayer(p) != null) {
final GameFour game = plugin.getGm().getGameFourByPlayer(p);
game.removePlayer(p);
if (game.getTeamsAlive() == 1)
game.checkWin(game.getLastTeam(), game.getTeamPlayer(p), game.getLastTeam().getTeamPlayers().get(0));
}
for (final Player on : plugin.getSB().getSB().keySet())
plugin.getSB().update(on);
for (final Player on : plugin.getSb().getSB().keySet())
plugin.getSb().update(on);
if (InventoryData.getInventoryData(p) != null) {
InventoryData.getInventoryData(p).restore();
InventoryData.remove(p);
}
plugin.getSB().remove(p);
plugin.getTOP().removeHolo(p);
plugin.getDB().saveData(PlayerStat.getPlayerStat(p));
plugin.getCB().saveData(PlayerStat.getPlayerStat(p));
plugin.getSb().remove(p);
plugin.getTop().removeHolo(p);
plugin.getDb().saveData(PlayerStat.getPlayerStat(p));
plugin.getCb().saveData(PlayerStat.getPlayerStat(p));
}
@EventHandler
public void onBreak(BlockBreakEvent e) {
final Player p = e.getPlayer();
if (plugin.getGM().getGameByPlayer(p) != null) {
final GameDuo game = plugin.getGM().getGameByPlayer(p);
if (plugin.getGm().getGameByPlayer(p) != null) {
final GameDuo game = plugin.getGm().getGameByPlayer(p);
if (game.isState(State.WAITING) || game.isState(State.STARTING) || game.isState(State.PREGAME)
|| game.isState(State.PREGAME) || game.isState(State.FINISH) || game.isState(State.RESTARTING))
e.setCancelled(true);
@ -1216,8 +1381,8 @@ public class PlayerListener implements Listener {
PlayerStat.getPlayerStat(p).addBroken();
return;
}
if (plugin.getGM().getGameFourByPlayer(p) != null) {
final GameFour game = plugin.getGM().getGameFourByPlayer(p);
if (plugin.getGm().getGameFourByPlayer(p) != null) {
final GameFour game = plugin.getGm().getGameFourByPlayer(p);
if (game.isState(FState.WAITING) || game.isState(FState.STARTING) || game.isState(FState.PREGAME)
|| game.isState(FState.PREGAME) || game.isState(FState.FINISH) || game.isState(FState.RESTARTING))
e.setCancelled(true);
@ -1234,8 +1399,8 @@ public class PlayerListener implements Listener {
@EventHandler
public void onPlace(BlockPlaceEvent e) {
final Player p = e.getPlayer();
if (plugin.getGM().getGameByPlayer(p) != null) {
final GameDuo game = plugin.getGM().getGameByPlayer(p);
if (plugin.getGm().getGameByPlayer(p) != null) {
final GameDuo game = plugin.getGm().getGameByPlayer(p);
if (game.isState(State.WAITING) || game.isState(State.STARTING) || game.isState(State.PREGAME)
|| game.isState(State.FINISH) || game.isState(State.RESTARTING))
e.setCancelled(true);
@ -1249,8 +1414,8 @@ public class PlayerListener implements Listener {
}
return;
}
if (plugin.getGM().getGameFourByPlayer(p) != null) {
final GameFour game = plugin.getGM().getGameFourByPlayer(p);
if (plugin.getGm().getGameFourByPlayer(p) != null) {
final GameFour game = plugin.getGm().getGameFourByPlayer(p);
if (game.isState(FState.WAITING) || game.isState(FState.STARTING) || game.isState(FState.PREGAME)
|| game.isState(FState.PREGAME) || game.isState(FState.FINISH) || game.isState(FState.RESTARTING))
e.setCancelled(true);
@ -1271,7 +1436,7 @@ public class PlayerListener implements Listener {
d.getInventory().clear();
d.setHealth(d.getMaxHealth());
if (k != null) {
final GameDuo game = plugin.getGM().getGameByPlayer(k);
final GameDuo game = plugin.getGm().getGameByPlayer(k);
if (game == null)
return;
game.addKill(k);
@ -1322,7 +1487,7 @@ public class PlayerListener implements Listener {
.replaceAll("<death>", d.getName()).replaceAll("<player>", k.getName()));
}
} else {
final GameDuo game = plugin.getGM().getGameByPlayer(d);
final GameDuo game = plugin.getGm().getGameByPlayer(d);
d.teleport(game.getTeamPlayer(d).getTeamRespawn());
game.giveKit(d, game.getTeamPlayer(d));
if (d.getLastDamageCause() == null)
@ -1356,7 +1521,7 @@ public class PlayerListener implements Listener {
d.getInventory().clear();
d.setHealth(d.getMaxHealth());
if (k != null) {
final GameFour game = plugin.getGM().getGameFourByPlayer(k);
final GameFour game = plugin.getGm().getGameFourByPlayer(k);
game.addKill(k);
PlayerStat.getPlayerStat(k).addFourKills();
d.teleport(game.getTeamPlayer(d).getTeamRespawn());
@ -1405,7 +1570,7 @@ public class PlayerListener implements Listener {
.replaceAll("<death>", d.getName()).replaceAll("<player>", k.getName()));
}
} else {
final GameFour game = plugin.getGM().getGameFourByPlayer(d);
final GameFour game = plugin.getGm().getGameFourByPlayer(d);
d.teleport(game.getTeamPlayer(d).getTeamRespawn());
game.giveKit(d, game.getTeamPlayer(d));
if (d.getLastDamageCause() == null)

38
MultiArena-TheBridge/src/cx/sfy/TheBridge/listeners/SetupListener.java

@ -34,13 +34,13 @@ public class SetupListener implements Listener {
return;
}
ItemStack item = p.getItemInHand();
if (item.getType() == Material.BLAZE_ROD && item.getItemMeta().getDisplayName().equalsIgnoreCase("§eSetup TheBridge")) {
if (item.getType() == Material.BLAZE_ROD && item.getItemMeta().getDisplayName().equalsIgnoreCase("§eSetup TheBridge")) {
if (e.getAction().equals(Action.LEFT_CLICK_BLOCK)) {
plugin.getSM().setMax(p, e.getClickedBlock().getLocation());
plugin.getSm().setMax(p, e.getClickedBlock().getLocation());
e.setCancelled(true);
}
if (e.getAction().equals(Action.RIGHT_CLICK_BLOCK)) {
plugin.getSM().setMin(p, e.getClickedBlock().getLocation());
plugin.getSm().setMin(p, e.getClickedBlock().getLocation());
e.setCancelled(true);
}
}
@ -56,31 +56,31 @@ public class SetupListener implements Listener {
if (e.getLine(1).toLowerCase().equals("normal")) {
String game = e.getLine(2);
Sign sign = (Sign)e.getBlock().getState();
if (plugin.getGM().getGameByName(game) == null) {
p.sendMessage("§cThis Game not exits.");
if (plugin.getGm().getGameByName(game) == null) {
p.sendMessage("§cThis Game not exits.");
return;
}
GameDuo gname = plugin.getGM().getGameByName(game);
plugin.getSIM().createSign(e.getBlock().getLocation(), game, sign);
GameDuo gname = plugin.getGm().getGameByName(game);
plugin.getSim().createSign(e.getBlock().getLocation(), game, sign);
e.setLine(0, plugin.getLang().get("signs.normal.line-1").replaceAll("<state>", getState(gname.getState())).replaceAll("<name>", game).replaceAll("<players>", String.valueOf(gname.getPlayers())).replaceAll("<max>", String.valueOf(gname.getMax())));
e.setLine(1, plugin.getLang().get("signs.normal.line-2").replaceAll("<state>", getState(gname.getState())).replaceAll("<name>", game).replaceAll("<players>", String.valueOf(gname.getPlayers())).replaceAll("<max>", String.valueOf(gname.getMax())));
e.setLine(2, plugin.getLang().get("signs.normal.line-3").replaceAll("<state>", getState(gname.getState())).replaceAll("<name>", game).replaceAll("<players>", String.valueOf(gname.getPlayers())).replaceAll("<max>", String.valueOf(gname.getMax())));
e.setLine(3, plugin.getLang().get("signs.normal.line-4").replaceAll("<state>", getState(gname.getState())).replaceAll("<name>", game).replaceAll("<players>", String.valueOf(gname.getPlayers())).replaceAll("<max>", String.valueOf(gname.getMax())));
p.sendMessage("§aSign Normal added.");
p.sendMessage("§aSign Normal added.");
} else if (e.getLine(1).toLowerCase().equals("four")) {
String game = e.getLine(2);
Sign sign = (Sign)e.getBlock().getState();
if (plugin.getGM().getGameFourByName(game) == null) {
p.sendMessage("§cThis Game not exits.");
if (plugin.getGm().getGameFourByName(game) == null) {
p.sendMessage("§cThis Game not exits.");
return;
}
GameFour gname = plugin.getGM().getGameFourByName(game);
plugin.getSIM().createFourSign(e.getBlock().getLocation(), game, sign);
GameFour gname = plugin.getGm().getGameFourByName(game);
plugin.getSim().createFourSign(e.getBlock().getLocation(), game, sign);
e.setLine(0, plugin.getLang().get("signs.four.line-1").replaceAll("<state>", getState(gname.getState())).replaceAll("<name>", game).replaceAll("<players>", String.valueOf(gname.getPlayers().size())).replaceAll("<max>", String.valueOf(gname.getMax())));
e.setLine(1, plugin.getLang().get("signs.four.line-2").replaceAll("<state>", getState(gname.getState())).replaceAll("<name>", game).replaceAll("<players>", String.valueOf(gname.getPlayers().size())).replaceAll("<max>", String.valueOf(gname.getMax())));
e.setLine(2, plugin.getLang().get("signs.four.line-3").replaceAll("<state>", getState(gname.getState())).replaceAll("<name>", game).replaceAll("<players>", String.valueOf(gname.getPlayers().size())).replaceAll("<max>", String.valueOf(gname.getMax())));
e.setLine(3, plugin.getLang().get("signs.four.line-4").replaceAll("<state>", getState(gname.getState())).replaceAll("<name>", game).replaceAll("<players>", String.valueOf(gname.getPlayers().size())).replaceAll("<max>", String.valueOf(gname.getMax())));
p.sendMessage("§aSign Four added.");
p.sendMessage("§aSign Four added.");
}
}
}
@ -135,14 +135,14 @@ public class SetupListener implements Listener {
if (!p.hasPermission("bridges.admin")) {
return;
}
if (plugin.getSIM().getSigns().keySet().contains(e.getBlock().getLocation())) {
plugin.getSigns().set("signs.normal." + plugin.getSIM().getSigns().get(e.getBlock().getLocation()).getGame(), null);
if (plugin.getSim().getSigns().keySet().contains(e.getBlock().getLocation())) {
plugin.getSigns().set("signs.normal." + plugin.getSim().getSigns().get(e.getBlock().getLocation()).getGame(), null);
plugin.getSigns().save();
p.sendMessage("§cSign normal removed.");
} else if (plugin.getSIM().getFourSigns().keySet().contains(e.getBlock().getLocation())) {
plugin.getSigns().set("signs.four." + plugin.getSIM().getFourSigns().get(e.getBlock().getLocation()).getGame(), null);
p.sendMessage("§cSign normal removed.");
} else if (plugin.getSim().getFourSigns().keySet().contains(e.getBlock().getLocation())) {
plugin.getSigns().set("signs.four." + plugin.getSim().getFourSigns().get(e.getBlock().getLocation()).getGame(), null);
plugin.getSigns().save();
p.sendMessage("§cSign four removed.");
p.sendMessage("§cSign four removed.");
}
}

38
MultiArena-TheBridge/src/cx/sfy/TheBridge/listeners/SpectatorListener.java

@ -52,7 +52,7 @@ public class SpectatorListener implements Listener {
@EventHandler
public void onBlockPlace(BlockPlaceEvent e) {
final GameFour game = plugin.getGM().getGameFourByPlayer(e.getPlayer());
final GameFour game = plugin.getGm().getGameFourByPlayer(e.getPlayer());
if (game == null)
return;
if (game.getSpects().contains(e.getPlayer()))
@ -61,7 +61,7 @@ public class SpectatorListener implements Listener {
@EventHandler
public void onDrop(PlayerDropItemEvent e) {
final GameFour game = plugin.getGM().getGameFourByPlayer(e.getPlayer());
final GameFour game = plugin.getGm().getGameFourByPlayer(e.getPlayer());
if (game == null)
return;
if (game.getSpects().contains(e.getPlayer()))
@ -70,7 +70,7 @@ public class SpectatorListener implements Listener {
@EventHandler
public void onChest(PlayerInteractEvent e) {
final GameFour game = plugin.getGM().getGameFourByPlayer(e.getPlayer());
final GameFour game = plugin.getGm().getGameFourByPlayer(e.getPlayer());
if (game == null)
return;
if (game.getSpects().contains(e.getPlayer()))
@ -80,7 +80,7 @@ public class SpectatorListener implements Listener {
@EventHandler
public void onInventoryClick(InventoryClickEvent e) {
final GameFour game = plugin.getGM().getGameFourByPlayer((Player)e.getWhoClicked());
final GameFour game = plugin.getGm().getGameFourByPlayer((Player)e.getWhoClicked());
if (game == null)
return;
if (game.getSpects().contains(e.getWhoClicked())) {
@ -103,7 +103,7 @@ public class SpectatorListener implements Listener {
@EventHandler
public void onDrag(InventoryDragEvent e) {
final GameFour game = plugin.getGM().getGameFourByPlayer((Player)e.getWhoClicked());
final GameFour game = plugin.getGm().getGameFourByPlayer((Player)e.getWhoClicked());
if (game == null)
return;
if (game.getSpects().contains(e.getWhoClicked()))
@ -116,7 +116,7 @@ public class SpectatorListener implements Listener {
final Location blockL = e.getBlock().getLocation();
boolean allowed = false;
for (final Player target : Bukkit.getServer().getOnlinePlayers()) {
final GameFour game = plugin.getGM().getGameFourByPlayer(target);
final GameFour game = plugin.getGm().getGameFourByPlayer(target);
if (game == null)
return;
if (target.getWorld().equals(e.getBlock().getWorld()) && game.getSpects().contains(target)) {
@ -141,7 +141,7 @@ public class SpectatorListener implements Listener {
@EventHandler
public void onPlayer(BlockPlaceEvent e) {
final Location location = e.getBlock().getLocation();
final GameFour game = plugin.getGM().getGameFourByPlayer(e.getPlayer());
final GameFour game = plugin.getGm().getGameFourByPlayer(e.getPlayer());
if (game == null)
return;
for (final Player on : Bukkit.getOnlinePlayers())
@ -155,19 +155,19 @@ public class SpectatorListener implements Listener {
@EventHandler
protected void onEntityDamageEvent(EntityDamageByEntityEvent e) {
if (e.getDamager() instanceof Player && e.getEntity() instanceof Player) {
final GameFour game = plugin.getGM().getGameFourByPlayer((Player)e.getDamager());
final GameFour game = plugin.getGm().getGameFourByPlayer((Player)e.getDamager());
if (game == null)
return;
if ((!e.getDamager().hasMetadata("NPC") && game.getSpects().contains(e.getDamager())) || (!e.getEntity().hasMetadata("NPC") && game.getSpects().contains(e.getEntity())))
e.setCancelled(true);
} else if (!(e.getEntity() instanceof Player) && e.getDamager() instanceof Player) {
final GameFour game = plugin.getGM().getGameFourByPlayer((Player)e.getDamager());
final GameFour game = plugin.getGm().getGameFourByPlayer((Player)e.getDamager());
if (game == null)
return;
if (!e.getDamager().hasMetadata("NPC") && game.getSpects().contains(e.getDamager()))
e.setCancelled(true);
} else if (e.getEntity() instanceof Player && !(e.getDamager() instanceof Player)) {
final GameFour game = plugin.getGM().getGameFourByPlayer((Player)e.getEntity());
final GameFour game = plugin.getGm().getGameFourByPlayer((Player)e.getEntity());
if (game == null)
return;
if (!e.getEntity().hasMetadata("NPC") && game.getSpects().contains(e.getEntity()))
@ -175,7 +175,7 @@ public class SpectatorListener implements Listener {
}
GameFour game = null;
if (e.getEntity() instanceof Player)
game = plugin.getGM().getGameFourByPlayer((Player)e.getEntity());
game = plugin.getGm().getGameFourByPlayer((Player)e.getEntity());
if (game == null)
return;
if(e.getDamager() instanceof Projectile
@ -234,7 +234,7 @@ public class SpectatorListener implements Listener {
final ArrayList<UUID> spectatorsAffected = new ArrayList<>();
GameFour game = null;
if (e.getEntity().getShooter() instanceof Player)
game = plugin.getGM().getGameFourByPlayer((Player)e.getEntity().getShooter());
game = plugin.getGm().getGameFourByPlayer((Player)e.getEntity().getShooter());
for(final LivingEntity player : e.getAffectedEntities())
if(player instanceof Player && !player.hasMetadata("NPC") && game.getSpects().contains(player))
@ -291,7 +291,7 @@ public class SpectatorListener implements Listener {
@EventHandler
protected void onPlayerPickupItem(PlayerPickupItemEvent e) {
final GameFour game = plugin.getGM().getGameFourByPlayer(e.getPlayer());
final GameFour game = plugin.getGm().getGameFourByPlayer(e.getPlayer());
if (game == null)
return;
if (game.getSpects().contains(e.getPlayer()))
@ -302,7 +302,7 @@ public class SpectatorListener implements Listener {
protected void onEntityTarget(EntityTargetEvent e) {
GameFour game = null;
if (e.getTarget() instanceof Player)
game = plugin.getGM().getGameFourByPlayer((Player)e.getTarget());
game = plugin.getGm().getGameFourByPlayer((Player)e.getTarget());
if (game == null)
return;
if (e.getTarget() != null && e.getTarget() instanceof Player && !e.getTarget().hasMetadata("NPC") && game.getSpects().contains(e.getTarget()))
@ -317,7 +317,7 @@ public class SpectatorListener implements Listener {
@EventHandler
protected void onBlockDamage(BlockDamageEvent e) {
final GameFour game = plugin.getGM().getGameFourByPlayer(e.getPlayer());
final GameFour game = plugin.getGm().getGameFourByPlayer(e.getPlayer());
if (game == null)
return;
if (game.getSpects().contains(e.getPlayer()))
@ -328,7 +328,7 @@ public class SpectatorListener implements Listener {
protected void onEntityDamage(EntityDamageEvent e) {
GameFour game = null;
if (e.getEntity() instanceof Player)
game = plugin.getGM().getGameFourByPlayer((Player)e.getEntity());
game = plugin.getGm().getGameFourByPlayer((Player)e.getEntity());
if (game == null)
return;
if (e.getEntity() instanceof Player && !e.getEntity().hasMetadata("NPC") && game.getSpects().contains(e.getEntity())) {
@ -341,7 +341,7 @@ public class SpectatorListener implements Listener {
protected void onFoodLevelChange(FoodLevelChangeEvent e) {
GameFour game = null;
if (e.getEntity() instanceof Player)
game = plugin.getGM().getGameFourByPlayer((Player)e.getEntity());
game = plugin.getGm().getGameFourByPlayer((Player)e.getEntity());
if (game == null)
return;
if (e.getEntity() instanceof Player && !e.getEntity().hasMetadata("NPC") && game.getSpects().contains(e.getEntity())) {
@ -352,7 +352,7 @@ public class SpectatorListener implements Listener {
}
@EventHandler
public void onInventoryDrag(InventoryDragEvent e) {
final GameFour game = plugin.getGM().getGameFourByPlayer((Player)e.getWhoClicked());
final GameFour game = plugin.getGm().getGameFourByPlayer((Player)e.getWhoClicked());
if (game == null)
return;
if (game.getSpects().contains(e.getWhoClicked()))
@ -363,7 +363,7 @@ public class SpectatorListener implements Listener {
public void onVehicleEnter(VehicleEnterEvent e) {
GameFour game = null;
if (e.getEntered() instanceof Player)
game = plugin.getGM().getGameFourByPlayer((Player)e.getEntered());
game = plugin.getGm().getGameFourByPlayer((Player)e.getEntered());
if (game == null)
return;
if (e.getEntered() instanceof Player && game.getSpects().contains(e.getEntered()))

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

@ -0,0 +1,59 @@
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;
}
}

333
MultiArena-TheBridge/src/cx/sfy/TheBridge/managers/GameManager.java

@ -28,59 +28,62 @@ public class GameManager {
private HashMap<Player, GameDuo> playerGame;
private HashMap<Player, GameFour> playerGameFour;
private Inventory kit;
Main plugin;
Main plugin;
public GameManager(Main plugin) {
this.plugin = plugin;
this.normalGames = new ArrayList<>();
this.fourGames = new ArrayList<>();
this.playerGame = new HashMap<Player, GameDuo>();
this.playerGameFour = new HashMap<Player, GameFour>();
this.kit = Bukkit.getServer().createInventory(null, InventoryType.PLAYER);
if (plugin.getConfig().getString("kit") == null) {
Bukkit.getConsoleSender().sendMessage(ChatColor.RED + "You don't have a default kit set up. Use " + ChatColor.YELLOW + "/bridges setkit");
} else {
try {
public GameManager(Main plugin) {
this.plugin = plugin;
this.normalGames = new ArrayList<>();
this.fourGames = new ArrayList<>();
this.playerGame = new HashMap<Player, GameDuo>();
this.playerGameFour = new HashMap<Player, GameFour>();
this.kit = Bukkit.getServer().createInventory(null, InventoryType.PLAYER);
if (plugin.getConfig().getString("kit") == null) {
Bukkit.getConsoleSender().sendMessage(
ChatColor.RED + "You don't have a default kit set up. Use " + ChatColor.YELLOW + "/bridges setkit");
} else {
try {
kit.setContents(plugin.getKit().fromBase64(plugin.getConfig().getString("kit")).getContents());
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
this.loadGames();
}
public void reloadKit() {
try {
}
this.loadGames();
}
public void reloadKit() {
try {
kit.setContents(plugin.getKit().fromBase64(plugin.getConfig().getString("kit")).getContents());
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
public Inventory getKit() {
return kit;
}
}
public void resetNormalGame(String file) {
GameDuo prev = null;
for (GameDuo game : normalGames) {
if (game.getName().equals(file)) {
prev = game;
}
}
normalGames.remove(prev);
File arena = new File(plugin.getDataFolder() + "/arenas/" + file + ".yml");
public Inventory getKit() {
return kit;
}
public void resetNormalGame(String file) {
GameDuo prev = null;
for (GameDuo game : normalGames) {
if (game.getName().equals(file)) {
prev = game;
}
}
normalGames.remove(prev);
File arena = new File(plugin.getDataFolder() + "/arenas/" + file + ".yml");
FileConfiguration yml = YamlConfiguration.loadConfiguration(arena);
String name = yml.getString("name");
String name = yml.getString("name");
if (yml.getString("locations.lobby") == null) {
Bukkit.getServer().getConsoleSender().sendMessage(ChatColor.RED + "The map " + ChatColor.YELLOW + name + " " + ChatColor.RED + "doesn't have lobby location set up.");
Bukkit.getServer().getConsoleSender().sendMessage(ChatColor.RED + "The map " + ChatColor.YELLOW + name + " "
+ ChatColor.RED + "doesn't have lobby location set up.");
}
if (yml.getString("locations.spect") == null) {
Bukkit.getServer().getConsoleSender().sendMessage(ChatColor.RED + "The map " + ChatColor.YELLOW + name + " " + ChatColor.RED + "doesn't have spectator location set up.");
Bukkit.getServer().getConsoleSender().sendMessage(ChatColor.RED + "The map " + ChatColor.YELLOW + name + " "
+ ChatColor.RED + "doesn't have spectator location set up.");
}
Location hRed = null;
Location hBlue = null;
@ -90,7 +93,7 @@ public class GameManager {
if (yml.get("locations.holograms.blue") != null) {
hBlue = getStringLocation(yml.getString("locations.holograms.blue"));
}
plugin.getWC().resetWorld(name);
plugin.getWc().resetWorld(name);
int min = yml.getInt("minPlayers");
int teamSize = yml.getInt("teamSize");
int starting = yml.getInt("timers.starting");
@ -112,21 +115,24 @@ public class GameManager {
for (String locBlue : yml.getStringList("locations.portal.blue")) {
portalBlue.add(getStringLocation(locBlue));
}
normalGames.add(new GameDuo(plugin, name, min, 2 * teamSize, teamSize, starting, prestart, restart, getStringLocation(lobby), getStringLocation(spect), getStringLocation(buildMin), getStringLocation(buildMax), getStringLocation(spawnsRed), getStringLocation(spawnsBlue), portalRed, portalBlue, getStringLocation(respawnsRed), getStringLocation(respawnsBlue), hRed, hBlue));
}
public void resetFourGame(String file) {
GameFour prev = null;
for (GameFour game : fourGames) {
if (game.getName().equals(file)) {
prev = game;
}
}
fourGames.remove(prev);
File arena = new File(plugin.getDataFolder() + "/arenas/" + file + ".yml");
FileConfiguration yml = YamlConfiguration.loadConfiguration(arena);
String name = yml.getString("name");
plugin.getWC().resetWorld(name);
normalGames.add(new GameDuo(plugin, name, min, 2 * teamSize, teamSize, starting, prestart, restart,
getStringLocation(lobby), getStringLocation(spect), getStringLocation(buildMin),
getStringLocation(buildMax), getStringLocation(spawnsRed), getStringLocation(spawnsBlue), portalRed,
portalBlue, getStringLocation(respawnsRed), getStringLocation(respawnsBlue), hRed, hBlue));
}
public void resetFourGame(String file) {
GameFour prev = null;
for (GameFour game : fourGames) {
if (game.getName().equals(file)) {
prev = game;
}
}
fourGames.remove(prev);
File arena = new File(plugin.getDataFolder() + "/arenas/" + file + ".yml");
FileConfiguration yml = YamlConfiguration.loadConfiguration(arena);
String name = yml.getString("name");
plugin.getWc().resetWorld(name);
Location hRed = null;
Location hBlue = null;
Location hGreen = null;
@ -175,11 +181,16 @@ public class GameManager {
for (String locYellow : yml.getStringList("locations.portal.yellow")) {
portalYellow.add(getStringLocation(locYellow));
}
fourGames.add(new GameFour(plugin, name, min, 4 * teamSize, teamSize, starting, prestart, getStringLocation(lobby), getStringLocation(spect), getStringLocation(buildMin), getStringLocation(buildMax), getStringLocation(spawnsRed), getStringLocation(spawnsBlue), getStringLocation(spawnsGreen), getStringLocation(spawnsYellow), getStringLocation(respawnsRed), getStringLocation(respawnsBlue), getStringLocation(respawnsGreen), getStringLocation(respawnsYellow), portalRed, portalBlue, portalGreen, portalYellow, hRed, hBlue, hGreen, hYellow));
}
public void loadGames() {
File folder = new File(plugin.getDataFolder() + "/arenas");
fourGames.add(new GameFour(plugin, name, min, 4 * teamSize, teamSize, starting, prestart,
getStringLocation(lobby), getStringLocation(spect), getStringLocation(buildMin),
getStringLocation(buildMax), getStringLocation(spawnsRed), getStringLocation(spawnsBlue),
getStringLocation(spawnsGreen), getStringLocation(spawnsYellow), getStringLocation(respawnsRed),
getStringLocation(respawnsBlue), getStringLocation(respawnsGreen), getStringLocation(respawnsYellow),
portalRed, portalBlue, portalGreen, portalYellow, hRed, hBlue, hGreen, hYellow));
}
public void loadGames() {
File folder = new File(plugin.getDataFolder() + "/arenas");
File[] listFiles = folder.listFiles();
for (int f = 0; f < listFiles.length; f++) {
if (listFiles[f].isFile()) {
@ -188,14 +199,16 @@ public class GameManager {
if (yml.getString("mode").toLowerCase().equals("normal")) {
String name = yml.getString("name");
if (yml.getString("locations.lobby") == null) {
Bukkit.getServer().getConsoleSender().sendMessage(ChatColor.RED + "The map " + ChatColor.YELLOW + name + " " + ChatColor.RED + "doesn't have lobby location set up.");
Bukkit.getServer().getConsoleSender().sendMessage(ChatColor.RED + "The map " + ChatColor.YELLOW
+ name + " " + ChatColor.RED + "doesn't have lobby location set up.");
continue;
}
if (yml.getString("locations.spect") == null) {
Bukkit.getServer().getConsoleSender().sendMessage(ChatColor.RED + "The map " + ChatColor.YELLOW + name + " " + ChatColor.RED + "doesn't have spectator location set up.");
Bukkit.getServer().getConsoleSender().sendMessage(ChatColor.RED + "The map " + ChatColor.YELLOW
+ name + " " + ChatColor.RED + "doesn't have spectator location set up.");
continue;
}
plugin.getWC().resetWorld(name);
plugin.getWc().resetWorld(name);
Location hRed = null;
Location hBlue = null;
if (yml.get("locations.holograms.red") != null) {
@ -225,11 +238,15 @@ public class GameManager {
for (String locBlue : yml.getStringList("locations.portal.blue")) {
portalBlue.add(getStringLocation(locBlue));
}
normalGames.add(new GameDuo(plugin, name, min, 2 * teamSize, teamSize, starting, prestart, restart, getStringLocation(lobby), getStringLocation(spect), getStringLocation(buildMin), getStringLocation(buildMax), getStringLocation(spawnsRed), getStringLocation(spawnsBlue), portalRed, portalBlue, getStringLocation(respawnsRed), getStringLocation(respawnsBlue), hRed, hBlue));
normalGames.add(new GameDuo(plugin, name, min, 2 * teamSize, teamSize, starting, prestart, restart,
getStringLocation(lobby), getStringLocation(spect), getStringLocation(buildMin),
getStringLocation(buildMax), getStringLocation(spawnsRed), getStringLocation(spawnsBlue),
portalRed, portalBlue, getStringLocation(respawnsRed), getStringLocation(respawnsBlue),
hRed, hBlue));
}
if (yml.getString("mode").toLowerCase().equals("four")) {
String name = yml.getString("name");
plugin.getWC().resetWorld(name);
plugin.getWc().resetWorld(name);
int min = yml.getInt("minPlayers");
Location hRed = null;
Location hBlue = null;
@ -278,103 +295,109 @@ public class GameManager {
for (String locYellow : yml.getStringList("locations.portal.yellow")) {
portalYellow.add(getStringLocation(locYellow));
}
fourGames.add(new GameFour(plugin, name, min, 4 * teamSize, teamSize, starting, prestart, getStringLocation(lobby), getStringLocation(spect), getStringLocation(buildMin), getStringLocation(buildMax), getStringLocation(spawnsRed), getStringLocation(spawnsBlue), getStringLocation(spawnsGreen), getStringLocation(spawnsYellow), getStringLocation(respawnsRed), getStringLocation(respawnsBlue), getStringLocation(respawnsGreen), getStringLocation(respawnsYellow), portalRed, portalBlue, portalGreen, portalYellow, hRed, hBlue, hGreen, hYellow));
fourGames.add(new GameFour(plugin, name, min, 4 * teamSize, teamSize, starting, prestart,
getStringLocation(lobby), getStringLocation(spect), getStringLocation(buildMin),
getStringLocation(buildMax), getStringLocation(spawnsRed), getStringLocation(spawnsBlue),
getStringLocation(spawnsGreen), getStringLocation(spawnsYellow),
getStringLocation(respawnsRed), getStringLocation(respawnsBlue),
getStringLocation(respawnsGreen), getStringLocation(respawnsYellow), portalRed, portalBlue,
portalGreen, portalYellow, hRed, hBlue, hGreen, hYellow));
}
}
}
}
}
public void addPlayerGame(Player p, GameDuo game) {
playerGame.put(p, game);
game.addPlayer(p);
}
public void addPlayerGameFour(Player p, GameFour game) {
playerGameFour.put(p, game);
game.addPlayer(p);
}
public void removePlayerGame(Player p, GameDuo game) {
game.removePlayer(p);
playerGame.remove(p);
plugin.getSb().update(p);
}
public void removePlayerGameFour(Player p, GameFour game) {
game.removePlayer(p);
playerGameFour.remove(p);
plugin.getSb().update(p);
}
public void removePlayerAllGames(Player p) {
for (GameDuo game : normalGames) {
if (game.getGamePlayers().contains(p)) {
game.removePlayer(p);
playerGame.remove(p);
plugin.getSb().update(p);
}
}
}
public void removePlayerFourGames(Player p) {
for (GameFour game : fourGames) {
if (game.getPlayers().contains(p)) {
game.removePlayer(p);
playerGameFour.remove(p);
plugin.getSb().update(p);
}
}
}
public GameDuo getGameByPlayer(Player p) {
if (playerGame.containsKey(p)) {
return playerGame.get(p);
}
return null;
}
public GameFour getGameFourByPlayer(Player p) {
if (playerGameFour.containsKey(p)) {
return playerGameFour.get(p);
}
return null;
}
public GameDuo getGameByName(String name) {
for (GameDuo game : normalGames) {
if (game.getName().equals(name)) {
return game;
}
}
return null;
}
public GameFour getGameFourByName(String name) {
for (GameFour game : fourGames) {
if (game.getName().equals(name)) {
return game;
}
}
return null;
}
public Location getStringLocation(String location) {
String[] l = location.split(";");
World world = Bukkit.getWorld(l[0]);
double x = Double.parseDouble(l[1]);
double y = Double.parseDouble(l[2]);
double z = Double.parseDouble(l[3]);
float yaw = Float.parseFloat(l[4]);
float pitch = Float.parseFloat(l[5]);
return new Location(world, x, y, z, yaw, pitch);
}
public ArrayList<GameDuo> getGames() {
return normalGames;
}
public void addPlayerGame(Player p, GameDuo game) {
playerGame.put(p, game);
game.addPlayer(p);
}
public void addPlayerGameFour(Player p, GameFour game) {
playerGameFour.put(p, game);
game.addPlayer(p);
}
public void removePlayerGame(Player p, GameDuo game) {
game.removePlayer(p);
playerGame.remove(p);
plugin.getSB().update(p);
}
public void removePlayerGameFour(Player p, GameFour game) {
game.removePlayer(p);
playerGameFour.remove(p);
plugin.getSB().update(p);
}
public void removePlayerAllGames(Player p) {
for (GameDuo game : normalGames) {
if (game.getGamePlayers().contains(p)) {
game.removePlayer(p);
playerGame.remove(p);
plugin.getSB().update(p);
}
}
}
public void removePlayerFourGames(Player p) {
for (GameFour game : fourGames) {
if (game.getPlayers().contains(p)) {
game.removePlayer(p);
playerGameFour.remove(p);
plugin.getSB().update(p);
}
}
}
public GameDuo getGameByPlayer(Player p) {
if (playerGame.containsKey(p)) {
return playerGame.get(p);
}
return null;
}
public GameFour getGameFourByPlayer(Player p) {
if (playerGameFour.containsKey(p)) {
return playerGameFour.get(p);
}
return null;
}
public GameDuo getGameByName(String name) {
for (GameDuo game : normalGames) {
if (game.getName().equals(name)) {
return game;
}
}
return null;
}
public GameFour getGameFourByName(String name) {
for (GameFour game : fourGames) {
if (game.getName().equals(name)) {
return game;
}
}
return null;
}
public ArrayList<GameFour> getGamesFour() {
return fourGames;
}
public Location getStringLocation(String location) {
String[] l = location.split(";");
World world = Bukkit.getWorld(l[0]);
double x = Double.parseDouble(l[1]);
double y = Double.parseDouble(l[2]);
double z = Double.parseDouble(l[3]);
float yaw = Float.parseFloat(l[4]);
float pitch = Float.parseFloat(l[5]);
return new Location(world, x, y, z, yaw, pitch);
}
public ArrayList<GameDuo> getGames(){
return normalGames;
}
public ArrayList<GameFour> getGamesFour(){
return fourGames;
}
}

2
MultiArena-TheBridge/src/cx/sfy/TheBridge/managers/LocationManager.java

@ -32,7 +32,7 @@ public class LocationManager {
plugin.getConfig().set("mainLobby", world + ";" + x + ";" + y + ";" + z + ";" + yaw + ";" + pitch);
plugin.saveConfig();
plugin.reloadMainLobby();
p.sendMessage("§aLobby has been setted.");
p.sendMessage("§aLobby has been setted.");
}
public void reloadLocations() {

250
MultiArena-TheBridge/src/cx/sfy/TheBridge/managers/ScoreboardManager.java

@ -22,204 +22,206 @@ public class ScoreboardManager {
private HashMap<Player, String> sb = new HashMap<Player, String>();
private HashMap<Player, ScoreboardUtil> score = new HashMap<Player, ScoreboardUtil>();
Main plugin;
public ScoreboardManager(Main plugin) {
this.plugin = plugin;
}
public HashMap<Player, String> getSB(){
public HashMap<Player, String> getSB() {
return sb;
}
public void createLobbyBoard(Player p) {
sb.put(p, "lobby");
p.getScoreboard().clearSlot(DisplaySlot.SIDEBAR);
ScoreboardUtil scoreboardUtil = new ScoreboardUtil("all", "starting", false);
scoreboardUtil.setName(plugin.getLang().get("scoreboards.main-title"));
String titulo = plugin.getLang().get(p, "scoreboards.main");
String [] title = titulo.split("\\n");
for (Integer n = 1, n2 = title.length - 1; n < title.length + 1; ++n, --n2) {
scoreboardUtil.lines(n, lobby(p, title[n2]));
}
String titulo = plugin.getLang().get(p, "scoreboards.main");
String[] title = titulo.split("\\n");
for (Integer n = 1, n2 = title.length - 1; n < title.length + 1; ++n, --n2) {
scoreboardUtil.lines(n, lobby(p, title[n2]));
}
scoreboardUtil.build(p);
score.put(p, scoreboardUtil);
}
public void createWaitingBoard(Player p) {
sb.put(p, "waiting");
GameDuo game = plugin.getGM().getGameByPlayer(p);
GameDuo game = plugin.getGm().getGameByPlayer(p);
p.getScoreboard().clearSlot(DisplaySlot.SIDEBAR);
ScoreboardUtil scoreboardUtil = new ScoreboardUtil("lobby", "starting", false);
scoreboardUtil.setName(plugin.getLang().get("scoreboards.lobby-title"));
String titulo = plugin.getLang().get(p, "scoreboards.lobby");
String [] title = titulo.split("\\n");
for (Integer n = 1, n2 = title.length - 1; n < title.length + 1; ++n, --n2) {
scoreboardUtil.lines(n, game(p, title[n2], game));
}
String titulo = plugin.getLang().get(p, "scoreboards.lobby");
String[] title = titulo.split("\\n");
for (Integer n = 1, n2 = title.length - 1; n < title.length + 1; ++n, --n2) {
scoreboardUtil.lines(n, game(p, title[n2], game));
}
scoreboardUtil.build(p);
score.put(p, scoreboardUtil);
}
public void createStartingBoard(Player p) {
sb.put(p, "starting");
GameDuo game = plugin.getGM().getGameByPlayer(p);
GameDuo game = plugin.getGm().getGameByPlayer(p);
p.getScoreboard().clearSlot(DisplaySlot.SIDEBAR);
ScoreboardUtil scoreboardUtil = new ScoreboardUtil("starting", "starting", false);
scoreboardUtil.setName(plugin.getLang().get("scoreboards.starting-title"));
String titulo = plugin.getLang().get(p, "scoreboards.starting");
String [] title = titulo.split("\\n");
for (Integer n = 1, n2 = title.length - 1; n < title.length + 1; ++n, --n2) {
scoreboardUtil.lines(n, game(p, title[n2], game));
}
String titulo = plugin.getLang().get(p, "scoreboards.starting");
String[] title = titulo.split("\\n");
for (Integer n = 1, n2 = title.length - 1; n < title.length + 1; ++n, --n2) {
scoreboardUtil.lines(n, game(p, title[n2], game));
}
scoreboardUtil.build(p);
score.put(p, scoreboardUtil);
}
public void createGameBoard(Player p) {
sb.put(p, "game");
GameDuo game = plugin.getGM().getGameByPlayer(p);
GameDuo game = plugin.getGm().getGameByPlayer(p);
p.getScoreboard().clearSlot(DisplaySlot.SIDEBAR);
ScoreboardUtil scoreboardUtil = new ScoreboardUtil("game-normal", "starting", false);
scoreboardUtil.setName(plugin.getLang().get("scoreboards.game-normal-title"));
String titulo = plugin.getLang().get(p, "scoreboards.game-normal");
String [] title = titulo.split("\\n");
for (Integer n = 1, n2 = title.length - 1; n < title.length + 1; ++n, --n2) {
scoreboardUtil.lines(n, game(p, title[n2], game));
}
String titulo = plugin.getLang().get(p, "scoreboards.game-normal");
String[] title = titulo.split("\\n");
for (Integer n = 1, n2 = title.length - 1; n < title.length + 1; ++n, --n2) {
scoreboardUtil.lines(n, game(p, title[n2], game));
}
scoreboardUtil.build(p);
score.put(p, scoreboardUtil);
}
public void createWaitingFourBoard(Player p) {
sb.put(p, "waiting");
GameFour game = plugin.getGM().getGameFourByPlayer(p);
GameFour game = plugin.getGm().getGameFourByPlayer(p);
p.getScoreboard().clearSlot(DisplaySlot.SIDEBAR);
ScoreboardUtil scoreboardUtil = new ScoreboardUtil("lobby", "starting", false);
scoreboardUtil.setName(plugin.getLang().get("scoreboards.lobby-title"));
String titulo = plugin.getLang().get(p, "scoreboards.lobby");
String [] title = titulo.split("\\n");
for (Integer n = 1, n2 = title.length - 1; n < title.length + 1; ++n, --n2) {
scoreboardUtil.lines(n, gameFour(p, title[n2], game));
}
String titulo = plugin.getLang().get(p, "scoreboards.lobby");
String[] title = titulo.split("\\n");
for (Integer n = 1, n2 = title.length - 1; n < title.length + 1; ++n, --n2) {
scoreboardUtil.lines(n, gameFour(p, title[n2], game));
}
scoreboardUtil.build(p);
score.put(p, scoreboardUtil);
}
public void createStartingFourBoard(Player p) {
sb.put(p, "starting");
GameFour game = plugin.getGM().getGameFourByPlayer(p);
GameFour game = plugin.getGm().getGameFourByPlayer(p);
p.getScoreboard().clearSlot(DisplaySlot.SIDEBAR);
ScoreboardUtil scoreboardUtil = new ScoreboardUtil("starting", "starting", false);
scoreboardUtil.setName(plugin.getLang().get("scoreboards.starting-title"));
String titulo = plugin.getLang().get(p, "scoreboards.starting");
String [] title = titulo.split("\\n");
for (Integer n = 1, n2 = title.length - 1; n < title.length + 1; ++n, --n2) {
scoreboardUtil.lines(n, gameFour(p, title[n2], game));
}
String titulo = plugin.getLang().get(p, "scoreboards.starting");
String[] title = titulo.split("\\n");
for (Integer n = 1, n2 = title.length - 1; n < title.length + 1; ++n, --n2) {
scoreboardUtil.lines(n, gameFour(p, title[n2], game));
}
scoreboardUtil.build(p);
score.put(p, scoreboardUtil);
}
public void createGameFourBoard(Player p) {
sb.put(p, "game");
GameFour game = plugin.getGM().getGameFourByPlayer(p);
GameFour game = plugin.getGm().getGameFourByPlayer(p);
p.getScoreboard().clearSlot(DisplaySlot.SIDEBAR);
ScoreboardUtil scoreboardUtil = new ScoreboardUtil("game-four", "starting", false);
scoreboardUtil.setName(plugin.getLang().get("scoreboards.game-four-title"));
String titulo = plugin.getLang().get(p, "scoreboards.game-four");
String [] title = titulo.split("\\n");
for (Integer n = 1, n2 = title.length - 1; n < title.length + 1; ++n, --n2) {
scoreboardUtil.lines(n, gameFour(p, title[n2], game));
}
String titulo = plugin.getLang().get(p, "scoreboards.game-four");
String[] title = titulo.split("\\n");
for (Integer n = 1, n2 = title.length - 1; n < title.length + 1; ++n, --n2) {
scoreboardUtil.lines(n, gameFour(p, title[n2], game));
}
scoreboardUtil.build(p);
score.put(p, scoreboardUtil);
}
public void update(Player p) {
if (p == null || !p.isOnline()) {
return;
}
ScoreboardUtil scoreboardUtil = score.get(p);
if (plugin.getGM().getGameByPlayer(p) == null && plugin.getGM().getGameFourByPlayer(p) == null) {
if (plugin.getGm().getGameByPlayer(p) == null && plugin.getGm().getGameFourByPlayer(p) == null) {
if (sb.get(p).equals("lobby")) {
scoreboardUtil.setName(plugin.getLang().get("scoreboards.main-title"));
String titulo = plugin.getLang().get(p, "scoreboards.main");
String [] title = titulo.split("\\n");
for (Integer n = 1, n2 = title.length - 1; n < title.length + 1; ++n, --n2) {
scoreboardUtil.lines(n, lobby(p, title[n2]));
}
String titulo = plugin.getLang().get(p, "scoreboards.main");
String[] title = titulo.split("\\n");
for (Integer n = 1, n2 = title.length - 1; n < title.length + 1; ++n, --n2) {
scoreboardUtil.lines(n, lobby(p, title[n2]));
}
} else {
createLobbyBoard(p);
}
} else {
if (plugin.getGM().getGameByPlayer(p) != null) {
GameDuo game = plugin.getGM().getGameByPlayer(p);
if (plugin.getGm().getGameByPlayer(p) != null) {
GameDuo game = plugin.getGm().getGameByPlayer(p);
if (game.isState(State.WAITING)) {
if (sb.get(p).equals("waiting")) {
scoreboardUtil.setName(plugin.getLang().get("scoreboards.lobby-title"));
String titulo = plugin.getLang().get(p, "scoreboards.lobby");
String [] title = titulo.split("\\n");
for (Integer n = 1, n2 = title.length - 1; n < title.length + 1; ++n, --n2) {
scoreboardUtil.lines(n, game(p, title[n2], game));
}
String titulo = plugin.getLang().get(p, "scoreboards.lobby");
String[] title = titulo.split("\\n");
for (Integer n = 1, n2 = title.length - 1; n < title.length + 1; ++n, --n2) {
scoreboardUtil.lines(n, game(p, title[n2], game));
}
} else {
createWaitingBoard(p);
}
} else if (game.isState(State.STARTING)) {
if (sb.get(p).equals("starting")) {
scoreboardUtil.setName(plugin.getLang().get("scoreboards.starting-title"));
String titulo = plugin.getLang().get(p, "scoreboards.starting");
String [] title = titulo.split("\\n");
for (Integer n = 1, n2 = title.length - 1; n < title.length + 1; ++n, --n2) {
scoreboardUtil.lines(n, game(p, title[n2], game));
}
String titulo = plugin.getLang().get(p, "scoreboards.starting");
String[] title = titulo.split("\\n");
for (Integer n = 1, n2 = title.length - 1; n < title.length + 1; ++n, --n2) {
scoreboardUtil.lines(n, game(p, title[n2], game));
}
} else {
createStartingBoard(p);
}
} else if (game.isState(State.INGAME) || game.isState(State.PREGAME) || game.isState(State.FINISH) || game.isState(State.RESTARTING)) {
} else if (game.isState(State.INGAME) || game.isState(State.PREGAME) || game.isState(State.FINISH)
|| game.isState(State.RESTARTING)) {
if (sb.get(p).equals("game")) {
scoreboardUtil.setName(plugin.getLang().get("scoreboards.game-normal-title"));
String titulo = plugin.getLang().get(p, "scoreboards.game-normal");
String [] title = titulo.split("\\n");
for (Integer n = 1, n2 = title.length - 1; n < title.length + 1; ++n, --n2) {
scoreboardUtil.lines(n, game(p, title[n2], game));
}
String titulo = plugin.getLang().get(p, "scoreboards.game-normal");
String[] title = titulo.split("\\n");
for (Integer n = 1, n2 = title.length - 1; n < title.length + 1; ++n, --n2) {
scoreboardUtil.lines(n, game(p, title[n2], game));
}
} else {
createGameBoard(p);
}
}
} else if (plugin.getGM().getGameFourByPlayer(p) != null) {
GameFour game = plugin.getGM().getGameFourByPlayer(p);
} else if (plugin.getGm().getGameFourByPlayer(p) != null) {
GameFour game = plugin.getGm().getGameFourByPlayer(p);
if (game.isState(FState.WAITING)) {
if (sb.get(p).equals("waiting")) {
scoreboardUtil.setName(plugin.getLang().get("scoreboards.lobby-title"));
String titulo = plugin.getLang().get(p, "scoreboards.lobby");
String [] title = titulo.split("\\n");
for (Integer n = 1, n2 = title.length - 1; n < title.length + 1; ++n, --n2) {
scoreboardUtil.lines(n, gameFour(p, title[n2], game));
}
String titulo = plugin.getLang().get(p, "scoreboards.lobby");
String[] title = titulo.split("\\n");
for (Integer n = 1, n2 = title.length - 1; n < title.length + 1; ++n, --n2) {
scoreboardUtil.lines(n, gameFour(p, title[n2], game));
}
} else {
createWaitingFourBoard(p);
}
} else if (game.isState(FState.STARTING)) {
if (sb.get(p).equals("starting")) {
scoreboardUtil.setName(plugin.getLang().get("scoreboards.starting-title"));
String titulo = plugin.getLang().get(p, "scoreboards.starting");
String [] title = titulo.split("\\n");
for (Integer n = 1, n2 = title.length - 1; n < title.length + 1; ++n, --n2) {
scoreboardUtil.lines(n, gameFour(p, title[n2], game));
}
String titulo = plugin.getLang().get(p, "scoreboards.starting");
String[] title = titulo.split("\\n");
for (Integer n = 1, n2 = title.length - 1; n < title.length + 1; ++n, --n2) {
scoreboardUtil.lines(n, gameFour(p, title[n2], game));
}
} else {
createStartingFourBoard(p);
}
} else if (game.isState(FState.INGAME) || game.isState(FState.PREGAME) || game.isState(FState.FINISH) || game.isState(FState.RESTARTING)) {
} else if (game.isState(FState.INGAME) || game.isState(FState.PREGAME) || game.isState(FState.FINISH)
|| game.isState(FState.RESTARTING)) {
if (sb.get(p).equals("game")) {
scoreboardUtil.setName(plugin.getLang().get("scoreboards.game-four-title"));
String titulo = plugin.getLang().get(p, "scoreboards.game-four");
String [] title = titulo.split("\\n");
for (Integer n = 1, n2 = title.length - 1; n < title.length + 1; ++n, --n2) {
scoreboardUtil.lines(n, gameFour(p, title[n2], game));
}
String titulo = plugin.getLang().get(p, "scoreboards.game-four");
String[] title = titulo.split("\\n");
for (Integer n = 1, n2 = title.length - 1; n < title.length + 1; ++n, --n2) {
scoreboardUtil.lines(n, gameFour(p, title[n2], game));
}
} else {
createGameFourBoard(p);
}
@ -227,38 +229,48 @@ public class ScoreboardManager {
}
}
}
Date now = new Date();
SimpleDateFormat sm = new SimpleDateFormat("dd/MM/yy");
public String lobby(Player p, String c) {
if (plugin.getPlaceholder()) {
return PlaceholderAPI.setPlaceholders(p, c.replaceAll("<online>", String.valueOf(Bukkit.getOnlinePlayers().size())).replaceAll("<player>", p.getName()));
if (plugin.isPlaceholder()) {
return PlaceholderAPI.setPlaceholders(p,
c.replaceAll("<online>", String.valueOf(Bukkit.getOnlinePlayers().size())).replaceAll("<player>",
p.getName()));
} else {
return c.replaceAll("<online>", String.valueOf(Bukkit.getOnlinePlayers().size())).replaceAll("<player>", p.getName());
return c.replaceAll("<online>", String.valueOf(Bukkit.getOnlinePlayers().size())).replaceAll("<player>",
p.getName());
}
}
public String game(Player p, String c, GameDuo game) {
if (plugin.getPlaceholder()) {
return PlaceholderAPI.setPlaceholders(p, c
.replaceAll("<goals>", String.valueOf(game.getGoals(p)))
.replaceAll("<kills>", String.valueOf(game.getKills(p)))
.replaceAll("<date>", sm.format(now))
if (plugin.isPlaceholder()) {
return PlaceholderAPI.setPlaceholders(p, c.replaceAll("<goals>", String.valueOf(game.getGoals(p)))
.replaceAll("<kills>", String.valueOf(game.getKills(p))).replaceAll("<date>", sm.format(now))
.replaceAll("<blueGoals>", String.valueOf(game.getTeams().get(ChatColor.BLUE).getGoals()))
.replaceAll("<redGoals>", String.valueOf(game.getTeams().get(ChatColor.RED).getGoals()))
.replaceAll("<time>", String.valueOf(game.getStarting())).replaceAll("<s>", (game.getStarting() > 1) ? "s" : "").replaceAll("<max>", String.valueOf(game.getMax())).replaceAll("<players>", String.valueOf(game.getPlayers())).replaceAll("<map>", game.getName()).replaceAll("<mode>", game.getMode()).replaceAll("<server>", plugin.getConfig().getString("server")));
.replaceAll("<time>", String.valueOf(game.getStarting()))
.replaceAll("<s>", (game.getStarting() > 1) ? "s" : "")
.replaceAll("<max>", String.valueOf(game.getMax()))
.replaceAll("<players>", String.valueOf(game.getPlayers())).replaceAll("<map>", game.getName())
.replaceAll("<mode>", game.getMode())
.replaceAll("<server>", plugin.getConfig().getString("server")));
} else {
return c.replaceAll("<goals>", String.valueOf(game.getGoals(p)))
.replaceAll("<kills>", String.valueOf(game.getKills(p)))
.replaceAll("<date>", sm.format(now))
.replaceAll("<kills>", String.valueOf(game.getKills(p))).replaceAll("<date>", sm.format(now))
.replaceAll("<blueGoals>", String.valueOf(game.getTeams().get(ChatColor.BLUE).getGoals()))
.replaceAll("<redGoals>", String.valueOf(game.getTeams().get(ChatColor.RED).getGoals()))
.replaceAll("<time>", String.valueOf(game.getStarting())).replaceAll("<max>", String.valueOf(game.getMax())).replaceAll("<players>", String.valueOf(game.getPlayers())).replaceAll("<map>", game.getName()).replaceAll("<mode>", game.getMode()).replaceAll("<server>", plugin.getConfig().getString("server"));
.replaceAll("<time>", String.valueOf(game.getStarting()))
.replaceAll("<max>", String.valueOf(game.getMax()))
.replaceAll("<players>", String.valueOf(game.getPlayers())).replaceAll("<map>", game.getName())
.replaceAll("<mode>", game.getMode())
.replaceAll("<server>", plugin.getConfig().getString("server"));
}
}
public String gameFour(Player p, String c, GameFour game) {
if (plugin.getPlaceholder()) {
if (plugin.isPlaceholder()) {
return PlaceholderAPI.setPlaceholders(p, c.replaceAll("<red>", game.getTeams().get(ChatColor.RED).getAlly())
.replaceAll("<redLife>", game.getTeams().get(ChatColor.RED).getLifeString())
.replaceAll("<blue>", game.getTeams().get(ChatColor.BLUE).getAlly())
@ -267,7 +279,13 @@ public class ScoreboardManager {
.replaceAll("<yellowLife>", game.getTeams().get(ChatColor.YELLOW).getLifeString())
.replaceAll("<green>", game.getTeams().get(ChatColor.GREEN).getAlly())
.replaceAll("<greenLife>", game.getTeams().get(ChatColor.GREEN).getLifeString())
.replaceAll("<goals>", String.valueOf(game.getGoals(p))).replaceAll("<kills>", String.valueOf(game.getKills(p))).replaceAll("<date>", sm.format(now)).replaceAll("<server>", plugin.getConfig().getString("server")).replaceAll("<players>", String.valueOf(game.getPlayers().size())).replaceAll("<max>", String.valueOf(game.getMax())).replaceAll("<mode>", game.getMode()).replaceAll("<map>", game.getName()).replaceAll("<time>", String.valueOf(game.getStarting())).replaceAll("<s>", (game.getStarting() > 1) ? "s" : ""));
.replaceAll("<goals>", String.valueOf(game.getGoals(p)))
.replaceAll("<kills>", String.valueOf(game.getKills(p))).replaceAll("<date>", sm.format(now))
.replaceAll("<server>", plugin.getConfig().getString("server"))
.replaceAll("<players>", String.valueOf(game.getPlayers().size()))
.replaceAll("<max>", String.valueOf(game.getMax())).replaceAll("<mode>", game.getMode())
.replaceAll("<map>", game.getName()).replaceAll("<time>", String.valueOf(game.getStarting()))
.replaceAll("<s>", (game.getStarting() > 1) ? "s" : ""));
}
return c.replaceAll("<red>", game.getTeams().get(ChatColor.RED).getAlly())
.replaceAll("<redLife>", game.getTeams().get(ChatColor.RED).getLifeString())
@ -277,12 +295,18 @@ public class ScoreboardManager {
.replaceAll("<yellowLife>", game.getTeams().get(ChatColor.YELLOW).getLifeString())
.replaceAll("<green>", game.getTeams().get(ChatColor.GREEN).getAlly())
.replaceAll("<greenLife>", game.getTeams().get(ChatColor.GREEN).getLifeString())
.replaceAll("<goals>", String.valueOf(game.getGoals(p))).replaceAll("<kills>", String.valueOf(game.getKills(p))).replaceAll("<date>", sm.format(now)).replaceAll("<server>", plugin.getConfig().getString("server")).replaceAll("<players>", String.valueOf(game.getPlayers().size())).replaceAll("<max>", String.valueOf(game.getMax())).replaceAll("<mode>", game.getMode()).replaceAll("<map>", game.getName()).replaceAll("<time>", String.valueOf(game.getStarting())).replaceAll("<s>", (game.getStarting() > 1) ? "s" : "");
.replaceAll("<goals>", String.valueOf(game.getGoals(p)))
.replaceAll("<kills>", String.valueOf(game.getKills(p))).replaceAll("<date>", sm.format(now))
.replaceAll("<server>", plugin.getConfig().getString("server"))
.replaceAll("<players>", String.valueOf(game.getPlayers().size()))
.replaceAll("<max>", String.valueOf(game.getMax())).replaceAll("<mode>", game.getMode())
.replaceAll("<map>", game.getName()).replaceAll("<time>", String.valueOf(game.getStarting()))
.replaceAll("<s>", (game.getStarting() > 1) ? "s" : "");
}
public void remove(Player p) {
sb.remove(p);
score.remove(p);
}
}

147
MultiArena-TheBridge/src/cx/sfy/TheBridge/managers/SignManager.java

@ -43,27 +43,27 @@ public class SignManager {
}
}
public HashMap<Location, GameNormalSign> getSigns(){
public HashMap<Location, GameNormalSign> getSigns() {
return gameSign;
}
public HashMap<Location, GameFourSign> getFourSigns(){
public HashMap<Location, GameFourSign> getFourSigns() {
return gameFourSign;
}
@SuppressWarnings("deprecation")
public Block getBlockFaced(Block b) {
switch (b.getData()) {
case 2:
return b.getRelative(BlockFace.SOUTH);
case 3:
return b.getRelative(BlockFace.NORTH);
case 4:
return b.getRelative(BlockFace.EAST);
case 5:
return b.getRelative(BlockFace.WEST);
default:
return b;
case 2:
return b.getRelative(BlockFace.SOUTH);
case 3:
return b.getRelative(BlockFace.NORTH);
case 4:
return b.getRelative(BlockFace.EAST);
case 5:
return b.getRelative(BlockFace.WEST);
default:
return b;
}
}
@ -71,11 +71,23 @@ public class SignManager {
plugin.getSigns().set("signs.normal." + game + ".loc", getLocationString(loc));
plugin.getSigns().set("signs.normal." + game + ".game", game);
gameSign.put(loc, new GameNormalSign(loc, game, getBlockFaced(loc.getBlock())));
final GameDuo gname = plugin.getGM().getGameByName(game);
sign.setLine(0, plugin.getLang().get("signs.normal.line-1").replaceAll("<state>", getState(gname.getState())).replaceAll("<name>", game).replaceAll("<players>", String.valueOf(gname.getPlayers())).replaceAll("<max>", String.valueOf(gname.getMax())));
sign.setLine(1, plugin.getLang().get("signs.normal.line-2").replaceAll("<state>", getState(gname.getState())).replaceAll("<name>", game).replaceAll("<players>", String.valueOf(gname.getPlayers())).replaceAll("<max>", String.valueOf(gname.getMax())));
sign.setLine(2, plugin.getLang().get("signs.normal.line-3").replaceAll("<state>", getState(gname.getState())).replaceAll("<name>", game).replaceAll("<players>", String.valueOf(gname.getPlayers())).replaceAll("<max>", String.valueOf(gname.getMax())));
sign.setLine(3, plugin.getLang().get("signs.normal.line-4").replaceAll("<state>", getState(gname.getState())).replaceAll("<name>", game).replaceAll("<players>", String.valueOf(gname.getPlayers())).replaceAll("<max>", String.valueOf(gname.getMax())));
final GameDuo gname = plugin.getGm().getGameByName(game);
sign.setLine(0,
plugin.getLang().get("signs.normal.line-1").replaceAll("<state>", getState(gname.getState()))
.replaceAll("<name>", game).replaceAll("<players>", String.valueOf(gname.getPlayers()))
.replaceAll("<max>", String.valueOf(gname.getMax())));
sign.setLine(1,
plugin.getLang().get("signs.normal.line-2").replaceAll("<state>", getState(gname.getState()))
.replaceAll("<name>", game).replaceAll("<players>", String.valueOf(gname.getPlayers()))
.replaceAll("<max>", String.valueOf(gname.getMax())));
sign.setLine(2,
plugin.getLang().get("signs.normal.line-3").replaceAll("<state>", getState(gname.getState()))
.replaceAll("<name>", game).replaceAll("<players>", String.valueOf(gname.getPlayers()))
.replaceAll("<max>", String.valueOf(gname.getMax())));
sign.setLine(3,
plugin.getLang().get("signs.normal.line-4").replaceAll("<state>", getState(gname.getState()))
.replaceAll("<name>", game).replaceAll("<players>", String.valueOf(gname.getPlayers()))
.replaceAll("<max>", String.valueOf(gname.getMax())));
sign.update(true);
plugin.getSigns().save();
}
@ -84,11 +96,23 @@ public class SignManager {
plugin.getSigns().set("signs.four." + game + ".loc", getLocationString(loc));
plugin.getSigns().set("signs.four." + game + ".game", game);
gameFourSign.put(loc, new GameFourSign(loc, game, getBlockFaced(loc.getBlock())));
final GameFour gname = plugin.getGM().getGameFourByName(game);
sign.setLine(0, plugin.getLang().get("signs.four.line-1").replaceAll("<state>", getState(gname.getState())).replaceAll("<name>", game).replaceAll("<players>", String.valueOf(gname.getPlayers().size())).replaceAll("<max>", String.valueOf(gname.getMax())));
sign.setLine(1, plugin.getLang().get("signs.four.line-2").replaceAll("<state>", getState(gname.getState())).replaceAll("<name>", game).replaceAll("<players>", String.valueOf(gname.getPlayers().size())).replaceAll("<max>", String.valueOf(gname.getMax())));
sign.setLine(2, plugin.getLang().get("signs.four.line-3").replaceAll("<state>", getState(gname.getState())).replaceAll("<name>", game).replaceAll("<players>", String.valueOf(gname.getPlayers().size())).replaceAll("<max>", String.valueOf(gname.getMax())));
sign.setLine(3, plugin.getLang().get("signs.four.line-4").replaceAll("<state>", getState(gname.getState())).replaceAll("<name>", game).replaceAll("<players>", String.valueOf(gname.getPlayers().size())).replaceAll("<max>", String.valueOf(gname.getMax())));
final GameFour gname = plugin.getGm().getGameFourByName(game);
sign.setLine(0,
plugin.getLang().get("signs.four.line-1").replaceAll("<state>", getState(gname.getState()))
.replaceAll("<name>", game).replaceAll("<players>", String.valueOf(gname.getPlayers().size()))
.replaceAll("<max>", String.valueOf(gname.getMax())));
sign.setLine(1,
plugin.getLang().get("signs.four.line-2").replaceAll("<state>", getState(gname.getState()))
.replaceAll("<name>", game).replaceAll("<players>", String.valueOf(gname.getPlayers().size()))
.replaceAll("<max>", String.valueOf(gname.getMax())));
sign.setLine(2,
plugin.getLang().get("signs.four.line-3").replaceAll("<state>", getState(gname.getState()))
.replaceAll("<name>", game).replaceAll("<players>", String.valueOf(gname.getPlayers().size()))
.replaceAll("<max>", String.valueOf(gname.getMax())));
sign.setLine(3,
plugin.getLang().get("signs.four.line-4").replaceAll("<state>", getState(gname.getState()))
.replaceAll("<name>", game).replaceAll("<players>", String.valueOf(gname.getPlayers().size()))
.replaceAll("<max>", String.valueOf(gname.getMax())));
sign.update(true);
plugin.getSigns().save();
}
@ -97,10 +121,26 @@ public class SignManager {
for (final GameNormalSign sig : gameSign.values())
if (sig.getGame().equals(game.getName())) {
final Sign sign = sig.getSign();
sign.setLine(0, plugin.getLang().get("signs.normal.line-1").replaceAll("<state>", getState(game.getState())).replaceAll("<name>", game.getName()).replaceAll("<players>", String.valueOf(game.getPlayers())).replaceAll("<max>", String.valueOf(game.getMax())));
sign.setLine(1, plugin.getLang().get("signs.normal.line-2").replaceAll("<state>", getState(game.getState())).replaceAll("<name>", game.getName()).replaceAll("<players>", String.valueOf(game.getPlayers())).replaceAll("<max>", String.valueOf(game.getMax())));
sign.setLine(2, plugin.getLang().get("signs.normal.line-3").replaceAll("<state>", getState(game.getState())).replaceAll("<name>", game.getName()).replaceAll("<players>", String.valueOf(game.getPlayers())).replaceAll("<max>", String.valueOf(game.getMax())));
sign.setLine(3, plugin.getLang().get("signs.normal.line-4").replaceAll("<state>", getState(game.getState())).replaceAll("<name>", game.getName()).replaceAll("<players>", String.valueOf(game.getPlayers())).replaceAll("<max>", String.valueOf(game.getMax())));
sign.setLine(0,
plugin.getLang().get("signs.normal.line-1").replaceAll("<state>", getState(game.getState()))
.replaceAll("<name>", game.getName())
.replaceAll("<players>", String.valueOf(game.getPlayers()))
.replaceAll("<max>", String.valueOf(game.getMax())));
sign.setLine(1,
plugin.getLang().get("signs.normal.line-2").replaceAll("<state>", getState(game.getState()))
.replaceAll("<name>", game.getName())
.replaceAll("<players>", String.valueOf(game.getPlayers()))
.replaceAll("<max>", String.valueOf(game.getMax())));
sign.setLine(2,
plugin.getLang().get("signs.normal.line-3").replaceAll("<state>", getState(game.getState()))
.replaceAll("<name>", game.getName())
.replaceAll("<players>", String.valueOf(game.getPlayers()))
.replaceAll("<max>", String.valueOf(game.getMax())));
sign.setLine(3,
plugin.getLang().get("signs.normal.line-4").replaceAll("<state>", getState(game.getState()))
.replaceAll("<name>", game.getName())
.replaceAll("<players>", String.valueOf(game.getPlayers()))
.replaceAll("<max>", String.valueOf(game.getMax())));
sign.update();
updateBlock(game, sig.getRetract());
}
@ -110,51 +150,68 @@ public class SignManager {
for (final GameFourSign sig : gameFourSign.values())
if (sig.getGame().equals(game.getName())) {
final Sign sign = sig.getSign();
sign.setLine(0, plugin.getLang().get("signs.four.line-1").replaceAll("<state>", getState(game.getState())).replaceAll("<name>", game.getName()).replaceAll("<players>", String.valueOf(game.getPlayers().size())).replaceAll("<max>", String.valueOf(game.getMax())));
sign.setLine(1, plugin.getLang().get("signs.four.line-2").replaceAll("<state>", getState(game.getState())).replaceAll("<name>", game.getName()).replaceAll("<players>", String.valueOf(game.getPlayers().size())).replaceAll("<max>", String.valueOf(game.getMax())));
sign.setLine(2, plugin.getLang().get("signs.four.line-3").replaceAll("<state>", getState(game.getState())).replaceAll("<name>", game.getName()).replaceAll("<players>", String.valueOf(game.getPlayers().size())).replaceAll("<max>", String.valueOf(game.getMax())));
sign.setLine(3, plugin.getLang().get("signs.four.line-4").replaceAll("<state>", getState(game.getState())).replaceAll("<name>", game.getName()).replaceAll("<players>", String.valueOf(game.getPlayers().size())).replaceAll("<max>", String.valueOf(game.getMax())));
sign.setLine(0,
plugin.getLang().get("signs.four.line-1").replaceAll("<state>", getState(game.getState()))
.replaceAll("<name>", game.getName())
.replaceAll("<players>", String.valueOf(game.getPlayers().size()))
.replaceAll("<max>", String.valueOf(game.getMax())));
sign.setLine(1,
plugin.getLang().get("signs.four.line-2").replaceAll("<state>", getState(game.getState()))
.replaceAll("<name>", game.getName())
.replaceAll("<players>", String.valueOf(game.getPlayers().size()))
.replaceAll("<max>", String.valueOf(game.getMax())));
sign.setLine(2,
plugin.getLang().get("signs.four.line-3").replaceAll("<state>", getState(game.getState()))
.replaceAll("<name>", game.getName())
.replaceAll("<players>", String.valueOf(game.getPlayers().size()))
.replaceAll("<max>", String.valueOf(game.getMax())));
sign.setLine(3,
plugin.getLang().get("signs.four.line-4").replaceAll("<state>", getState(game.getState()))
.replaceAll("<name>", game.getName())
.replaceAll("<players>", String.valueOf(game.getPlayers().size()))
.replaceAll("<max>", String.valueOf(game.getMax())));
sign.update();
updateBlock(game, sig.getRetract());
}
}
public Location getStringLocation(String location) {
final String [] loca = location.split(";");
final Location loc = new Location(Bukkit.getWorld(loca[0]), Double.valueOf(loca[1]), Double.valueOf(loca[2]), Double.valueOf(loca[3]), Float.valueOf(loca[4]), Float.valueOf(loca[5]));
final String[] loca = location.split(";");
final Location loc = new Location(Bukkit.getWorld(loca[0]), Double.valueOf(loca[1]), Double.valueOf(loca[2]),
Double.valueOf(loca[3]), Float.valueOf(loca[4]), Float.valueOf(loca[5]));
return loc;
}
@SuppressWarnings("deprecation")
public void updateBlock(GameDuo game, Block b) {
if (game.isState(State.WAITING))
b.setData((byte)plugin.getConfig().getInt("signs.waiting"));
b.setData((byte) plugin.getConfig().getInt("signs.waiting"));
if (game.isState(State.STARTING))
b.setData((byte)plugin.getConfig().getInt("signs.starting"));
b.setData((byte) plugin.getConfig().getInt("signs.starting"));
if (game.isState(State.PREGAME))
b.setData((byte)plugin.getConfig().getInt("signs.ingame"));
b.setData((byte) plugin.getConfig().getInt("signs.ingame"));
if (game.isState(State.INGAME))
b.setData((byte)plugin.getConfig().getInt("signs.ingame"));
b.setData((byte) plugin.getConfig().getInt("signs.ingame"));
if (game.isState(State.FINISH))
b.setData((byte)plugin.getConfig().getInt("signs.full"));
b.setData((byte) plugin.getConfig().getInt("signs.full"));
if (game.isState(State.RESTARTING))
b.setData((byte)plugin.getConfig().getInt("signs.restart"));
b.setData((byte) plugin.getConfig().getInt("signs.restart"));
}
@SuppressWarnings("deprecation")
public void updateBlock(GameFour game, Block b) {
if (game.isState(FState.WAITING))
b.setData((byte)plugin.getConfig().getInt("signs.waiting"));
b.setData((byte) plugin.getConfig().getInt("signs.waiting"));
if (game.isState(FState.STARTING))
b.setData((byte)plugin.getConfig().getInt("signs.starting"));
b.setData((byte) plugin.getConfig().getInt("signs.starting"));
if (game.isState(FState.PREGAME))
b.setData((byte)plugin.getConfig().getInt("signs.ingame"));
b.setData((byte) plugin.getConfig().getInt("signs.ingame"));
if (game.isState(FState.INGAME))
b.setData((byte)plugin.getConfig().getInt("signs.ingame"));
b.setData((byte) plugin.getConfig().getInt("signs.ingame"));
if (game.isState(FState.FINISH))
b.setData((byte)plugin.getConfig().getInt("signs.full"));
b.setData((byte) plugin.getConfig().getInt("signs.full"));
if (game.isState(FState.RESTARTING))
b.setData((byte)plugin.getConfig().getInt("signs.restart"));
b.setData((byte) plugin.getConfig().getInt("signs.restart"));
}
protected String getState(FState state) {
@ -189,7 +246,7 @@ public class SignManager {
return "";
}
public String getLocationString(Location loc){
public String getLocationString(Location loc) {
final String world = loc.getWorld().getName();
final double x = loc.getX();
final double y = loc.getY();

12
MultiArena-TheBridge/src/cx/sfy/TheBridge/managers/TitleManager.java

@ -45,23 +45,23 @@ public class TitleManager {
public void sendPreTitle(Player p, int time, boolean s) {
if (s)
plugin.getNMS().sendTitle(p, pfadein, pstayin, pfadeout, preTitle.replaceAll("<none>", "").replaceAll("<time>", String.valueOf(time)).replaceAll("<s>", "s"), preSubTitle.replaceAll("<none>", "").replaceAll("<time>", String.valueOf(time)).replaceAll("<s>", "s"));
plugin.getNms().sendTitle(p, pfadein, pstayin, pfadeout, preTitle.replaceAll("<none>", "").replaceAll("<time>", String.valueOf(time)).replaceAll("<s>", "s"), preSubTitle.replaceAll("<none>", "").replaceAll("<time>", String.valueOf(time)).replaceAll("<s>", "s"));
else
plugin.getNMS().sendTitle(p, pfadein, pstayin, pfadeout, preTitle.replaceAll("<none>", "").replaceAll("<time>", String.valueOf(time)).replaceAll("<s>", ""), preSubTitle.replaceAll("<none>", "").replaceAll("<time>", String.valueOf(time)).replaceAll("<s>", ""));
plugin.getNms().sendTitle(p, pfadein, pstayin, pfadeout, preTitle.replaceAll("<none>", "").replaceAll("<time>", String.valueOf(time)).replaceAll("<s>", ""), preSubTitle.replaceAll("<none>", "").replaceAll("<time>", String.valueOf(time)).replaceAll("<s>", ""));
}
public void sendStartTitle(Player p, int time, boolean s) {
if (s)
plugin.getNMS().sendTitle(p, sfadein, sstayin, sfadeout, startTitle.replaceAll("<none>", "").replaceAll("<time>", getColor(time) + String.valueOf(time)).replaceAll("<s>", "s"), startSubTitle.replaceAll("<none>", "").replaceAll("<time>", getColor(time) + String.valueOf(time)).replaceAll("<s>", "s"));
plugin.getNms().sendTitle(p, sfadein, sstayin, sfadeout, startTitle.replaceAll("<none>", "").replaceAll("<time>", getColor(time) + String.valueOf(time)).replaceAll("<s>", "s"), startSubTitle.replaceAll("<none>", "").replaceAll("<time>", getColor(time) + String.valueOf(time)).replaceAll("<s>", "s"));
else
plugin.getNMS().sendTitle(p, sfadein, sstayin, sfadeout, startTitle.replaceAll("<none>", "").replaceAll("<time>", getColor(time) + String.valueOf(time)).replaceAll("<s>", ""), startSubTitle.replaceAll("<none>", "").replaceAll("<time>", getColor(time) + String.valueOf(time)).replaceAll("<s>", ""));
plugin.getNms().sendTitle(p, sfadein, sstayin, sfadeout, startTitle.replaceAll("<none>", "").replaceAll("<time>", getColor(time) + String.valueOf(time)).replaceAll("<s>", ""), startSubTitle.replaceAll("<none>", "").replaceAll("<time>", getColor(time) + String.valueOf(time)).replaceAll("<s>", ""));
}
public void sendReStartTitle(final Player w, final Player p, final int time, final boolean s) {
if (s)
this.plugin.getNMS().sendTitle(p, this.rfadein, this.rstayin, this.rfadeout, this.restartTitle.replaceAll("<color>", new StringBuilder().append(this.plugin.getGM().getGameByPlayer(p).getTeamPlayer(w).getColor()).toString()).replaceAll("<player>", w.getName()).replaceAll("<none>", "").replaceAll("<time>", String.valueOf(time)).replaceAll("<s>", "s"), this.restartSubTitle.replaceAll("<color>", new StringBuilder().append(this.plugin.getGM().getGameByPlayer(p).getTeamPlayer(w).getColor()).toString()).replaceAll("<player>", w.getName()).replaceAll("<none>", "").replaceAll("<time>", String.valueOf(time)).replaceAll("<s>", "s"));
this.plugin.getNms().sendTitle(p, this.rfadein, this.rstayin, this.rfadeout, this.restartTitle.replaceAll("<color>", new StringBuilder().append(this.plugin.getGm().getGameByPlayer(p).getTeamPlayer(w).getColor()).toString()).replaceAll("<player>", w.getName()).replaceAll("<none>", "").replaceAll("<time>", String.valueOf(time)).replaceAll("<s>", "s"), this.restartSubTitle.replaceAll("<color>", new StringBuilder().append(this.plugin.getGm().getGameByPlayer(p).getTeamPlayer(w).getColor()).toString()).replaceAll("<player>", w.getName()).replaceAll("<none>", "").replaceAll("<time>", String.valueOf(time)).replaceAll("<s>", "s"));
else
this.plugin.getNMS().sendTitle(p, this.rfadein, this.rstayin, this.rfadeout, this.restartTitle.replaceAll("<color>", new StringBuilder().append(this.plugin.getGM().getGameByPlayer(p).getTeamPlayer(w).getColor()).toString()).replaceAll("<player>", w.getName()).replaceAll("<none>", "").replaceAll("<time>", String.valueOf(time)).replaceAll("<s>", ""), this.restartSubTitle.replaceAll("<color>", new StringBuilder().append(this.plugin.getGM().getGameByPlayer(p).getTeamPlayer(w).getColor()).toString()).replaceAll("<player>", w.getName()).replaceAll("<none>", "").replaceAll("<time>", String.valueOf(time)).replaceAll("<s>", ""));
this.plugin.getNms().sendTitle(p, this.rfadein, this.rstayin, this.rfadeout, this.restartTitle.replaceAll("<color>", new StringBuilder().append(this.plugin.getGm().getGameByPlayer(p).getTeamPlayer(w).getColor()).toString()).replaceAll("<player>", w.getName()).replaceAll("<none>", "").replaceAll("<time>", String.valueOf(time)).replaceAll("<s>", ""), this.restartSubTitle.replaceAll("<color>", new StringBuilder().append(this.plugin.getGm().getGameByPlayer(p).getTeamPlayer(w).getColor()).toString()).replaceAll("<player>", w.getName()).replaceAll("<none>", "").replaceAll("<time>", String.valueOf(time)).replaceAll("<s>", ""));
}
private ChatColor getColor(int time) {

61
MultiArena-TheBridge/src/cx/sfy/TheBridge/managers/TopManager.java

@ -16,7 +16,7 @@ import cx.sfy.TheBridge.tops.Top;
import me.clip.placeholderapi.PlaceholderAPI;
public class TopManager {
private HashMap<Integer, Top> nkills = new HashMap<Integer, Top>();
private HashMap<Integer, Top> nwins = new HashMap<Integer, Top>();
private HashMap<Integer, Top> ngoals = new HashMap<Integer, Top>();
@ -32,35 +32,34 @@ public class TopManager {
private HashMap<Player, ArrayList<TruenoHologram>> playerHolo = new HashMap<Player, ArrayList<TruenoHologram>>();
private HashMap<BoardType, TruenoHologram> holo = new HashMap<BoardType, TruenoHologram>();
Main plugin;
public TopManager(Main plugin) {
this.plugin = plugin;
}
public void updateTops() {
plugin.getLM().reloadLocations();
plugin.getLm().reloadLocations();
nkills.clear();
nwins.clear();
ngoals.clear();
fkills.clear();
fwins.clear();
fgoals.clear();
plugin.getDB().loadNormalKills();
plugin.getDB().loadNormalWins();
plugin.getDB().loadNormalGoals();
plugin.getDB().loadFourKills();
plugin.getDB().loadFourWins();
plugin.getDB().loadFourGoals();
plugin.getDb().loadNormalKills();
plugin.getDb().loadNormalWins();
plugin.getDb().loadNormalGoals();
plugin.getDb().loadFourKills();
plugin.getDb().loadFourWins();
plugin.getDb().loadFourGoals();
Bukkit.getConsoleSender().sendMessage(ChatColor.GREEN + "Tops Updated");
}
public void createInfo(Player p) {
if (!playerHolo.containsKey(p)) {
playerHolo.put(p, new ArrayList<TruenoHologram>());
}
removeHolo(p);
if (plugin.getLM().getStats() != null) {
if (plugin.getLm().getStats() != null) {
ArrayList<String> stats = new ArrayList<String>();
Bukkit.getServer().getScheduler().runTaskLater(plugin, new Runnable() {
@Override
@ -69,26 +68,26 @@ public class TopManager {
stats.add(PlaceholderAPI.setPlaceholders(p, ChatColor.translateAlternateColorCodes('&', msg2)));
}
TruenoHologram hologram2 = TruenoHologramAPI.getNewHologram();
hologram2.setupPlayerHologram(p, plugin.getLM().getStats(), stats);
hologram2.setupPlayerHologram(p, plugin.getLm().getStats(), stats);
hologram2.display();
playerHolo.get(p).add(hologram2);
}
}, 20L);
}
}
public void removeHolo(Player p) {
for (TruenoHologram holo : playerHolo.get(p)) {
holo.delete();
}
}
public void removeHolo() {
for (TruenoHologram holo : holo.values()) {
holo.delete();
}
}
public void removeHolo(BoardType type) {
if (holo.containsKey(type)) {
holo.get(type).delete();
@ -102,7 +101,8 @@ public class TopManager {
for (String line : plugin.getLang().getList("tops.normal.kills")) {
if (line.contains("<top>")) {
for (Top top : nkills.values()) {
nkillslines.add(ChatColor.YELLOW + "" + ChatColor.BOLD + top.getTop() + ".- " + ChatColor.GRAY + top.getName() + " - " + ChatColor.GOLD + "" + top.getAmount());
nkillslines.add(ChatColor.YELLOW + "" + ChatColor.BOLD + top.getTop() + ".- " + ChatColor.GRAY
+ top.getName() + " - " + ChatColor.GOLD + "" + top.getAmount());
}
} else {
nkillslines.add(ChatColor.translateAlternateColorCodes('&', line));
@ -120,7 +120,8 @@ public class TopManager {
for (String line : plugin.getLang().getList("tops.normal.wins")) {
if (line.contains("<top>")) {
for (Top top : nwins.values()) {
nwinslines.add(ChatColor.YELLOW + "" + ChatColor.BOLD + top.getTop() + ".- " + ChatColor.GRAY + top.getName() + " - " + ChatColor.GOLD + "" + top.getAmount());
nwinslines.add(ChatColor.YELLOW + "" + ChatColor.BOLD + top.getTop() + ".- " + ChatColor.GRAY
+ top.getName() + " - " + ChatColor.GOLD + "" + top.getAmount());
}
} else {
nwinslines.add(ChatColor.translateAlternateColorCodes('&', line));
@ -138,7 +139,8 @@ public class TopManager {
for (String line : plugin.getLang().getList("tops.normal.goals")) {
if (line.contains("<top>")) {
for (Top top : ngoals.values()) {
ngoalslines.add(ChatColor.YELLOW + "" + ChatColor.BOLD + top.getTop() + ".- " + ChatColor.GRAY + top.getName() + " - " + ChatColor.GOLD + "" + top.getAmount());
ngoalslines.add(ChatColor.YELLOW + "" + ChatColor.BOLD + top.getTop() + ".- " + ChatColor.GRAY
+ top.getName() + " - " + ChatColor.GOLD + "" + top.getAmount());
}
} else {
ngoalslines.add(ChatColor.translateAlternateColorCodes('&', line));
@ -156,7 +158,8 @@ public class TopManager {
for (String line : plugin.getLang().getList("tops.four.kills")) {
if (line.contains("<top>")) {
for (Top top : fkills.values()) {
fkillslines.add(ChatColor.YELLOW + "" + ChatColor.BOLD + top.getTop() + ".- " + ChatColor.GRAY + top.getName() + " - " + ChatColor.GOLD + "" + top.getAmount());
fkillslines.add(ChatColor.YELLOW + "" + ChatColor.BOLD + top.getTop() + ".- " + ChatColor.GRAY
+ top.getName() + " - " + ChatColor.GOLD + "" + top.getAmount());
}
} else {
fkillslines.add(ChatColor.translateAlternateColorCodes('&', line));
@ -174,7 +177,8 @@ public class TopManager {
for (String line : plugin.getLang().getList("tops.four.wins")) {
if (line.contains("<top>")) {
for (Top top : fwins.values()) {
fwinslines.add(ChatColor.YELLOW + "" + ChatColor.BOLD + top.getTop() + ".- " + ChatColor.GRAY + top.getName() + " - " + ChatColor.GOLD + "" + top.getAmount());
fwinslines.add(ChatColor.YELLOW + "" + ChatColor.BOLD + top.getTop() + ".- " + ChatColor.GRAY
+ top.getName() + " - " + ChatColor.GOLD + "" + top.getAmount());
}
} else {
fwinslines.add(ChatColor.translateAlternateColorCodes('&', line));
@ -192,7 +196,8 @@ public class TopManager {
for (String line : plugin.getLang().getList("tops.four.goals")) {
if (line.contains("<top>")) {
for (Top top : fgoals.values()) {
fgoalslines.add(ChatColor.YELLOW + "" + ChatColor.BOLD + top.getTop() + ".- " + ChatColor.GRAY + top.getName() + " - " + ChatColor.GOLD + "" + top.getAmount());
fgoalslines.add(ChatColor.YELLOW + "" + ChatColor.BOLD + top.getTop() + ".- " + ChatColor.GRAY
+ top.getName() + " - " + ChatColor.GOLD + "" + top.getAmount());
}
} else {
fgoalslines.add(ChatColor.translateAlternateColorCodes('&', line));
@ -205,7 +210,7 @@ public class TopManager {
holo.put(type, hologram);
}
}
public void addTop(Top top) {
if (top.getType().equals(BoardType.NORMAL_KILLS)) {
nkills.put(getTopNumber(top), top);
@ -221,7 +226,7 @@ public class TopManager {
fgoals.put(getTopNumber(top), top);
}
}
public int getTopNumber(Top top) {
if (top.getType().equals(BoardType.NORMAL_KILLS)) {
return nkills.size() + 1;
@ -243,9 +248,9 @@ public class TopManager {
}
return 0;
}
public HashMap<Player, ArrayList<TruenoHologram>> getHolograms(){
public HashMap<Player, ArrayList<TruenoHologram>> getHolograms() {
return playerHolo;
}
}

144
MultiArena-TheBridge/src/cx/sfy/TheBridge/menus/AchievementsMenu.java

@ -21,24 +21,45 @@ import cx.sfy.TheBridge.utils.ItemBuilder;
public class AchievementsMenu {
Main plugin;
public AchievementsMenu(Main plugin) {
this.plugin = plugin;
}
public void createArchievementsMenu(Player p, int page) {
PlayerStat ps = PlayerStat.getPlayerStat(p);
Inventory inv = Bukkit.getServer().createInventory(null, 54, plugin.getAchievement().get("title").replaceAll("<player>", p.getName()));
ItemStack signKill = ItemBuilder.item(Material.valueOf(plugin.getAchievement().get("kills.item")), plugin.getAchievement().getInt("kills.amount"), (short)plugin.getAchievement().getInt("kills.data"), plugin.getAchievement().get("kills.name"), plugin.getAchievement().get("kills.lore"));
ItemStack signWin = ItemBuilder.item(Material.valueOf(plugin.getAchievement().get("wins.item")), plugin.getAchievement().getInt("wins.amount"), (short)plugin.getAchievement().getInt("wins.data"), plugin.getAchievement().get("wins.name"), plugin.getAchievement().get("wins.lore"));
ItemStack signGoals = ItemBuilder.item(Material.valueOf(plugin.getAchievement().get("goals.item")), plugin.getAchievement().getInt("goals.amount"), (short)plugin.getAchievement().getInt("goals.data"), plugin.getAchievement().get("goals.name"), plugin.getAchievement().get("goals.lore"));
ItemStack signPlaced = ItemBuilder.item(Material.valueOf(plugin.getAchievement().get("blocks_placed.item")), plugin.getAchievement().getInt("blocks_placed.amount"), (short)plugin.getAchievement().getInt("blocks_placed.data"), plugin.getAchievement().get("blocks_placed.name"), plugin.getAchievement().get("blocks_placed.lore"));
ItemStack signBroken = ItemBuilder.item(Material.valueOf(plugin.getAchievement().get("blocks_bloken.item")), plugin.getAchievement().getInt("blocks_bloken.amount"), (short)plugin.getAchievement().getInt("blocks_bloken.data"), plugin.getAchievement().get("blocks_bloken.name"), plugin.getAchievement().get("blocks_bloken.lore"));
ItemStack gLeft = ItemBuilder.item(Material.STAINED_GLASS_PANE, 1, (short)7, plugin.getAchievement().get("archivements").replaceAll("<arrow>", "→"), "");
ItemStack gRight = ItemBuilder.item(Material.STAINED_GLASS_PANE, 1, (short)7, plugin.getAchievement().get("archivements").replaceAll("<arrow>", "�"), "");
ItemStack next = ItemBuilder.createSkull(Material.SKULL_ITEM, 1, (short)SkullType.PLAYER.ordinal(), plugin.getAchievement().get("next").replaceAll("<next>", "→"), "", "creeyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNjgyYWQxYjljYjRkZDIxMjU5YzBkNzVhYTMxNWZmMzg5YzNjZWY3NTJiZTM5NDkzMzgxNjRiYWM4NGE5NmUifX19");
ItemStack back = ItemBuilder.createSkull(Material.SKULL_ITEM, 1, (short)SkullType.PLAYER.ordinal(), plugin.getAchievement().get("back").replaceAll("<back>", "�"), "", "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMzdhZWU5YTc1YmYwZGY3ODk3MTgzMDE1Y2NhMGIyYTdkNzU1YzYzMzg4ZmYwMTc1MmQ1ZjQ0MTlmYzY0NSJ9fX0=");
ItemStack close = ItemBuilder.item(Material.valueOf(plugin.getAchievement().get("close.item")), plugin.getAchievement().getInt("close.amount"), (short)plugin.getAchievement().getInt("close.data"), plugin.getAchievement().get("close.name"), plugin.getAchievement().get("close.lore"));
Inventory inv = Bukkit.getServer().createInventory(null, 54,
plugin.getAchievement().get("title").replaceAll("<player>", p.getName()));
ItemStack signKill = ItemBuilder.item(Material.valueOf(plugin.getAchievement().get("kills.item")),
plugin.getAchievement().getInt("kills.amount"), (short) plugin.getAchievement().getInt("kills.data"),
plugin.getAchievement().get("kills.name"), plugin.getAchievement().get("kills.lore"));
ItemStack signWin = ItemBuilder.item(Material.valueOf(plugin.getAchievement().get("wins.item")),
plugin.getAchievement().getInt("wins.amount"), (short) plugin.getAchievement().getInt("wins.data"),
plugin.getAchievement().get("wins.name"), plugin.getAchievement().get("wins.lore"));
ItemStack signGoals = ItemBuilder.item(Material.valueOf(plugin.getAchievement().get("goals.item")),
plugin.getAchievement().getInt("goals.amount"), (short) plugin.getAchievement().getInt("goals.data"),
plugin.getAchievement().get("goals.name"), plugin.getAchievement().get("goals.lore"));
ItemStack signPlaced = ItemBuilder.item(Material.valueOf(plugin.getAchievement().get("blocks_placed.item")),
plugin.getAchievement().getInt("blocks_placed.amount"),
(short) plugin.getAchievement().getInt("blocks_placed.data"),
plugin.getAchievement().get("blocks_placed.name"), plugin.getAchievement().get("blocks_placed.lore"));
ItemStack signBroken = ItemBuilder.item(Material.valueOf(plugin.getAchievement().get("blocks_bloken.item")),
plugin.getAchievement().getInt("blocks_bloken.amount"),
(short) plugin.getAchievement().getInt("blocks_bloken.data"),
plugin.getAchievement().get("blocks_bloken.name"), plugin.getAchievement().get("blocks_bloken.lore"));
ItemStack gLeft = ItemBuilder.item(Material.STAINED_GLASS_PANE, 1, (short) 7,
plugin.getAchievement().get("archivements").replaceAll("<arrow>", "→"), "");
ItemStack gRight = ItemBuilder.item(Material.STAINED_GLASS_PANE, 1, (short) 7,
plugin.getAchievement().get("archivements").replaceAll("<arrow>", "§?"), "");
ItemStack next = ItemBuilder.createSkull(Material.SKULL_ITEM, 1, (short) SkullType.PLAYER.ordinal(),
plugin.getAchievement().get("next").replaceAll("<next>", "→"), "",
"creeyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNjgyYWQxYjljYjRkZDIxMjU5YzBkNzVhYTMxNWZmMzg5YzNjZWY3NTJiZTM5NDkzMzgxNjRiYWM4NGE5NmUifX19");
ItemStack back = ItemBuilder.createSkull(Material.SKULL_ITEM, 1, (short) SkullType.PLAYER.ordinal(),
plugin.getAchievement().get("back").replaceAll("<back>", "§?"), "",
"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMzdhZWU5YTc1YmYwZGY3ODk3MTgzMDE1Y2NhMGIyYTdkNzU1YzYzMzg4ZmYwMTc1MmQ1ZjQ0MTlmYzY0NSJ9fX0=");
ItemStack close = ItemBuilder.item(Material.valueOf(plugin.getAchievement().get("close.item")),
plugin.getAchievement().getInt("close.amount"), (short) plugin.getAchievement().getInt("close.data"),
plugin.getAchievement().get("close.name"), plugin.getAchievement().get("close.lore"));
inv.setItem(0, gLeft);
inv.setItem(9, gLeft);
inv.setItem(18, gLeft);
@ -54,11 +75,11 @@ public class AchievementsMenu {
inv.setItem(4, signGoals);
inv.setItem(5, signPlaced);
inv.setItem(6, signBroken);
if (plugin.getAM().getArchiements().get(ArchiType.KILLS).size() >= (page + 1) * 4
&& plugin.getAM().getArchiements().get(ArchiType.WINS).size() >= (page + 1) * 4
&& plugin.getAM().getArchiements().get(ArchiType.GOALS).size() >= (page + 1) * 4
&& plugin.getAM().getArchiements().get(ArchiType.BLOCKS_PLACED).size() >= (page + 1) * 4
&& plugin.getAM().getArchiements().get(ArchiType.BLOCKS_BROKEN).size() >= (page + 1) * 4) {
if (plugin.getAm().getArchiements().get(ArchiType.KILLS).size() >= (page + 1) * 4
&& plugin.getAm().getArchiements().get(ArchiType.WINS).size() >= (page + 1) * 4
&& plugin.getAm().getArchiements().get(ArchiType.GOALS).size() >= (page + 1) * 4
&& plugin.getAm().getArchiements().get(ArchiType.BLOCKS_PLACED).size() >= (page + 1) * 4
&& plugin.getAm().getArchiements().get(ArchiType.BLOCKS_BROKEN).size() >= (page + 1) * 4) {
inv.setItem(53, next);
}
if (PlayerListener.page.containsKey(p)) {
@ -67,13 +88,17 @@ public class AchievementsMenu {
inv.setItem(49, close);
int min = (page - 1) * 4;
for (int i = 1; i < 5; i++) {
Archi archi = plugin.getAM().getArchiements().get(ArchiType.KILLS).get((i - 1) + min);
Archi archi = plugin.getAm().getArchiements().get(ArchiType.KILLS).get((i - 1) + min);
if (ps.getFourKills() + ps.getNormalKills() <= archi.getMax()) {
ItemStack locked = plugin.getAM().getLocked().clone();
ItemStack locked = plugin.getAm().getLocked().clone();
ItemMeta lockedM = locked.getItemMeta();
List<String> loreNew = new ArrayList<String>();
for (String msg : lockedM.getLore()) {
loreNew.add(msg.replaceAll("&", "§").replaceAll("<money>", String.valueOf(archi.getMoney())).replaceAll("<xp>", String.valueOf(archi.getXp())).replaceAll("<max>", String.valueOf(archi.getMax())).replaceAll("<name>", archi.getName()).replaceAll("<description>", archi.getDescription()).replaceAll("<current>", String.valueOf(ps.getFourKills() + ps.getNormalKills())));
loreNew.add(msg.replaceAll("&", "§").replaceAll("<money>", String.valueOf(archi.getMoney()))
.replaceAll("<xp>", String.valueOf(archi.getXp()))
.replaceAll("<max>", String.valueOf(archi.getMax())).replaceAll("<name>", archi.getName())
.replaceAll("<description>", archi.getDescription())
.replaceAll("<current>", String.valueOf(ps.getFourKills() + ps.getNormalKills())));
}
lockedM.setDisplayName("§c" + archi.getName());
lockedM.getLore().clear();
@ -81,11 +106,14 @@ public class AchievementsMenu {
locked.setItemMeta(lockedM);
inv.setItem(2 + (9 * (i)), locked);
} else {
ItemStack unlocked = plugin.getAM().getUnlocked().clone();
ItemStack unlocked = plugin.getAm().getUnlocked().clone();
ItemMeta unlockedM = unlocked.getItemMeta();
List<String> loreNew = new ArrayList<String>();
for (String msg : unlockedM.getLore()) {
loreNew.add(msg.replaceAll("&", "§").replaceAll("<money>", String.valueOf(archi.getMoney())).replaceAll("<xp>", String.valueOf(archi.getXp())).replaceAll("<name>", archi.getName()).replaceAll("<description>", archi.getDescription()).replaceAll("<current>", String.valueOf(ps.getFourKills() + ps.getNormalKills())));
loreNew.add(msg.replaceAll("&", "§").replaceAll("<money>", String.valueOf(archi.getMoney()))
.replaceAll("<xp>", String.valueOf(archi.getXp())).replaceAll("<name>", archi.getName())
.replaceAll("<description>", archi.getDescription())
.replaceAll("<current>", String.valueOf(ps.getFourKills() + ps.getNormalKills())));
}
unlockedM.setDisplayName("§a" + archi.getName());
unlockedM.getLore().clear();
@ -95,13 +123,17 @@ public class AchievementsMenu {
}
}
for (int i = 1; i < 5; i++) {
Archi archi = plugin.getAM().getArchiements().get(ArchiType.WINS).get((i - 1) + min);
Archi archi = plugin.getAm().getArchiements().get(ArchiType.WINS).get((i - 1) + min);
if (ps.getFourWins() + ps.getNormalWins() <= archi.getMax()) {
ItemStack locked = plugin.getAM().getLocked().clone();
ItemStack locked = plugin.getAm().getLocked().clone();
ItemMeta lockedM = locked.getItemMeta();
List<String> loreNew = new ArrayList<String>();
for (String msg : lockedM.getLore()) {
loreNew.add(msg.replaceAll("&", "§").replaceAll("<money>", String.valueOf(archi.getMoney())).replaceAll("<xp>", String.valueOf(archi.getXp())).replaceAll("<max>", String.valueOf(archi.getMax())).replaceAll("<name>", archi.getName()).replaceAll("<description>", archi.getDescription()).replaceAll("<current>", String.valueOf(ps.getFourWins() + ps.getNormalWins())));
loreNew.add(msg.replaceAll("&", "§").replaceAll("<money>", String.valueOf(archi.getMoney()))
.replaceAll("<xp>", String.valueOf(archi.getXp()))
.replaceAll("<max>", String.valueOf(archi.getMax())).replaceAll("<name>", archi.getName())
.replaceAll("<description>", archi.getDescription())
.replaceAll("<current>", String.valueOf(ps.getFourWins() + ps.getNormalWins())));
}
lockedM.setDisplayName("§c" + archi.getName());
lockedM.getLore().clear();
@ -109,11 +141,14 @@ public class AchievementsMenu {
locked.setItemMeta(lockedM);
inv.setItem(3 + (9 * (i)), locked);
} else {
ItemStack unlocked = plugin.getAM().getUnlocked().clone();
ItemStack unlocked = plugin.getAm().getUnlocked().clone();
ItemMeta unlockedM = unlocked.getItemMeta();
List<String> loreNew = new ArrayList<String>();
for (String msg : unlockedM.getLore()) {
loreNew.add(msg.replaceAll("&", "§").replaceAll("<money>", String.valueOf(archi.getMoney())).replaceAll("<xp>", String.valueOf(archi.getXp())).replaceAll("<name>", archi.getName()).replaceAll("<description>", archi.getDescription()).replaceAll("<current>", String.valueOf(ps.getFourWins() + ps.getNormalWins())));
loreNew.add(msg.replaceAll("&", "§").replaceAll("<money>", String.valueOf(archi.getMoney()))
.replaceAll("<xp>", String.valueOf(archi.getXp())).replaceAll("<name>", archi.getName())
.replaceAll("<description>", archi.getDescription())
.replaceAll("<current>", String.valueOf(ps.getFourWins() + ps.getNormalWins())));
}
unlockedM.setDisplayName("§a" + archi.getName());
unlockedM.getLore().clear();
@ -123,13 +158,17 @@ public class AchievementsMenu {
}
}
for (int i = 1; i < 5; i++) {
Archi archi = plugin.getAM().getArchiements().get(ArchiType.GOALS).get((i - 1) + min);
Archi archi = plugin.getAm().getArchiements().get(ArchiType.GOALS).get((i - 1) + min);
if (ps.getFourGoals() + ps.getNormalGoals() <= archi.getMax()) {
ItemStack locked = plugin.getAM().getLocked().clone();
ItemStack locked = plugin.getAm().getLocked().clone();
ItemMeta lockedM = locked.getItemMeta();
List<String> loreNew = new ArrayList<String>();
for (String msg : lockedM.getLore()) {
loreNew.add(msg.replaceAll("&", "§").replaceAll("<money>", String.valueOf(archi.getMoney())).replaceAll("<xp>", String.valueOf(archi.getXp())).replaceAll("<max>", String.valueOf(archi.getMax())).replaceAll("<name>", archi.getName()).replaceAll("<description>", archi.getDescription()).replaceAll("<current>", String.valueOf(ps.getFourGoals() + ps.getNormalGoals())));
loreNew.add(msg.replaceAll("&", "§").replaceAll("<money>", String.valueOf(archi.getMoney()))
.replaceAll("<xp>", String.valueOf(archi.getXp()))
.replaceAll("<max>", String.valueOf(archi.getMax())).replaceAll("<name>", archi.getName())
.replaceAll("<description>", archi.getDescription())
.replaceAll("<current>", String.valueOf(ps.getFourGoals() + ps.getNormalGoals())));
}
lockedM.setDisplayName("§c" + archi.getName());
lockedM.getLore().clear();
@ -137,11 +176,14 @@ public class AchievementsMenu {
locked.setItemMeta(lockedM);
inv.setItem(4 + (9 * (i)), locked);
} else {
ItemStack unlocked = plugin.getAM().getUnlocked().clone();
ItemStack unlocked = plugin.getAm().getUnlocked().clone();
ItemMeta unlockedM = unlocked.getItemMeta();
List<String> loreNew = new ArrayList<String>();
for (String msg : unlockedM.getLore()) {
loreNew.add(msg.replaceAll("&", "§").replaceAll("<money>", String.valueOf(archi.getMoney())).replaceAll("<xp>", String.valueOf(archi.getXp())).replaceAll("<name>", archi.getName()).replaceAll("<description>", archi.getDescription()).replaceAll("<current>", String.valueOf(ps.getFourGoals() + ps.getNormalGoals())));
loreNew.add(msg.replaceAll("&", "§").replaceAll("<money>", String.valueOf(archi.getMoney()))
.replaceAll("<xp>", String.valueOf(archi.getXp())).replaceAll("<name>", archi.getName())
.replaceAll("<description>", archi.getDescription())
.replaceAll("<current>", String.valueOf(ps.getFourGoals() + ps.getNormalGoals())));
}
unlockedM.setDisplayName("§a" + archi.getName());
unlockedM.getLore().clear();
@ -151,13 +193,17 @@ public class AchievementsMenu {
}
}
for (int i = 1; i < 5; i++) {
Archi archi = plugin.getAM().getArchiements().get(ArchiType.BLOCKS_PLACED).get((i - 1) + min);
Archi archi = plugin.getAm().getArchiements().get(ArchiType.BLOCKS_PLACED).get((i - 1) + min);
if (ps.getPlaced() <= archi.getMax()) {
ItemStack locked = plugin.getAM().getLocked().clone();
ItemStack locked = plugin.getAm().getLocked().clone();
ItemMeta lockedM = locked.getItemMeta();
List<String> loreNew = new ArrayList<String>();
for (String msg : lockedM.getLore()) {
loreNew.add(msg.replaceAll("&", "§").replaceAll("<money>", String.valueOf(archi.getMoney())).replaceAll("<xp>", String.valueOf(archi.getXp())).replaceAll("<max>", String.valueOf(archi.getMax())).replaceAll("<name>", archi.getName()).replaceAll("<description>", archi.getDescription()).replaceAll("<current>", String.valueOf(ps.getPlaced())));
loreNew.add(msg.replaceAll("&", "§").replaceAll("<money>", String.valueOf(archi.getMoney()))
.replaceAll("<xp>", String.valueOf(archi.getXp()))
.replaceAll("<max>", String.valueOf(archi.getMax())).replaceAll("<name>", archi.getName())
.replaceAll("<description>", archi.getDescription())
.replaceAll("<current>", String.valueOf(ps.getPlaced())));
}
lockedM.setDisplayName("§c" + archi.getName());
lockedM.getLore().clear();
@ -165,11 +211,14 @@ public class AchievementsMenu {
locked.setItemMeta(lockedM);
inv.setItem(5 + (9 * (i)), locked);
} else {
ItemStack unlocked = plugin.getAM().getUnlocked().clone();
ItemStack unlocked = plugin.getAm().getUnlocked().clone();
ItemMeta unlockedM = unlocked.getItemMeta();
List<String> loreNew = new ArrayList<String>();
for (String msg : unlockedM.getLore()) {
loreNew.add(msg.replaceAll("&", "§").replaceAll("<money>", String.valueOf(archi.getMoney())).replaceAll("<xp>", String.valueOf(archi.getXp())).replaceAll("<name>", archi.getName()).replaceAll("<description>", archi.getDescription()).replaceAll("<current>", String.valueOf(ps.getPlaced())));
loreNew.add(msg.replaceAll("&", "§").replaceAll("<money>", String.valueOf(archi.getMoney()))
.replaceAll("<xp>", String.valueOf(archi.getXp())).replaceAll("<name>", archi.getName())
.replaceAll("<description>", archi.getDescription())
.replaceAll("<current>", String.valueOf(ps.getPlaced())));
}
unlockedM.setDisplayName("§a" + archi.getName());
unlockedM.getLore().clear();
@ -179,13 +228,17 @@ public class AchievementsMenu {
}
}
for (int i = 1; i < 5; i++) {
Archi archi = plugin.getAM().getArchiements().get(ArchiType.BLOCKS_BROKEN).get((i - 1) + min);
Archi archi = plugin.getAm().getArchiements().get(ArchiType.BLOCKS_BROKEN).get((i - 1) + min);
if (ps.getBroken() <= archi.getMax()) {
ItemStack locked = plugin.getAM().getLocked().clone();
ItemStack locked = plugin.getAm().getLocked().clone();
ItemMeta lockedM = locked.getItemMeta();
List<String> loreNew = new ArrayList<String>();
for (String msg : lockedM.getLore()) {
loreNew.add(msg.replaceAll("&", "§").replaceAll("<money>", String.valueOf(archi.getMoney())).replaceAll("<xp>", String.valueOf(archi.getXp())).replaceAll("<max>", String.valueOf(archi.getMax())).replaceAll("<name>", archi.getName()).replaceAll("<description>", archi.getDescription()).replaceAll("<current>", String.valueOf(ps.getBroken())));
loreNew.add(msg.replaceAll("&", "§").replaceAll("<money>", String.valueOf(archi.getMoney()))
.replaceAll("<xp>", String.valueOf(archi.getXp()))
.replaceAll("<max>", String.valueOf(archi.getMax())).replaceAll("<name>", archi.getName())
.replaceAll("<description>", archi.getDescription())
.replaceAll("<current>", String.valueOf(ps.getBroken())));
}
lockedM.setDisplayName("§c" + archi.getName());
lockedM.getLore().clear();
@ -193,11 +246,14 @@ public class AchievementsMenu {
locked.setItemMeta(lockedM);
inv.setItem(6 + (9 * (i)), locked);
} else {
ItemStack unlocked = plugin.getAM().getUnlocked().clone();
ItemStack unlocked = plugin.getAm().getUnlocked().clone();
ItemMeta unlockedM = unlocked.getItemMeta();
List<String> loreNew = new ArrayList<String>();
for (String msg : unlockedM.getLore()) {
loreNew.add(msg.replaceAll("&", "§").replaceAll("<money>", String.valueOf(archi.getMoney())).replaceAll("<xp>", String.valueOf(archi.getXp())).replaceAll("<name>", archi.getName()).replaceAll("<description>", archi.getDescription()).replaceAll("<current>", String.valueOf(ps.getBroken())));
loreNew.add(msg.replaceAll("&", "§").replaceAll("<money>", String.valueOf(archi.getMoney()))
.replaceAll("<xp>", String.valueOf(archi.getXp())).replaceAll("<name>", archi.getName())
.replaceAll("<description>", archi.getDescription())
.replaceAll("<current>", String.valueOf(ps.getBroken())));
}
unlockedM.setDisplayName("§a" + archi.getName());
unlockedM.getLore().clear();
@ -208,5 +264,5 @@ public class AchievementsMenu {
}
p.openInventory(inv);
}
}

33
MultiArena-TheBridge/src/cx/sfy/TheBridge/menus/ArrowMenu.java

@ -0,0 +1,33 @@
package cx.sfy.TheBridge.menus;
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;
public class ArrowMenu {
Main plugin;
public ArrowMenu(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);
if (!arrow.isBuy() && !p.hasPermission(arrow.getPermission())) {
inv.setItem(arrow.getSlot(), arrow.getPermIcon());
} else if (arrow.isBuy() && !p.hasPermission(arrow.getPermission())) {
inv.setItem(arrow.getSlot(), arrow.getBuyIcon());
} else {
inv.setItem(arrow.getSlot(), arrow.getHasIcon());
}
}
p.openInventory(inv);
}
}

51
MultiArena-TheBridge/src/cx/sfy/TheBridge/menus/GameMenu.java

@ -23,8 +23,12 @@ public class GameMenu {
public void openSelectTypeMenu(Player p) {
final Inventory inv = Bukkit.getServer().createInventory(null, 27, plugin.getLang().get(p, "menus.type.title"));
final ItemStack normal = ItemBuilder.item(Material.STAINED_CLAY, 1, (short)11, plugin.getLang().get(p, "menus.type.normal.nameItem"), plugin.getLang().get(p, "menus.type.normal.loreItem"));
final ItemStack four = ItemBuilder.item(Material.STAINED_CLAY, 1, (short)14, plugin.getLang().get(p, "menus.type.four.nameItem"), plugin.getLang().get(p, "menus.type.four.loreItem"));
final ItemStack normal = ItemBuilder.item(Material.STAINED_CLAY, 1, (short) 11,
plugin.getLang().get(p, "menus.type.normal.nameItem"),
plugin.getLang().get(p, "menus.type.normal.loreItem"));
final ItemStack four = ItemBuilder.item(Material.STAINED_CLAY, 1, (short) 14,
plugin.getLang().get(p, "menus.type.four.nameItem"),
plugin.getLang().get(p, "menus.type.four.loreItem"));
inv.setItem(11, normal);
inv.setItem(15, four);
p.openInventory(inv);
@ -32,25 +36,34 @@ public class GameMenu {
public void openGameMenu(Player p) {
final Inventory inv = Bukkit.getServer().createInventory(null, 27, plugin.getLang().get(p, "menus.game.title"));
for (final GameDuo game : plugin.getGM().getGames())
for (final GameDuo game : plugin.getGm().getGames())
inv.addItem(game(p, game));
p.openInventory(inv);
}
public void openGameFourMenu(Player p) {
final Inventory inv = Bukkit.getServer().createInventory(null, 27, plugin.getLang().get(p, "menus.gameFour.title"));
for (final GameFour game : plugin.getGM().getGamesFour())
final Inventory inv = Bukkit.getServer().createInventory(null, 27,
plugin.getLang().get(p, "menus.gameFour.title"));
for (final GameFour game : plugin.getGm().getGamesFour())
inv.addItem(game(p, game));
p.openInventory(inv);
}
protected ItemStack game(Player p, GameDuo game) {
final ItemStack item = ItemBuilder.item(Material.STAINED_CLAY, 1, getState(game), "§a" + game.getName(), plugin.getLang().get(p, "menus.game.generalDesc").replaceAll("<players>", String.valueOf(game.getPlayers())).replaceAll("<max>", String.valueOf(game.getMax())).replaceAll("<mode>", game.getMode()).replaceAll("<state>", getState(game.getState())));
final ItemStack item = ItemBuilder.item(Material.STAINED_CLAY, 1, getState(game), "§a" + game.getName(),
plugin.getLang().get(p, "menus.game.generalDesc")
.replaceAll("<players>", String.valueOf(game.getPlayers()))
.replaceAll("<max>", String.valueOf(game.getMax())).replaceAll("<mode>", game.getMode())
.replaceAll("<state>", getState(game.getState())));
return item;
}
protected ItemStack game(Player p, GameFour game) {
final ItemStack item = ItemBuilder.item(Material.STAINED_CLAY, 1, getState(game), "§a" + game.getName(), plugin.getLang().get(p, "menus.game.generalDesc").replaceAll("<players>", String.valueOf(game.getPlayers().size())).replaceAll("<max>", String.valueOf(game.getMax())).replaceAll("<mode>", game.getMode()).replaceAll("<state>", getState(game.getState())));
final ItemStack item = ItemBuilder.item(Material.STAINED_CLAY, 1, getState(game), "§a" + game.getName(),
plugin.getLang().get(p, "menus.game.generalDesc")
.replaceAll("<players>", String.valueOf(game.getPlayers().size()))
.replaceAll("<max>", String.valueOf(game.getMax())).replaceAll("<mode>", game.getMode())
.replaceAll("<state>", getState(game.getState())));
return item;
}
@ -88,33 +101,33 @@ public class GameMenu {
protected short getState(GameDuo game) {
if (game.isState(State.WAITING))
return (short)plugin.getConfig().getInt("signs.waiting");
return (short) plugin.getConfig().getInt("signs.waiting");
if (game.isState(State.STARTING))
return (short)plugin.getConfig().getInt("signs.starting");
return (short) plugin.getConfig().getInt("signs.starting");
if (game.isState(State.PREGAME))
return (short)plugin.getConfig().getInt("signs.pregame");
return (short) plugin.getConfig().getInt("signs.pregame");
if (game.isState(State.INGAME))
return (short)plugin.getConfig().getInt("signs.ingame");
return (short) plugin.getConfig().getInt("signs.ingame");
if (game.isState(State.RESTARTING))
return (short)plugin.getConfig().getInt("signs.restart");
return (short) plugin.getConfig().getInt("signs.restart");
if (game.isState(State.FINISH))
return (short)plugin.getConfig().getInt("signs.finish");
return (short) plugin.getConfig().getInt("signs.finish");
return 5;
}
protected short getState(GameFour game) {
if (game.isState(FState.WAITING))
return (short)plugin.getConfig().getInt("signs.waiting");
return (short) plugin.getConfig().getInt("signs.waiting");
if (game.isState(FState.STARTING))
return (short)plugin.getConfig().getInt("signs.starting");
return (short) plugin.getConfig().getInt("signs.starting");
if (game.isState(FState.PREGAME))
return (short)plugin.getConfig().getInt("signs.pregame");
return (short) plugin.getConfig().getInt("signs.pregame");
if (game.isState(FState.INGAME))
return (short)plugin.getConfig().getInt("signs.ingame");
return (short) plugin.getConfig().getInt("signs.ingame");
if (game.isState(FState.RESTARTING))
return (short)plugin.getConfig().getInt("signs.restart");
return (short) plugin.getConfig().getInt("signs.restart");
if (game.isState(FState.FINISH))
return (short)plugin.getConfig().getInt("signs.finish");
return (short) plugin.getConfig().getInt("signs.finish");
return 5;
}

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

@ -10,14 +10,15 @@ import cx.sfy.TheBridge.cosmetics.Cage;
public class GlassMenu {
Main plugin;
public GlassMenu(Main plugin) {
this.plugin = plugin;
}
public void createGlassMenu(Player p) {
Inventory inv = Bukkit.getServer().createInventory(null, plugin.getCages().getInt("size"), plugin.getCages().get("title"));
for (Cage cage : plugin.getCM().getCages().values()) {
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());
@ -29,5 +30,5 @@ public class GlassMenu {
}
p.openInventory(inv);
}
}

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

@ -10,20 +10,34 @@ import cx.sfy.TheBridge.Main;
import cx.sfy.TheBridge.utils.ItemBuilder;
public class ShopMenu {
Main plugin;
public ShopMenu(Main plugin) {
this.plugin = plugin;
}
public void openShopMenu(Player p) {
Inventory inv = Bukkit.getServer().createInventory(null, plugin.getConfig().getInt("shop.size"), plugin.getLang().get("shop.title"));
ItemStack glass = ItemBuilder.item(Material.valueOf(plugin.getConfig().getString("shop.glass.icon")), plugin.getConfig().getInt("shop.glass.amount"), (short)plugin.getConfig().getInt("shop.glass.data"), plugin.getLang().get("shop.glass.nameItem"), plugin.getLang().get("shop.glass.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.glass.slot"), glass);
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"),
(short) plugin.getConfig().getInt("shop.glass.data"), plugin.getLang().get("shop.glass.nameItem"),
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 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.close.slot"), close);
p.openInventory(inv);
}
}

39
MultiArena-TheBridge/src/cx/sfy/TheBridge/menus/SpectOptionsMenu.java

@ -15,19 +15,38 @@ public class SpectOptionsMenu {
public HashMap<Player, Boolean> settings = new HashMap<Player, Boolean>();
public Main plugin;
public SpectOptionsMenu(Main plugin){
public SpectOptionsMenu(Main plugin) {
this.plugin = plugin;
}
public void openOptionsMenu(Player p) {
Inventory inv = Bukkit.createInventory(null, 36, plugin.getLang().get("menus.options.title"));
ItemStack velo1 = ItemBuilder.item(Material.LEATHER_BOOTS, 1, (short)0, plugin.getLang().get("menus.options.velocidad.nameItem").replaceAll("<#>", "I"), plugin.getLang().get("menus.options.velocidad.loreItem").replaceAll("<#>", "I"));
ItemStack velo2 = ItemBuilder.item(Material.GOLD_BOOTS, 1, (short)0, plugin.getLang().get("menus.options.velocidad.nameItem").replaceAll("<#>", "II"), plugin.getLang().get("menus.options.velocidad.loreItem").replaceAll("<#>", "II"));
ItemStack velo3 = ItemBuilder.item(Material.CHAINMAIL_BOOTS, 1, (short)0, plugin.getLang().get("menus.options.velocidad.nameItem").replaceAll("<#>", "III"), plugin.getLang().get("menus.options.velocidad.loreItem").replaceAll("<#>", "III"));
ItemStack velo4 = ItemBuilder.item(Material.IRON_BOOTS, 1, (short)0, plugin.getLang().get("menus.options.velocidad.nameItem").replaceAll("<#>", "IV"), plugin.getLang().get("menus.options.velocidad.loreItem").replaceAll("<#>", "IV"));
ItemStack velo5 = ItemBuilder.item(Material.DIAMOND_BOOTS, 1, (short)0, plugin.getLang().get("menus.options.velocidad.nameItem").replaceAll("<#>", "V"), plugin.getLang().get("menus.options.velocidad.loreItem").replaceAll("<#>", "V"));
ItemStack visNo = ItemBuilder.item(Material.EYE_OF_ENDER, 1, (short)0, plugin.getLang().get("menus.options.vision.nameItem").replaceAll("<type>", plugin.getLang().get("menus.options.enable")), plugin.getLang().get("menus.options.vision.loreItem").replaceAll("<type>", plugin.getLang().get("menus.options.enable")));
ItemStack visSi = ItemBuilder.item(Material.ENDER_PEARL, 1, (short)0, plugin.getLang().get("menus.options.vision.nameItem").replaceAll("<type>", plugin.getLang().get("menus.options.disable")), plugin.getLang().get("menus.options.vision.loreItem").replaceAll("<type>", plugin.getLang().get("menus.options.disable")));
ItemStack velo1 = ItemBuilder.item(Material.LEATHER_BOOTS, 1, (short) 0,
plugin.getLang().get("menus.options.velocidad.nameItem").replaceAll("<#>", "I"),
plugin.getLang().get("menus.options.velocidad.loreItem").replaceAll("<#>", "I"));
ItemStack velo2 = ItemBuilder.item(Material.GOLD_BOOTS, 1, (short) 0,
plugin.getLang().get("menus.options.velocidad.nameItem").replaceAll("<#>", "II"),
plugin.getLang().get("menus.options.velocidad.loreItem").replaceAll("<#>", "II"));
ItemStack velo3 = ItemBuilder.item(Material.CHAINMAIL_BOOTS, 1, (short) 0,
plugin.getLang().get("menus.options.velocidad.nameItem").replaceAll("<#>", "III"),
plugin.getLang().get("menus.options.velocidad.loreItem").replaceAll("<#>", "III"));
ItemStack velo4 = ItemBuilder.item(Material.IRON_BOOTS, 1, (short) 0,
plugin.getLang().get("menus.options.velocidad.nameItem").replaceAll("<#>", "IV"),
plugin.getLang().get("menus.options.velocidad.loreItem").replaceAll("<#>", "IV"));
ItemStack velo5 = ItemBuilder.item(Material.DIAMOND_BOOTS, 1, (short) 0,
plugin.getLang().get("menus.options.velocidad.nameItem").replaceAll("<#>", "V"),
plugin.getLang().get("menus.options.velocidad.loreItem").replaceAll("<#>", "V"));
ItemStack visNo = ItemBuilder.item(Material.EYE_OF_ENDER, 1, (short) 0,
plugin.getLang().get("menus.options.vision.nameItem").replaceAll("<type>",
plugin.getLang().get("menus.options.enable")),
plugin.getLang().get("menus.options.vision.loreItem").replaceAll("<type>",
plugin.getLang().get("menus.options.enable")));
ItemStack visSi = ItemBuilder.item(Material.ENDER_PEARL, 1, (short) 0,
plugin.getLang().get("menus.options.vision.nameItem").replaceAll("<type>",
plugin.getLang().get("menus.options.disable")),
plugin.getLang().get("menus.options.vision.loreItem").replaceAll("<type>",
plugin.getLang().get("menus.options.disable")));
inv.setItem(11, velo1);
inv.setItem(12, velo2);
inv.setItem(13, velo3);
@ -45,5 +64,5 @@ public class SpectOptionsMenu {
}
p.openInventory(inv);
}
}

64
MultiArena-TheBridge/src/cx/sfy/TheBridge/menus/SpectPlayerMenu.java

@ -19,26 +19,43 @@ public class SpectPlayerMenu {
Main plugin;
DecimalFormat df = new DecimalFormat("##.##");
public SpectPlayerMenu(Main plugin) {
this.plugin = plugin;
}
public void openSpectPlayerMenu(Player p) {
GameFour game = plugin.getGM().getGameFourByPlayer(p);
GameFour game = plugin.getGm().getGameFourByPlayer(p);
Inventory inv = Bukkit.getServer().createInventory(null, 54, plugin.getLang().get("menus.options.title"));
ItemStack wool1 = ItemBuilder.item(Material.STAINED_CLAY, 1, (short)11, plugin.getLang().get("menus.teleport.team.nameItem").replaceAll("<color>", "" + ChatColor.BLUE).replaceAll("<team>", game.getTeams().get(ChatColor.BLUE).getTeamName()), plugin.getLang().get("menus.teleport.team.loreItem"));
ItemStack wool2 = ItemBuilder.item(Material.STAINED_CLAY, 1, (short)14, plugin.getLang().get("menus.teleport.team.nameItem").replaceAll("<color>", "" + ChatColor.RED).replaceAll("<team>", game.getTeams().get(ChatColor.RED).getTeamName()), plugin.getLang().get("menus.teleport.team.loreItem"));
ItemStack wool3 = ItemBuilder.item(Material.STAINED_CLAY, 1, (short)4, plugin.getLang().get("menus.teleport.team.nameItem").replaceAll("<color>", "" + ChatColor.YELLOW).replaceAll("<team>", game.getTeams().get(ChatColor.YELLOW).getTeamName()), plugin.getLang().get("menus.teleport.team.loreItem"));
ItemStack wool4 = ItemBuilder.item(Material.STAINED_CLAY, 1, (short)5, plugin.getLang().get("menus.teleport.team.nameItem").replaceAll("<color>", "" + ChatColor.GREEN).replaceAll("<team>", game.getTeams().get(ChatColor.GREEN).getTeamName()), plugin.getLang().get("menus.teleport.team.loreItem"));
ItemStack wool1 = ItemBuilder.item(Material.STAINED_CLAY, 1, (short) 11,
plugin.getLang().get("menus.teleport.team.nameItem").replaceAll("<color>", "" + ChatColor.BLUE)
.replaceAll("<team>", game.getTeams().get(ChatColor.BLUE).getTeamName()),
plugin.getLang().get("menus.teleport.team.loreItem"));
ItemStack wool2 = ItemBuilder.item(Material.STAINED_CLAY, 1, (short) 14,
plugin.getLang().get("menus.teleport.team.nameItem").replaceAll("<color>", "" + ChatColor.RED)
.replaceAll("<team>", game.getTeams().get(ChatColor.RED).getTeamName()),
plugin.getLang().get("menus.teleport.team.loreItem"));
ItemStack wool3 = ItemBuilder.item(Material.STAINED_CLAY, 1, (short) 4,
plugin.getLang().get("menus.teleport.team.nameItem").replaceAll("<color>", "" + ChatColor.YELLOW)
.replaceAll("<team>", game.getTeams().get(ChatColor.YELLOW).getTeamName()),
plugin.getLang().get("menus.teleport.team.loreItem"));
ItemStack wool4 = ItemBuilder.item(Material.STAINED_CLAY, 1, (short) 5,
plugin.getLang().get("menus.teleport.team.nameItem").replaceAll("<color>", "" + ChatColor.GREEN)
.replaceAll("<team>", game.getTeams().get(ChatColor.GREEN).getTeamName()),
plugin.getLang().get("menus.teleport.team.loreItem"));
if (!game.getTeams().get(ChatColor.BLUE).getDeath()) {
TeamFour team = game.getTeams().get(ChatColor.BLUE);
for (int i = 0; i < team.getTeamPlayers().size(); i++) {
if (team.getTeamPlayers().get(i) != null) {
Player p1 = team.getTeamPlayers().get(i);
ItemStack ip1 = ItemBuilder.skull(Material.SKULL_ITEM, 1, (short)SkullType.PLAYER.ordinal(), plugin.getLang().get("menus.teleport.player.nameItem").replaceAll("<player>", "§7" + p1.getName()), plugin.getLang().get("menus.teleport.player.loreItem").replaceAll("<health>", df.format(p1.getHealth())), p1.getName());
ItemStack ip1 = ItemBuilder.skull(Material.SKULL_ITEM, 1, (short) SkullType.PLAYER.ordinal(),
plugin.getLang().get("menus.teleport.player.nameItem").replaceAll("<player>",
"§7" + p1.getName()),
plugin.getLang().get("menus.teleport.player.loreItem").replaceAll("<health>",
df.format(p1.getHealth())),
p1.getName());
inv.setItem(i + 10, ip1);
}
}
}
}
if (!game.getTeams().get(ChatColor.RED).getDeath()) {
@ -46,9 +63,14 @@ public class SpectPlayerMenu {
for (int i = 0; i < team.getTeamPlayers().size(); i++) {
if (team.getTeamPlayers().get(i) != null) {
Player p1 = team.getTeamPlayers().get(i);
ItemStack ip1 = ItemBuilder.skull(Material.SKULL_ITEM, 1, (short)SkullType.PLAYER.ordinal(), plugin.getLang().get("menus.teleport.player.nameItem").replaceAll("<player>", "§7" + p1.getName()), plugin.getLang().get("menus.teleport.player.loreItem").replaceAll("<health>", df.format(p1.getHealth())), p1.getName());
ItemStack ip1 = ItemBuilder.skull(Material.SKULL_ITEM, 1, (short) SkullType.PLAYER.ordinal(),
plugin.getLang().get("menus.teleport.player.nameItem").replaceAll("<player>",
"§7" + p1.getName()),
plugin.getLang().get("menus.teleport.player.loreItem").replaceAll("<health>",
df.format(p1.getHealth())),
p1.getName());
inv.setItem(i + 19, ip1);
}
}
}
}
if (!game.getTeams().get(ChatColor.YELLOW).getDeath()) {
@ -56,9 +78,14 @@ public class SpectPlayerMenu {
for (int i = 0; i < team.getTeamPlayers().size(); i++) {
if (team.getTeamPlayers().get(i) != null) {
Player p1 = team.getTeamPlayers().get(i);
ItemStack ip1 = ItemBuilder.skull(Material.SKULL_ITEM, 1, (short)SkullType.PLAYER.ordinal(), plugin.getLang().get("menus.teleport.player.nameItem").replaceAll("<player>", "§7" + p1.getName()), plugin.getLang().get("menus.teleport.player.loreItem").replaceAll("<health>", df.format(p1.getHealth())), p1.getName());
ItemStack ip1 = ItemBuilder.skull(Material.SKULL_ITEM, 1, (short) SkullType.PLAYER.ordinal(),
plugin.getLang().get("menus.teleport.player.nameItem").replaceAll("<player>",
"§7" + p1.getName()),
plugin.getLang().get("menus.teleport.player.loreItem").replaceAll("<health>",
df.format(p1.getHealth())),
p1.getName());
inv.setItem(i + 28, ip1);
}
}
}
}
if (!game.getTeams().get(ChatColor.GREEN).getDeath()) {
@ -66,9 +93,14 @@ public class SpectPlayerMenu {
for (int i = 0; i < team.getTeamPlayers().size(); i++) {
if (team.getTeamPlayers().get(i) != null) {
Player p1 = team.getTeamPlayers().get(i);
ItemStack ip1 = ItemBuilder.skull(Material.SKULL_ITEM, 1, (short)SkullType.PLAYER.ordinal(), plugin.getLang().get("menus.teleport.player.nameItem").replaceAll("<player>", "§7" + p1.getName()), plugin.getLang().get("menus.teleport.player.loreItem").replaceAll("<health>", df.format(p1.getHealth())), p1.getName());
ItemStack ip1 = ItemBuilder.skull(Material.SKULL_ITEM, 1, (short) SkullType.PLAYER.ordinal(),
plugin.getLang().get("menus.teleport.player.nameItem").replaceAll("<player>",
"§7" + p1.getName()),
plugin.getLang().get("menus.teleport.player.loreItem").replaceAll("<health>",
df.format(p1.getHealth())),
p1.getName());
inv.setItem(i + 36, ip1);
}
}
}
}
inv.setItem(9, wool1);
@ -77,5 +109,5 @@ public class SpectPlayerMenu {
inv.setItem(36, wool4);
p.openInventory(inv);
}
}

76
MultiArena-TheBridge/src/cx/sfy/TheBridge/menus/TeamMenu.java

@ -21,21 +21,45 @@ import cx.sfy.TheBridge.utils.ItemBuilder;
public class TeamMenu {
Main plugin;
public TeamMenu(Main plugin) {
this.plugin = plugin;
}
public void openTeamFourMenu(Player p) {
GameFour game = plugin.getGM().getGameFourByPlayer(p);
GameFour game = plugin.getGm().getGameFourByPlayer(p);
Inventory inv = Bukkit.getServer().createInventory(null, 27, plugin.getLang().get("menus.teamFour.title"));
new BukkitRunnable() {
@Override
public void run() {
ItemStack blue = ItemBuilder.item(Material.STAINED_CLAY, (game.getTeams().get(ChatColor.BLUE).getTeamSize() == 0) ? 1 : game.getTeams().get(ChatColor.BLUE).getTeamSize(), (short)11, "§9" + plugin.getLang().get("menus.teamFour.team.nameItem").replaceAll("<#>", plugin.getConfig().getString("names.blue")), getLore(game.getTeams().get(ChatColor.BLUE)));
ItemStack red = ItemBuilder.item(Material.STAINED_CLAY, (game.getTeams().get(ChatColor.RED).getTeamSize() == 0) ? 1 : game.getTeams().get(ChatColor.RED).getTeamSize(), (short)14, "§c" + plugin.getLang().get("menus.teamFour.team.nameItem").replaceAll("<#>", plugin.getConfig().getString("names.red")), getLore(game.getTeams().get(ChatColor.RED)));
ItemStack yellow = ItemBuilder.item(Material.STAINED_CLAY, (game.getTeams().get(ChatColor.YELLOW).getTeamSize() == 0) ? 1 : game.getTeams().get(ChatColor.YELLOW).getTeamSize(), (short)4, "§e" + plugin.getLang().get("menus.teamFour.team.nameItem").replaceAll("<#>", plugin.getConfig().getString("names.yellow")), getLore(game.getTeams().get(ChatColor.YELLOW)));
ItemStack green = ItemBuilder.item(Material.STAINED_CLAY, (game.getTeams().get(ChatColor.GREEN).getTeamSize() == 0) ? 1 : game.getTeams().get(ChatColor.GREEN).getTeamSize(), (short)5, "§a" + plugin.getLang().get("menus.teamFour.team.nameItem").replaceAll("<#>", plugin.getConfig().getString("names.green")), getLore(game.getTeams().get(ChatColor.GREEN)));
ItemStack blue = ItemBuilder.item(Material.STAINED_CLAY,
(game.getTeams().get(ChatColor.BLUE).getTeamSize() == 0) ? 1
: game.getTeams().get(ChatColor.BLUE).getTeamSize(),
(short) 11,
"§9" + plugin.getLang().get("menus.teamFour.team.nameItem").replaceAll("<#>",
plugin.getConfig().getString("names.blue")),
getLore(game.getTeams().get(ChatColor.BLUE)));
ItemStack red = ItemBuilder.item(Material.STAINED_CLAY,
(game.getTeams().get(ChatColor.RED).getTeamSize() == 0) ? 1
: game.getTeams().get(ChatColor.RED).getTeamSize(),
(short) 14,
"§c" + plugin.getLang().get("menus.teamFour.team.nameItem").replaceAll("<#>",
plugin.getConfig().getString("names.red")),
getLore(game.getTeams().get(ChatColor.RED)));
ItemStack yellow = ItemBuilder.item(Material.STAINED_CLAY,
(game.getTeams().get(ChatColor.YELLOW).getTeamSize() == 0) ? 1
: game.getTeams().get(ChatColor.YELLOW).getTeamSize(),
(short) 4,
"§e" + plugin.getLang().get("menus.teamFour.team.nameItem").replaceAll("<#>",
plugin.getConfig().getString("names.yellow")),
getLore(game.getTeams().get(ChatColor.YELLOW)));
ItemStack green = ItemBuilder.item(Material.STAINED_CLAY,
(game.getTeams().get(ChatColor.GREEN).getTeamSize() == 0) ? 1
: game.getTeams().get(ChatColor.GREEN).getTeamSize(),
(short) 5,
"§a" + plugin.getLang().get("menus.teamFour.team.nameItem").replaceAll("<#>",
plugin.getConfig().getString("names.green")),
getLore(game.getTeams().get(ChatColor.GREEN)));
inv.setItem(10, blue);
inv.setItem(12, red);
inv.setItem(14, yellow);
@ -47,15 +71,27 @@ public class TeamMenu {
}.runTaskTimer(plugin, 0, 0);
p.openInventory(inv);
}
public void openTeamNormalMenu(Player p) {
GameDuo game = plugin.getGM().getGameByPlayer(p);
GameDuo game = plugin.getGm().getGameByPlayer(p);
Inventory inv = Bukkit.getServer().createInventory(null, 27, plugin.getLang().get("menus.team.title"));
new BukkitRunnable() {
@Override
public void run() {
ItemStack blue = ItemBuilder.item(Material.STAINED_CLAY, (game.getTeams().get(ChatColor.BLUE).getTeamSize() == 0) ? 1 : game.getTeams().get(ChatColor.BLUE).getTeamSize(), (short)11, "§9" + plugin.getLang().get("menus.team.team.nameItem").replaceAll("<#>", plugin.getConfig().getString("names.blue")), getLore(game.getTeams().get(ChatColor.BLUE)));
ItemStack red = ItemBuilder.item(Material.STAINED_CLAY, (game.getTeams().get(ChatColor.RED).getTeamSize() == 0) ? 1 : game.getTeams().get(ChatColor.RED).getTeamSize(), (short)14, "§c" + plugin.getLang().get("menus.team.team.nameItem").replaceAll("<#>", plugin.getConfig().getString("names.red")), getLore(game.getTeams().get(ChatColor.RED)));
ItemStack blue = ItemBuilder.item(Material.STAINED_CLAY,
(game.getTeams().get(ChatColor.BLUE).getTeamSize() == 0) ? 1
: game.getTeams().get(ChatColor.BLUE).getTeamSize(),
(short) 11,
"§9" + plugin.getLang().get("menus.team.team.nameItem").replaceAll("<#>",
plugin.getConfig().getString("names.blue")),
getLore(game.getTeams().get(ChatColor.BLUE)));
ItemStack red = ItemBuilder.item(Material.STAINED_CLAY,
(game.getTeams().get(ChatColor.RED).getTeamSize() == 0) ? 1
: game.getTeams().get(ChatColor.RED).getTeamSize(),
(short) 14,
"§c" + plugin.getLang().get("menus.team.team.nameItem").replaceAll("<#>",
plugin.getConfig().getString("names.red")),
getLore(game.getTeams().get(ChatColor.RED)));
inv.setItem(11, blue);
inv.setItem(15, red);
if (!p.getOpenInventory().getTitle().equals(plugin.getLang().get("menus.team.title"))) {
@ -65,33 +101,33 @@ public class TeamMenu {
}.runTaskTimer(plugin, 0, 0);
p.openInventory(inv);
}
public List<String> getLore(TeamDuo team){
public List<String> getLore(TeamDuo team) {
List<String> lore = new ArrayList<String>();
for (String msg : plugin.getLang().getList("menus.team.team.loreItem")) {
if (msg.contains("<teamPlayers>")) {
for (Player p : team.getTeamPlayers()) {
lore.add("§7- " + team.getColor() + p.getName());
lore.add("§7- " + team.getColor() + p.getName());
}
} else {
lore.add(msg.replaceAll("&", "§"));
lore.add(msg.replaceAll("&", "§"));
}
}
return lore;
}
public List<String> getLore(TeamFour team){
public List<String> getLore(TeamFour team) {
List<String> lore = new ArrayList<String>();
for (String msg : plugin.getLang().getList("menus.teamFour.team.loreItem")) {
if (msg.contains("<teamPlayers>")) {
for (Player p : team.getTeamPlayers()) {
lore.add("§7- " + team.getColor() + p.getName());
lore.add("§7- " + team.getColor() + p.getName());
}
} else {
lore.add(msg.replaceAll("&", "§"));
lore.add(msg.replaceAll("&", "§"));
}
}
return lore;
}
}

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

@ -13,6 +13,7 @@ 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.Reflection;
public class GenericNMS implements NMS {
@ -77,7 +78,7 @@ public class GenericNMS implements NMS {
case "v1_10_R1":
case "v1_11_R1":
case "v1_12_R1":
case "v1_13_R1":{
case "v1_13_R1": {
b = Biome.valueOf("VOID");
break;
}
@ -101,4 +102,9 @@ public class GenericNMS implements NMS {
}
@Override
public void sendParticle(Location loc, Arrow particle) {
Reflection.sendParticle(loc, particle.getTrail(), 50, 0.3);
}
}

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

@ -1,12 +1,19 @@
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;
public interface NMS {
public ChunkGenerator getChunkGenerator();
public void sendTitle(Player player, int fadein, int stay, int fadeout, String title, String subtitle);
public void sendActionBar(Player player, String s);
public void sendParticle(Location loc, Arrow arrow);
}

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

@ -5,6 +5,7 @@ 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;
@ -21,6 +22,7 @@ import org.bukkit.plugin.SimplePluginManager;
import org.bukkit.scoreboard.Scoreboard;
import org.json.simple.JSONObject;
import cx.sfy.TheBridge.Main;
import cx.sfy.TheBridge.utils.V1_8;
import net.md_5.bungee.api.ChatMessageType;
import net.md_5.bungee.api.chat.ComponentBuilder;
@ -31,7 +33,8 @@ public class Reflection {
public enum Classes {
CraftWorld(), CraftBlock(), CraftPlayer(), Material(), MapMeta(), WorldServer(), PacketPlayOutTitle(), IChatBaseComponent();
CraftWorld(), CraftBlock(), CraftPlayer(), Material(), MapMeta(), WorldServer(), PacketPlayOutTitle(),
IChatBaseComponent(), EnumParticle(), PacketPlayOutWorldParticles();
private Class<?> type;
@ -62,6 +65,8 @@ 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);
@ -85,8 +90,7 @@ public class Reflection {
final Object enumTitle = Classes.PacketPlayOutTitle.getType().getDeclaredClasses()[0].getField("TITLE")
.get(null);
final Object enumSubtitle = Classes.PacketPlayOutTitle.getType().getDeclaredClasses()[0]
.getField("SUBTITLE")
.get(null);
.getField("SUBTITLE").get(null);
final Object titlebase = runMethod(null, Methods.getIChatBaseComponent.getMethod(),
"{\"text\": \"" + title + "\"}");
@ -110,6 +114,38 @@ 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);
Bukkit.getScheduler().runTaskAsynchronously(Main.get(), () -> {
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, 2F, 20,
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();

6
MultiArena-TheBridge/src/cx/sfy/TheBridge/team/TeamDuo.java

@ -1,5 +1,8 @@
package cx.sfy.TheBridge.team;
import java.io.IOException;
import java.util.ArrayList;
import org.bukkit.ChatColor;
import org.bukkit.Color;
import org.bukkit.Location;
@ -15,9 +18,6 @@ import com.sk89q.worldedit.math.transform.Transform;
import cx.sfy.TheBridge.cosmetics.Cage;
import java.io.IOException;
import java.util.ArrayList;
public class TeamDuo {
private ArrayList<Player> players;

16
MultiArena-TheBridge/src/cx/sfy/TheBridge/tops/Top.java

@ -8,29 +8,29 @@ public class Top {
private int amount;
private int top;
private String name;
public Top(String name, int amount, BoardType type) {
this.type = type;
this.amount = amount;
this.name = name;
this.top = Main.get().getTOP().getTopNumber(this);
Main.get().getTOP().addTop(this);
this.top = Main.get().getTop().getTopNumber(this);
Main.get().getTop().addTop(this);
}
public BoardType getType() {
return type;
}
public int getTop() {
return top;
}
public int getAmount() {
return amount;
}
public String getName() {
return name;
}
}

32
MultiArena-TheBridge/trails.yml

@ -0,0 +1,32 @@
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