Merge pull request 'Update Permission' (#220) from PermissionUpdate into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Reviewed-on: #220 Reviewed-by: Lixfel <lixfel@steamwar.de>
Dieser Commit ist enthalten in:
Commit
e4dc05ce02
@ -27,6 +27,10 @@ PAGE_LIST=§e Page ({0}/{1}) »»
|
||||
LIST_PREVIOUS_PAGE=§ePrevious page
|
||||
LIST_NEXT_PAGE=§eNext page
|
||||
|
||||
# Permissions
|
||||
NO_PERMISSION = You are not allowed to use that here
|
||||
SPECTATOR = §fSpectator
|
||||
|
||||
# Scoreboard
|
||||
SCOREBOARD_TIME = Time
|
||||
SCOREBOARD_REGION = Region
|
||||
@ -121,7 +125,6 @@ BACKUP_HELP_LOAD=§8/§ebackup load §8[§7BackupName§8] §8- §7Load a region
|
||||
BACKUP_HELP_LIST=§8/§ebackup list §8- §7List all region backups
|
||||
BACKUP_HELP_GUI=§8/§ebackup gui §8- §7Open the backup GUI
|
||||
BACKUP_REGION_NO_REGION=§cYou are not inside any region
|
||||
BACKUP_NO_PERMS=§You do not have permission to use the backup system
|
||||
BACKUP_CREATE_SUCCESS=§7Backup created
|
||||
BACKUP_CREATE_FAILURE=§cBackup failed
|
||||
BACKUP_CREATE_NO_CHANGE=§7No changes to save
|
||||
@ -135,11 +138,6 @@ BACKUP_LORE=§eClick to load
|
||||
|
||||
# Bau
|
||||
BAU_COMMAND_HELP_INFO = §8/§ebau info §8- §7Alias for §8/§ebauinfo
|
||||
BAU_COMMAND_HELP_TOGGLEWE = §8/§ebau togglewe §8[§7Player§8] §8- §7Edit the WorldEdit permissions of a player
|
||||
BAU_COMMAND_HELP_TOGGLEWORLD = §8/§ebau toggleworld §8[§7Player§8] §8- §7Edit the World permissions of a player
|
||||
BAU_UNKNOWN_PLAYER = §cUnknown Player
|
||||
BAU_NO_PLAYER = §cThe player is no member of your world!
|
||||
BAU_NO_WORLD = §cThis is not your world!
|
||||
|
||||
BAU_INFO_ITEM_NAME = §eBau-Management
|
||||
## This is used in BauInfoBauGuiItem.java
|
||||
@ -153,11 +151,6 @@ BAU_INFO_ITEM_LORE_ITEMS = §7Items§8: §e{0}
|
||||
BAU_INFO_COMMAND_HELP = §8/§ebauinfo §8- §7Information regarding this build server
|
||||
BAU_INFO_COMMAND_OWNER = §7Owner§8: §e{0}
|
||||
BAU_INFO_COMMAND_MEMBER = §7Member §8[§7{0}§8]§8: §e
|
||||
BAU_INFO_MEMBER_INFO = §e{0}§8[{1}§8,{2}§8] §8
|
||||
BAU_INFO_MEMBER_WE_ALLOW = §aWE
|
||||
BAU_INFO_MEMBER_WE_DISALLOW = §cWE
|
||||
BAU_INFO_MEMBER_WORLD_ALLOW = §aW
|
||||
BAU_INFO_MEMBER_WORLD_DISALLOW = §cW
|
||||
BAU_INFO_COMMAND_FLAG = §7{0}§8: §7{1}
|
||||
BAU_INFO_COMMAND_TPS = §7TPS§8:§e
|
||||
|
||||
@ -216,11 +209,6 @@ HOTBAR_INVENTORY=Standard hotbar
|
||||
# GUI
|
||||
GUI_EDITOR_ITEM_NAME=§eGui editor
|
||||
GUI_NAME=Bau GUI
|
||||
GUI_NO_PERMISSION=§cYou do not have enough permissions for this
|
||||
GUI_NO_OWNER=§cYou are not the owner of this World
|
||||
GUI_NO_WORLD=§cYou do not have permissions to change the World
|
||||
GUI_NO_WORLDEDIT=§cYou do not have permissions to use WorldEdit
|
||||
GUI_NO_MEMBER=§cYou need to be a member of this World
|
||||
GUI_ITEM_LORE1=§7Use this item to open the bau gui
|
||||
GUI_ITEM_LORE2=§7or press swap hands twice.
|
||||
GUI_EDITOR_TITLE=Bau GUI Editor
|
||||
@ -271,7 +259,6 @@ SHIELD_PRINTING_HELP_STEP_7 = §87. §7Apply the shield printing with §8/§eshi
|
||||
|
||||
SHIELD_PRINTING_NO_REGION = §cYou are not in a region.
|
||||
SHIELD_PRINTING_NOT_RUNNING = §cThe shield printing is not running.
|
||||
SHIELD_PRINTING_DISALLOWED = §cYou are not allowed to use shield printing here.
|
||||
SHIELD_PRINTING_BOSSBAR = §fMovements: {0}
|
||||
SHIELD_PRINTING_BOSSBAR_COPIED = §fMovements: {0} Copied: {1}
|
||||
|
||||
@ -308,7 +295,6 @@ SIMULATOR_CHANGE_HELP = §8/§esimulator change §8-§7 Change your simulator wa
|
||||
SIMULATOR_DELETE_HELP = §8/§esimulator delete §8[§7name§8] §8-§7 Deletes the simulator
|
||||
SIMULATOR_START_HELP = §8/§esimulator start §8[§7name§8] §8-§7 Starts the simulator
|
||||
SIMULATOR_COPY_HELP = §8/§esimulator copy §8[§7to-copy§8] §8[§7name§8] §8-§7 Copy the simulator
|
||||
SIMULATOR_NO_PERMS = §cYou are not allowed to use the simulator here
|
||||
|
||||
SIMULATOR_GUI_ITEM_NAME = §eTNT Simulator
|
||||
|
||||
@ -487,7 +473,6 @@ TPSLIMIT_GUI_ITEM_NAME = §eTPS limiter
|
||||
TPSLIMIT_GUI_ITEM_LORE = §7Currently: §e{0}
|
||||
TPSLIMIT_ANVIL_GUI = New TPS limit
|
||||
TPSLIMIT_CURRENT = §7Current TPS limit§8: §e{0}
|
||||
TPSLIMIT_NO_PERMS = §cYou are not allowed to use the TPS-Limiter here
|
||||
TPSLIMIT_SET = §eSet TPS limit to {0}
|
||||
TPSLIMIT_FROZEN = §eTPS frozen
|
||||
|
||||
@ -513,7 +498,6 @@ TRACE_MESSAGE_DELETE = §cAll TNT-positions deleted
|
||||
TRACE_MESSAGE_SHOW = §aAll TNT-positions shown
|
||||
TRACE_MESSAGE_HIDE = §cAll TNT-positions hidden
|
||||
TRACE_MESSAGE_CLICK_ISOLATE = §eClick to §aisolate§8/§cunisolate
|
||||
TRACE_MESSAGE_DISALLOWED = §cYou are not allowed to use the TNT-Tracer here
|
||||
TRACE_MESSAGE_SHOW_AT = §aTNT-positions shown with {0} at {1}
|
||||
TRACE_MESSAGE_SHOW_FROM = §aAll TNT-positions shown with {0} from {1}
|
||||
TRACE_MESSAGE_SHOW_FROM_TO = §aAll TNT-positions shown with {0} from {1} to {2}
|
||||
@ -702,7 +686,6 @@ OTHER_CLEAR_HELP_PLAYER=§8/§eclear §8[§7Player§8] §8- §7Clears a player i
|
||||
OTHER_CLEAR_CLEARED=Your inventory was cleared.
|
||||
OTHER_CLEAR_FROM=Your invetnory was cleared by {0}.
|
||||
OTHER_CLEAR_TO=The inventory of {0} §7was cleared.
|
||||
OTHER_CLEAR_NO_PERMS=§cYou are not allowed to clear other's inventory here.
|
||||
OTHER_DECLUTTER_HELP=§8/§edeclutter §8- §7Organise your inventory
|
||||
OTHER_DECLUTTER_DONE=§aYour inventory was organised.
|
||||
OTHER_GAMEMODE_UNKNOWN=§cUnknown gamemode.
|
||||
@ -718,7 +701,6 @@ OTHER_TELEPORT_SELF_2=§cBlocks left to travel: 0; ETA: 0:00
|
||||
OTHER_TELEPORT_SELF_3=§cA little Movement is important.
|
||||
OTHER_TELEPORT_SELF_4=§cFor such a distance?
|
||||
OTHER_TIME_HELP=§8/§etime §8<§7Time 0=Morining§8, §76000=Midday§8, §718000=Midnight§8> - §7Sets the time on the Build
|
||||
OTHER_TIME_NO_PERM=§cYou are not allowed to change the time here
|
||||
OTHER_TIME_INVALID=§cPlease input a time between 0 and 24000
|
||||
OTHER_TIME_RESULT=§7§oWhooosh
|
||||
OTHER_TPS_HEAD = §7TPS: 1s 10s 1m 5m 10m
|
||||
@ -784,17 +766,6 @@ MATERIAL_FLAMMABLE=§8- §eFlammable block
|
||||
MATERIAL_BURNABLE=§8- §eBurnable block
|
||||
MATERIAL_WATERLOGGABLE=§8- §eWaterloggable block
|
||||
MATERIAL_UNMOVABLE=§8- §eUnmovable block
|
||||
# Redstonetester
|
||||
RT_HELP=§8/§eredstonetester §8-§7 Gives you the redstone tester
|
||||
RT_GIVEN=§7Measure the time between activation of components
|
||||
RT_ITEM_NAME=§eRedstonetester
|
||||
RT_ITEM_LORE_1=§eLeftclick block §8-§7 Sets the 1. Position
|
||||
RT_ITEM_LORE_2=§eRightclick block §8-§7 Sets the 2. Position
|
||||
RT_ITEM_LORE_3=§eShift-rightclick in air §8-§7 Reset
|
||||
RT_LOC=§8: §e{0} {1} {2}
|
||||
RT_INVALID_LOC=§cUnknown Position
|
||||
RT_RESULT=§7Difference§8: §e{0}§7 Ticks §8,§7 R-Ticks §e{1}
|
||||
RT_ACTIVATE=§7Positions deleted§8.
|
||||
# Region Items
|
||||
REGION_ITEM_COLOR=§7Color: §e{0}
|
||||
REGION_ITEM_COLOR_CHOOSE=Choose color
|
||||
@ -820,24 +791,18 @@ REGION_COLOR_HELP_COLOR=§8/§ecolor §8[§7Color§8] §8- §7Sets the color of
|
||||
REGION_COLOR_HELP_COLOR_TYPE=§8/§ecolor §8[§7Color§8] §8[§7Type§8] §8- §7Sets the color of the region or globally
|
||||
REGION_COLOR_GLOBAL=§7All regions color set to §e{0}
|
||||
REGION_COLOR_NO_REGION=§cYou are currently not in any region
|
||||
REGION_COLOR_NO_PERMS=§cThis is not your world!
|
||||
REGION_FIRE_HELP=§8/§efire §8- §7Toggle fire damage
|
||||
REGION_FIRE_NO_PERMS=§cYou are not allowed to toggle fire damage here
|
||||
REGION_FIRE_ENABLED=§cFire damage deactivated in this region
|
||||
REGION_FIRE_DISABLED=§aFire damage activated in this region
|
||||
REGION_FREEZE_HELP=§8/§efreeze §8- §7Toggle Freeze
|
||||
REGION_FREEZE_NO_PERMS=§cYou are not allowed to freeze this world
|
||||
REGION_FREEZE_ENABLED=§cRegion frozen
|
||||
REGION_FREEZE_DISABLED=§aRegion thawed
|
||||
REGION_ITEMS_HELP=§8/§eitems §8- §7Toggle Items
|
||||
REGION_ITEMS_NO_PERMS=§cYou are not allowed to toggle items in this world
|
||||
REGION_ITEMS_ENABLED=§aItems enabled in this region
|
||||
REGION_ITEMS_DISABLED_GLOBAL=§cItems disabled in this world
|
||||
REGION_ITEMS_DISABLED=§cItems disabled in this region
|
||||
REGION_PROTECT_HELP=§8/§eprotect §8- §7Protect the region
|
||||
REGION_PROTECT_DISABLE=§cProtection disabled
|
||||
REGION_PROTECT_ENABLE=§aProtection enabled
|
||||
REGION_PROTECT_NO_PERMS=§cYou are not allowed to protect the floor here
|
||||
REGION_PROTECT_FALSE_REGION=§cYou are not currently in a (M)WG-region
|
||||
REGION_REGION_HELP_UNDO=§8/§eregion undo §8- §7undo the last 20 /testblock or /reset
|
||||
REGION_REGION_HELP_REDO=§8/§eregion redo §8- §7redo the last 20 §8/§7rg undo
|
||||
@ -845,8 +810,6 @@ REGION_REGION_HELP_RESTORE=§8/§eregion restore §8- §7Resets the region, with
|
||||
REGION_REGION_HELP_RESTORE_SCHEMATIC=§8/§eregion restore §8[§7Schematic§8] §8- §7Resets the region, withoout removing your builds
|
||||
REGION_REGION_HELP_COPYPOINT=§8/§eregion copypoint §8- §7Teleport to the regions copy point
|
||||
REGION_REGION_HELP_TESTBLOCKPOINT=§8/§eregion testblockpoint §8- §7Teleport to the regions dummy point
|
||||
REGION_REGION_HELP_CHANGETYPE_INFO=§8/§eregion changetype §8- §7Returns the region type
|
||||
REGION_REGION_HELP_CHANGETYPE=§8/§eregion changetype §8[§7Type§8] §8- §8Sets the region type
|
||||
REGION_REGION_HELP_CHANGESKIN_INFO=§8/§eregion changeskin §8- §7Returns the region skin
|
||||
REGION_REGION_HELP_CHANGESKIN=§8/§eregion changeskin §8[§7Skin§8] §8- §8Sets the region skin
|
||||
REGION_REGION_NOTHING_UNDO=§cNothing left to undo
|
||||
@ -862,13 +825,6 @@ REGION_REGION_TP_COPY=§7Teleported to the copy point
|
||||
REGION_REGION_TP_TEST_BLOCK=§7Teleported to the tesblock
|
||||
REGION_REGION_TP_UNKNOWN=§cUndefined teleport point
|
||||
REGION_REGION_NO_REGION=§cYou are not inside any region
|
||||
REGION_REGION_NO_PERMS=§cYou are not allowed to change the region
|
||||
REGION_REGION_CHANGETYPE_INFO=§7RRegion type is §e{0}
|
||||
REGION_REGION_CHANGETYPE_UNKNOWN=§cRegion type is invalid
|
||||
REGION_REGION_CHANGETYPE_INVALID=§cRegion type is not allowed here
|
||||
REGION_REGION_CHANGETYPE_CHANGE=§7Region type changed to §e{0}
|
||||
REGION_REGION_CHANGETYPE_CHANGE_UPDATE=§7Click §e§lHERE §7to change the region type
|
||||
REGION_REGION_CHANGETYPE_CHANGE_UPDATE_HOVER=§8/§ereset
|
||||
REGION_REGION_CHANGESKIN_INFO=§7Region skin is §e{0}
|
||||
REGION_REGION_CHANGESKIN_INFO_CREATOR=§7Skin created by §e{0}
|
||||
REGION_REGION_CHANGESKIN_UNKNOWN=§cRegion skin is invalid
|
||||
@ -880,7 +836,6 @@ REGION_RESET_HELP_RESET=§8/§ereset §8- §7Resets the region
|
||||
REGION_RESET_HELP_SCHEMATIC=§8/§ereset §8[§7Schematic§8] §8- §7Resets the region using a schematic
|
||||
REGION_RESET_RESETED=§7Region reset
|
||||
REGION_RESET_ERROR=§cError reseting the region
|
||||
REGION_RESET_NO_PERMS=§cYou are not allowed to reset the region here
|
||||
REGION_RESET_NO_REGION=§cYou are currently not in any region
|
||||
REGION_TB_HELP_RESET=§8/§etestblock §8- §7Reset the dummy
|
||||
REGION_TB_HELP_RESET_EXTENSION=§8/§etestblock §8[§7ExtensionType§8] §8- §7Reset the dummy
|
||||
@ -888,7 +843,6 @@ REGION_TB_HELP_SCHEMATIC=§8/§etestblock §8[§7Schematic§8] §8- §7Reset the
|
||||
REGION_TB_HELP_SCHEMATIC_EXTENSION=§8/§etestblock §8[§7Schematic§8] §8[§7ExtensionType§8] §8- §7Reset the dummy using a schematic
|
||||
REGION_TB_DONE=§7Dummy reset
|
||||
REGION_TB_ERROR=§cError resetting the dummy
|
||||
REGION_TB_NO_PERMS=§cYou are not allowed to reset the dummy here
|
||||
REGION_TB_NO_REGION=§cYou are currently not in any region
|
||||
REGION_TB_NO_SCHEMSHARING=§cYou currently cannot share schematics until {0}.
|
||||
REGION_TB_NO_SCHEMRECEIVING=§cThe Owner of this build server cannot receive any schematics until {0}.
|
||||
@ -898,7 +852,6 @@ REGION_TNT_ON=§aTNT-Damage activated
|
||||
REGION_TNT_OFF=§cTNT-Damage deactivated
|
||||
REGION_TNT_TB=§aTNT-Damage activated outside the building area
|
||||
REGION_TNT_BUILD=§aTNT-Damage activated outside the testblok area
|
||||
REGION_TNT_NO_PERMS=§cYou are not allowed to toggle tnt damage here
|
||||
REGION_TNT_BUILD_DESTROY=§cAn explosion would have destroyed blocks in the building area
|
||||
REGION_TNT_TB_DESTROY=§cAn explosion would have destroyed blocks in the testblock area
|
||||
|
||||
@ -917,7 +870,6 @@ PANZERN_PREPARE1 = §71. Check, if barrels reach until border of armor.
|
||||
PANZERN_PREPARE2 = §72. Carpet on the floor in walkways helps with armoring.
|
||||
PANZERN_PREPARE3 = §73. Shieldtechnology should be encased.
|
||||
PANZERN_PREPARE4 = §74. Standing in the region that is being armored can improve armoring.
|
||||
PANZERN_NO_PERM = §cYou are not allowed to use the armoring system here
|
||||
PANZERN_NO_WORLDEDIT = §cYou have no WorldEdit selcetion
|
||||
PANZERN_PROGRESS = §e{0} §7Blocks left, §e{1} §7Blocks per second, §e{2} §7block delta
|
||||
PANZERN_DONE = §aDone
|
||||
@ -927,7 +879,6 @@ LAUFBAU_HELP = §8/§elaufbau §8[§7smallest§8|§7blastresistant§8] §8- §7B
|
||||
LAUFBAU_HELP_SETTINGS = §8/§elaufbau settings §8- §7Opens the settings GUI
|
||||
LAUFBAU_PREPARE1 = §71. Trace the cannons as often as necessary, in all modes.
|
||||
LAUFBAU_PREPARE2 = §72. Try to delete all fails from the traces.
|
||||
LAUFBAU_NO_PERM = §cYou are not allowed to use the barrel building system here
|
||||
LAUFBAU_NO_WORLDEDIT = §cYou don't have a WorldEdit selection
|
||||
LAUFBAU_STATE_FILTERING_TRACES = Filtering traces
|
||||
LAUFBAU_STATE_PROCESSING_TRACES = Connnecting traces
|
||||
@ -1039,7 +990,6 @@ LAUFBAU_TILT_PARTIAL = §8-§7 Tilt partial
|
||||
# UTILS
|
||||
SELECT_HELP = §8/§eselect §8[§7RegionsTyp§8] §8- §7Select a region type
|
||||
SELECT_EXTENSION_HELP = §8/§eselect §8[§7RegionsTyp§8] §8[§7Extension§8] §8- §7Select a region type with or without extension
|
||||
SELECT_NO_PERMS = §cYou are not allowed to use the slection tool here
|
||||
SELECT_GLOBAL_REGION = §cThe global region cannot be selected
|
||||
SELECT_NO_TYPE = §cThis region has no {0}
|
||||
SELECT_NO_EXTENSION = §cThis region has no extension
|
||||
@ -1093,7 +1043,6 @@ PISTON_HELP_3 = §7Count is yellow, if too many blocks are present.
|
||||
PISTON_INFO = §7Moved Blocks {0}{1}§8/§712
|
||||
|
||||
# Warp
|
||||
WARP_DISALLOWED = §cYou are not allowed to use the warp here
|
||||
WARP_LOC_X = §7X§8: §e{0}
|
||||
WARP_LOC_Y = §7Y§8: §e{0}
|
||||
WARP_LOC_Z = §7Z§8: §e{0}
|
||||
@ -1119,12 +1068,9 @@ WARP_HELP_LIST=§8/§ewarp list §8- §7List all warps
|
||||
|
||||
# WORLD
|
||||
STOP_HELP = §8/§estop §8- §7Stops the server
|
||||
STOP_NO_PERMS = §cYou do not have the permission to stop the server
|
||||
STOP_MESSAGE = §eServer is stopping
|
||||
WORLD_EDIT_NO_PERMS = §cYou do not have the permission to use WorldEdit
|
||||
|
||||
KICKALL_HELP = §8/§ekickall §8- §7Kick all players from the server except the owner
|
||||
KICKALL_NO_PERM = §cThis is not your world!
|
||||
|
||||
# Techhider
|
||||
TECHHIDER_HELP = §8/§etechhider §8- §7Toggle Techhider
|
||||
|
@ -27,6 +27,10 @@ PAGE_LIST=§e Seite ({0}/{1}) »»
|
||||
LIST_PREVIOUS_PAGE=§eVorherige Seite
|
||||
LIST_NEXT_PAGE=§eNächste Seite
|
||||
|
||||
# Permission
|
||||
NO_PERMISSION = Du darfst dies hier nicht nutzen
|
||||
SPECTATOR = §fZuschauer
|
||||
|
||||
# Scoreboard
|
||||
SCOREBOARD_TIME = Uhrzeit
|
||||
SCOREBOARD_REGION = Region
|
||||
@ -120,7 +124,6 @@ BACKUP_HELP_LOAD=§8/§ebackup load §8[§7BackupName§8] §8- §7 Lade ein Back
|
||||
BACKUP_HELP_LIST=§8/§ebackup list §8- §7Liste alle Backups der Region auf
|
||||
BACKUP_HELP_GUI=§8/§ebackup gui §8- §7Öffne die Backups in einer GUI
|
||||
BACKUP_REGION_NO_REGION=§cDu bist in keiner Region
|
||||
BACKUP_NO_PERMS=§cDu darfst hier nicht das Backup System verwenden
|
||||
BACKUP_CREATE_SUCCESS=§7Das Backup wurde erstellt
|
||||
BACKUP_CREATE_FAILURE=§cDas Backup erstellen ist schiefgegangen
|
||||
BACKUP_CREATE_NO_CHANGE=§7Die Region hat keine Veränderung
|
||||
@ -134,11 +137,6 @@ BACKUP_LORE=§eKlicken zum Laden
|
||||
|
||||
# Bau
|
||||
BAU_COMMAND_HELP_INFO = §8/§ebau info §8- §7Alias für §8/§ebauinfo
|
||||
BAU_COMMAND_HELP_TOGGLEWE = §8/§ebau togglewe §8[§7Player§8] §8- §7Editiere die WorldEdit Rechte eines Spielers
|
||||
BAU_COMMAND_HELP_TOGGLEWORLD = §8/§ebau toggleworld §8[§7Player§8] §8- §7Editiere die Welt Rechte eines Spielers
|
||||
BAU_UNKNOWN_PLAYER = §cUnbekannter Spieler
|
||||
BAU_NO_PLAYER = §cDer Spieler ist kein Mitglied deiner Welt!
|
||||
BAU_NO_WORLD = §cDies ist nicht deine Welt!
|
||||
|
||||
BAU_INFO_ITEM_NAME = §eBau-Management
|
||||
## This is used in BauInfoBauGuiItem.java
|
||||
@ -152,11 +150,6 @@ BAU_INFO_ITEM_LORE_PROTECT = §7Protect§8: §e{0}
|
||||
BAU_INFO_COMMAND_HELP = §8/§ebauinfo §8- §7Gibt Informationen über den Bau
|
||||
BAU_INFO_COMMAND_OWNER = §7Besitzer§8: §e{0}
|
||||
BAU_INFO_COMMAND_MEMBER = §7Mitglieder §8[§7{0}§8]§8: §e
|
||||
BAU_INFO_MEMBER_INFO = §e{0}§8[{1}§8,{2}§8] §8
|
||||
BAU_INFO_MEMBER_WE_ALLOW = §aWE
|
||||
BAU_INFO_MEMBER_WE_DISALLOW = §cWE
|
||||
BAU_INFO_MEMBER_WORLD_ALLOW = §aW
|
||||
BAU_INFO_MEMBER_WORLD_DISALLOW = §cW
|
||||
BAU_INFO_COMMAND_FLAG = §7{0}§8: §7{1}
|
||||
BAU_INFO_COMMAND_TPS = §7TPS§8:§e
|
||||
|
||||
@ -215,11 +208,6 @@ HOTBAR_INVENTORY=Standard Hotbar
|
||||
# GUI
|
||||
GUI_EDITOR_ITEM_NAME=§eGui Editor
|
||||
GUI_NAME=Bau GUI
|
||||
GUI_NO_PERMISSION=§cDu hast nicht genug Rechte um dies zu tun
|
||||
GUI_NO_OWNER=§cDas ist nicht deine Bauwelt
|
||||
GUI_NO_WORLD=§cDu darfst hier die Welt nicht einstellen
|
||||
GUI_NO_WORLDEDIT=§cDu darfst hier kein Worldedit benutzen
|
||||
GUI_NO_MEMBER=§cDu musst ein Member der Bauwelt sein
|
||||
GUI_ITEM_LORE1=§7Du kannst dieses Item zum Öffnen der BauGUI nutzen
|
||||
GUI_ITEM_LORE2=§7oder Doppel F (Swap hands) drücken.
|
||||
GUI_EDITOR_TITLE=Bau GUI Editor
|
||||
@ -263,7 +251,6 @@ SHIELD_PRINTING_HELP_STEP_7 = §87. §7Wende das gedruckte mit §8/§eshieldprin
|
||||
|
||||
SHIELD_PRINTING_NO_REGION = §cDu bist in keiner Region.
|
||||
SHIELD_PRINTING_NOT_RUNNING = §cShield printing ist nicht aktiv.
|
||||
SHIELD_PRINTING_DISALLOWED = §cDu darfst Shield printing nicht benutzen.
|
||||
SHIELD_PRINTING_BOSSBAR = §fBewegungen: {0}
|
||||
SHIELD_PRINTING_BOSSBAR_COPIED = §fBewegungen: {0} Kopiert: {1}
|
||||
|
||||
@ -300,7 +287,6 @@ SIMULATOR_CHANGE_HELP = §8/§esimulator change §8-§7 Wechsel zu einem anderen
|
||||
SIMULATOR_DELETE_HELP = §8/§esimulator delete §8[§7name§8] §8-§7 Löscht den Simulator
|
||||
SIMULATOR_START_HELP = §8/§esimulator start §8[§7name§8] §8-§7 Startet die Simulation
|
||||
SIMULATOR_COPY_HELP = §8/§esimulator copy §8[§7to-copy§8] §8[§7name§8] §8-§7 Kopiert einen Simulator
|
||||
SIMULATOR_NO_PERMS = §cDu darfst hier nicht den Simulator nutzen
|
||||
|
||||
SIMULATOR_GUI_ITEM_NAME = §eTNT Simulator
|
||||
|
||||
@ -456,7 +442,6 @@ TPSLIMIT_GUI_ITEM_NAME = §eTPS Limiter
|
||||
TPSLIMIT_GUI_ITEM_LORE = §7Aktuell: §e{0}
|
||||
TPSLIMIT_ANVIL_GUI = Neues TPS Limit
|
||||
TPSLIMIT_CURRENT = §7Jetziges TPS limit§8: §e{0}
|
||||
TPSLIMIT_NO_PERMS = §cDu darfst hier nicht den TPS-Limiter nutzen
|
||||
TPSLIMIT_SET = §eTPS limit auf {0} gesetzt.
|
||||
TPSLIMIT_FROZEN = §eTPS eingefroren.
|
||||
|
||||
@ -482,7 +467,6 @@ TRACE_MESSAGE_DELETE = §cAlle TNT-Positionen gelöscht
|
||||
TRACE_MESSAGE_SHOW = §aAlle TNT-Positionen angezeigt
|
||||
TRACE_MESSAGE_HIDE = §cAlle TNT-Positionen ausgeblendet
|
||||
TRACE_MESSAGE_CLICK_ISOLATE = §eKlicken zum §aisolieren§8/§causblenden
|
||||
TRACE_MESSAGE_DISALLOWED = §cDu darfst hier nicht den TNT-Tracer nutzen
|
||||
TRACE_MESSAGE_SHOW_AT = §aTNT-positions angezeigt mit {0} bei {1}
|
||||
TRACE_MESSAGE_SHOW_FROM = §aAll TNT-positions angezeigt mit {0} von {1}
|
||||
TRACE_MESSAGE_SHOW_FROM_TO = §aAll TNT-positions angezeigt mit {0} von {1} bis {2}
|
||||
@ -669,7 +653,6 @@ OTHER_CLEAR_HELP_PLAYER=§8/§eclear §8[§7Player§8] §8- §7Leere ein Spieler
|
||||
OTHER_CLEAR_CLEARED=Dein Inventar wurde geleert.
|
||||
OTHER_CLEAR_FROM=Dein Inventar wurde von {0} §7geleert.
|
||||
OTHER_CLEAR_TO=Das Inventar von {0} §7wurde geleert.
|
||||
OTHER_CLEAR_NO_PERMS=§cDu darfst hier keine fremden Inventare leeren.
|
||||
OTHER_DECLUTTER_HELP=§8/§edeclutter §8- §7Räume dein Inventar auf
|
||||
OTHER_DECLUTTER_DONE=§aDein Inventar wurde aufgeräumt.
|
||||
OTHER_GAMEMODE_UNKNOWN=§cUnbekannter Spielmodus.
|
||||
@ -685,7 +668,6 @@ OTHER_TELEPORT_SELF_2=§cNoch zu reisende Blöcke: 0; ETA: 0:00
|
||||
OTHER_TELEPORT_SELF_3=§cEin wenig bewegung muss ein.
|
||||
OTHER_TELEPORT_SELF_4=§cFür eine solche Distanz?
|
||||
OTHER_TIME_HELP=§8/§etime §8<§7Zeit 0=Morgen§8, §76000=Mittag§8, §718000=Mitternacht§8> - §7Setzt die Zeit auf dem Bau
|
||||
OTHER_TIME_NO_PERM=§cDu darfst hier nicht die Zeit ändern
|
||||
OTHER_TIME_INVALID=§cBitte gib eine Zahl zwischen 0 und 24000 an
|
||||
OTHER_TIME_RESULT=§7§oWhooosh
|
||||
OTHER_TPS_HEAD = §7TPS: 1s 10s 1m 5m 10m
|
||||
@ -747,17 +729,6 @@ MATERIAL_INTERACTABLE=§8- §eInterargierbarer Block
|
||||
MATERIAL_FLAMMABLE=§8- §eFlammbarer Block
|
||||
MATERIAL_BURNABLE=§8- §eBrennbarer Block
|
||||
MATERIAL_WATERLOGGABLE=§8- §eWasserspeicherbarer Block
|
||||
# Redstonetester
|
||||
RT_HELP=§8/§eredstonetester §8-§7 Gibt den RedstoneTester
|
||||
RT_GIVEN=§7Messe die Zeit zwischen der Aktivierung zweier Redstone Komponenten
|
||||
RT_ITEM_NAME=§eRedstonetester
|
||||
RT_ITEM_LORE_1=§eLinksklick Block §8-§7 Setzt die 1. Position
|
||||
RT_ITEM_LORE_2=§eRechtsklick Block §8-§7 Setzt die 2. Position
|
||||
RT_ITEM_LORE_3=§eShift-Rechtsklick Luft §8-§7 Zurücksetzten
|
||||
RT_LOC=§8: §e{0} {1} {2}
|
||||
RT_INVALID_LOC=§cUnbekannte Position
|
||||
RT_RESULT=§7Differenz§8: §e{0}§7 Ticks §8,§7 R-Ticks §e{1}
|
||||
RT_ACTIVATE=§7Positionen gelöscht§8.
|
||||
# Region Items
|
||||
REGION_ITEM_COLOR=§7Color: §e{0}
|
||||
REGION_ITEM_COLOR_CHOOSE=Farbe Wählen
|
||||
@ -783,24 +754,18 @@ REGION_COLOR_HELP_COLOR=§8/§ecolor §8[§7Color§8] §8- §7Setze die Farbe de
|
||||
REGION_COLOR_HELP_COLOR_TYPE=§8/§ecolor §8[§7Color§8] §8[§7Type§8] §8- §7Setze die Farbe der Region oder Global
|
||||
REGION_COLOR_GLOBAL=§7Alle Regions farben auf §e{0}§7 gesetzt
|
||||
REGION_COLOR_NO_REGION=§cDu befindest dich derzeit in keiner Region
|
||||
REGION_COLOR_NO_PERMS=§cDies ist nicht deine Welt!
|
||||
REGION_FIRE_HELP=§8/§efire §8- §7Toggle Feuerschaden
|
||||
REGION_FIRE_NO_PERMS=§cDu darfst hier nicht Feuerschaden (de-)aktivieren
|
||||
REGION_FIRE_ENABLED=§cRegions Feuerschaden deaktiviert
|
||||
REGION_FIRE_DISABLED=§aRegions Feuerschaden aktiviert
|
||||
REGION_FREEZE_HELP=§8/§efreeze §8- §7Toggle Freeze
|
||||
REGION_FREEZE_NO_PERMS=§cDu darfst diese Welt nicht einfrieren
|
||||
REGION_FREEZE_ENABLED=§cRegion eingefroren
|
||||
REGION_FREEZE_DISABLED=§aRegion aufgetaut
|
||||
REGION_ITEMS_HELP=§8/§eitems §8- §7Toggle Items
|
||||
REGION_ITEMS_NO_PERMS=§cDu darfst hier nicht Items (de-)aktivieren
|
||||
REGION_ITEMS_ENABLED=§aItems aktiviert in dieser Region
|
||||
REGION_ITEMS_DISABLED=§cItems deaktiviert in dieser Region
|
||||
REGION_ITEMS_DISABLED_GLOBAL=§cItems sind auf dem Server deaktiviert.
|
||||
REGION_PROTECT_HELP=§8/§eprotect §8- §7Schütze die Region
|
||||
REGION_PROTECT_DISABLE=§cBoden Schutz aufgehoben
|
||||
REGION_PROTECT_ENABLE=§aBoden geschützt
|
||||
REGION_PROTECT_NO_PERMS=§cDu darfst hier nicht den Boden schützen
|
||||
REGION_PROTECT_FALSE_REGION=§cDu befindest dich derzeit in keiner (M)WG-Region
|
||||
REGION_REGION_HELP_UNDO=§8/§eregion undo §8- §7Mache die letzten 20 /testblock oder /reset rückgängig
|
||||
REGION_REGION_HELP_REDO=§8/§eregion redo §8- §7Wiederhole die letzten 20 §8/§7rg undo
|
||||
@ -808,8 +773,6 @@ REGION_REGION_HELP_RESTORE=§8/§eregion restore §8- §7Setzte die Region zurü
|
||||
REGION_REGION_HELP_RESTORE_SCHEMATIC=§8/§eregion restore §8[§7Schematic§8] §8- §7Setzte die Region zurück, ohne das Gebaute zu löschen
|
||||
REGION_REGION_HELP_COPYPOINT=§8/§eregion copypoint §8- §7Teleportiere dich zum Regions Kopierpunkt
|
||||
REGION_REGION_HELP_TESTBLOCKPOINT=§8/§eregion testblockpoint §8- §7Teleportiere dich zum Regions Testblockpunkt
|
||||
REGION_REGION_HELP_CHANGETYPE_INFO=§8/§eregion changetype §8- §7Gebe den Regions Type aus
|
||||
REGION_REGION_HELP_CHANGETYPE=§8/§eregion changetype §8[§7Type§8] §8- §8Setzte den Regions Type
|
||||
REGION_REGION_HELP_CHANGESKIN_INFO=§8/§eregion changeskin §8- §7Gebe den Regions Skin aus
|
||||
REGION_REGION_HELP_CHANGESKIN=§8/§eregion changeskin §8[§7Skin§8] §8- §8Setzte den Regions Skin
|
||||
REGION_REGION_NOTHING_UNDO=§cNichts zum rückgängig machen
|
||||
@ -825,13 +788,6 @@ REGION_REGION_TP_COPY=§7Zum Kopierpunkt teleportiert
|
||||
REGION_REGION_TP_TEST_BLOCK=§7Zum Testblock teleportiert
|
||||
REGION_REGION_TP_UNKNOWN=§cNicht definierter Teleportierpunkt
|
||||
REGION_REGION_NO_REGION=§cDu bist in keiner Region
|
||||
REGION_REGION_NO_PERMS=§cDu darfst hier nicht die Region verändern
|
||||
REGION_REGION_CHANGETYPE_INFO=§7Regions Type ist §e{0}
|
||||
REGION_REGION_CHANGETYPE_UNKNOWN=§cRegions Type ist nicht valide
|
||||
REGION_REGION_CHANGETYPE_INVALID=§cRegions Type ist nicht erlaubt hier
|
||||
REGION_REGION_CHANGETYPE_CHANGE=§7Regions Type ist auf §e{0}§7 geändert
|
||||
REGION_REGION_CHANGETYPE_CHANGE_UPDATE=§7Klicke §e§lHIER §7um den Type anzuwenden
|
||||
REGION_REGION_CHANGETYPE_CHANGE_UPDATE_HOVER=§8/§ereset
|
||||
REGION_REGION_CHANGESKIN_INFO=§7Regions Skin ist §e{0}
|
||||
REGION_REGION_CHANGESKIN_INFO_CREATOR=§7Skin erstellt von §e{0}
|
||||
REGION_REGION_CHANGESKIN_UNKNOWN=§cRegions Skin ist nicht valide
|
||||
@ -843,7 +799,6 @@ REGION_RESET_HELP_RESET=§8/§ereset §8- §7Setzte die Region zurück
|
||||
REGION_RESET_HELP_SCHEMATIC=§8/§ereset §8[§7Schematic§8] §8- §7Setzte die Region mit einer Schematic zurück
|
||||
REGION_RESET_RESETED=§7Region zurückgesetzt
|
||||
REGION_RESET_ERROR=§cFehler beim Zurücksetzen der Region
|
||||
REGION_RESET_NO_PERMS=§cDu darfst hier nicht die Region zurücksetzen
|
||||
REGION_RESET_NO_REGION=§cDu befindest dich derzeit in keiner Region
|
||||
REGION_TB_HELP_RESET=§8/§etestblock §8- §7Setzte den Testblock zurück
|
||||
REGION_TB_HELP_RESET_EXTENSION=§8/§etestblock §8[§7ExtensionType§8] §8- §7Setzte den Testblock zurück
|
||||
@ -851,7 +806,6 @@ REGION_TB_HELP_SCHEMATIC=§8/§etestblock §8[§7Schematic§8] §8- §7Setzte de
|
||||
REGION_TB_HELP_SCHEMATIC_EXTENSION=§8/§etestblock §8[§7Schematic§8] §8[§7ExtensionType§8] §8- §7Setzte den Testblock mit einer Schematic zurück
|
||||
REGION_TB_DONE=§7Testblock zurückgesetzt
|
||||
REGION_TB_ERROR=§cFehler beim Zurücksetzen des Testblocks
|
||||
REGION_TB_NO_PERMS=§cDu darfst hier nicht den Testblock zurücksetzen
|
||||
REGION_TB_NO_REGION=§cDu befindest dich derzeit in keiner Region
|
||||
REGION_TB_NO_SCHEMSHARING=§cDu kannst aktuell keine Schematics teilen bis {0}.
|
||||
REGION_TB_NO_SCHEMRECEIVING=§cDer Besitzer dieses Bauservers kann keine Schematics erhalten bis {0}.
|
||||
@ -860,7 +814,6 @@ REGION_TNT_HELP_MODE=§8/§etnt §8[§7Mode§8] §8- §7Setzte das TNT verhalten
|
||||
REGION_TNT_ON=§aTNT-Schaden aktiviert
|
||||
REGION_TNT_OFF=§cTNT-Schaden deaktiviert
|
||||
REGION_TNT_TB=§aTNT-Schaden außerhalb Baurahmen aktiviert
|
||||
REGION_TNT_NO_PERMS=§cDu darfst hier nicht TNT-Schaden (de-)aktivieren
|
||||
REGION_TNT_BUILD_DESTROY=§cEine Explosion hätte Blöcke im Baubereich zerstört
|
||||
REGION_TNT_TB_DESTROY=§cEine Explosion hätte Blöcke im Testblockbereich zerstört
|
||||
AFK_KICK_MESSAGE=§cAuf diesem Server ist seit 15 Minuten nichts passiert.
|
||||
@ -878,7 +831,6 @@ PANZERN_PREPARE1 = §71. Gucke nochmal nach, ob Läufe auch bis zur Panzergrenze
|
||||
PANZERN_PREPARE2 = §72. Teppich in Gänge auf dem Boden vereinfacht das panzern.
|
||||
PANZERN_PREPARE3 = §73. Schildtechnik sollte explizit eingeschlossen sein.
|
||||
PANZERN_PREPARE4 = §74. Innerhalb der zu panzernden Region zu stehen, beim Befehlausführen kann das Panzern verbessern.
|
||||
PANZERN_NO_PERM = §cDu darfst hier nicht das Panzern System verwenden
|
||||
PANZERN_NO_WORLDEDIT = §cDu hast keine WorldEdit Selection
|
||||
PANZERN_PROGRESS = §e{0} §7Blöcke übrig, §e{1} §7Blöcke pro Sekunde, §e{2} §7Block Delta
|
||||
PANZERN_DONE = §aZuende gepanzert
|
||||
@ -888,7 +840,6 @@ LAUFBAU_HELP = §8/§elaufbau §8[§7smallest§8|§7blastresistant§8] §8- §7B
|
||||
LAUFBAU_HELP_SETTINGS = §8/§elaufbau settings §8- §7Öffnet die Settings GUI
|
||||
LAUFBAU_PREPARE1 = §71. Trace die Kanonen so oft wie nötig, in allen Modi.
|
||||
LAUFBAU_PREPARE2 = §72. Versuche alle Fails aus dem Trace zu löschen.
|
||||
LAUFBAU_NO_PERM = §cDu darfst hier nicht das Laufbau System verwenden
|
||||
LAUFBAU_NO_WORLDEDIT = §cDu hast keine WorldEdit Selection
|
||||
LAUFBAU_STATE_FILTERING_TRACES = Traces filtern
|
||||
LAUFBAU_STATE_PROCESSING_TRACES = Traces verbinden
|
||||
@ -996,7 +947,6 @@ LAUFBAU_TILT_PARTIAL = §8-§7 Neigung teilweise
|
||||
# UTILS
|
||||
SELECT_HELP = §8/§eselect §8[§7RegionsTyp§8] §8- §7Wähle einen RegionsTyp aus
|
||||
SELECT_EXTENSION_HELP = §8/§eselect §8[§7RegionsTyp§8] §8[§7Extension§8] §8- §7Wähle einen RegionsTyp aus mit oder ohne Extension
|
||||
SELECT_NO_PERMS = §cDu darfst hier nicht den Select Befehl verwenden
|
||||
SELECT_GLOBAL_REGION = §cDie globale Region kannst du nicht auswählen
|
||||
SELECT_NO_TYPE = §cDiese Region hat keinen {0}
|
||||
SELECT_NO_EXTENSION = §cDiese Region hat keine Ausfahrmaße
|
||||
@ -1048,7 +998,6 @@ PISTON_HELP_3 = §7Die Anzahl ist Gelb, wenn zu viele Blöcke vorhanden sind.
|
||||
PISTON_INFO = §7Bewegte Blöcke {0}{1}§8/§712
|
||||
|
||||
# Warp
|
||||
WARP_DISALLOWED = §cDu darfst hier nicht das Warp System nutzen
|
||||
WARP_LOC_X = §7X§8: §e{0}
|
||||
WARP_LOC_Y = §7Y§8: §e{0}
|
||||
WARP_LOC_Z = §7Z§8: §e{0}
|
||||
@ -1074,12 +1023,9 @@ WARP_HELP_LIST=§8/§ewarp list §8- §7Liste alle Warp-Punkt auf
|
||||
|
||||
# WORLD
|
||||
STOP_HELP = §8/§estop §8- §7Stoppt den Server
|
||||
STOP_NO_PERMS = §cDu hast keine Rechte den Server zu stoppen
|
||||
STOP_MESSAGE = §eDer Server wird gestoppt
|
||||
WORLD_EDIT_NO_PERMS = §cDu darfst hier kein WorldEdit benutzen
|
||||
|
||||
KICKALL_HELP = §8/§ekickall §8- §7Kickt alle Spieler vom Server außer den Owner
|
||||
KICKALL_NO_PERM = §cDies ist nicht deine Welt!
|
||||
|
||||
# Techhider
|
||||
TECHHIDER_HELP = §8/§etechhider §8- §7Techhider umschalten
|
||||
|
@ -28,9 +28,13 @@ import de.steamwar.bausystem.region.loader.RegionLoader;
|
||||
import de.steamwar.bausystem.region.loader.Updater;
|
||||
import de.steamwar.bausystem.utils.TickListener;
|
||||
import de.steamwar.bausystem.worlddata.WorldData;
|
||||
import de.steamwar.command.AbstractValidator;
|
||||
import de.steamwar.command.SWCommandUtils;
|
||||
import de.steamwar.message.Message;
|
||||
import lombok.Getter;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
@ -74,10 +78,27 @@ public class BauSystem extends JavaPlugin implements Listener {
|
||||
new Updater(PrototypeLoader.file, PrototypeLoader::load);
|
||||
new Updater(RegionLoader.file, RegionLoader::load);
|
||||
|
||||
SWCommandUtils.addValidator(Player.class, validator(Permission.BUILD));
|
||||
SWCommandUtils.addValidator(CommandSender.class, validator(Permission.BUILD));
|
||||
SWCommandUtils.addValidator("supervisor", validator(Permission.SUPERVISOR));
|
||||
|
||||
LinkageUtils.link();
|
||||
TickListener.impl.init();
|
||||
}
|
||||
|
||||
private <T extends CommandSender> AbstractValidator<T, ?> validator(Permission permission) {
|
||||
return (commandSender, object, messageSender) -> {
|
||||
if (commandSender instanceof Player) {
|
||||
if (permission.hasPermission((Player) commandSender)) {
|
||||
return true;
|
||||
}
|
||||
messageSender.send("NO_PERMISSION");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
LinkageUtils.unlink();
|
||||
|
@ -20,43 +20,77 @@
|
||||
package de.steamwar.bausystem;
|
||||
|
||||
import de.steamwar.bausystem.config.BauServer;
|
||||
import de.steamwar.command.CommandMetaData;
|
||||
import de.steamwar.command.TypeValidator;
|
||||
import de.steamwar.bausystem.features.world.BauMemberUpdate;
|
||||
import de.steamwar.bausystem.utils.BauMemberUpdateEvent;
|
||||
import de.steamwar.sql.BauweltMember;
|
||||
import de.steamwar.sql.SteamwarUser;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
@AllArgsConstructor
|
||||
public enum Permission {
|
||||
|
||||
WORLD(BauweltMember::isWorld),
|
||||
WORLDEDIT(BauweltMember::isWorldEdit),
|
||||
MEMBER(bauweltMember -> true),
|
||||
OWNER(bauweltMember -> false);
|
||||
OWNER(bauweltMember -> false),
|
||||
SUPERVISOR(bauweltMember -> {
|
||||
return bauweltMember.isSupervisor();
|
||||
}),
|
||||
BUILD(bauweltMember -> {
|
||||
if (isTempOnlySpectator(bauweltMember)) return false;
|
||||
return bauweltMember.isBuild() || SUPERVISOR.permissionPredicate.test(bauweltMember);
|
||||
}),
|
||||
/**
|
||||
* Only used for {@link BauMemberUpdate}
|
||||
*/
|
||||
REAL_SPECTATOR(bauweltMember -> {
|
||||
return !bauweltMember.isBuild() && !bauweltMember.isSupervisor();
|
||||
}),
|
||||
/**
|
||||
* Primarily used for {@link de.steamwar.bausystem.linkage.specific.GuiItem}
|
||||
*/
|
||||
MEMBER(bauweltMember -> {
|
||||
return true;
|
||||
});
|
||||
|
||||
private static final Set<Integer> TEMP_ONLY_SPECTATOR = new HashSet<>();
|
||||
|
||||
private static boolean isTempOnlySpectator(BauweltMember bauweltMember) {
|
||||
return TEMP_ONLY_SPECTATOR.contains(bauweltMember.getMemberID());
|
||||
}
|
||||
|
||||
public static boolean isTempOnlySpectator(Player player) {
|
||||
return TEMP_ONLY_SPECTATOR.contains(SteamwarUser.get(player.getUniqueId()).getId());
|
||||
}
|
||||
|
||||
public static void forceOnlySpectator(Player player) {
|
||||
TEMP_ONLY_SPECTATOR.add(SteamwarUser.get(player.getUniqueId()).getId());
|
||||
BauMemberUpdate.baumemberUpdate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Only used by {@link BauMemberUpdate}
|
||||
*/
|
||||
public static void removeForceOnlySpectator(Player player) {
|
||||
TEMP_ONLY_SPECTATOR.remove(SteamwarUser.get(player.getUniqueId()).getId());
|
||||
}
|
||||
|
||||
private final Predicate<BauweltMember> permissionPredicate;
|
||||
|
||||
public boolean hasPermission(BauweltMember bauweltMember) {
|
||||
if (bauweltMember == null) return false;
|
||||
return permissionPredicate.test(bauweltMember);
|
||||
}
|
||||
|
||||
public boolean hasPermission(Player member) {
|
||||
if (member.getUniqueId().equals(BauServer.getInstance().getOwner())) {
|
||||
return true;
|
||||
if (SteamwarUser.get(member.getUniqueId()).getId() == BauServer.getInstance().getOwnerID()) {
|
||||
return this != REAL_SPECTATOR;
|
||||
}
|
||||
|
||||
BauweltMember bauMember = BauweltMember.getBauMember(BauServer.getInstance().getOwner(), member.getUniqueId());
|
||||
if (bauMember == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return permissionPredicate.test(bauMember);
|
||||
}
|
||||
|
||||
public static boolean hasPermission(Player member, Permission permission) {
|
||||
return permission.hasPermission(member);
|
||||
BauweltMember bauweltMember = BauweltMember.getBauMember(BauServer.getInstance().getOwner(), member.getUniqueId());
|
||||
if (bauweltMember == null) return this == REAL_SPECTATOR;
|
||||
return permissionPredicate.test(bauweltMember);
|
||||
}
|
||||
}
|
@ -44,7 +44,7 @@ public class AttributeRemoveCommand extends SWCommand {
|
||||
|
||||
@Register({"all"})
|
||||
@Register({"*"})
|
||||
public void genericCommand(Player player) {
|
||||
public void genericCommand(@Validator Player player) {
|
||||
ItemStack itemStack = player.getInventory().getItemInMainHand();
|
||||
ItemMeta itemMeta = itemStack.getItemMeta();
|
||||
itemMeta.setLore(new ArrayList<>());
|
||||
@ -53,7 +53,7 @@ public class AttributeRemoveCommand extends SWCommand {
|
||||
}
|
||||
|
||||
@Register(description = "ATTRIBUTE_REMOVE_COMMAND_HELP")
|
||||
public void genericCommand(Player player, @Mapper("attribute") String attribute) {
|
||||
public void genericCommand(@Validator Player player, @Mapper("attribute") String attribute) {
|
||||
ItemStack itemStack = player.getInventory().getItemInMainHand();
|
||||
ItemMeta itemMeta = itemStack.getItemMeta();
|
||||
if (itemMeta == null) {
|
||||
|
@ -41,7 +41,7 @@ public class AttributesCopyCommand extends SWCommand {
|
||||
}
|
||||
|
||||
@Register
|
||||
public void genericCommand(Player player) {
|
||||
public void genericCommand(@Validator Player player) {
|
||||
Block block = player.getTargetBlockExact(8, FluidCollisionMode.ALWAYS);
|
||||
if (block == null) return;
|
||||
ItemStack mainHand = player.getInventory().getItemInMainHand();
|
||||
|
@ -20,6 +20,7 @@
|
||||
package de.steamwar.bausystem.features.attributescopy;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
@ -40,6 +41,7 @@ public class AttributesPlaceListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onBlockPlace(BlockPlaceEvent event) {
|
||||
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
||||
ItemStack itemStack = event.getItemInHand();
|
||||
ItemMeta itemMeta = itemStack.getItemMeta();
|
||||
if (itemMeta == null) return;
|
||||
|
@ -32,7 +32,7 @@ public class AutoStartCommand extends SWCommand {
|
||||
}
|
||||
|
||||
@Register(description = "AUTOSTART_COMMAND_HELP")
|
||||
public void genericCommand(Player p) {
|
||||
public void genericCommand(@Validator Player p) {
|
||||
SWUtils.giveItemToPlayer(p, AutostartListener.getWandItem(p));
|
||||
}
|
||||
}
|
||||
|
@ -50,6 +50,6 @@ public class AutoStartGuiItem extends BauGuiItem {
|
||||
|
||||
@Override
|
||||
public Permission permission() {
|
||||
return Permission.MEMBER;
|
||||
return Permission.BUILD;
|
||||
}
|
||||
}
|
||||
|
@ -20,6 +20,7 @@
|
||||
package de.steamwar.bausystem.features.autostart;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.features.tpslimit.TPSUtils;
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
import de.steamwar.bausystem.region.RegionUtils;
|
||||
@ -66,6 +67,7 @@ public class AutostartListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
||||
if (!ItemUtils.isItem(event.getItem(), "autostart")) {
|
||||
return;
|
||||
}
|
||||
@ -83,6 +85,7 @@ public class AutostartListener implements Listener {
|
||||
if (!(event.getPlayer() instanceof Player)) {
|
||||
return;
|
||||
}
|
||||
if(!Permission.BUILD.hasPermission((Player) event.getPlayer())) return;
|
||||
if (!ItemUtils.isItem(event.getPlayer().getInventory().getItemInMainHand(), "autostart")) {
|
||||
return;
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ public class BackupCommand extends SWCommand {
|
||||
}
|
||||
|
||||
@Register(value = "create", description = "BACKUP_HELP_CREATE")
|
||||
public void backupCreate(@Validator Player p) {
|
||||
public void backupCreate(@Validator("supervisor") Player p) {
|
||||
Region region = Region.getRegion(p.getLocation());
|
||||
if (checkGlobalRegion(region, p)) {
|
||||
return;
|
||||
@ -79,7 +79,7 @@ public class BackupCommand extends SWCommand {
|
||||
}
|
||||
|
||||
@Register(value = "load", description = "BACKUP_HELP_LOAD")
|
||||
public void backupLoad(@Validator Player p, @Mapper("backupName") String backupName) {
|
||||
public void backupLoad(@Validator("supervisor") Player p, @Mapper("backupName") String backupName) {
|
||||
Region region = Region.getRegion(p.getLocation());
|
||||
if (checkGlobalRegion(region, p)) {
|
||||
return;
|
||||
@ -130,7 +130,7 @@ public class BackupCommand extends SWCommand {
|
||||
}
|
||||
SWListInv<String> swListInv = new SWListInv<>(p, BauSystem.MESSAGE.parse("BACKUP_INV_NAME", p), swListEntries, (clickType, s) -> {
|
||||
p.getOpenInventory().close();
|
||||
backupLoad(p, s);
|
||||
p.performCommand("backup load " + s);
|
||||
});
|
||||
swListInv.open();
|
||||
}
|
||||
@ -140,13 +140,6 @@ public class BackupCommand extends SWCommand {
|
||||
return SWCommandUtils.createMapper(s -> s, (commandSender, s) -> listBackup((Player) commandSender));
|
||||
}
|
||||
|
||||
@ClassValidator(value = Player.class, local = true)
|
||||
public TypeValidator<Player> backupValidator() {
|
||||
return (commandSender, player, messageSender) -> {
|
||||
return !messageSender.send(!Permission.hasPermission(player, Permission.WORLDEDIT), "BACKUP_NO_PERMS");
|
||||
};
|
||||
}
|
||||
|
||||
private List<String> listBackup(Player p) {
|
||||
Region region = Region.getRegion(p.getLocation());
|
||||
if (checkGlobalRegion(region, p)) {
|
||||
|
@ -1,41 +0,0 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2021 SteamWar.de-Serverteam
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.bausystem.features.bau;
|
||||
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.linkage.LinkedInstance;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@Linked
|
||||
public class BauCommand extends SWCommand {
|
||||
|
||||
@LinkedInstance
|
||||
public InfoCommand infoCommand;
|
||||
|
||||
public BauCommand() {
|
||||
super("bau", "b", "gs");
|
||||
}
|
||||
|
||||
@Register(value = "info", description = "BAU_COMMAND_HELP_INFO")
|
||||
public void infoCommand(Player p) {
|
||||
infoCommand.sendBauInfo(p);
|
||||
}
|
||||
}
|
@ -0,0 +1,73 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2023 SteamWar.de-Serverteam
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.bausystem.features.bau;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.command.PreviousArguments;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.command.TypeMapper;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.techhider.TechHider;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Linked
|
||||
public class ForceSpectatorCommand extends SWCommand {
|
||||
|
||||
public ForceSpectatorCommand() {
|
||||
super("forcespectator");
|
||||
}
|
||||
|
||||
@Register
|
||||
public void forceSpectator(@Validator("supervisor") Player player, @Mapper("builder") Player other) {
|
||||
Permission.forceOnlySpectator(other);
|
||||
}
|
||||
|
||||
@Mapper("builder")
|
||||
public TypeMapper<Player> spectatorMapper() {
|
||||
return new TypeMapper<>() {
|
||||
@Override
|
||||
public Player map(CommandSender commandSender, String[] previousArguments, String s) {
|
||||
Player player = Bukkit.getPlayer(s);
|
||||
if (player == null) {
|
||||
return null;
|
||||
}
|
||||
if (Permission.BUILD.hasPermission(player) && !Permission.SUPERVISOR.hasPermission(player)) {
|
||||
return player;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<String> tabCompletes(CommandSender sender, PreviousArguments previousArguments, String s) {
|
||||
return Bukkit.getOnlinePlayers().stream()
|
||||
.filter(Permission.BUILD::hasPermission)
|
||||
.filter(player -> !Permission.SUPERVISOR.hasPermission(player))
|
||||
.map(Player::getName)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
package de.steamwar.bausystem.features.bau;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.config.BauServer;
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
import de.steamwar.bausystem.region.flags.Flag;
|
||||
@ -24,17 +25,8 @@ public class InfoCommand extends SWCommand {
|
||||
super("bauinfo");
|
||||
}
|
||||
|
||||
@Register(help = true)
|
||||
public void genericHelp(Player p, String... args) {
|
||||
BauSystem.MESSAGE.send("BAU_INFO_COMMAND_HELP", p);
|
||||
}
|
||||
|
||||
@Register
|
||||
@Register(description = "BAU_INFO_COMMAND_HELP")
|
||||
public void genericCommand(Player p) {
|
||||
sendBauInfo(p);
|
||||
}
|
||||
|
||||
public void sendBauInfo(Player p) {
|
||||
BauSystem.MESSAGE.send("BAU_INFO_COMMAND_OWNER", p, SteamwarUser.get(bauServer.getOwnerID()).getUserName());
|
||||
Region region = Region.getRegion(p.getLocation());
|
||||
for (Flag flag : Flag.getFlags()) {
|
||||
@ -47,18 +39,27 @@ public class InfoCommand extends SWCommand {
|
||||
}
|
||||
}
|
||||
|
||||
if (Permission.BUILD.hasPermission(p)) {
|
||||
List<BauweltMember> members = BauweltMember.getMembers(bauServer.getOwnerID());
|
||||
StringBuilder membermessage = new StringBuilder();
|
||||
membermessage.append(BauSystem.MESSAGE.parsePrefixed("BAU_INFO_COMMAND_MEMBER", p, members.size()));
|
||||
|
||||
for (BauweltMember member : members) {
|
||||
membermessage.append(BauSystem.MESSAGE.parse("BAU_INFO_MEMBER_INFO", p,
|
||||
SteamwarUser.get(member.getMemberID()).getUserName(),
|
||||
member.isWorldEdit() ? BauSystem.MESSAGE.parse("BAU_INFO_MEMBER_WE_ALLOW", p) : BauSystem.MESSAGE.parse("BAU_INFO_MEMBER_WE_DISALLOW", p),
|
||||
member.isWorld() ? BauSystem.MESSAGE.parse("BAU_INFO_MEMBER_WORLD_ALLOW", p) : BauSystem.MESSAGE.parse("BAU_INFO_MEMBER_WORLD_DISALLOW", p)
|
||||
));
|
||||
for (int i = 0; i < members.size(); i++) {
|
||||
if (i != 0) {
|
||||
membermessage.append("§8, ");
|
||||
}
|
||||
BauweltMember member = members.get(i);
|
||||
if (Permission.SUPERVISOR.hasPermission(member)) {
|
||||
membermessage.append("§e");
|
||||
} else if (Permission.BUILD.hasPermission(member)) {
|
||||
membermessage.append("§6");
|
||||
} else {
|
||||
membermessage.append("§7");
|
||||
}
|
||||
membermessage.append(SteamwarUser.get(member.getMemberID()).getUserName());
|
||||
}
|
||||
p.sendMessage(membermessage.toString());
|
||||
}
|
||||
|
||||
StringBuilder tpsMessage = new StringBuilder();
|
||||
tpsMessage.append(BauSystem.MESSAGE.parsePrefixed("BAU_INFO_COMMAND_TPS", p));
|
||||
|
@ -48,6 +48,6 @@ public class CountingwandGuiItem extends BauGuiItem {
|
||||
|
||||
@Override
|
||||
public Permission permission() {
|
||||
return Permission.WORLDEDIT;
|
||||
return Permission.MEMBER;
|
||||
}
|
||||
}
|
@ -44,7 +44,6 @@ public class DesignEndStone {
|
||||
private REntityServer entityServer = new REntityServer();
|
||||
private List<REntity> entities = new ArrayList<>();
|
||||
private Set<Location> locations = new HashSet<>();
|
||||
private List<Player> players = new ArrayList<>();
|
||||
|
||||
public DesignEndStone(Region region) {
|
||||
this.minX = region.getMinPointBuild().getX();
|
||||
@ -95,12 +94,10 @@ public class DesignEndStone {
|
||||
}
|
||||
|
||||
public void toggle(Player player) {
|
||||
if (players.contains(player)) {
|
||||
players.remove(player);
|
||||
if (entityServer.getPlayers().contains(player)) {
|
||||
entityServer.removePlayer(player);
|
||||
BauSystem.MESSAGE.sendPrefixless("DESIGN_ENDSTONE_DISABLE", player, ChatMessageType.ACTION_BAR);
|
||||
} else {
|
||||
players.add(player);
|
||||
entityServer.addPlayer(player);
|
||||
calc();
|
||||
BauSystem.MESSAGE.sendPrefixless("DESIGN_ENDSTONE_ENABLE", player, ChatMessageType.ACTION_BAR);
|
||||
@ -108,7 +105,7 @@ public class DesignEndStone {
|
||||
}
|
||||
|
||||
public boolean removePlayer(Player player) {
|
||||
players.remove(player);
|
||||
return players.isEmpty();
|
||||
entityServer.removePlayer(player);
|
||||
return entityServer.getPlayers().isEmpty();
|
||||
}
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ package de.steamwar.bausystem.features.design.endstone;
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
import de.steamwar.bausystem.region.utils.RegionType;
|
||||
import de.steamwar.bausystem.utils.BauMemberUpdateEvent;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import org.bukkit.Location;
|
||||
@ -33,6 +34,7 @@ import org.bukkit.event.block.BlockPlaceEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
|
||||
@Linked
|
||||
@ -45,7 +47,7 @@ public class DesignEndStoneCommand extends SWCommand implements Listener {
|
||||
private Map<Region, DesignEndStone> designEndStoneMap = new HashMap<>();
|
||||
|
||||
@Register(description = "DESIGN_ENDSTONE_COMMAND_HELP")
|
||||
public void genericCommand(Player player) {
|
||||
public void genericCommand(@Validator Player player) {
|
||||
Region region = Region.getRegion(player.getLocation());
|
||||
if (!region.hasType(RegionType.BUILD)) {
|
||||
BauSystem.MESSAGE.send("DESIGN_ENDSTONE_REGION_ERROR", player);
|
||||
@ -56,14 +58,20 @@ public class DesignEndStoneCommand extends SWCommand implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerQuit(PlayerQuitEvent event) {
|
||||
Region region = Region.getRegion(event.getPlayer().getLocation());
|
||||
DesignEndStone designEndStone = designEndStoneMap.get(region);
|
||||
if (designEndStone == null) {
|
||||
return;
|
||||
disableDesignEndStone(event.getPlayer());
|
||||
}
|
||||
if (designEndStone.removePlayer(event.getPlayer())) {
|
||||
designEndStoneMap.remove(region);
|
||||
|
||||
@EventHandler
|
||||
public void onBauMemberUpdate(BauMemberUpdateEvent event) {
|
||||
event.getNewSpectator().forEach(this::disableDesignEndStone);
|
||||
}
|
||||
|
||||
private void disableDesignEndStone(Player player) {
|
||||
new HashSet<>(designEndStoneMap.entrySet()).forEach(regionDesignEndStoneEntry -> {
|
||||
if (regionDesignEndStoneEntry.getValue().removePlayer(player)) {
|
||||
designEndStoneMap.remove(regionDesignEndStoneEntry.getKey());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -47,6 +47,6 @@ public class DetonatorBauGuiItem extends BauGuiItem {
|
||||
|
||||
@Override
|
||||
public Permission permission() {
|
||||
return Permission.MEMBER;
|
||||
return Permission.BUILD;
|
||||
}
|
||||
}
|
||||
|
@ -58,12 +58,12 @@ public class DetonatorCommand extends SWCommand {
|
||||
}
|
||||
|
||||
@Register(value = "wand", description = "DETONATOR_HELP_WAND")
|
||||
public void giveWand(Player p) {
|
||||
public void giveWand(@Validator Player p) {
|
||||
SWUtils.giveItemToPlayer(p, getWAND(p));
|
||||
}
|
||||
|
||||
@Register(value = "click", description = "DETONATOR_HELP_CLICK")
|
||||
public void clickDetonator(Player p) {
|
||||
public void clickDetonator(@Validator Player p) {
|
||||
Detonator.activateDetonator(new ItemStorage(p));
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,7 @@
|
||||
package de.steamwar.bausystem.features.detonator;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.SWUtils;
|
||||
import de.steamwar.bausystem.features.detonator.storage.DetonatorStorage;
|
||||
import de.steamwar.bausystem.features.detonator.storage.ItemStorage;
|
||||
@ -65,6 +66,7 @@ public class DetonatorListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onBlockBreak(BlockBreakEvent event) {
|
||||
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
||||
Player p = event.getPlayer();
|
||||
if (Detonator.isDetonator(p.getInventory().getItemInMainHand())) {
|
||||
event.setCancelled(true);
|
||||
@ -75,6 +77,7 @@ public class DetonatorListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
||||
if (!Detonator.isDetonator(event.getItem())) {
|
||||
return;
|
||||
}
|
||||
@ -89,7 +92,7 @@ public class DetonatorListener implements Listener {
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onPlayerMove(PlayerMoveEvent event) {
|
||||
if (!Detonator.isDetonator(event.getPlayer().getInventory().getItemInMainHand())) {
|
||||
if (!Permission.BUILD.hasPermission(event.getPlayer()) ||!Detonator.isDetonator(event.getPlayer().getInventory().getItemInMainHand())) {
|
||||
if (Detonator.hasActiveDetonatorShow(event.getPlayer())) {
|
||||
Detonator.hideDetonator(event.getPlayer());
|
||||
}
|
||||
@ -110,6 +113,7 @@ public class DetonatorListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerItemHeld(PlayerItemHeldEvent event) {
|
||||
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
||||
if (Detonator.isDetonator(event.getPlayer().getInventory().getItemInMainHand())) {
|
||||
HAS_UPDATED.add(event.getPlayer());
|
||||
}
|
||||
@ -117,6 +121,7 @@ public class DetonatorListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerSwapHandItems(PlayerSwapHandItemsEvent event) {
|
||||
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
||||
if (Detonator.isDetonator(event.getMainHandItem()) || Detonator.isDetonator(event.getOffHandItem())) {
|
||||
HAS_UPDATED.add(event.getPlayer());
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ public class BauGUI {
|
||||
}
|
||||
} else {
|
||||
p.closeInventory();
|
||||
BauSystem.MESSAGE.send("GUI_NO_PERMISSION", p);
|
||||
BauSystem.MESSAGE.send("NO_PERMISSION", p);
|
||||
}
|
||||
});
|
||||
});
|
||||
@ -108,26 +108,13 @@ public class BauGUI {
|
||||
if (!permission.hasPermission(p)) {
|
||||
List<String> lore = meta.getLore();
|
||||
if (lore == null) {
|
||||
lore = Collections.singletonList(BauSystem.MESSAGE.parse(permissionString(permission), p));
|
||||
lore = Collections.singletonList(BauSystem.MESSAGE.parse("NO_PERMISSION", p));
|
||||
} else {
|
||||
lore.add(BauSystem.MESSAGE.parse(permissionString(permission), p));
|
||||
lore.add(BauSystem.MESSAGE.parse("NO_PERMISSION", p));
|
||||
}
|
||||
meta.setLore(lore);
|
||||
}
|
||||
itemStack.setItemMeta(meta);
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
private static String permissionString(Permission permission) {
|
||||
switch (permission) {
|
||||
case OWNER:
|
||||
return "GUI_NO_OWNER";
|
||||
case WORLD:
|
||||
return "GUI_NO_WORLD";
|
||||
case WORLDEDIT:
|
||||
return "GUI_NO_WORLDEDIT";
|
||||
default:
|
||||
return "GUI_NO_MEMBER";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ public class HotbarCommand extends SWCommand {
|
||||
}
|
||||
|
||||
@Register(value = "load", description = "HOTBAR_HELP_LOAD")
|
||||
public void loadHotbar(Player p) {
|
||||
public void loadHotbar(@Validator Player p) {
|
||||
DefaultHotbar.setHotbar(p);
|
||||
BauSystem.MESSAGE.send("HOTBAR_LOADED", p);
|
||||
}
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
package de.steamwar.bausystem.features.hotbar;
|
||||
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
@ -30,6 +31,7 @@ public class HotbarListener implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
||||
if (allNull(event.getPlayer().getInventory().getContents()) && allNull(event.getPlayer().getInventory().getArmorContents())) {
|
||||
DefaultHotbar.setHotbar(event.getPlayer());
|
||||
}
|
||||
|
@ -20,6 +20,7 @@
|
||||
package de.steamwar.bausystem.features.inventoryfiller;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.configplayer.Config;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import net.md_5.bungee.api.ChatMessageType;
|
||||
@ -38,6 +39,7 @@ public class InventoryFiller implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerDropItem(PlayerDropItemEvent event) {
|
||||
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
||||
if (!Config.getInstance().get(event.getPlayer()).getPlainValueOrDefault("inventoryfill", false)) return;
|
||||
if (!event.getPlayer().isSneaking()) return;
|
||||
Block block = event.getPlayer().getTargetBlockExact(5);
|
||||
@ -59,6 +61,7 @@ public class InventoryFiller implements Listener {
|
||||
*/
|
||||
@EventHandler
|
||||
public void onPlayerItemHeld(PlayerItemHeldEvent event) {
|
||||
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
||||
if (!Config.getInstance().get(event.getPlayer()).getPlainValueOrDefault("inventoryfill", false)) return;
|
||||
if (!event.getPlayer().isSneaking()) return;
|
||||
ItemStack itemStack = event.getPlayer().getInventory().getItemInMainHand();
|
||||
|
@ -21,6 +21,7 @@ package de.steamwar.bausystem.features.killchecker;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
import de.steamwar.bausystem.utils.BauMemberUpdateEvent;
|
||||
import de.steamwar.bausystem.utils.bossbar.BossBarService;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.linkage.Linked;
|
||||
@ -54,7 +55,7 @@ public class KillcheckerCommand extends SWCommand implements Listener {
|
||||
}
|
||||
|
||||
@Register(value = "enable", description = "KILLCHECKER_HELP_ENABLE")
|
||||
public void genericCommand(Player player, @OptionalValue("-outline") @StaticValue(value = {"-area", "-outline"}, allowISE = true) boolean onlyOutline) {
|
||||
public void genericCommand(@Validator Player player, @OptionalValue("-outline") @StaticValue(value = {"-area", "-outline"}, allowISE = true) boolean onlyOutline) {
|
||||
Region region = Region.getRegion(player.getLocation());
|
||||
KillcheckerVisualizer killcheckerVisualizer = visualizers.computeIfAbsent(region, region1 -> new KillcheckerVisualizer(region1, bossBarService));
|
||||
killcheckerVisualizer.recalc();
|
||||
@ -74,16 +75,22 @@ public class KillcheckerCommand extends SWCommand implements Listener {
|
||||
BauSystem.MESSAGE.send("KILLCHECKER_DISABLE", player);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onBauMemberUpdate(BauMemberUpdateEvent event) {
|
||||
event.getNewSpectator().forEach(this::hide);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerQuit(PlayerQuitEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
Set<Region> regions = new HashSet<>();
|
||||
visualizers.forEach((region, visualizer) -> {
|
||||
if (visualizer.disconnect(player)) {
|
||||
regions.add(region);
|
||||
hide(event.getPlayer());
|
||||
}
|
||||
|
||||
private void hide(Player player) {
|
||||
new HashSet<>(visualizers.entrySet()).forEach(regionKillcheckerVisualizerEntry -> {
|
||||
if (regionKillcheckerVisualizerEntry.getValue().hide(player)) {
|
||||
visualizers.remove(regionKillcheckerVisualizerEntry.getKey());
|
||||
}
|
||||
});
|
||||
regions.forEach(visualizers::remove);
|
||||
}
|
||||
|
||||
private void recalc(Block block) {
|
||||
|
@ -57,9 +57,6 @@ public class KillcheckerVisualizer {
|
||||
private final int zArea;
|
||||
private final int xArea;
|
||||
|
||||
private final Set<Player> players = new HashSet<>();
|
||||
private final Set<Player> areaPlayers = new HashSet<>();
|
||||
|
||||
private final Region region;
|
||||
private final BossBarService bossBarService;
|
||||
|
||||
@ -261,7 +258,7 @@ public class KillcheckerVisualizer {
|
||||
double zPercent = xCount / (double) zArea;
|
||||
percent = (xPercent + yPercent + zPercent) / 3;
|
||||
kills = zKills + yKills + xKills;
|
||||
players.forEach(this::updateBossBar);
|
||||
outline.getPlayers().forEach(this::updateBossBar);
|
||||
|
||||
Set<Point> pointSet = new HashSet<>(killCount.keySet());
|
||||
Set<Point> outlinePointsCacheLast = new HashSet<>(outlinePointsCache);
|
||||
@ -356,40 +353,21 @@ public class KillcheckerVisualizer {
|
||||
return new Cuboid(minX, minY, minZ, maxX, maxY, maxZ);
|
||||
}
|
||||
|
||||
public boolean show(Player player, boolean onlyOutline) {
|
||||
public void show(Player player, boolean onlyOutline) {
|
||||
outline.addPlayer(player);
|
||||
if (!onlyOutline) {
|
||||
inner.addPlayer(player);
|
||||
areaPlayers.add(player);
|
||||
} else if (areaPlayers.contains(player)) {
|
||||
} else {
|
||||
inner.removePlayer(player);
|
||||
areaPlayers.remove(player);
|
||||
}
|
||||
updateBossBar(player);
|
||||
return players.add(player);
|
||||
}
|
||||
|
||||
public boolean hide(Player player) {
|
||||
outline.removePlayer(player);
|
||||
if (areaPlayers.contains(player)) {
|
||||
inner.removePlayer(player);
|
||||
}
|
||||
players.remove(player);
|
||||
areaPlayers.remove(player);
|
||||
bossBarService.remove(player, region, "killchecker");
|
||||
if (players.isEmpty()) {
|
||||
outline.close();
|
||||
inner.close();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean disconnect(Player player) {
|
||||
players.remove(player);
|
||||
areaPlayers.remove(player);
|
||||
bossBarService.remove(player, region, "killchecker");
|
||||
if (players.isEmpty()) {
|
||||
if (outline.getPlayers().isEmpty() && inner.getPlayers().isEmpty()) {
|
||||
outline.close();
|
||||
inner.close();
|
||||
return true;
|
||||
|
@ -20,6 +20,7 @@
|
||||
package de.steamwar.bausystem.features.loader;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.features.loader.elements.LoaderElement;
|
||||
import de.steamwar.bausystem.features.loader.elements.LoaderInteractionElement;
|
||||
import de.steamwar.bausystem.features.loader.elements.impl.LoaderTNT;
|
||||
@ -70,6 +71,7 @@ public class Loader implements Listener {
|
||||
|
||||
BauSystem.runTaskTimer(BauSystem.getInstance(), () -> {
|
||||
if (stage != Stage.RUNNING) return;
|
||||
if(!Permission.BUILD.hasPermission(p)) return;
|
||||
if (waitTime > 0) {
|
||||
waitTime--;
|
||||
return;
|
||||
|
@ -21,13 +21,16 @@ package de.steamwar.bausystem.features.loader;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.utils.BauMemberUpdateEvent;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.command.TypeValidator;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
@Linked
|
||||
public class LoaderCommand extends SWCommand {
|
||||
public class LoaderCommand extends SWCommand implements Listener {
|
||||
|
||||
public LoaderCommand() {
|
||||
super("loader");
|
||||
@ -102,10 +105,12 @@ public class LoaderCommand extends SWCommand {
|
||||
loader.setTicksBetweenBlocks(delay);
|
||||
}
|
||||
|
||||
@ClassValidator(value = Player.class, local = true)
|
||||
public TypeValidator<Player> loaderValidator() {
|
||||
return (commandSender, player, messageSender) -> {
|
||||
return !messageSender.send(!Permission.hasPermission(player, Permission.WORLD), "LOADER_PERMS");
|
||||
};
|
||||
@EventHandler
|
||||
public void onBauMemberUpdate(BauMemberUpdateEvent event) {
|
||||
event.getNewSpectator().forEach(player -> {
|
||||
Loader loader = Loader.getLoader(player);
|
||||
if (loader == null) return;
|
||||
loader.stop();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -20,6 +20,7 @@
|
||||
package de.steamwar.bausystem.features.loader;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
import de.steamwar.bausystem.utils.ScoreboardElement;
|
||||
import de.steamwar.linkage.Linked;
|
||||
@ -40,6 +41,7 @@ public class LoaderScoreboardElement implements ScoreboardElement {
|
||||
|
||||
@Override
|
||||
public String get(Region region, Player p) {
|
||||
if(!Permission.BUILD.hasPermission(p)) return null;
|
||||
Loader loader = Loader.getLoader(p);
|
||||
if (loader == null) return null;
|
||||
if (loader.getStage() == Loader.Stage.RUNNING) {
|
||||
|
@ -32,12 +32,12 @@ public class LoadtimerCommand extends SWCommand {
|
||||
}
|
||||
|
||||
@Register(value = "start", description = "LOADTIMER_HELP_START_1")
|
||||
public void start(Player p) {
|
||||
public void start(@Validator Player p) {
|
||||
start(p, TimerMode.HALF);
|
||||
}
|
||||
|
||||
@Register(value = "start", description = {"LOADTIMER_HELP_START_2", "LOADTIMER_HELP_START_3"})
|
||||
public void start(Player p, TimerMode mode) {
|
||||
public void start(@Validator Player p, TimerMode mode) {
|
||||
Region r = Region.getRegion(p.getLocation());
|
||||
if (r.isGlobal()) return;
|
||||
if (!Loadtimer.hasTimer(r))
|
||||
@ -45,7 +45,7 @@ public class LoadtimerCommand extends SWCommand {
|
||||
}
|
||||
|
||||
@Register(value = "stop", description = "LOADTIMER_HELP_STOP")
|
||||
public void stop(Player p) {
|
||||
public void stop(@Validator Player p) {
|
||||
Region r = Region.getRegion(p.getLocation());
|
||||
if (r.isGlobal()) return;
|
||||
if (Loadtimer.hasTimer(r))
|
||||
|
@ -20,6 +20,7 @@
|
||||
package de.steamwar.bausystem.features.observer;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -46,13 +47,13 @@ public class ObserverTracerCommand extends SWCommand {
|
||||
}
|
||||
|
||||
@Register(value = "delete", description = "OBSERVER_HELP_DELETE")
|
||||
public void delete(Player p) {
|
||||
public void delete(@Validator Player p) {
|
||||
ObserverTracerListener.observerTracerMap.remove(p);
|
||||
BauSystem.MESSAGE.send("OBSERVER_DELETE", p);
|
||||
}
|
||||
|
||||
@Register(value = "retrace", description = "OBSERVER_HELP_RETRACE")
|
||||
public void retrace(Player p) {
|
||||
public void retrace(@Validator Player p) {
|
||||
if (ObserverTracerListener.observerTracerMap.containsKey(p)) {
|
||||
BauSystem.MESSAGE.send("OBSERVER_RETRACE_NO_TRACE", p);
|
||||
return;
|
||||
|
@ -20,6 +20,8 @@
|
||||
package de.steamwar.bausystem.features.observer;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.utils.BauMemberUpdateEvent;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
@ -55,6 +57,7 @@ public class ObserverTracerListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
||||
if (!enabled.contains(event.getPlayer())) {
|
||||
return;
|
||||
}
|
||||
@ -87,6 +90,11 @@ public class ObserverTracerListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onBauMemberUpdate(BauMemberUpdateEvent event) {
|
||||
event.getNewSpectator().forEach(observerTracerMap::remove);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||
enabled.add(event.getPlayer());
|
||||
|
@ -85,7 +85,7 @@ public class ColorCommand extends SWCommand {
|
||||
@ClassValidator(value = Player.class, local = true)
|
||||
public TypeValidator<Player> validator() {
|
||||
return (commandSender, player, messageSender) -> {
|
||||
return !messageSender.send(!bauServer.getOwner().equals(player.getUniqueId()), "REGION_COLOR_NO_PERMS");
|
||||
return !messageSender.send(!bauServer.getOwner().equals(player.getUniqueId()), "NO_PERMISSION");
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -46,10 +46,6 @@ public class FireCommand extends SWCommand {
|
||||
}
|
||||
}
|
||||
|
||||
private String getNoPermMessage() {
|
||||
return "REGION_FIRE_NO_PERMS";
|
||||
}
|
||||
|
||||
private String getEnableMessage() {
|
||||
return "REGION_FIRE_ENABLED";
|
||||
}
|
||||
@ -69,11 +65,4 @@ public class FireCommand extends SWCommand {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@ClassValidator(value = Player.class, local = true)
|
||||
public TypeValidator<Player> validator() {
|
||||
return (commandSender, player, messageSender) -> {
|
||||
return !messageSender.send(!Permission.hasPermission(player, Permission.WORLD), getNoPermMessage());
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -46,10 +46,6 @@ public class FreezeCommand extends SWCommand {
|
||||
}
|
||||
}
|
||||
|
||||
private String getNoPermMessage() {
|
||||
return "REGION_FREEZE_NO_PERMS";
|
||||
}
|
||||
|
||||
private String getEnableMessage(){
|
||||
return "REGION_FREEZE_ENABLED";
|
||||
}
|
||||
@ -69,11 +65,4 @@ public class FreezeCommand extends SWCommand {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@ClassValidator(value = Player.class, local = true)
|
||||
public TypeValidator<Player> validator() {
|
||||
return (commandSender, player, messageSender) -> {
|
||||
return !messageSender.send(!Permission.hasPermission(player, Permission.WORLD), getNoPermMessage());
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -49,10 +49,6 @@ public class ItemsCommand extends SWCommand {
|
||||
}
|
||||
}
|
||||
|
||||
private String getNoPermMessage() {
|
||||
return "REGION_ITEMS_NO_PERMS";
|
||||
}
|
||||
|
||||
private String getEnableMessage(){
|
||||
return "REGION_ITEMS_ENABLED";
|
||||
}
|
||||
@ -72,11 +68,4 @@ public class ItemsCommand extends SWCommand {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@ClassValidator(value = Player.class, local = true)
|
||||
public TypeValidator<Player> validator() {
|
||||
return (commandSender, player, messageSender) -> {
|
||||
return !messageSender.send(!Permission.hasPermission(player, Permission.WORLD), getNoPermMessage());
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -54,13 +54,6 @@ public class ProtectCommand extends SWCommand {
|
||||
}
|
||||
}
|
||||
|
||||
@ClassValidator(value = Player.class, local = true)
|
||||
public TypeValidator<Player> validator() {
|
||||
return (commandSender, player, messageSender) -> {
|
||||
return !messageSender.send(!Permission.hasPermission(player, Permission.WORLDEDIT), "REGION_PROTECT_NO_PERMS");
|
||||
};
|
||||
}
|
||||
|
||||
private Region regionCheck(Player player) {
|
||||
Region region = Region.getRegion(player.getLocation());
|
||||
if (region.getFloorLevel() == 0) {
|
||||
|
@ -71,7 +71,7 @@ public class RegionCommand extends SWCommand {
|
||||
}
|
||||
|
||||
@Register(value = "undo", description = "REGION_REGION_HELP_UNDO")
|
||||
public void undoCommand(@Validator("WORLD_EDIT") Player p) {
|
||||
public void undoCommand(@Validator Player p) {
|
||||
Region region = Region.getRegion(p.getLocation());
|
||||
if (checkGlobalRegion(region, p)) return;
|
||||
|
||||
@ -83,7 +83,7 @@ public class RegionCommand extends SWCommand {
|
||||
}
|
||||
|
||||
@Register(value = "redo", description = "REGION_REGION_HELP_REDO")
|
||||
public void redoCommand(@Validator("WORLD_EDIT") Player p) {
|
||||
public void redoCommand(@Validator Player p) {
|
||||
Region region = Region.getRegion(p.getLocation());
|
||||
if (checkGlobalRegion(region, p)) {
|
||||
return;
|
||||
@ -97,7 +97,7 @@ public class RegionCommand extends SWCommand {
|
||||
}
|
||||
|
||||
@Register(value = "restore", description = "REGION_REGION_HELP_RESTORE")
|
||||
public void genericRestoreCommand(@Validator("WORLD_EDIT") Player p) {
|
||||
public void genericRestoreCommand(@Validator Player p) {
|
||||
Region region = Region.getRegion(p.getLocation());
|
||||
if(checkGlobalRegion(region, p)) return;
|
||||
|
||||
@ -114,7 +114,7 @@ public class RegionCommand extends SWCommand {
|
||||
}
|
||||
|
||||
@Register(value = "restore", description = "REGION_REGION_HELP_RESTORE_SCHEMATIC")
|
||||
public void schematicRestoreCommand(@Validator("WORLD_EDIT") Player p, SchematicNode node) {
|
||||
public void schematicRestoreCommand(@Validator Player p, SchematicNode node) {
|
||||
Region region = Region.getRegion(p.getLocation());
|
||||
if (checkGlobalRegion(region, p)) return;
|
||||
|
||||
@ -164,36 +164,6 @@ public class RegionCommand extends SWCommand {
|
||||
BauSystem.MESSAGE.send("REGION_REGION_TP_TEST_BLOCK", p);
|
||||
}
|
||||
|
||||
@Register(value = "changetype", description = "REGION_REGION_HELP_CHANGETYPE_INFO")
|
||||
@Register("type")
|
||||
public void changeTypeCommand(Player p) {
|
||||
Region region = Region.getRegion(p.getLocation());
|
||||
if (checkGlobalRegion(region, p)) {
|
||||
return;
|
||||
}
|
||||
BauSystem.MESSAGE.send("REGION_REGION_CHANGETYPE_INFO", p, region.getPrototype().getDisplayName());
|
||||
}
|
||||
|
||||
@Register(value = "changetype", description = "REGION_REGION_HELP_CHANGETYPE")
|
||||
@Register("type")
|
||||
public void changeTypeCommand(@Validator("WORLD") Player p, @Mapper("regionTypeMapper") String s) {
|
||||
Region region = Region.getRegion(p.getLocation());
|
||||
if (checkGlobalRegion(region, p)) {
|
||||
return;
|
||||
}
|
||||
Prototype prototype = Prototype.getByDisplayName(s);
|
||||
if (prototype == null) {
|
||||
BauSystem.MESSAGE.send("REGION_REGION_CHANGETYPE_UNKNOWN", p);
|
||||
} else {
|
||||
if (region.setPrototype(prototype)) {
|
||||
BauSystem.MESSAGE.send("REGION_REGION_CHANGETYPE_CHANGE", p, s);
|
||||
BauSystem.MESSAGE.send("REGION_REGION_CHANGETYPE_CHANGE_UPDATE", p, BauSystem.MESSAGE.parse("REGION_REGION_CHANGETYPE_CHANGE_UPDATE_HOVER", p), new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/reset"));
|
||||
} else {
|
||||
BauSystem.MESSAGE.send("REGION_REGION_CHANGETYPE_INVALID", p);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Register(value = "changeskin", description = "REGION_REGION_HELP_CHANGESKIN_INFO")
|
||||
@Register("skin")
|
||||
public void changeSkinCommand(Player p) {
|
||||
@ -210,7 +180,7 @@ public class RegionCommand extends SWCommand {
|
||||
|
||||
@Register(value = "changeskin", description = "REGION_REGION_HELP_CHANGESKIN")
|
||||
@Register("skin")
|
||||
public void changeSkinCommand(@Validator("WORLD") Player p, @Mapper("skinTypeMapper") String s) {
|
||||
public void changeSkinCommand(@Validator Player p, @Mapper("skinTypeMapper") String s) {
|
||||
Region region = Region.getRegion(p.getLocation());
|
||||
if (checkGlobalRegion(region, p)) {
|
||||
return;
|
||||
@ -227,26 +197,6 @@ public class RegionCommand extends SWCommand {
|
||||
}
|
||||
}
|
||||
|
||||
@Mapper(value = "regionTypeMapper", local = true)
|
||||
private TypeMapper<String> regionTypeMapper() {
|
||||
return new TypeMapper<String>() {
|
||||
@Override
|
||||
public List<String> tabCompletes(CommandSender commandSender, PreviousArguments previousArguments, String s) {
|
||||
Player p = (Player) commandSender;
|
||||
Region region = Region.getRegion(p.getLocation());
|
||||
if (region.isGlobal()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return region.getPrototypes().stream().map(Prototype::getByName).map(Prototype::getDisplayName).map(c -> c.replace(' ', '_')).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String map(CommandSender commandSender, PreviousArguments previousArguments, String s) {
|
||||
return s.replace('_', ' ');
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Mapper(value = "skinTypeMapper", local = true)
|
||||
private TypeMapper<String> skinTypeMapper() {
|
||||
return new TypeMapper<String>() {
|
||||
@ -266,18 +216,4 @@ public class RegionCommand extends SWCommand {
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Validator(value = "WORLD", local = true)
|
||||
public TypeValidator<Player> worldValidator() {
|
||||
return (commandSender, player, messageSender) -> {
|
||||
return !messageSender.send(!Permission.hasPermission(player, Permission.WORLD), "REGION_REGION_NO_PERMS");
|
||||
};
|
||||
}
|
||||
|
||||
@Validator(value = "WORLD_EDIT", local = true)
|
||||
public TypeValidator<Player> worldEditValidator() {
|
||||
return (commandSender, player, messageSender) -> {
|
||||
return !messageSender.send(!Permission.hasPermission(player, Permission.WORLDEDIT), "REGION_REGION_NO_PERMS");
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -97,13 +97,6 @@ public class ResetCommand extends SWCommand {
|
||||
}
|
||||
}
|
||||
|
||||
@ClassValidator(value = Player.class, local = true)
|
||||
public TypeValidator<Player> validator() {
|
||||
return (commandSender, player, messageSender) -> {
|
||||
return !messageSender.send(!Permission.hasPermission(player, Permission.WORLD), "REGION_RESET_NO_PERMS");
|
||||
};
|
||||
}
|
||||
|
||||
private Region regionCheck(Player player) {
|
||||
Region region = Region.getRegion(player.getLocation());
|
||||
if (region == GlobalRegion.getInstance()) {
|
||||
|
@ -157,11 +157,4 @@ public class TNTCommand extends SWCommand {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ClassValidator(value = Player.class, local = true)
|
||||
public TypeValidator<Player> validator() {
|
||||
return (commandSender, player, messageSender) -> {
|
||||
return !messageSender.send(!Permission.hasPermission(player, Permission.WORLD), "REGION_TNT_NO_PERMS");
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -157,11 +157,6 @@ public class TestblockCommand extends SWCommand {
|
||||
};
|
||||
}
|
||||
|
||||
@ClassValidator(value = Player.class, local = true)
|
||||
public TypeValidator<Player> validator() {
|
||||
return (commandSender, player, messageSender) -> !messageSender.send(!Permission.hasPermission(player, Permission.WORLDEDIT), "REGION_TB_NO_PERMS");
|
||||
}
|
||||
|
||||
private Region regionCheck(Player player) {
|
||||
Region region = Region.getRegion(player.getLocation());
|
||||
if (!region.hasType(RegionType.TESTBLOCK)) {
|
||||
|
@ -57,6 +57,6 @@ public class FireBauGuiItem extends BauGuiItem {
|
||||
|
||||
@Override
|
||||
public Permission permission() {
|
||||
return Permission.WORLD;
|
||||
return Permission.BUILD;
|
||||
}
|
||||
}
|
||||
|
@ -57,6 +57,6 @@ public class FreezeBauGuiItem extends BauGuiItem {
|
||||
|
||||
@Override
|
||||
public Permission permission() {
|
||||
return Permission.WORLD;
|
||||
return Permission.BUILD;
|
||||
}
|
||||
}
|
||||
|
@ -58,6 +58,6 @@ public class ProtectBauGuiItem extends BauGuiItem {
|
||||
|
||||
@Override
|
||||
public Permission permission() {
|
||||
return Permission.WORLDEDIT;
|
||||
return Permission.BUILD;
|
||||
}
|
||||
}
|
||||
|
@ -65,6 +65,6 @@ public class ResetBauGuiItem extends BauGuiItem {
|
||||
|
||||
@Override
|
||||
public Permission permission() {
|
||||
return Permission.WORLDEDIT;
|
||||
return Permission.BUILD;
|
||||
}
|
||||
}
|
||||
|
@ -64,6 +64,6 @@ public class TestblockBauGuiItem extends BauGuiItem {
|
||||
|
||||
@Override
|
||||
public Permission permission() {
|
||||
return Permission.WORLDEDIT;
|
||||
return Permission.BUILD;
|
||||
}
|
||||
}
|
||||
|
@ -116,6 +116,6 @@ public class TntBauGuiItem extends BauGuiItem {
|
||||
|
||||
@Override
|
||||
public Permission permission() {
|
||||
return Permission.WORLD;
|
||||
return Permission.BUILD;
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ public class ScriptCommand extends SWCommand {
|
||||
}
|
||||
|
||||
@Register
|
||||
public void genericCommand(Player player) {
|
||||
public void genericCommand(@Validator Player player) {
|
||||
ScriptGUI.open(player);
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,8 @@
|
||||
|
||||
package de.steamwar.bausystem.features.script;
|
||||
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.utils.BauMemberUpdateEvent;
|
||||
import de.steamwar.bausystem.utils.FlatteningWrapper;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -42,6 +44,8 @@ public class ScriptListener implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void onLeftClick(PlayerInteractEvent event) {
|
||||
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
||||
|
||||
ItemStack item = event.getItem();
|
||||
if (item == null || FlatteningWrapper.impl.isNoBook(item) || item.getItemMeta() == null) {
|
||||
return;
|
||||
@ -68,6 +72,13 @@ public class ScriptListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
||||
ScriptRunner.updateGlobalScript(event.getPlayer());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onBauMemberUpdate(BauMemberUpdateEvent event) {
|
||||
event.getNewSpectator().forEach(ScriptRunner::remove);
|
||||
event.getNewBuilder().forEach(ScriptRunner::updateGlobalScript);
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
package de.steamwar.bausystem.features.script.event;
|
||||
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.features.script.ScriptRunner;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -41,6 +42,7 @@ public class CommandListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {
|
||||
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
||||
String[] split = event.getMessage().split(" ");
|
||||
if (calledCommands.getOrDefault(event.getPlayer(), new HashSet<>()).contains(split[0])) {
|
||||
return;
|
||||
|
@ -20,6 +20,7 @@
|
||||
package de.steamwar.bausystem.features.script.event;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.features.script.ScriptRunner;
|
||||
import de.steamwar.bausystem.features.script.lua.SteamWarGlobalLuaPlugin;
|
||||
import de.steamwar.bausystem.features.script.lua.libs.StorageLib;
|
||||
@ -64,17 +65,20 @@ public class EventListener implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
||||
ScriptRunner.callEvent(event.getPlayer(), SteamWarGlobalLuaPlugin.EventType.SelfJoin, LuaValue.NIL, event);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void onPlayerQuit(PlayerQuitEvent event) {
|
||||
StorageLib.removePlayer(event.getPlayer());
|
||||
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
||||
ScriptRunner.callEvent(event.getPlayer(), SteamWarGlobalLuaPlugin.EventType.SelfLeave, LuaValue.NIL, event);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void onPlayerSwapHandItems(PlayerSwapHandItemsEvent event) {
|
||||
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
||||
if (LAST_FS.containsKey(event.getPlayer())) {
|
||||
Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> {
|
||||
ScriptRunner.callEvent(event.getPlayer(), SteamWarGlobalLuaPlugin.EventType.DoubleSwap, LuaValue.NIL, event);
|
||||
@ -86,6 +90,7 @@ public class EventListener implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void onBlockPlace(BlockPlaceEvent event) {
|
||||
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
||||
LuaTable table = new LuaTable();
|
||||
table.set("x", event.getBlock().getX());
|
||||
table.set("y", event.getBlock().getY());
|
||||
@ -96,6 +101,7 @@ public class EventListener implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void onBlockBreak(BlockBreakEvent event) {
|
||||
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
||||
LuaTable table = new LuaTable();
|
||||
table.set("x", event.getBlock().getX());
|
||||
table.set("y", event.getBlock().getY());
|
||||
@ -108,6 +114,7 @@ public class EventListener implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
||||
if (ignore.remove(event.getPlayer())) {
|
||||
return;
|
||||
}
|
||||
@ -144,6 +151,7 @@ public class EventListener implements Listener {
|
||||
Region tntRegion = Region.getRegion(event.getLocation());
|
||||
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
if(!Permission.BUILD.hasPermission(player)) continue;
|
||||
if (tntRegion.inRegion(player.getLocation(), RegionType.NORMAL, RegionExtensionType.NORMAL)) {
|
||||
ScriptRunner.callEvent(player, SteamWarGlobalLuaPlugin.EventType.TNTSpawn, LuaValue.NIL, event);
|
||||
}
|
||||
@ -165,6 +173,7 @@ public class EventListener implements Listener {
|
||||
boolean inBuild = event.blockList().stream().anyMatch(block -> tntRegion.inRegion(block.getLocation(), RegionType.BUILD, RegionExtensionType.EXTENSION));
|
||||
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
if(!Permission.BUILD.hasPermission(player)) continue;
|
||||
if (tntRegion.inRegion(player.getLocation(), RegionType.NORMAL, RegionExtensionType.NORMAL)) {
|
||||
ScriptRunner.callEvent(player, SteamWarGlobalLuaPlugin.EventType.TNTExplode, table, event);
|
||||
if (inBuild) {
|
||||
@ -176,6 +185,7 @@ public class EventListener implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void onPlayerDropItem(PlayerDropItemEvent event) {
|
||||
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
||||
ignore.add(event.getPlayer());
|
||||
LuaTable table = new LuaTable();
|
||||
table.set("type", event.getItemDrop().getItemStack().getType().name());
|
||||
@ -185,6 +195,7 @@ public class EventListener implements Listener {
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void onEntityDeath(EntityDeathEvent event) {
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
if(!Permission.BUILD.hasPermission(player)) continue;
|
||||
LuaTable table = new LuaTable();
|
||||
table.set("type", event.getEntityType().name());
|
||||
ScriptRunner.callEvent(player, SteamWarGlobalLuaPlugin.EventType.EntityDeath, table, event);
|
||||
|
@ -20,6 +20,7 @@
|
||||
package de.steamwar.bausystem.features.script.event;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.features.script.ScriptRunner;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.linkage.api.Plain;
|
||||
@ -36,6 +37,7 @@ public class HotkeyListener implements PluginMessageListener, Plain {
|
||||
|
||||
@Override
|
||||
public void onPluginMessageReceived(String channel, Player player, byte[] message) {
|
||||
if(!Permission.BUILD.hasPermission(player)) return;
|
||||
if (!channel.equals("sw:hotkeys")) return;
|
||||
if (message.length < 5) return;
|
||||
int action = message[4] & 0xFF;
|
||||
|
@ -124,12 +124,10 @@ public class SteamWarLuaPlugin extends TwoArgFunction {
|
||||
return LuaValue.NIL;
|
||||
}
|
||||
|
||||
command = preprocessEvent.getMessage().substring(1);
|
||||
Bukkit.getLogger().log(Level.INFO, player.getName() + " dispatched command: " + command);
|
||||
String[] commandSplit = command.split(" ");
|
||||
if (!commandSplit[0].equals("select") && hasFAWE && WorldEditListener.isWorldEditCommand("/" + commandSplit[0])) {
|
||||
if (!Permission.WORLDEDIT.hasPermission(player)) {
|
||||
return NIL;
|
||||
}
|
||||
EditSession editSession = WorldEditUtils.getEditSession(player);
|
||||
Actor actor = BukkitAdapter.adapt(player);
|
||||
WorldEdit.getInstance().getPlatformManager().getPlatformCommandManager().handleCommandOnCurrentThread(new CommandEvent(actor, command, editSession));
|
||||
|
@ -20,7 +20,7 @@
|
||||
package de.steamwar.bausystem.features.script.lua.libs;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.features.tpslimit.TPSLimitUtils;
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.features.tpslimit.TPSSystem;
|
||||
import de.steamwar.bausystem.features.tpslimit.TPSUtils;
|
||||
import de.steamwar.core.TPSWatcher;
|
||||
@ -52,6 +52,9 @@ public class ServerLib implements LuaLib {
|
||||
serverLib.set("getBlockAt", new OneArgFunction() {
|
||||
@Override
|
||||
public LuaValue call(LuaValue arg1) {
|
||||
if (!Permission.SUPERVISOR.hasPermission(player)) {
|
||||
return LuaValue.NIL;
|
||||
}
|
||||
LuaTable pos = arg1.checktable();
|
||||
return valueOf(player.getWorld().getBlockAt(pos.get("x").checkint(), pos.get("y").checkint(), pos.get("z").checkint()).getType().name());
|
||||
}
|
||||
@ -59,6 +62,9 @@ public class ServerLib implements LuaLib {
|
||||
serverLib.set("setBlockAt", new TwoArgFunction() {
|
||||
@Override
|
||||
public LuaValue call(LuaValue arg1, LuaValue arg2) {
|
||||
if (!Permission.SUPERVISOR.hasPermission(player)) {
|
||||
return LuaValue.NIL;
|
||||
}
|
||||
LuaTable pos = arg1.checktable();
|
||||
LuaString material = arg2.checkstring();
|
||||
Material mat = SWItem.getMaterial(material.tojstring());
|
||||
|
@ -22,6 +22,7 @@ package de.steamwar.bausystem.features.shieldprinting;
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.features.shieldprinting.impl.*;
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
import de.steamwar.bausystem.utils.BauMemberUpdateEvent;
|
||||
import de.steamwar.bausystem.utils.bossbar.BauSystemBossbar;
|
||||
import de.steamwar.bausystem.utils.bossbar.BossBarService;
|
||||
import de.steamwar.inventory.SWItem;
|
||||
@ -273,6 +274,12 @@ public class ShieldPrinting implements Listener {
|
||||
updateBossbar(event.getPlayer());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onBauMemberUpdate(BauMemberUpdateEvent event) {
|
||||
event.getNewSpectator().forEach(player -> BossBarService.instance.remove(player, region, "shieldprinting"));
|
||||
event.getNewBuilder().forEach(this::updateBossbar);
|
||||
}
|
||||
|
||||
private void updateBossbars() {
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
updateBossbar(player);
|
||||
|
@ -108,8 +108,8 @@ public class ShieldPrintingCommand extends SWCommand implements Listener {
|
||||
@ClassValidator(value = Player.class, local = true)
|
||||
public TypeValidator<Player> validator() {
|
||||
return (commandSender, player, messageSender) -> {
|
||||
if (!Permission.hasPermission(player, Permission.WORLD)) {
|
||||
messageSender.send("SHIELD_PRINTING_DISALLOWED", player);
|
||||
if (!Permission.BUILD.hasPermission(player)) {
|
||||
messageSender.send("NO_PERMISSION", player);
|
||||
return false;
|
||||
}
|
||||
Region region = Region.getRegion(player.getLocation());
|
||||
@ -123,6 +123,7 @@ public class ShieldPrintingCommand extends SWCommand implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
||||
if (event.getClickedBlock() == null) {
|
||||
return;
|
||||
}
|
||||
|
@ -55,6 +55,6 @@ public class SimulatorBauGuiItem extends BauGuiItem {
|
||||
|
||||
@Override
|
||||
public Permission permission() {
|
||||
return Permission.WORLD;
|
||||
return Permission.BUILD;
|
||||
}
|
||||
}
|
||||
|
@ -102,11 +102,4 @@ public class SimulatorCommand extends SWCommand {
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@ClassValidator(value = Player.class, local = true)
|
||||
public TypeValidator<Player> validator() {
|
||||
return (commandSender, player, messageSender) -> {
|
||||
return !messageSender.send(!Permission.hasPermission(player, Permission.WORLD), "SIMULATOR_NO_PERMS");
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ package de.steamwar.bausystem.features.simulator;
|
||||
import com.comphenix.tinyprotocol.Reflection;
|
||||
import com.comphenix.tinyprotocol.TinyProtocol;
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.SWUtils;
|
||||
import de.steamwar.bausystem.features.simulator.data.Simulator;
|
||||
import de.steamwar.bausystem.features.simulator.data.SimulatorElement;
|
||||
@ -36,6 +37,7 @@ import de.steamwar.bausystem.features.simulator.execute.SimulatorExecutor;
|
||||
import de.steamwar.bausystem.features.simulator.gui.SimulatorGroupGui;
|
||||
import de.steamwar.bausystem.features.simulator.gui.SimulatorGui;
|
||||
import de.steamwar.bausystem.features.simulator.gui.base.SimulatorBaseGui;
|
||||
import de.steamwar.bausystem.utils.BauMemberUpdateEvent;
|
||||
import de.steamwar.bausystem.utils.ItemUtils;
|
||||
import de.steamwar.bausystem.utils.RayTraceUtils;
|
||||
import de.steamwar.entity.REntity;
|
||||
@ -94,6 +96,7 @@ public class SimulatorCursor implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||
if (!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
||||
Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> {
|
||||
calcCursor(event.getPlayer());
|
||||
}, 0);
|
||||
@ -101,16 +104,23 @@ public class SimulatorCursor implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerDropItem(PlayerDropItemEvent event) {
|
||||
if (!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
||||
calcCursor(event.getPlayer());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerItemHeld(PlayerItemHeldEvent event) {
|
||||
if (!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
||||
Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> {
|
||||
calcCursor(event.getPlayer());
|
||||
}, 1);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onBauMemberUpdate(BauMemberUpdateEvent event) {
|
||||
event.getChanged().forEach(this::calcCursor);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerQuit(PlayerQuitEvent event) {
|
||||
cursorType.remove(event.getPlayer());
|
||||
@ -149,7 +159,7 @@ public class SimulatorCursor implements Listener {
|
||||
if (calculating.contains(player)) return;
|
||||
calculating.add(player);
|
||||
}
|
||||
if (!isSimulatorItem(player.getInventory().getItemInMainHand()) && !isSimulatorItem(player.getInventory().getItemInOffHand())) {
|
||||
if (!Permission.BUILD.hasPermission(player) || (!isSimulatorItem(player.getInventory().getItemInMainHand()) && !isSimulatorItem(player.getInventory().getItemInOffHand()))) {
|
||||
if (removeCursor(player) || SimulatorWatcher.show(null, player)) {
|
||||
SWUtils.sendToActionbar(player, "");
|
||||
}
|
||||
@ -334,6 +344,7 @@ public class SimulatorCursor implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||
if (!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
||||
if (!ItemUtils.isItem(event.getItem(), "simulator")) {
|
||||
return;
|
||||
}
|
||||
|
@ -24,7 +24,6 @@ import de.steamwar.bausystem.features.simulator.execute.SimulatorAction;
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
import de.steamwar.bausystem.region.flags.Flag;
|
||||
import de.steamwar.bausystem.region.flags.flagvalues.FreezeMode;
|
||||
import de.steamwar.bausystem.region.tags.Tag;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
@ -78,11 +78,4 @@ public class LaufbauCommand extends SWCommand {
|
||||
public void laufbauSettings(@Validator Player player) {
|
||||
new LaufbauSettings(player);
|
||||
}
|
||||
|
||||
@ClassValidator(value = Player.class, local = true)
|
||||
public TypeValidator<Player> validator() {
|
||||
return (commandSender, player, messageSender) -> {
|
||||
return !messageSender.send(!Permission.hasPermission(player, Permission.WORLDEDIT), "LAUFBAU_NO_PERM");
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -91,13 +91,6 @@ public class PanzernCommand extends SWCommand {
|
||||
}.runTaskTimer(BauSystem.getInstance(), 1, 1);
|
||||
}
|
||||
|
||||
@ClassValidator(value = Player.class, local = true)
|
||||
public TypeValidator<Player> validator() {
|
||||
return (commandSender, player, messageSender) -> {
|
||||
return !messageSender.send(!Permission.hasPermission(player, Permission.WORLDEDIT), "PANZERN_NO_PERM");
|
||||
};
|
||||
}
|
||||
|
||||
@Mapper(value = "block", local = true)
|
||||
private TypeMapper<Material> blockMapper() {
|
||||
Set<String> strings = new HashSet<>();
|
||||
|
@ -22,6 +22,7 @@ package de.steamwar.bausystem.features.smartplace;
|
||||
import com.comphenix.tinyprotocol.Reflection;
|
||||
import com.comphenix.tinyprotocol.TinyProtocol;
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.configplayer.Config;
|
||||
import de.steamwar.inventory.SWItem;
|
||||
import de.steamwar.linkage.Linked;
|
||||
@ -94,6 +95,7 @@ public class SmartPlaceListener implements Plain, Listener {
|
||||
|
||||
public SmartPlaceListener() {
|
||||
TinyProtocol.instance.addFilter(useItem, (player, packet) -> {
|
||||
if(!Permission.BUILD.hasPermission(player)) return packet;
|
||||
if (!Config.getInstance().get(player).getPlainValueOrDefault("smartPlace", false)) return packet;
|
||||
Block block = player.getTargetBlockExact(6);
|
||||
boolean shouldSneak = false;
|
||||
@ -128,6 +130,7 @@ public class SmartPlaceListener implements Plain, Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
||||
if (!Config.getInstance().get(event.getPlayer()).getPlainValueOrDefault("smartPlace", false)) return;
|
||||
WAS_EXECUTED.add(event.getPlayer());
|
||||
if (event.getAction() != Action.RIGHT_CLICK_BLOCK) return;
|
||||
@ -146,6 +149,7 @@ public class SmartPlaceListener implements Plain, Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onBlockPlace(BlockPlaceEvent event) {
|
||||
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
||||
if (!Config.getInstance().get(event.getPlayer()).getPlainValueOrDefault("smartPlace", false)) return;
|
||||
if (!SMART_PLACING.contains(event.getPlayer())) {
|
||||
if (CONTAINERS.contains(event.getBlockAgainst().getType())) {
|
||||
|
@ -20,16 +20,22 @@
|
||||
package de.steamwar.bausystem.features.techhider;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.features.world.SpectatorListener;
|
||||
import de.steamwar.bausystem.features.xray.XrayCommand;
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
import de.steamwar.bausystem.utils.ScoreboardElement;
|
||||
import de.steamwar.command.PreviousArguments;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.command.TypeMapper;
|
||||
import de.steamwar.core.CraftbukkitWrapper;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.linkage.LinkedInstance;
|
||||
import de.steamwar.techhider.TechHider;
|
||||
import net.md_5.bungee.api.ChatMessageType;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -55,7 +61,7 @@ public class TechHiderCommand extends SWCommand implements Listener, ScoreboardE
|
||||
public XrayCommand xrayCommand;
|
||||
|
||||
@Register(description = "TECHHIDER_HELP")
|
||||
public void toggleHider(Player player) {
|
||||
public void toggleHider(@Validator Player player) {
|
||||
Region region = Region.getRegion(player.getLocation());
|
||||
if (region.isGlobal()) {
|
||||
BauSystem.MESSAGE.send("TECHHIDER_GLOBAL", player);
|
||||
@ -104,6 +110,33 @@ public class TechHiderCommand extends SWCommand implements Listener, ScoreboardE
|
||||
});
|
||||
}
|
||||
|
||||
@Register
|
||||
public void toggleHider(@Validator("supervisor") Player player, @Mapper("spectator") Player other) {
|
||||
SpectatorListener.toggleNoTechHider(other);
|
||||
}
|
||||
|
||||
@Mapper("spectator")
|
||||
public TypeMapper<Player> spectatorMapper() {
|
||||
return new TypeMapper<>() {
|
||||
@Override
|
||||
public Player map(CommandSender commandSender, String[] previousArguments, String s) {
|
||||
Player player = Bukkit.getPlayer(s);
|
||||
if (player != null && Permission.REAL_SPECTATOR.hasPermission(player)) {
|
||||
return player;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<String> tabCompletes(CommandSender sender, PreviousArguments previousArguments, String s) {
|
||||
return Bukkit.getOnlinePlayers().stream()
|
||||
.filter(Permission.REAL_SPECTATOR::hasPermission)
|
||||
.map(Player::getName)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerQuit(PlayerQuitEvent event) {
|
||||
hidden.values().forEach(set -> set.remove(event.getPlayer()));
|
||||
|
@ -20,6 +20,7 @@
|
||||
package de.steamwar.bausystem.features.testblock.blockcounter;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.configplayer.Config;
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
import lombok.experimental.UtilityClass;
|
||||
@ -49,6 +50,8 @@ public class BlockCounter {
|
||||
}
|
||||
|
||||
public String getMessage(Player player, int count, int tntCount, long tick, long lastTick) {
|
||||
if(!Permission.BUILD.hasPermission(player)) return null;
|
||||
|
||||
double countPerTNT = (double) count / tntCount;
|
||||
double countPerTick = (double) count / Math.max((lastTick - tick), 1);
|
||||
if (isActive(player)) {
|
||||
|
@ -146,16 +146,6 @@ public class TPSSystem implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
public TypeValidator<Player> player() {
|
||||
return (commandSender, player, messageSender) -> {
|
||||
if (!Permission.hasPermission(player, Permission.WORLD)) {
|
||||
messageSender.send("TPSLIMIT_NO_PERMS");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
}
|
||||
|
||||
private class TPSBaseCommand extends SWCommand {
|
||||
|
||||
private TPSBaseCommand() {
|
||||
@ -163,11 +153,6 @@ public class TPSSystem implements Listener {
|
||||
setMessage(BauSystem.MESSAGE);
|
||||
addDefaultHelpMessage("TPSLIMIT_HELP");
|
||||
}
|
||||
|
||||
@ClassValidator(value = Player.class, local = true)
|
||||
public TypeValidator<Player> player() {
|
||||
return TPSSystem.this.player();
|
||||
}
|
||||
}
|
||||
|
||||
@AbstractSWCommand.PartOf(TPSBaseCommand.class)
|
||||
@ -233,11 +218,6 @@ public class TPSSystem implements Listener {
|
||||
super("tick");
|
||||
setMessage(BauSystem.MESSAGE);
|
||||
}
|
||||
|
||||
@ClassValidator(value = Player.class, local = true)
|
||||
public TypeValidator<Player> player() {
|
||||
return TPSSystem.this.player();
|
||||
}
|
||||
}
|
||||
|
||||
@AbstractSWCommand.PartOf(TickBaseCommand.class)
|
||||
@ -406,7 +386,7 @@ public class TPSSystem implements Listener {
|
||||
|
||||
@Override
|
||||
public Permission permission() {
|
||||
return Permission.WORLD;
|
||||
return Permission.BUILD;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -243,15 +243,4 @@ public class TraceCommand extends SWCommand {
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@ClassValidator(value = Player.class, local = true)
|
||||
public TypeValidator<Player> validator() {
|
||||
return (commandSender, player, messageSender) -> {
|
||||
if (!Permission.hasPermission(player, Permission.WORLD)) {
|
||||
messageSender.send("TRACE_MESSAGE_DISALLOWED", player);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -96,6 +96,6 @@ public class TracerBauGuiItem extends BauGuiItem {
|
||||
|
||||
@Override
|
||||
public Permission permission() {
|
||||
return Permission.WORLD;
|
||||
return Permission.BUILD;
|
||||
}
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.features.tracer.TNTPosition;
|
||||
import de.steamwar.bausystem.region.Region;
|
||||
import de.steamwar.bausystem.shared.ShowMode;
|
||||
import de.steamwar.bausystem.utils.BauMemberUpdateEvent;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@ -131,12 +132,21 @@ public class TraceShowManager implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onLeave(PlayerQuitEvent event) {
|
||||
hideComplete(event.getPlayer());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onBauMemberUpdate(BauMemberUpdateEvent event) {
|
||||
event.getNewSpectator().forEach(this::hideComplete);
|
||||
}
|
||||
|
||||
private void hideComplete(Player player) {
|
||||
showModes.forEach((region, playerShowModeMap) -> {
|
||||
ShowMode<TNTPosition> showMode = playerShowModeMap.remove(event.getPlayer());
|
||||
ShowMode<TNTPosition> showMode = playerShowModeMap.remove(player);
|
||||
if (showMode != null) showMode.hide();
|
||||
});
|
||||
showFilters.forEach((region, playerPredicateMap) -> {
|
||||
playerPredicateMap.remove(event.getPlayer());
|
||||
playerPredicateMap.remove(player);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ public class BindCommand extends SWCommand implements Listener {
|
||||
}
|
||||
|
||||
@Register(description = "OTHER_BIND_HELP")
|
||||
public void bind(Player player, @Mapper("command") @ErrorMessage("OTHER_BIND_ERROR") String... command) {
|
||||
public void bind(@Validator Player player, @Mapper("command") @ErrorMessage("OTHER_BIND_ERROR") String... command) {
|
||||
bindInternal(player, command);
|
||||
}
|
||||
|
||||
@ -103,6 +103,7 @@ public class BindCommand extends SWCommand implements Listener {
|
||||
@EventHandler
|
||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||
if (!event.hasItem()) return;
|
||||
if(!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
||||
ItemStack itemStack = event.getItem();
|
||||
ItemMeta meta = itemStack.getItemMeta();
|
||||
if (meta == null) {
|
||||
@ -116,23 +117,21 @@ public class BindCommand extends SWCommand implements Listener {
|
||||
|
||||
event.setCancelled(true);
|
||||
Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> {
|
||||
PlayerCommandPreprocessEvent playerCommandPreprocessEvent = new PlayerCommandPreprocessEvent(event.getPlayer(), "/" + command);
|
||||
Bukkit.getPluginManager().callEvent(playerCommandPreprocessEvent);
|
||||
if (playerCommandPreprocessEvent.isCancelled()) return;
|
||||
PlayerCommandPreprocessEvent preprocessEvent = new PlayerCommandPreprocessEvent(event.getPlayer(), "/" + command);
|
||||
Bukkit.getPluginManager().callEvent(preprocessEvent);
|
||||
if (preprocessEvent.isCancelled()) return;
|
||||
|
||||
Bukkit.getLogger().log(Level.INFO, event.getPlayer().getName() + " dispatched command: " + command);
|
||||
String[] commandSplit = command.split(" ");
|
||||
String processedCommand = preprocessEvent.getMessage().substring(1);
|
||||
Bukkit.getLogger().log(Level.INFO, event.getPlayer().getName() + " dispatched command: " + processedCommand);
|
||||
String[] commandSplit = processedCommand.split(" ");
|
||||
if (!commandSplit[0].equals("select") && hasFAWE && WorldEditListener.isWorldEditCommand("/" + commandSplit[0])) {
|
||||
if (!Permission.WORLDEDIT.hasPermission(event.getPlayer())) {
|
||||
return;
|
||||
}
|
||||
EditSession editSession = WorldEditUtils.getEditSession(event.getPlayer());
|
||||
Actor actor = BukkitAdapter.adapt(event.getPlayer());
|
||||
WorldEdit.getInstance().getPlatformManager().getPlatformCommandManager().handleCommandOnCurrentThread(new CommandEvent(actor, command, editSession));
|
||||
WorldEdit.getInstance().getPlatformManager().getPlatformCommandManager().handleCommandOnCurrentThread(new CommandEvent(actor, processedCommand, editSession));
|
||||
editSession.flushSession();
|
||||
WorldEditUtils.addToPlayer(event.getPlayer(), editSession);
|
||||
} else {
|
||||
Bukkit.getServer().dispatchCommand(event.getPlayer(), command);
|
||||
Bukkit.getServer().dispatchCommand(event.getPlayer(), processedCommand);
|
||||
}
|
||||
}, 1);
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ public class BookReplaceCommand extends SWCommand {
|
||||
}
|
||||
|
||||
@Register("color")
|
||||
public void color(Player player) {
|
||||
public void color(@Validator Player player) {
|
||||
ItemStack itemStack = player.getInventory().getItemInMainHand();
|
||||
ItemMeta itemMeta = itemStack.getItemMeta();
|
||||
if (itemMeta instanceof BookMeta) {
|
||||
@ -29,7 +29,7 @@ public class BookReplaceCommand extends SWCommand {
|
||||
}
|
||||
|
||||
@Register("uncolor")
|
||||
public void uncolor(Player player) {
|
||||
public void uncolor(@Validator Player player) {
|
||||
ItemStack itemStack = player.getInventory().getItemInMainHand();
|
||||
ItemMeta itemMeta = itemStack.getItemMeta();
|
||||
if (itemMeta instanceof BookMeta) {
|
||||
|
@ -48,13 +48,6 @@ public class ClearCommand extends SWCommand {
|
||||
BauSystem.MESSAGE.send("OTHER_CLEAR_TO", p, target.getName());
|
||||
}
|
||||
|
||||
@ClassValidator(value = Player.class, local = true)
|
||||
public TypeValidator<Player> validator() {
|
||||
return (commandSender, player, messageSender) -> {
|
||||
return !messageSender.send(!Permission.hasPermission(player, Permission.WORLD), "OTHER_CLEAR_NO_PERMS");
|
||||
};
|
||||
}
|
||||
|
||||
private void clear(Player player) {
|
||||
player.getInventory().clear();
|
||||
player.getInventory().setHelmet(new ItemStack(Material.AIR));
|
||||
|
@ -34,7 +34,7 @@ public class DebugStickCommand extends SWCommand {
|
||||
}
|
||||
|
||||
@Register(description = "DEBUG_STICK_COMMAND_HELP")
|
||||
public void genericCommand(Player p) {
|
||||
public void genericCommand(@Validator Player p) {
|
||||
SWUtils.giveItemToPlayer(p, new ItemStack(Material.DEBUG_STICK));
|
||||
}
|
||||
}
|
||||
|
@ -45,12 +45,12 @@ public class KillAllCommand extends SWCommand {
|
||||
}
|
||||
|
||||
@Register(description = "OTHER_KILLALL_HELP_SELF")
|
||||
public void genericCommand(Player player) {
|
||||
public void genericCommand(@Validator Player player) {
|
||||
genericCommand(player, RegionSelectionType.LOCAL);
|
||||
}
|
||||
|
||||
@Register(description = "OTHER_KILLALL_HELP_ALL")
|
||||
public void genericCommand(Player player, RegionSelectionType regionSelectionType) {
|
||||
public void genericCommand(@Validator Player player, RegionSelectionType regionSelectionType) {
|
||||
Region region = Region.getRegion(player.getLocation());
|
||||
AtomicLong count = new AtomicLong(0);
|
||||
if (regionSelectionType == RegionSelectionType.GLOBAL || GlobalRegion.getInstance() == region) {
|
||||
|
@ -24,6 +24,7 @@ import com.comphenix.tinyprotocol.TinyProtocol;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.features.tpslimit.TPSUtils;
|
||||
import de.steamwar.bausystem.utils.BauMemberUpdateEvent;
|
||||
import de.steamwar.bausystem.utils.NMSWrapper;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.core.ProtocolWrapper;
|
||||
@ -97,7 +98,7 @@ public class NoClipCommand extends SWCommand implements Listener {
|
||||
}
|
||||
|
||||
@Register(help = true)
|
||||
public void genericCommand(Player player, String... args) {
|
||||
public void genericCommand(@Validator Player player) {
|
||||
if (NOCLIPS.contains(player)) {
|
||||
NOCLIPS.remove(player);
|
||||
player.setGameMode(GameMode.CREATIVE);
|
||||
@ -116,6 +117,16 @@ public class NoClipCommand extends SWCommand implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onBauMemberUpdate(BauMemberUpdateEvent event) {
|
||||
event.getNewSpectator().forEach(player -> {
|
||||
if (NOCLIPS.contains(player)) {
|
||||
NOCLIPS.remove(player);
|
||||
player.setGameMode(GameMode.CREATIVE);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onPlayerGameModeChange(PlayerGameModeChangeEvent event) {
|
||||
if (NOCLIPS.contains(event.getPlayer())) {
|
||||
|
@ -20,6 +20,7 @@
|
||||
package de.steamwar.bausystem.features.util;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.entity.REntityServer;
|
||||
import de.steamwar.entity.RFallingBlockEntity;
|
||||
import de.steamwar.linkage.Linked;
|
||||
@ -49,6 +50,7 @@ public class PistonCalculator implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||
if (!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
||||
if (event.getAction() != Action.RIGHT_CLICK_BLOCK) return;
|
||||
if (!event.hasItem() || event.getItem().getType() != Material.SLIME_BALL) return;
|
||||
if (event.getClickedBlock() == null) return;
|
||||
|
@ -32,7 +32,7 @@ public class PistonCalculatorCommand extends SWCommand {
|
||||
}
|
||||
|
||||
@Register
|
||||
public void help(Player player) {
|
||||
public void help(@Validator Player player) {
|
||||
BauSystem.MESSAGE.send("PISTON_HELP_1", player);
|
||||
BauSystem.MESSAGE.send("PISTON_HELP_2", player);
|
||||
BauSystem.MESSAGE.send("PISTON_HELP_3", player);
|
||||
|
@ -45,13 +45,6 @@ public class SelectCommand extends SWCommand {
|
||||
baurahmenCommand(p, RegionType.TESTBLOCK, regionExtensionType);
|
||||
}
|
||||
|
||||
@ClassValidator(value = Player.class, local = true)
|
||||
public TypeValidator<Player> validator() {
|
||||
return (commandSender, player, messageSender) -> {
|
||||
return !messageSender.send(!Permission.hasPermission(player, Permission.WORLDEDIT), "SELECT_NO_PERMS");
|
||||
};
|
||||
}
|
||||
|
||||
private void setSelection(RegionType regionType, RegionExtensionType regionExtensionType, Region region, Player p) {
|
||||
Point minPoint = region.getMinPoint(regionType, regionExtensionType);
|
||||
Point maxPoint = region.getMaxPoint(regionType, regionExtensionType);
|
||||
|
@ -43,7 +43,7 @@ public class SkullCommand extends SWCommand {
|
||||
}
|
||||
|
||||
@Register(description = "SKULL_HELP")
|
||||
public void giveCommand(Player p, @Mapper("player") @ErrorMessage("SKULL_INVALID") String skull) {
|
||||
public void giveCommand(@Validator Player p, @Mapper("player") @ErrorMessage("SKULL_INVALID") String skull) {
|
||||
ItemStack is = SWItem.getPlayerSkull(skull).getItemStack();
|
||||
SkullMeta sm = (SkullMeta) is.getItemMeta();
|
||||
assert sm != null;
|
||||
|
@ -41,7 +41,7 @@ public class SlotCommand extends SWCommand {
|
||||
}
|
||||
|
||||
@Register
|
||||
public void slotCommand(Player player, Integer slot) {
|
||||
public void slotCommand(@Validator Player player, Integer slot) {
|
||||
if (slot < 1 || slot > 9) {
|
||||
BauSystem.MESSAGE.send("OTHER_SLOT_INVALID_SLOT", player);
|
||||
return;
|
||||
@ -50,7 +50,7 @@ public class SlotCommand extends SWCommand {
|
||||
}
|
||||
|
||||
@Register(value = "pick", description = "OTHER_NOCLIP_SLOT_HELP_PICK")
|
||||
public void eyedropBlock(Player player) {
|
||||
public void eyedropBlock(@Validator Player player) {
|
||||
Block block = player.getTargetBlockExact(6);
|
||||
ItemStack itemStack;
|
||||
if (block == null) {
|
||||
@ -61,7 +61,7 @@ public class SlotCommand extends SWCommand {
|
||||
}
|
||||
|
||||
@Register(value = "drop", description = "OTHER_NOCLIP_SLOT_HELP_DROP")
|
||||
public void dropBlock(Player player) {
|
||||
public void dropBlock(@Validator Player player) {
|
||||
player.getInventory().setItemInMainHand(new ItemStack(Material.AIR));
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ public class StructureVoidCommand extends SWCommand {
|
||||
}
|
||||
|
||||
@Register(description = "STRUCTURE_VOID_COMMAND_HELP")
|
||||
public void genericCommand(Player p) {
|
||||
public void genericCommand(@Validator Player p) {
|
||||
SWUtils.giveItemToPlayer(p, new ItemStack(Material.STRUCTURE_VOID, 1));
|
||||
}
|
||||
}
|
||||
|
@ -20,6 +20,7 @@
|
||||
package de.steamwar.bausystem.features.util;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Entity;
|
||||
@ -34,9 +35,9 @@ public class TNTClickListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerInteractEntity(PlayerInteractEntityEvent event) {
|
||||
if (event.getHand() != EquipmentSlot.HAND) {
|
||||
return;
|
||||
}
|
||||
if (!Permission.BUILD.hasPermission(event.getPlayer())) return;
|
||||
if (event.getHand() != EquipmentSlot.HAND) return;
|
||||
|
||||
Entity entity = event.getRightClicked();
|
||||
if (event.getRightClicked() instanceof TNTPrimed) {
|
||||
TNTPrimed tntPrimed = (TNTPrimed) entity;
|
||||
|
@ -66,13 +66,6 @@ public class TimeCommand extends SWCommand {
|
||||
}, s -> tabCompletions);
|
||||
}
|
||||
|
||||
@ClassValidator(value = Player.class, local = true)
|
||||
public TypeValidator<Player> validator() {
|
||||
return (commandSender, player, messageSender) -> {
|
||||
return !messageSender.send(!Permission.hasPermission(player, Permission.WORLD), "OTHER_TIME_NO_PERM");
|
||||
};
|
||||
}
|
||||
|
||||
public enum Time {
|
||||
NIGHT(18000),
|
||||
DAY(6000),
|
||||
|
@ -50,6 +50,6 @@ public class DebugstickBauGuiItem extends BauGuiItem {
|
||||
|
||||
@Override
|
||||
public Permission permission() {
|
||||
return Permission.MEMBER;
|
||||
return Permission.BUILD;
|
||||
}
|
||||
}
|
||||
|
@ -62,6 +62,6 @@ public class KillAllBauGuiItem extends BauGuiItem {
|
||||
|
||||
@Override
|
||||
public Permission permission() {
|
||||
return Permission.MEMBER;
|
||||
return Permission.BUILD;
|
||||
}
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ public class NavWandBauGuiItem extends BauGuiItem {
|
||||
}
|
||||
|
||||
@Override public Permission permission() {
|
||||
return Permission.WORLDEDIT;
|
||||
return Permission.MEMBER;
|
||||
}
|
||||
|
||||
@Override public ItemStack getItem(Player player) {
|
||||
|
@ -18,7 +18,7 @@ public class SchemBauGuiItem extends BauGuiItem {
|
||||
|
||||
@Override
|
||||
public Permission permission() {
|
||||
return Permission.WORLDEDIT;
|
||||
return Permission.BUILD;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -88,7 +88,7 @@ public class SelectBauGuiItem extends BauGuiItem {
|
||||
|
||||
@Override
|
||||
public Permission permission() {
|
||||
return Permission.WORLDEDIT;
|
||||
return Permission.BUILD;
|
||||
}
|
||||
|
||||
@AllArgsConstructor
|
||||
|
@ -54,6 +54,6 @@ public class SkullBauGuiItem extends BauGuiItem {
|
||||
|
||||
@Override
|
||||
public Permission permission() {
|
||||
return Permission.MEMBER;
|
||||
return Permission.BUILD;
|
||||
}
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ public class WorldEditBauGuiItem extends BauGuiItem {
|
||||
|
||||
@Override
|
||||
public Permission permission() {
|
||||
return Permission.WORLDEDIT;
|
||||
return Permission.BUILD;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -122,13 +122,6 @@ public class WarpCommand extends SWCommand implements Disable, Enable {
|
||||
BauSystem.MESSAGE.sendPrefixless("WARP_GUI_DISTANCE", player, warp.getLocation().distance(player.getLocation()));
|
||||
}
|
||||
|
||||
@ClassValidator(value = Player.class, local = true)
|
||||
public TypeValidator<Player> validator() {
|
||||
return (commandSender, player, messageSender) -> {
|
||||
return !messageSender.send(!Permission.hasPermission(player, Permission.WORLD), "WARP_DISALLOWED");
|
||||
};
|
||||
}
|
||||
|
||||
@Linked
|
||||
public static class WarpsLink extends SWCommand {
|
||||
|
||||
|
@ -55,7 +55,7 @@ public class WarpGui {
|
||||
), warp)));
|
||||
|
||||
SWListInv<Warp> inv = new SWListInv<>(player, BauSystem.MESSAGE.parse("WARP_GUI_NAME", player), false, entries, (clickType, warp) -> {
|
||||
if (clickType.isRightClick() && Permission.hasPermission(player, Permission.WORLD)) {
|
||||
if (clickType.isRightClick() && Permission.BUILD.hasPermission(player)) {
|
||||
openWarpGui(player, warp);
|
||||
} else {
|
||||
warp.teleport(player);
|
||||
|
@ -21,6 +21,7 @@ package de.steamwar.bausystem.features.world;
|
||||
|
||||
import com.moulberry.axiom.event.AxiomHandshakeEvent;
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.config.BauServer;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.linkage.PluginCheck;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@ -32,7 +33,7 @@ public class AxiomPermissionCheck implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onAxiomHandshake(AxiomHandshakeEvent event) {
|
||||
if (Permission.WORLDEDIT.hasPermission(event.getPlayer())) {
|
||||
if (Permission.SUPERVISOR.hasPermission(event.getPlayer()) || BauServer.getInstance().getOwner().equals(event.getPlayer().getUniqueId())) {
|
||||
event.setMaxBufferSize(Short.MAX_VALUE);
|
||||
return;
|
||||
}
|
||||
|
@ -0,0 +1,148 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2023 SteamWar.de-Serverteam
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.bausystem.features.world;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.region.GlobalRegion;
|
||||
import de.steamwar.bausystem.utils.BauMemberUpdateEvent;
|
||||
import de.steamwar.bausystem.utils.bossbar.BauSystemBossbar;
|
||||
import de.steamwar.bausystem.utils.bossbar.BossBarService;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.network.packets.PacketHandler;
|
||||
import de.steamwar.network.packets.server.BaumemberUpdatePacket;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.boss.BarColor;
|
||||
import org.bukkit.boss.BarStyle;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.event.player.PlayerItemConsumeEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.event.player.PlayerRespawnEvent;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
@Linked
|
||||
public class BauMemberUpdate extends PacketHandler implements Listener {
|
||||
|
||||
private static final Set<Player> SPECTATORS = new HashSet<>();
|
||||
|
||||
@Handler
|
||||
public void baumemberUpdate(BaumemberUpdatePacket baumemberUpdatePacket) {
|
||||
baumemberUpdate();
|
||||
}
|
||||
|
||||
public static void baumemberUpdate() {
|
||||
Set<Player> newSpectator = new HashSet<>();
|
||||
Set<Player> newBuilder = new HashSet<>();
|
||||
Bukkit.getOnlinePlayers().forEach(player -> {
|
||||
if (Permission.REAL_SPECTATOR.hasPermission(player)) {
|
||||
if (!SPECTATORS.contains(player)) {
|
||||
SPECTATORS.add(player);
|
||||
Permission.removeForceOnlySpectator(player);
|
||||
newSpectator.add(player);
|
||||
player.addPotionEffect(new PotionEffect(PotionEffectType.GLOWING, -1, 1, false,false, false));
|
||||
showSpectatorNotice(player);
|
||||
}
|
||||
} else {
|
||||
if (Permission.SUPERVISOR.hasPermission(player)) {
|
||||
Permission.removeForceOnlySpectator(player);
|
||||
}
|
||||
if (SPECTATORS.contains(player)) {
|
||||
SPECTATORS.remove(player);
|
||||
newBuilder.add(player);
|
||||
player.removePotionEffect(PotionEffectType.GLOWING);
|
||||
BossBarService.instance.remove(player, GlobalRegion.getInstance(), "spectator");
|
||||
}
|
||||
}
|
||||
});
|
||||
Bukkit.getPluginManager().callEvent(new BauMemberUpdateEvent(newSpectator, newBuilder));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||
if (!Permission.BUILD.hasPermission(event.getPlayer())) {
|
||||
SPECTATORS.add(event.getPlayer());
|
||||
event.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.GLOWING, -1, 1, false,false, false));
|
||||
showSpectatorNotice(event.getPlayer());
|
||||
} else {
|
||||
event.getPlayer().removePotionEffect(PotionEffectType.GLOWING);
|
||||
}
|
||||
}
|
||||
|
||||
private static void showSpectatorNotice(Player player) {
|
||||
BauSystemBossbar bossbar = BossBarService.instance.get(player, GlobalRegion.getInstance(), "spectator");
|
||||
bossbar.setTitle(BauSystem.MESSAGE.parse("SPECTATOR", player));
|
||||
bossbar.setColor(BarColor.WHITE);
|
||||
bossbar.setStyle(BarStyle.SOLID);
|
||||
bossbar.setProgress(1.0);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerQuit(PlayerQuitEvent event) {
|
||||
SPECTATORS.remove(event.getPlayer());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerDeath(PlayerDeathEvent event) {
|
||||
event.setDeathMessage(null);
|
||||
if (SPECTATORS.contains(event.getEntity())) {
|
||||
event.getDrops().clear();
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerRespawn(PlayerRespawnEvent event) {
|
||||
Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> {
|
||||
if (SPECTATORS.contains(event.getPlayer())) {
|
||||
event.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.GLOWING, -1, 1, false, false, false));
|
||||
}
|
||||
}, 1);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerItemConsume(PlayerItemConsumeEvent event) {
|
||||
Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> {
|
||||
if (SPECTATORS.contains(event.getPlayer())) {
|
||||
event.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.GLOWING, -1, 1, false,false, false));
|
||||
}
|
||||
}, 1);
|
||||
}
|
||||
|
||||
@Linked
|
||||
public static class TestCommand extends SWCommand { // TODO: Remove before merge
|
||||
|
||||
public TestCommand() {
|
||||
super("test");
|
||||
}
|
||||
|
||||
@Register
|
||||
public void test(Player player) {
|
||||
PacketHandler.handlePacket(new BaumemberUpdatePacket());
|
||||
}
|
||||
}
|
||||
}
|
@ -19,6 +19,7 @@
|
||||
|
||||
package de.steamwar.bausystem.features.world;
|
||||
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.sql.SchematicData;
|
||||
import de.steamwar.sql.SchematicNode;
|
||||
@ -35,6 +36,8 @@ public class ClipboardListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onLogin(PlayerJoinEvent e) {
|
||||
if(!Permission.BUILD.hasPermission(e.getPlayer())) return;
|
||||
|
||||
try {
|
||||
SchematicNode schematic = SchematicNode.getSchematicNode(SteamwarUser.get(e.getPlayer().getUniqueId()).getId(), CLIPBOARD_SCHEMNAME, (Integer) null);
|
||||
if (schematic != null) {
|
||||
@ -47,6 +50,8 @@ public class ClipboardListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onLogout(PlayerQuitEvent e) {
|
||||
if(!Permission.SUPERVISOR.hasPermission(e.getPlayer())) return;
|
||||
|
||||
SchematicNode schematic = SchematicNode.getSchematicNode(SteamwarUser.get(e.getPlayer().getUniqueId()).getId(), CLIPBOARD_SCHEMNAME, (Integer) null);
|
||||
boolean newSchem = false;
|
||||
if (schematic == null) {
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
package de.steamwar.bausystem.features.world;
|
||||
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.SWUtils;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import org.bukkit.Material;
|
||||
@ -40,6 +41,9 @@ public class ItemFrameListener implements Listener {
|
||||
if (!(event.getEntity() instanceof ItemFrame)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(!Permission.BUILD.hasPermission((Player) event.getDamager())) return;
|
||||
|
||||
event.setCancelled(true);
|
||||
ItemFrame itemFrame = (ItemFrame) event.getEntity();
|
||||
ItemStack itemStack = itemFrame.getItem();
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
package de.steamwar.bausystem.features.world;
|
||||
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.config.BauServer;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.command.TypeValidator;
|
||||
@ -38,16 +39,11 @@ public class KickallCommand extends SWCommand {
|
||||
}
|
||||
|
||||
@Register(description = "KICKALL_HELP")
|
||||
public void genericCommand(@Validator Player player) {
|
||||
public void genericCommand(Player player) {
|
||||
if(!Permission.OWNER.hasPermission(player)) return;
|
||||
|
||||
Bukkit.getOnlinePlayers().forEach(p -> {
|
||||
if (!bauServer.getOwner().equals(p.getUniqueId())) p.kickPlayer("");
|
||||
});
|
||||
}
|
||||
|
||||
@ClassValidator(value = Player.class, local = true)
|
||||
public TypeValidator<Player> validator() {
|
||||
return (commandSender, player, messageSender) -> {
|
||||
return !messageSender.send(!bauServer.getOwner().equals(player.getUniqueId()), "KICKALL_NO_PERM");
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ package de.steamwar.bausystem.features.world;
|
||||
import com.comphenix.tinyprotocol.Reflection;
|
||||
import com.comphenix.tinyprotocol.TinyProtocol;
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.utils.PlaceItemUtils;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.linkage.MinVersion;
|
||||
@ -81,6 +82,7 @@ public class SignEditFrom20 implements Listener {
|
||||
}
|
||||
|
||||
private void edit(Player player, Block block) {
|
||||
if (!Permission.BUILD.hasPermission(player)) return;
|
||||
Sign sign = (Sign) block.getState();
|
||||
Side side = signSide(player, block);
|
||||
SignSide signSide = sign.getSide(side);
|
||||
|
@ -22,6 +22,7 @@ package de.steamwar.bausystem.features.world;
|
||||
import com.comphenix.tinyprotocol.Reflection;
|
||||
import com.comphenix.tinyprotocol.TinyProtocol;
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.linkage.MaxVersion;
|
||||
import org.bukkit.Bukkit;
|
||||
@ -68,6 +69,7 @@ public class SignEditUntil19 implements Listener {
|
||||
}
|
||||
|
||||
private void edit(Player player, Block block) {
|
||||
if (!Permission.BUILD.hasPermission(player)) return;
|
||||
Sign sign = (org.bukkit.block.Sign) block.getState();
|
||||
String[] lines = sign.getLines();
|
||||
for (int i = 0; i < lines.length; i++) {
|
||||
|
@ -0,0 +1,258 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2023 SteamWar.de-Serverteam
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.bausystem.features.world;
|
||||
|
||||
import de.steamwar.bausystem.BauSystem;
|
||||
import de.steamwar.bausystem.Permission;
|
||||
import de.steamwar.bausystem.config.BauServer;
|
||||
import de.steamwar.bausystem.utils.BauMemberUpdateEvent;
|
||||
import de.steamwar.core.CraftbukkitWrapper;
|
||||
import de.steamwar.inventory.SWItem;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.sql.BauweltMember;
|
||||
import de.steamwar.techhider.TechHider;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.event.block.BlockCanBuildEvent;
|
||||
import org.bukkit.event.block.BlockMultiPlaceEvent;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
import org.bukkit.event.entity.EntityPickupItemEvent;
|
||||
import org.bukkit.event.player.*;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
@Linked
|
||||
public class SpectatorListener implements Listener {
|
||||
|
||||
private static final Set<Player> NO_TECHHIDER = new HashSet<>();
|
||||
|
||||
static {
|
||||
Set<Material> materials = new HashSet<>();
|
||||
materials.add(Material.REDSTONE_WIRE);
|
||||
materials.add(Material.REDSTONE_TORCH);
|
||||
materials.add(Material.REDSTONE_BLOCK);
|
||||
materials.add(Material.REPEATER);
|
||||
materials.add(Material.COMPARATOR);
|
||||
materials.add(Material.LEVER);
|
||||
for (Material value : Material.values()) {
|
||||
if (value.name().endsWith("_BUTTON")) {
|
||||
materials.add(value);
|
||||
}
|
||||
if (value.name().endsWith("_PRESSURE_PLATE")) {
|
||||
materials.add(value);
|
||||
}
|
||||
if (value.name().endsWith("_SIGN")) {
|
||||
materials.add(value);
|
||||
}
|
||||
}
|
||||
materials.add(SWItem.getMaterial("SCULK_SENSOR"));
|
||||
materials.add(SWItem.getMaterial("CALIBRATED_SCULK_SENSOR"));
|
||||
materials.add(SWItem.getMaterial("SCULK_SHRIEKER"));
|
||||
materials.add(SWItem.getMaterial("AMETHYST_BLOCK"));
|
||||
materials.add(SWItem.getMaterial("AMETHYST_CLUSTER"));
|
||||
materials.add(SWItem.getMaterial("SMALL_AMETHYST_BUG"));
|
||||
materials.add(SWItem.getMaterial("MEDIUM_AMETHYST_BUG"));
|
||||
materials.add(SWItem.getMaterial("LARGE_AMETHYST_BUG"));
|
||||
materials.add(Material.TRIPWIRE_HOOK);
|
||||
materials.add(Material.TRIPWIRE);
|
||||
materials.add(Material.DAYLIGHT_DETECTOR);
|
||||
materials.add(SWItem.getMaterial("LIGHTNING_ROD"));
|
||||
materials.add(Material.PISTON);
|
||||
materials.add(Material.PISTON_HEAD);
|
||||
materials.add(Material.MOVING_PISTON);
|
||||
materials.add(Material.STICKY_PISTON);
|
||||
materials.add(Material.SLIME_BLOCK);
|
||||
materials.add(Material.HONEY_BLOCK);
|
||||
materials.add(Material.OBSERVER);
|
||||
materials.add(Material.RAIL);
|
||||
materials.add(Material.POWERED_RAIL);
|
||||
materials.add(Material.DETECTOR_RAIL);
|
||||
materials.add(Material.ACTIVATOR_RAIL);
|
||||
materials.add(Material.TNT);
|
||||
materials.add(Material.REDSTONE_ORE);
|
||||
materials.add(SWItem.getMaterial("SCAFFOLDING"));
|
||||
materials.add(Material.WATER);
|
||||
materials.remove(Material.BARRIER);
|
||||
materials.remove(Material.STONE);
|
||||
TechHider techHider = new TechHider((player, i, i1) -> {
|
||||
return Permission.BUILD.hasPermission(player) || Permission.isTempOnlySpectator(player) || NO_TECHHIDER.contains(player);
|
||||
}, Material.END_STONE, materials, new HashSet<>());
|
||||
techHider.enable();
|
||||
}
|
||||
|
||||
public static void toggleNoTechHider(Player player) {
|
||||
if (NO_TECHHIDER.contains(player)) {
|
||||
NO_TECHHIDER.remove(player);
|
||||
} else {
|
||||
NO_TECHHIDER.add(player);
|
||||
}
|
||||
resendChunks(player);
|
||||
}
|
||||
|
||||
private static void resendChunks(Player player) {
|
||||
int distance = player.getClientViewDistance();
|
||||
Location location = player.getLocation();
|
||||
for (int x = (int) Math.floor(location.getX() / 16.0) - distance; x <= (int) Math.ceil(location.getX() / 16.0) + distance; x++) {
|
||||
for (int z = (int) Math.floor(location.getZ() / 16.0) - distance; z <= (int) Math.ceil(location.getZ() / 16.0) + distance; z++) {
|
||||
CraftbukkitWrapper.impl.sendChunk(player, x, z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean anySupervisorOnline(Player player) {
|
||||
return Bukkit.getOnlinePlayers().stream().filter(p -> p != player).anyMatch(Permission.SUPERVISOR::hasPermission);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||
if (event.getPlayer().getUniqueId().equals(BauServer.getInstance().getOwner())) {
|
||||
return;
|
||||
}
|
||||
BauweltMember bauweltMember = BauweltMember.getBauMember(BauServer.getInstance().getOwner(), event.getPlayer().getUniqueId());
|
||||
if (bauweltMember == null) {
|
||||
event.getPlayer().kickPlayer("");
|
||||
return;
|
||||
}
|
||||
if (Permission.SUPERVISOR.hasPermission(event.getPlayer())) {
|
||||
return;
|
||||
}
|
||||
if (!anySupervisorOnline(null)) {
|
||||
Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> {
|
||||
event.getPlayer().kickPlayer("");
|
||||
}, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onBauMemberUpdate(BauMemberUpdateEvent event) {
|
||||
if (!anySupervisorOnline(null)) {
|
||||
Bukkit.getOnlinePlayers().forEach(player -> {
|
||||
player.kickPlayer("");
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
event.getChanged().forEach(player -> {
|
||||
NO_TECHHIDER.remove(player);
|
||||
if (Permission.isTempOnlySpectator(player)) return;
|
||||
resendChunks(player);
|
||||
});
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerQuit(PlayerQuitEvent event) {
|
||||
NO_TECHHIDER.remove(event.getPlayer());
|
||||
if (!anySupervisorOnline(event.getPlayer())) {
|
||||
Bukkit.getOnlinePlayers().forEach(player -> {
|
||||
player.kickPlayer("");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {
|
||||
if (event.getMessage().startsWith("/schem save") || event.getMessage().startsWith("//schem save") || event.getMessage().startsWith("/schematic save") || event.getMessage().startsWith("//schematic save")) {
|
||||
if (!Permission.SUPERVISOR.hasPermission(event.getPlayer())) {
|
||||
event.setCancelled(true);
|
||||
event.setMessage("/");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||
public void onBlockMultiPlace(BlockMultiPlaceEvent event) {
|
||||
if (!Permission.BUILD.hasPermission(event.getPlayer())) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||
public void onBlockCanBuild(BlockCanBuildEvent event) {
|
||||
if (event.getPlayer() == null) return;
|
||||
if (!Permission.BUILD.hasPermission(event.getPlayer())) {
|
||||
event.setBuildable(false);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||
public void onBlockPlace(BlockPlaceEvent event) {
|
||||
if (!Permission.BUILD.hasPermission(event.getPlayer())) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||
public void onBlockBreak(BlockBreakEvent event) {
|
||||
if (!Permission.BUILD.hasPermission(event.getPlayer())) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||
if (!Permission.BUILD.hasPermission(event.getPlayer())) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||
public void onPlayerBucketEmpty(PlayerBucketEmptyEvent event) {
|
||||
if (!Permission.BUILD.hasPermission(event.getPlayer())) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||
public void onPlayerBucketEntity(PlayerBucketEntityEvent event) {
|
||||
if (!Permission.BUILD.hasPermission(event.getPlayer())) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||
public void onPlayerBucketFill(PlayerBucketFillEvent event) {
|
||||
if (!Permission.BUILD.hasPermission(event.getPlayer())) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||
public void onPlayerDropItem(PlayerDropItemEvent event) {
|
||||
if (!Permission.BUILD.hasPermission(event.getPlayer())) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||
public void onEntityPickupItem(EntityPickupItemEvent event) {
|
||||
if (!(event.getEntity() instanceof Player)) return;
|
||||
if (!Permission.BUILD.hasPermission((Player) event.getEntity())) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden Mehr anzeigen
In neuem Issue referenzieren
Einen Benutzer sperren