diff options
author | ementalo <ementalodev@gmx.co.uk> | 2012-07-17 12:26:55 +0100 |
---|---|---|
committer | ementalo <ementalodev@gmx.co.uk> | 2012-07-17 14:21:03 +0100 |
commit | a661bce7b3de3f53e2b7b79c1283f0affa6fe9c3 (patch) | |
tree | 2aa10b6300f6c8d3cb2b298c124180fade74857a | |
parent | 3c385e69271dfe8530fadc3f67e13ee495e4b0e1 (diff) | |
parent | 9f05e43ecf8e6e1a8fcaef757678e762f0d82573 (diff) | |
download | Essentials-a661bce7b3de3f53e2b7b79c1283f0affa6fe9c3.tar Essentials-a661bce7b3de3f53e2b7b79c1283f0affa6fe9c3.tar.gz Essentials-a661bce7b3de3f53e2b7b79c1283f0affa6fe9c3.tar.lz Essentials-a661bce7b3de3f53e2b7b79c1283f0affa6fe9c3.tar.xz Essentials-a661bce7b3de3f53e2b7b79c1283f0affa6fe9c3.zip |
Merge of server-layer branch
445 files changed, 13580 insertions, 14853 deletions
diff --git a/.gitignore b/.gitignore index a76656100..164936d32 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ build.xml # maven target +jars # vim .*.sw[a-p] @@ -30,5 +31,4 @@ manifest.mf *.iws .idea/ -EssentialsRelease/ -jars/
\ No newline at end of file +EssentialsRelease/
\ No newline at end of file diff --git a/Essentials/pom.xml b/Essentials/pom.xml index 057253fc7..281a1449a 100644 --- a/Essentials/pom.xml +++ b/Essentials/pom.xml @@ -17,11 +17,11 @@ <artifactId>BukkitPermissions</artifactId> <version>1.2</version> </dependency> - <dependency> + <!--<dependency> <groupId>org.bukkit</groupId> <artifactId>craftbukkit</artifactId> - <version>1.2.3-R0.1-SNAPSHOT</version> - </dependency> + <version>${bukkit.version}</version> + </dependency>--> <dependency> <groupId>${project.groupId}</groupId> <artifactId>EssentialsGroupManager</artifactId> @@ -44,7 +44,7 @@ <version>1.15</version> </dependency> <!-- - None of these jars are manually added to our maven repo + Note: these jars are manually added to our maven repo --> <dependency> <groupId>cosine</groupId> diff --git a/Essentials/src/config.yml b/Essentials/src/config.yml index c1ed63046..f283191a4 100644 --- a/Essentials/src/config.yml +++ b/Essentials/src/config.yml @@ -33,6 +33,10 @@ nickname-prefix: '~' # Disable this if you have any other plugin, that modifies the displayname of a user. change-displayname: true +# When this option is enabled, the (tab) player list will be updated with the displayname. +# The value of change-displayname (above) has to be true. +#change-playerlist: true + # Adds the prefix and suffix to the displayname of the player, so it will be displayed in messages and lists. # The prefix/suffix can be set using Permissions, Group Manager or PermissionsEx. # The value of change-displayname (above) has to be true. @@ -46,6 +50,10 @@ teleport-cooldown: 0 # The delay, in seconds, before a user actually teleports. If the user moves or gets attacked in this timeframe, the teleport never occurs. teleport-delay: 0 +# The delay, in seconds, a player can't be attacked by other players after he has been teleported by a command +# This will also prevent that the player can attack other players +teleport-invulnerability: 2 + # The delay, in seconds, required between /heal attempts heal-cooldown: 60 @@ -97,9 +105,16 @@ player-commands: - back - back.ondeath - balance + - balance.others + - balancetop + - chat.color + - chat.format + - chat.shout + - chat.question - clearinventory - compass - depth + - delhome - getpos - geoip.show - help @@ -108,20 +123,26 @@ player-commands: - home.others - ignore - info + - itemdb - kit + - kit.tools - list - mail - mail.send - me - motd - msg + - msg.color - nick + - near - pay - ping - powertool + - powertooltoggle - protect - r - rules + - realname - seen - sell - sethome @@ -133,8 +154,11 @@ player-commands: - signs.use.balance - signs.use.buy - signs.use.disposal + - signs.use.enchant - signs.use.free + - signs.use.gamemode - signs.use.heal + - signs.use.kit - signs.use.mail - signs.use.protection - signs.use.sell @@ -144,6 +168,7 @@ player-commands: - signs.use.weather - spawn - suicide + - time - tpa - tpaccept - tpahere @@ -156,14 +181,22 @@ player-commands: # Note: All items MUST be followed by a quantity! # All kit names should be lower case, and will be treated as lower in permissions/costs. -# Times are measured in seconds. +# Syntax: - itemID[:DataValue] Amount [Enchantment:Level].. +# 'delay' refers to the cooldown between how often you can use each kit, measured in seconds. kits: dtools: delay: 10 items: - - 277 1 + - 277 1 efficiency:1 - 278 1 - - 279 1 + - 279:780 1 + tools: + delay: 10 + items: + - 272 1 + - 273 1 + - 274 1 + - 275 1 tools: delay: 10 items: @@ -175,9 +208,11 @@ kits: # Essentials Sign Control # See http://ess.khhq.net/wiki/Sign_Tutorial for instructions on how to use these. # To enable signs, remove # symbol. To disable all signs, comment/remove each sign. +# Essentials Colored sign support will be enabled when any sign types are enabled. # We recommend not enabling chest protection signs if you don't intend to use them, (or are using LWC/Lockette). enabledSigns: + #- color #- balance #- buy #- sell @@ -194,12 +229,19 @@ enabledSigns: #- time #- weather #- protection + + +# How many times per second can Essentials signs be interacted with. +# Values should be between 1-20, 20 being virtually no lag protection.s +# Lower numbers will reduce the possiblity of lag, but may annoy players. +sign-use-per-second: 4 # Backup runs a command while saving is disabled backup: # Interval in minutes - interval: 60 - # Add a command that backups your data, e.g. + interval: 30 + # Unless you add a valid backup command or script here, this feature will be useless. + # Use 'save-all' to simply force regular world saving without backup. #command: 'rdiff-backup World1 backups/World1' # Set this true to enable permission per warp. @@ -241,7 +283,12 @@ freeze-afk-players: false # When the player is afk, should he be able to pickup items? # Enable this, when you don't want people idling in mob traps. -disable-item-pickup-while-afk: true +disable-item-pickup-while-afk: false + +# Should we automatically remove afk status when the player moves? +# Player will be removed from afk on chat/command reguardless of this setting. +# Disable this to reduce server lag. +cancel-afk-on-move: true # You can disable the death messages of minecraft here death-messages: true @@ -250,7 +297,8 @@ death-messages: true no-god-in-worlds: # - world_nether -# Set to true to enable per-world permissions for teleporting with /world +# Set to true to enable per-world permissions for teleporting between worlds with essentials commands +# This applies to /world, /back, /tp[a|o][here|all], but not warps. # Give someone permission to teleport to a world with essentials.world.<worldname> world-teleport-permissions: false @@ -280,6 +328,9 @@ tpa-accept-cancellation: 0 #Cancels a request made by tpa / tpc on world change to prevent cross world tp cancel-tp-requests-on-world-change: false +#Delay to wait before people can cause attack damage after logging in +login-attack-delay: 5 + ############################################################ # +------------------------------------------------------+ # # | EssentialsHome | # @@ -292,6 +343,11 @@ spawn-if-no-home: true # Allows people to set their bed at daytime update-bed-at-daytime: true +# Set to true to enable per-world permissions for using homes to teleport between worlds +# This applies to the /home only. +# Give someone permission to teleport to a world with essentials.world.<worldname> +world-home-permissions: false + # Allow players to have multiple homes. # Players need essentials.sethome.multiple before they can have more than 1 home, default to 'default' below. # Define different amounts of multiple homes for different permissions, e.g. essentials.sethome.multiple.vip @@ -394,6 +450,8 @@ protect: # Database settings for sign/rail protection # mysql or sqlite + # We strongly recommend against using mysql here, unless you have a good reason. + # Sqlite seems to be faster in almost all cases, and in some cases mysql can be much slower. datatype: 'sqlite' # If you specified MySQL above, you MUST enter the appropriate details here. @@ -450,30 +508,31 @@ protect: entitytarget: false # Prevent the spawning of creatures spawn: - chicken: false - cow: false creeper: false - ghast: false - giant: false - monster: false - pig: false - pig_zombie: false - sheep: false skeleton: false - slime: false spider: false - squid: false + giant: false zombie: false - wolf: false - cave_spider: false + slime: false + ghast: false + pig_zombie: false enderman: false + cave_spider: false silverfish: false - ender_dragon: false - villager: false blaze: false - mushroom_cow: false magma_cube: false + ender_dragon: false + pig: false + sheep: false + cow: false + chicken: false + squid: false + wolf: false + mushroom_cow: false snowman: false + ocelot: false + iron_golem: false + villager: false # Maximum height the creeper should explode. -1 allows them to explode everywhere. # Set prevent.creeper-explosion to true, if you want to disable creeper explosions. diff --git a/Essentials/src/info.txt b/Essentials/src/info.txt index 0b4fb3c42..cfc037040 100644 --- a/Essentials/src/info.txt +++ b/Essentials/src/info.txt @@ -8,7 +8,7 @@ Name it info_username.txt or info_groupname.txt This also works with motd and rules. Extra pages: -Type /info Colours +Type /info Colors Type /info Tags If you have problem viewing this file ingame, try using /einfo. @@ -29,6 +29,7 @@ Minecraft colors: &4 &&4 &5 &&5 &6 &&6 &7 &&7 &8 &&8 &9 &&9 &a &&a &b &&b &c &&c &d &&d &e &&e &f &&f +&&k &k Magic! #Tags PLAYER: {PLAYER} diff --git a/Essentials/src/items.csv b/Essentials/src/items.csv index 33ed4af66..a3234c9aa 100644 --- a/Essentials/src/items.csv +++ b/Essentials/src/items.csv @@ -1,12 +1,20 @@ #version: ${build.number} -# If you change this file, it will not be automatically updated after the next release. +#If you change this file, it will not be automatically updated after the next release, #item,id,metadata stone,1,0 sstone,1,0 smoothstone,1,0 rock,1,0 grass,2,0 +greendirt,2,0 +greenearth,2,0 +greenland,2,0 +gdirt,2,0 +gearth,2,0 +gland,2,0 dirt,3,0 +earth,3,0 +land,3,0 cobblestone,4,0 cstone,4,0 cobble,4,0 @@ -17,6 +25,76 @@ wplank,5,0 plankwooden,5,0 plankwood,5,0 plankw,5,0 +darkplank,5,1 +darkwoodenplank,5,1 +darkwoodplank,5,1 +darkwplank,5,1 +darkplankwooden,5,1 +darkplankwood,5,1 +darkplankw,5,1 +dplank,5,1 +dwoodenplank,5,1 +dwoodplank,5,1 +dwplank,5,1 +dplankwooden,5,1 +dplankwood,5,1 +dplankw,5,1 +pineplank,5,1 +pinewoodenplank,5,1 +pinewoodplank,5,1 +pinewplank,5,1 +pineplankwooden,5,1 +pineplankwood,5,1 +pineplankw,5,1 +pplank,5,1 +pwoodenplank,5,1 +pwoodplank,5,1 +pwplank,5,1 +pplankwooden,5,1 +pplankwood,5,1 +pplankw,5,1 +lightplank,5,2 +lightwoodenplank,5,2 +lightwoodplank,5,2 +lightwplank,5,2 +lightplankwooden,5,2 +lightplankwood,5,2 +lightplankw,5,2 +liteplank,5,2 +litewoodenplank,5,2 +litewoodplank,5,2 +litewplank,5,2 +liteplankwooden,5,2 +liteplankwood,5,2 +liteplankw,5,2 +birchplank,5,2 +birchwoodenplank,5,2 +birchwoodplank,5,2 +birchwplank,5,2 +birchplankwooden,5,2 +birchplankwood,5,2 +birchplankw,5,2 +bplank,5,2 +bwoodenplank,5,2 +bwoodplank,5,2 +bwplank,5,2 +bplankwooden,5,2 +bplankwood,5,2 +bplankw,5,2 +jungleplank,5,3 +junglewoodenplank,5,3 +junglewoodplank,5,3 +junglewplank,5,3 +jungleplankwooden,5,3 +jungleplankwood,5,3 +jungleplankw,5,3 +jplank,5,3 +jwoodenplank,5,3 +jwoodplank,5,3 +jwplank,5,3 +jplankwooden,5,3 +jplankwood,5,3 +jplankw,5,3 sapling,6,0 treesapling,6,0 logsapling,6,0 @@ -232,6 +310,10 @@ wtreesap,6,2 wlogsap,6,2 wtrunksap,6,2 wwoodsap,6,2 +junglesapling,6,3 +jsapling,6,3 +junglesap,6,3 +jsap,6,3 bedrock,7,0 oprock,7,0 opblock,7,0 @@ -360,6 +442,12 @@ wtree,17,2 wlog,17,2 wtrunk,17,2 wwood,17,2 +junglewood,17,3 +jwood,17,3 +junglelog,17,3 +jlog,17,3 +monkeytree,17,3 +monkeylog,17,3 leaves,18,4 leaf,18,4 treeleaves,18,4 @@ -454,6 +542,12 @@ bitreeleaf,18,6 bilogleaf,18,6 bitrunkleaf,18,6 biwoodleaf,18,6 +jungleleaves,18,7 +jleaves,18,7 +jleaf,18,7 +jungleleaf,18,7 +monkeyleaf,18,7 +monkeyleaves,18,7 sponge,19,0 glass,20,0 lapislazuliore,21,0 @@ -476,6 +570,27 @@ dispenser,23,0 dispense,23,0 sandstone,24,0 sastone,24,0 +csandstone,24,1 +csastone,24,1 +creepsandstone,24,1 +creepsastone,24,1 +creepersandstone,24,1 +creepersastone,24,1 +hieroglyphicsandstone,24,1 +hieroglyphicsastone,24,1 +hieroglyphsandstone,24,1 +hieroglyphsastone,24,1 +hsandstone,24,1 +hsastone,24,1 +pyramidsandstone,24,1 +pyramidsastone,24,1 +psandstone,24,1 +psastone,24,1 +smoothsandstone,24,2 +smoothsastone,24,2 +ssandstone,24,2 +smsastone,24,2 +ssastone,24,2 noteblock,25,0 musicblock,25,0 nblock,25,0 @@ -515,6 +630,7 @@ pistonstick,29,7 pistonsbase,29,7 pistons,29,7 psticky,29,7 +pstick,29,7 spiderweb,30,0 sweb,30,0 web,30,0 @@ -704,6 +820,7 @@ blawool,35,15 blacotton,35,15 pistonmovingpiece,36,0 pistonmp,36,0 +pistontop,36,0 yellowflower,37,0 yflower,37,0 flower,37,0 @@ -758,6 +875,32 @@ dstoneslab,43,0 doublesslab,43,0 doubleslab,43,0 dslab,43,0 +smoothstonedoublehalfblock,43,0 +smoothstonedhalfblock,43,0 +stonedoublehalfblock,43,0 +stonedhalfblock,43,0 +sdoublehalfblock,43,0 +sdhalfblock,43,0 +doublesmoothstonehalfblock,43,0 +dsmoothstonehalfblock,43,0 +doublestonehalfblock,43,0 +dstonehalfblock,43,0 +doubleshalfblock,43,0 +doublehalfblock,43,0 +dhalfblock,43,0 +smoothstonedoublehblock,43,0 +smoothstonedhblock,43,0 +stonedoublehblock,43,0 +stonedhblock,43,0 +sdoublehblock,43,0 +sdhblock,43,0 +doublesmoothstonehblock,43,0 +dsmoothstonehblock,43,0 +doublestonehblock,43,0 +dstonehblock,43,0 +doubleshblock,43,0 +doublehblock,43,0 +dhblock,43,0 sandstonedoublestep,43,1 sandstonedstep,43,1 sstonedoublestep,43,1 @@ -782,6 +925,118 @@ doublesstoneslab,43,1 dsstoneslab,43,1 doublessslab,43,1 dsslab,43,1 +sandstonedoublehalfblock,43,1 +sandstonedhalfblock,43,1 +sstonedoublehalfblock,43,1 +sstonedhalfblock,43,1 +ssdoublehalfblock,43,1 +ssdhalfblock,43,1 +doublesandstonehalfblock,43,1 +dsandstonehalfblock,43,1 +doublesstonehalfblock,43,1 +dsstonehalfblock,43,1 +doublesshalfblock,43,1 +dsshalfblock,43,1 +sandstonedoublehblock,43,1 +sandstonedhblock,43,1 +sstonedoublehblock,43,1 +sstonedhblock,43,1 +ssdoublehblock,43,1 +ssdhblock,43,1 +doublesandstonehblock,43,1 +dsandstonehblock,43,1 +doublesstonehblock,43,1 +dsstonehblock,43,1 +doublesshblock,43,1 +dsshblock,43,1 +woodenplankdoublehalfblock,43,2 +woodenplankdhalfblock,43,2 +woodplankdoublehalfblock,43,2 +woodplankdhalfblock,43,2 +wplankdoublehalfblock,43,2 +wplankdhalfblock,43,2 +plankdoublehalfblock,43,2 +plankdhalfblock,43,2 +woodenpdoublehalfblock,43,2 +woodenpdhalfblock,43,2 +woodpdoublehalfblock,43,2 +woodpdhalfblock,43,2 +wpdoublehalfblock,43,2 +wpdhalfblock,43,2 +pdoublehalfblock,43,2 +pdhalfblock,43,2 +woodendoublehalfblock,43,2 +woodendhalfblock,43,2 +wooddoublehalfblock,43,2 +wooddhalfblock,43,2 +wdoublehalfblock,43,2 +wdhalfblock,43,2 +doublewoodenplankhalfblock,43,2 +dwoodenplankhalfblock,43,2 +doublewoodplankhalfblock,43,2 +dwoodplankhalfblock,43,2 +doublewplankhalfblock,43,2 +dwplankhalfblock,43,2 +doubleplankhalfblock,43,2 +dplankhalfblock,43,2 +doublewoodenphalfblock,43,2 +dwoodenphalfblock,43,2 +doublewoodphalfblock,43,2 +dwoodphalfblock,43,2 +doublewphalfblock,43,2 +dwphalfblock,43,2 +doublephalfblock,43,2 +dphalfblock,43,2 +doublewoodenhalfblock,43,2 +dwoodenhalfblock,43,2 +doublewoodhalfblock,43,2 +dwoodhalfblock,43,2 +doublewhalfblock,43,2 +dwhalfblock,43,2 +woodenplankdoublehblock,43,2 +woodenplankdhblock,43,2 +woodplankdoublehblock,43,2 +woodplankdhblock,43,2 +wplankdoublehblock,43,2 +wplankdhblock,43,2 +plankdoublehblock,43,2 +plankdhblock,43,2 +woodenpdoublehblock,43,2 +woodenpdhblock,43,2 +woodpdoublehblock,43,2 +woodpdhblock,43,2 +wpdoublehblock,43,2 +wpdhblock,43,2 +pdoublehblock,43,2 +pdhblock,43,2 +woodendoublehblock,43,2 +woodendhblock,43,2 +wooddoublehblock,43,2 +wooddhblock,43,2 +wdoublehblock,43,2 +wdhblock,43,2 +doublewoodenplankhblock,43,2 +dwoodenplankhblock,43,2 +doublewoodplankhblock,43,2 +dwoodplankhblock,43,2 +doublewplankhblock,43,2 +dwplankhblock,43,2 +doubleplankhblock,43,2 +dplankhblock,43,2 +doublewoodenphblock,43,2 +dwoodenphblock,43,2 +doublewoodphblock,43,2 +dwoodphblock,43,2 +doublewphblock,43,2 +dwphblock,43,2 +doublewoodenhblock,43,2 +dwoodenhblock,43,2 +doublewoodhblock,43,2 +dwoodhblock,43,2 +doublewhblock,43,2 +dwhblock,43,2 +doublephblock,43,2 +dphblock,43,2 woodenplankdoublestep,43,2 woodenplankdstep,43,2 woodplankdoublestep,43,2 @@ -790,10 +1045,20 @@ wplankdoublestep,43,2 wplankdstep,43,2 plankdoublestep,43,2 plankdstep,43,2 +woodenpdoublestep,43,2 +woodenpdstep,43,2 +woodpdoublestep,43,2 +woodpdstep,43,2 wpdoublestep,43,2 -pdoublestep,43,2 wpdstep,43,2 +pdoublestep,43,2 pdstep,43,2 +woodendoublestep,43,2 +woodendstep,43,2 +wooddoublestep,43,2 +wooddstep,43,2 +wdoublestep,43,2 +wdstep,43,2 doublewoodenplankstep,43,2 dwoodenplankstep,43,2 doublewoodplankstep,43,2 @@ -802,10 +1067,20 @@ doublewplankstep,43,2 dwplankstep,43,2 doubleplankstep,43,2 dplankstep,43,2 +doublewoodenpstep,43,2 +dwoodenpstep,43,2 +doublewoodpstep,43,2 +dwoodpstep,43,2 doublewpstep,43,2 dwpstep,43,2 doublepstep,43,2 dpstep,43,2 +doublewoodenstep,43,2 +dwoodenstep,43,2 +doublewoodstep,43,2 +dwoodstep,43,2 +doublewstep,43,2 +dwstep,43,2 woodenplankdoubleslab,43,2 woodenplankdslab,43,2 woodplankdoubleslab,43,2 @@ -814,10 +1089,20 @@ wplankdoubleslab,43,2 wplankdslab,43,2 plankdoubleslab,43,2 plankdslab,43,2 +woodenpdoubleslab,43,2 +woodenpdslab,43,2 +woodpdoubleslab,43,2 +woodpdslab,43,2 wpdoubleslab,43,2 -pdoubleslab,43,2 wpdslab,43,2 +pdoubleslab,43,2 pdslab,43,2 +woodendoubleslab,43,2 +woodendslab,43,2 +wooddoubleslab,43,2 +wooddslab,43,2 +wdoubleslab,43,2 +wdslab,43,2 doublewoodenplankslab,43,2 dwoodenplankslab,43,2 doublewoodplankslab,43,2 @@ -826,8 +1111,18 @@ doublewplankslab,43,2 dwplankslab,43,2 doubleplankslab,43,2 dplankslab,43,2 +doublewoodenpslab,43,2 +dwoodenpslab,43,2 +doublewoodpslab,43,2 +dwoodpslab,43,2 doublewpslab,43,2 dwpslab,43,2 +doublewoodenslab,43,2 +dwoodenslab,43,2 +doublewoodslab,43,2 +dwoodslab,43,2 +doublewslab,43,2 +dwslab,43,2 doublepslab,43,2 dpslab,43,2 cobblestonedoublestep,43,3 @@ -862,18 +1157,169 @@ doublecstoneslab,43,3 dcstoneslab,43,3 doublecsslab,43,3 dcsslab,43,3 +cobblestonedoublehalfblock,43,3 +cobblestonedhalfblock,43,3 +cobbledoublehalfblock,43,3 +cobbledhalfblock,43,3 +cstonedoublehalfblock,43,3 +cstonedhalfblock,43,3 +csdoublehalfblock,43,3 +csdhalfblock,43,3 +doublecobblestonehalfblock,43,3 +dcobblestonehalfblock,43,3 +doublecobblehalfblock,43,3 +dcobblehalfblock,43,3 +doublecstonehalfblock,43,3 +dcstonehalfblock,43,3 +doublecshalfblock,43,3 +dcshalfblock,43,3 +cobblestonedoublehblock,43,3 +cobblestonedhblock,43,3 +cobbledoublehblock,43,3 +cobbledhblock,43,3 +cstonedoublehblock,43,3 +cstonedhblock,43,3 +csdoublehblock,43,3 +csdhblock,43,3 +doublecobblestonehblock,43,3 +dcobblestonehblock,43,3 +doublecobblehblock,43,3 +dcobblehblock,43,3 +doublecstonehblock,43,3 +dcstonehblock,43,3 +doublecshblock,43,3 +dcshblock,43,3 +brickblockdoublestep,43,4 +brickblockdstep,43,4 +brickbdoublestep,43,4 +brickbdstep,43,4 brickdoublestep,43,4 brickdstep,43,4 +bdoublestep,43,4 bdstep,43,4 +brickblockdoubleslab,43,4 +brickblockdslab,43,4 +brickbdoubleslab,43,4 +brickbdslab,43,4 brickdoubleslab,43,4 brickdslab,43,4 +bdoubleslab,43,4 bdslab,43,4 +doublebrickblockstep,43,4 +dbrickblockstep,43,4 +doublebrickbstep,43,4 +dbrickbstep,43,4 +doublebrickstep,43,4 +dbrickstep,43,4 +doublebstep,43,4 +dbstep,43,4 +doublebrickblockslab,43,4 +dbrickblockslab,43,4 +doublebrickbslab,43,4 +dbrickbslab,43,4 +doublebrickslab,43,4 +dbrickslab,43,4 +doublebslab,43,4 +dbslab,43,4 +brickblockdoublehalfblock,43,4 +brickblockdhalfblock,43,4 +brickbdoublehalfblock,43,4 +brickbdhalfblock,43,4 +brickdoublehalfblock,43,4 +brickdhalfblock,43,4 +bdoublehalfblock,43,4 +bdhalfblock,43,4 +brickblockdoublehblock,43,4 +brickblockdhblock,43,4 +brickbdoublehblock,43,4 +brickbdhblock,43,4 +brickdoublehblock,43,4 +brickdhblock,43,4 +bdoublehblock,43,4 +bdhblock,43,4 +doublebrickblockhalfblock,43,4 +dbrickblockhalfblock,43,4 +doublebrickbhalfblock,43,4 +dbrickbhalfblock,43,4 +doublebrickhalfblock,43,4 +dbrickhalfblock,43,4 +doublebhalfblock,43,4 +dbhalfblock,43,4 +doublebrickblockhblock,43,4 +dbrickblockhblock,43,4 +doublebrickbhblock,43,4 +dbrickbhblock,43,4 +doublebrickhblock,43,4 +dbrickhblock,43,4 +doublebhblock,43,4 +dbhblock,43,4 stonebrickdoublestep,43,5 +stonebrickdstep,43,5 +stonebdoublestep,43,5 stonebdstep,43,5 +sbrickdoublestep,43,5 +sbrickdstep,43,5 +sbdoublestep,43,5 sbdstep,43,5 stonebrickdoubleslab,43,5 +stonebrickdslab,43,5 +stonebdoubleslab,43,5 stonebdslab,43,5 +sbrickdoubleslab,43,5 +sbrickdslab,43,5 +sbdoubleslab,43,5 sbdslab,43,5 +doublestonebrickstep,43,5 +dstonebrickstep,43,5 +doublestonebstep,43,5 +dstonebstep,43,5 +doublesbrickstep,43,5 +dsbrickstep,43,5 +doublesbstep,43,5 +dsbstep,43,5 +doublestonebrickslab,43,5 +dstonebrickslab,43,5 +doublestonebslab,43,5 +dstonebslab,43,5 +doublesbrickslab,43,5 +dsbrickdslab,43,5 +doublesbslab,43,5 +dsbslab,43,5 +stonebrickdoublehalfblock,43,5 +stonebrickdhalfblock,43,5 +stonebdoublehalfblock,43,5 +stonebdhalfblock,43,5 +sbrickdoublehalfblock,43,5 +sbrickdhalfblock,43,5 +sbdoublehalfblock,43,5 +sbdhalfblock,43,5 +stonebrickdoublehblock,43,5 +stonebrickdhblock,43,5 +stonebdoublehblock,43,5 +stonebdhblock,43,5 +sbrickdoublehblock,43,5 +sbrickdhblock,43,5 +sbdoublehblock,43,5 +sbdhblock,43,5 +doublestonebrickhalfblock,43,5 +dstonebrickhalfblock,43,5 +doublestonebhalfblock,43,5 +dstonebhalfblock,43,5 +doublesbrickhalfblock,43,5 +dsbrickhalfblock,43,5 +doublesbhalfblock,43,5 +dsbhalfblock,43,5 +doublestonebrickhblock,43,5 +dstonebrickhblock,43,5 +doublestonebhblock,43,5 +dstonebhblock,43,5 +doublesbrickhblock,43,5 +dsbrickdhblock,43,5 +doublesbhblock,43,5 +dsbhblock,43,5 +adminslab,43,6 +magicslab,43,6 +adslab,43,6 smoothstonestep,44,0 stonestep,44,0 sstep,44,0 @@ -882,22 +1328,68 @@ smoothstoneslab,44,0 stoneslab,44,0 sslab,44,0 slab,44,0 +smoothstonehalfblock,44,0 +stonehalfblock,44,0 +shalfblock,44,0 +halfblock,44,0 +smoothstonehblock,44,0 +stonehblock,44,0 +shblock,44,0 +hblock,44,0 sanddstonestep,44,1 sstonestep,44,1 ssstep,44,1 sanddstoneslab,44,1 sstoneslab,44,1 ssslab,44,1 +sanddstonehalfblock,44,1 +sstonehalfblock,44,1 +sshalfblock,44,1 +sanddstonehblock,44,1 +sstonehblock,44,1 +sshblock,44,1 +woodenplankstep,44,2 woodplankstep,44,2 wplankstep,44,2 plankstep,44,2 +woodenpstep,44,2 +woodpstep,44,2 wpstep,44,2 +woodenstep,44,2 +woodstep,44,2 +wstep,44,2 pstep,44,2 woodplankslab,44,2 wplankslab,44,2 plankslab,44,2 +woodenpslab,44,2 +woodpslab,44,2 wpslab,44,2 +woodenslab,44,2 +woodslab,44,2 +wslab,44,2 pslab,44,2 +woodenplankhalfblock,44,2 +woodplankhalfblock,44,2 +wplankhalfblock,44,2 +plankhalfblock,44,2 +woodenphalfblock,44,2 +woodphalfblock,44,2 +wphalfblock,44,2 +woodenhalfblock,44,2 +woodhalfblock,44,2 +whalfblock,44,2 +phalfblock,44,2 +woodplankhblock,44,2 +wplankhblock,44,2 +plankhblock,44,2 +woodenphblock,44,2 +woodphblock,44,2 +wphblock,44,2 +woodenhblock,44,2 +woodhblock,44,2 +whblock,44,2 +phblock,44,2 cobblestonestep,44,3 cobblestep,44,3 cstonestep,44,3 @@ -906,16 +1398,46 @@ cobblestoneslab,44,3 cobbleslab,44,3 cstoneslab,44,3 csslab,44,3 -brickstep,44,4 +cobblestonehalfblock,44,3 +cobblehalfblock,44,3 +cstonehalfblock,44,3 +cshalfblock,44,3 +cobblestonehblock,44,3 +cobblehblock,44,3 +cstonehblock,44,3 +cshblock,44,3 brickblockstep,44,4 +brickbstep,44,4 +brickstep,44,4 bstep,44,4 -brickslab,44,4 brickblockslab,44,4 +brickbslab,44,4 +brickslab,44,4 bslab,44,4 +brickblockhalfblock,44,4 +brickbhalfblock,44,4 +brickhalfblock,44,4 +bhalfblock,44,4 +brickblockhblock,44,4 +brickbhblock,44,4 +brickhblock,44,4 +bhblock,44,4 stonebrickstep,44,5 +stonebstep,44,5 +sbrickstep,44,5 sbstep,44,5 stonebrickslab,44,5 +stonebslab,44,5 +sbrickslab,44,5 sbslab,44,5 +stonebrickhalfblock,44,5 +stonebhalfblock,44,5 +sbrickhalfblock,44,5 +sbhalfblock,44,5 +stonebrickhblock,44,5 +stonebhblock,44,5 +sbrickhblock,44,5 +sbhblock,44,5 brickblock,45,0 blockbrick,45,0 bblock,45,0 @@ -945,13 +1467,25 @@ obsidian,49,0 obsi,49,0 obby,49,0 torch,50,0 +burningstick,50,0 +burnstick,50,0 +coalonstick,50,0 +coalonastick,50,0 +charcoalonstick,50,0 +charcoalonastick,50,0 +ccoalonstick,50,0 +ccoalonastick,50,0 fire,51,0 flame,51,0 flames,51,0 mobspawner,52,0 +mobcage,52,0 monsterspawner,52,0 +monstercage,52,0 mspawner,52,0 +mcage,52,0 spawner,52,0 +cage,52,0 woodenstairs,53,0 woodstairs,53,0 wstairs,53,0 @@ -1169,6 +1703,10 @@ snowcovering,78,0 snowcover,78,0 scover,78,0 ice,79,0 +frozenwater,79,0 +waterfrozen,79,0 +freezewater,79,0 +waterfreeze,79,0 snowblock,80,0 blocksnow,80,0 sblock,80,0 @@ -1193,6 +1731,12 @@ blockbamboo,83,0 jukebox,84,0 jbox,84,0 fence,85,0 +woodenfence,85,0 +woodfence,85,0 +wfence,85,0 +fencewooden,85,0 +fencewood,85,0 +fencew,85,0 pumpkin,86,0 netherrack,87,0 netherrock,87,0 @@ -1274,14 +1818,60 @@ tdoor,96,0 doort,96,0 trapd,96,0 dtrap,96,0 -silverstone,97,0 +silverfish,97,0 +monstereggsmoothstone,97,0 +monstereggsstone,97,0 +meggsmoothstone,97,0 +meggsstone,97,0 +mesmoothstone,97,0 +messtone,97,0 +silverfishsmoothstone,97,0 +silverfishsstone,97,0 silverfishstone,97,0 -silverfishs,97,0 -sfstone,97,0 -stonesilverfish,97,0 +sfishsmoothstone,97,0 +sfishsstone,97,0 +sfishstone,97,0 +fishsmoothstone,97,0 +fishsstone,97,0 fishstone,97,0 +sfsmoothstone,97,0 +sfsstone,97,0 +sfstone,97,0 +trapsmoothstone,97,0 +trapsstone,97,0 trapstone,97,0 -silverfish,97,0 +monstereggcobblestone,97,1 +monstereggcstone,97,1 +meggcobblestone,97,1 +meggcstone,97,1 +mecobblestone,97,1 +mecstone,97,1 +silverfishcobblestone,97,1 +silverfishcstone,97,1 +sfishcobblestone,97,1 +sfishcstone,97,1 +fishcobblestone,97,1 +fishcstone,97,1 +sfcobblestone,97,1 +sfcstone,97,1 +trapcobblestone,97,1 +trapcstone,97,1 +monstereggstonebrick,97,2 +monstereggsbrick,97,2 +meggstonebrick,97,2 +meggsbrick,97,2 +mestonebrick,97,2 +mesbrick,97,2 +silverfishstonebrick,97,2 +silverfishsbrick,97,2 +sfishstonebrick,97,2 +sfishsbrick,97,2 +fishstonebrick,97,2 +fishsbrick,97,2 +sfstonebrick,97,2 +sfsbrick,97,2 +trapstonebrick,97,2 +trapsbrick,97,2 stonebrick,98,0 stonebricks,98,0 stonebrickblock,98,0 @@ -1295,6 +1885,10 @@ crackedstonebrick,98,2 crackedstonebricks,98,2 crackedstonebrickblock,98,2 crackedstonebb,98,2 +circlestonebrick,98,3 +circlestonebb,98,3 +circlestone,98,3 +circlesbb,98,3 hugeredmushroom,99,0 bigredmushroom,99,0 brmushroom,99,0 @@ -1314,10 +1908,26 @@ metalbars,101,0 jailbarsblock,101,0 jailbarsb,101,0 jailbars,101,0 +mbarsblock,101,0 +mbarsb,101,0 +mbars,101,0 +jbarsblock,101,0 +jbarsb,101,0 +jbars,101,0 +ibarsb,101,0 +ibarsblock,101,0 glasspane,102,0 +glassp,102,0 +paneglass,102,0 +pglass,102,0 flatglass,102,0 +fglass,102,0 skinnyglass,102,0 +sglass,102,0 glassflat,102,0 +glassf,102,0 +glassskinny,102,0 +glasss,102,0 melon,103,0 watermelon,103,0 greenmelon,103,0 @@ -1338,34 +1948,72 @@ stemgreenmelon,105,0 vines,106,0 vine,106,0 greenvines,106,0 +greenvine,106,0 gardenvines,106,0 +gardenvine,106,0 vinesgreen,106,0 -fencegate,107,0 -woodenfence,107,0 +vinegreen,106,0 +vinesgarden,106,0 +vinegarden,106,0 +vinesg,106,0 +vineg,106,0 +gvines,106,0 +gvine,106,0 +wfencegate,107,0 +woodfencegate,107,0 woodenfencegate,107,0 -gatefence,107,0 woodengate,107,0 woodgate,107,0 +wgate,107,0 +gate,107,0 gardengate,107,0 +ggate,107,0 +fencegate,107,0 +fencegatewooden,107,0 +fencegatewood,107,0 brickstairs,108,0 redbrickstairs,108,0 +redbstairs,108,0 +rbrickstairs,108,0 bstairs,108,0 -stairsbrick,108,0 -brickstair,108,0 redstairs,108,0 +brickstair,108,0 +redbrickstair,108,0 +redbstair,108,0 +rbrickstair,108,0 +bstair,108,0 +redstair,108,0 +stairsbrick,108,0 +stairsredbrick,108,0 +stairsredb,108,0 +stairsrbrick,108,0 +stairsb,108,0 +stairsred,108,0 +stairbrick,108,0 +stairredbrick,108,0 +stairredb,108,0 +stairrbrick,108,0 +stairb,108,0 +stairred,108,0 +stairsstonebrick,109,0 stonebrickstairs,109,0 stonebstairs,109,0 sbstairs,109,0 -stairsstonebrick,109,0 cementbrickstairs,109,0 cementstairs,109,0 cementbstairs,109,0 +cbstairs,109,0 greybrickstairs,109,0 greybstairs,109,0 +greystairs,109,0 +purplegrass,110,0 +pinkgrass,110,0 mycel,110,0 mycelium,110,0 swampgrass,110,0 sgrass,110,0 +mushroomgrass,110,0 +mushgrass,110,0 waterlily,111,0 lilypad,111,0 lily,111,0 @@ -1389,7 +2037,37 @@ nbrickstairs,114,0 hellbrickstairs,114,0 deathbrickstairs,114,0 dbrickstairs,114,0 -hbrickstais,114,0 +hbrickstairs,114,0 +dstairs,114,0 +hstairs,114,0 +hellstairs,114,0 +deathstairs,114,0 +nstairs,114,0 +netherstairs,114,0 +dbstairs,114,0 +hbstairs,114,0 +hellbstairs,114,0 +deathbstairs,114,0 +nbstairs,114,0 +netherbstairs,114,0 +netherbrickstair,114,0 +nbrickstair,114,0 +hellbrickstair,114,0 +deathbrickstair,114,0 +dbrickstair,114,0 +hbrickstair,114,0 +dstair,114,0 +hstair,114,0 +hellstair,114,0 +deathstair,114,0 +nstair,114,0 +netherstair,114,0 +dbstair,114,0 +hbstair,114,0 +hellbstair,114,0 +deathbstair,114,0 +nbstair,114,0 +netherbstair,114,0 netherwarts,115,0 netherwart,115,0 netherplant,115,0 @@ -1421,6 +2099,7 @@ booktable,116,0 magicdesk,116,0 enchantmentdesk,116,0 edesk,116,0 +bookdesk,116,0 btable,116,0 bdesk,116,0 mtable,116,0 @@ -1462,8 +2141,14 @@ degg,122,0 bossegg,122,0 begg,122,0 redstonelamp,123,0 +redstonelampoff,123,0 redlamp,123,0 +redlampoff,123,0 rslamp,123,0 +rslampoff,123,0 +redstonelampon,124,0 +redlampon,124,0 +rslampon,124,0 ironshovel,256,0 ironspade,256,0 ishovel,256,0 @@ -1611,6 +2296,8 @@ diamondaxe,279,0 crystalaxe,279,0 daxe,279,0 stick,280,0 +twig,280,0 +branch,280,0 bowl,281,0 mushroomsoup,282,0 mrsoup,282,0 @@ -1908,6 +2595,7 @@ redsdust,331,0 reddust,331,0 rsdust,331,0 rdust,331,0 +snow,332,0 snowball,332,0 snball,332,0 boat,333,0 @@ -2092,12 +2780,16 @@ greencactusdye,351,2 greencolour,351,2 greencolor,351,2 greendye,351,2 +cocoabeans,351,3 +cocoabean,351,3 cocobeans,351,3 cocobean,351,3 cbeans,351,3 cbean,351,3 beans,351,3 bean,351,3 +browncocoabeans,351,3 +browncocoabean,351,3 browncocobeans,351,3 browncocobean,351,3 browncbeans,351,3 @@ -2105,12 +2797,16 @@ browncbean,351,3 brownbeans,351,3 brownbean,351,3 brownb,351,3 +cocoabeanscolour,351,3 +cocoabeancolour,351,3 cocobeanscolour,351,3 cocobeancolour,351,3 cbeanscolour,351,3 cbeancolour,351,3 beanscolour,351,3 beancolour,351,3 +browncocoabeanscolour,351,3 +browncocoabeancolour,351,3 browncocobeanscolour,351,3 browncocobeancolour,351,3 browncbeanscolour,351,3 @@ -2118,12 +2814,16 @@ browncbeancolour,351,3 brownbeanscolour,351,3 brownbeancolour,351,3 brownbcolour,351,3 +cocoabeanscolor,351,3 +cocoabeancolor,351,3 cocobeanscolor,351,3 cocobeancolor,351,3 cbeanscolor,351,3 cbeancolor,351,3 beanscolor,351,3 beancolor,351,3 +browncocoabeanscolor,351,3 +browncocoabeancolor,351,3 browncocobeanscolor,351,3 browncocobeancolor,351,3 browncbeanscolor,351,3 @@ -2131,12 +2831,16 @@ browncbeancolor,351,3 brownbeanscolor,351,3 brownbeancolor,351,3 brownbcolor,351,3 +cocoabeansdye,351,3 +cocoabeandye,351,3 cocobeansdye,351,3 cocobeandye,351,3 cbeansdye,351,3 cbeandye,351,3 beansdye,351,3 beandye,351,3 +browncocoabeansdye,351,3 +browncocoabeandye,351,3 browncocobeansdye,351,3 browncocobeandye,351,3 browncbeansdye,351,3 @@ -2268,8 +2972,13 @@ whitecolor,351,15 whitedye,351,15 bone,352,0 sugar,353,0 +whitedust,353,0 cake,354,0 bed,355,0 +sleepingtable,355,0 +sleeptable,355,0 +tablesleeping,355,0 +tablesleep,355,0 repeater,356,0 repeat,356,0 delayer,356,0 @@ -2283,6 +2992,10 @@ shears,359,0 shear,359,0 sheers,359,0 sheer,359,0 +woolcutters,359,0 +woolcutter,359,0 +cutterswool,359,0 +cutterwool,359,0 melonslice,360,0 mslice,360,0 slicemelon,360,0 @@ -2308,6 +3021,8 @@ uncookedbeef,363,0 uncookedsteak,363,0 cowmeat,363,0 plainbeef,363,0 +beef,364,0 +steak,364,0 cookedbeef,364,0 grilledbeef,364,0 cookedsteak,364,0 @@ -2322,12 +3037,16 @@ chickenraw,365,0 cookedchicken,366,0 grilledchicken,366,0 toastedchicken,366,0 +gchicken,366,0 +bbqchicken,366,0 +friedchicken,366,0 +cchicken,366,0 rottenflesh,367,0 zombieflesh,367,0 rottenmeat,367,0 zombiemeat,367,0 badflesh,367,0 -poisenflesh,367,0 +poisonflesh,367,0 zombieremains,367,0 enderpearl,368,0 pearl,368,0 @@ -2349,6 +3068,7 @@ ghosttear,370,0 ghostdrop,370,0 gtear,370,0 gdrop,370,0 +tear,370,0 goldnugget,371,0 gnugget,371,0 goldball,371,0 @@ -2356,8 +3076,17 @@ goldpebble,371,0 gball,371,0 gpebble,371,0 pigzombienugget,371,0 +pigznugget,371,0 +pzombienugget,371,0 +pznugget,371,0 pigzombieball,371,0 +pigzball,371,0 +pzombieball,371,0 +pzball,371,0 pigzombiepebble,371,0 +pigzpebble,371,0 +pzombiepebble,371,0 +pzpebble,371,0 netherstalk,372,0 deathstalk,372,0 hellstalk,372,0 @@ -2373,7 +3102,18 @@ gbottle,374,0 gvase,374,0 vase,374,0 glassvase,374,0 -emptypotion,374,0 +emptyglassbottle,374,0 +emptybottle,374,0 +emptygbottle,374,0 +emptygvase,374,0 +emptyvase,374,0 +emptyglassvase,374,0 +eglassbottle,374,0 +ebottle,374,0 +egbottle,374,0 +egvase,374,0 +evase,374,0 +eglassvase,374,0 spidereye,375,0 eyeofspider,375,0 spiderseye,375,0 @@ -2433,80 +3173,629 @@ shiningmelon,382,0 gmelon,382,0 smelon,382,0 creeperegg,383,50 +eggcreeper,383,50 skeletonegg,383,51 +eggskeleton,383,51 spideregg,383,52 +eggspider,383,52 giantegg,383,53 +egggiant,383,53 zombieegg,383,54 +eggzombie,383,54 slimeegg,383,55 +eggslime,383,55 ghastegg,383,56 +eggghast,383,56 zombiepigmanegg,383,57 +zpigmanegg,383,57 pigmanegg,383,57 +zombiepmanegg,383,57 +zpmanegg,383,57 +zombiepigmegg,383,57 +zpigmegg,383,57 +zombiepigegg,383,57 +zpigegg,383,57 +zombiepmegg,383,57 +zombiepegg,383,57 +eggzombiepigman,383,57 +eggzpigman,383,57 +eggpigman,383,57 +eggzombiepman,383,57 +eggzpman,383,57 +eggzombiepigm,383,57 +eggzpigm,383,57 +eggzombiepig,383,57 +eggzpig,383,57 +eggzombiepm,383,57 +eggzombiep,383,57 endermanegg,383,58 +eggenderman,383,58 +eggcavespider,383,59 cavespideregg,383,59 silverfishegg,383,60 +eggsilverfish,383,60 blazeegg,383,61 +eggblaze,383,61 lavaslimeegg,383,62 -magmacubeegg,383,63 +lavacubeegg,383,62 +magmacubeegg,383,62 +magmaslimeegg,383,62 +egglavaslime,383,62 +egglavacube,383,62 +eggmagmacube,383,62 +eggmagmaslime,383,62 pigegg,383,90 +eggpig,383,90 sheepegg,383,91 +eggsheep,383,91 cowegg,383,92 +eggcow,383,92 chickenegg,383,93 +eggchicken,383,93 squidegg,383,94 +eggsquid,383,94 wolfegg,383,95 +eggwolf,383,95 mooshroomegg,383,96 mushroomcowegg,383,96 +eggmooshroom,383,96 +eggmushroomcow,383,96 snowgolemegg,383,97 +sgolemegg,383,97 +eggsnowgolem,383,97 +eggsgolem,383,97 ocelotegg,383,98 +eggocelot,383,98 irongolemegg,383,99 +igolemegg,383,99 +eggirongolem,383,99 +eggigolem,383,99 villageregg,383,120 +eggvillager,383,120 bottleofenchanting,384,0 enchantingbottle,384,0 expbottle,384,0 xpbottle,384,0 +firecharge,385,0 +fireball,385,0 +grenade,385,0 goldmusicrecord,2256,0 goldmusicdisk,2256,0 +goldmusicdisc,2256,0 goldmusiccd,2256,0 +13musicrecord,2256,0 +13musicdisk,2256,0 +13musicdisc,2256,0 +13musiccd,2256,0 gomusicrecord,2256,0 gomusicdisk,2256,0 +gomusicdisc,2256,0 gomusiccd,2256,0 goldmrecord,2256,0 goldmdisk,2256,0 +goldmdisc,2256,0 goldmcd,2256,0 +13mrecord,2256,0 +13mdisk,2256,0 +13mdisc,2256,0 +13mcd,2256,0 gomrecord,2256,0 gomdisk,2256,0 +gomdisc,2256,0 gomcd,2256,0 goldrecord,2256,0 golddisk,2256,0 +golddisc,2256,0 goldcd,2256,0 +13record,2256,0 +13disk,2256,0 +13disc,2256,0 +13cd,2256,0 gorecord,2256,0 godisk,2256,0 +godisc,2256,0 gocd,2256,0 record1,2256,0 +disk1,2256,0 +disc1,2256,0 +cd1,2256,0 +1record,2256,0 +1disk,2256,0 +1disc,2256,0 +1cd,2256,0 greenmusicrecord,2257,0 greenmusicdisk,2257,0 +greenmusicdisc,2257,0 greenmusiccd,2257,0 +catmusicrecord,2257,0 +catmusicdisk,2257,0 +catmusicdisc,2257,0 +catmusiccd,2257,0 grmusicrecord,2257,0 grmusicdisk,2257,0 +grmusicdisc,2257,0 grmusiccd,2257,0 greenmrecord,2257,0 greenmdisk,2257,0 +greenmdisc,2257,0 greenmcd,2257,0 +catmrecord,2257,0 +catmdisk,2257,0 +catmdisc,2257,0 +catmcd,2257,0 grmrecord,2257,0 grmdisk,2257,0 +grmdisc,2257,0 grmcd,2257,0 greenrecord,2257,0 greendisk,2257,0 +greendisc,2257,0 greencd,2257,0 +catrecord,2257,0 +catdisk,2257,0 +catdisc,2257,0 +catcd,2257,0 grrecord,2257,0 grdisk,2257,0 +grdisc,2257,0 grcd,2257,0 record2,2257,0 +disk2,2257,0 +disc2,2257,0 +cd2,2257,0 +2record,2257,0 +2disk,2257,0 +2disc,2257,0 +2cd,2257,0 +orangemusicrecord,2258,0 +orangemusicdisk,2258,0 +orangemusicdisc,2258,0 +orangemusiccd,2258,0 +blocksmusicrecord,2258,0 +blocksmusicdisk,2258,0 +blocksmusicdisc,2258,0 +blocksmusiccd,2258,0 +ormusicrecord,2258,0 +ormusicdisk,2258,0 +ormusicdisc,2258,0 +ormusiccd,2258,0 +orangemrecord,2258,0 +orangemdisk,2258,0 +orangemdisc,2258,0 +orangemcd,2258,0 +blocksmrecord,2258,0 +blocksmdisk,2258,0 +blocksmdisc,2258,0 +blocksmcd,2258,0 +ormrecord,2258,0 +ormdisk,2258,0 +ormdisc,2258,0 +ormcd,2258,0 +orangerecord,2258,0 +orangedisk,2258,0 +orangedisc,2258,0 +orangecd,2258,0 +blocksrecord,2258,0 +blocksdisk,2258,0 +blocksdisc,2258,0 +blockscd,2258,0 +orrecord,2258,0 +ordisk,2258,0 +ordisc,2258,0 +orcd,2258,0 record3,2258,0 +disk3,2258,0 +disc3,2258,0 +cd3,2258,0 +3record,2258,0 +3disk,2258,0 +3disc,2258,0 +3cd,2258,0 +redmusicrecord,2259,0 +redmusicdisk,2259,0 +redmusicdisc,2259,0 +redmusiccd,2259,0 +chripmusicrecord,2259,0 +chripmusicdisk,2259,0 +chripmusicdisc,2259,0 +chripmusiccd,2259,0 +remusicrecord,2259,0 +remusicdisk,2259,0 +remusicdisc,2259,0 +remusiccd,2259,0 +redmrecord,2259,0 +redmdisk,2259,0 +redmdisc,2259,0 +redmcd,2259,0 +chripmrecord,2259,0 +chripmdisk,2259,0 +chripmdisc,2259,0 +chripmcd,2259,0 +remrecord,2259,0 +remdisk,2259,0 +remdisc,2259,0 +remcd,2259,0 +redrecord,2259,0 +reddisk,2259,0 +reddisc,2259,0 +redcd,2259,0 +chriprecord,2259,0 +chripdisk,2259,0 +chripdisc,2259,0 +chripcd,2259,0 +rerecord,2259,0 +redisk,2259,0 +redisc,2259,0 +recd,2259,0 record4,2259,0 +disk4,2259,0 +disc4,2259,0 +cd4,2259,0 +4record,2259,0 +4disk,2259,0 +4disc,2259,0 +4cd,2259,0 +lightgreenmusicrecord,2260,0 +lightgreenmusicdisk,2260,0 +lightgreenmusicdisc,2260,0 +lightgreenmusiccd,2260,0 +lgreenmusicrecord,2260,0 +lgreenmusicdisk,2260,0 +lgreenmusicdisc,2260,0 +lgreenmusiccd,2260,0 +lightgrmusicrecord,2260,0 +lightgrmusicdisk,2260,0 +lightgrmusicdisc,2260,0 +lightgrmusiccd,2260,0 +farmusicrecord,2260,0 +farmusicdisk,2260,0 +farmusicdisc,2260,0 +farmusiccd,2260,0 +lgrmusicrecord,2260,0 +lgrmusicdisk,2260,0 +lgrmusicdisc,2260,0 +lgrmusiccd,2260,0 +lightgreenmrecord,2260,0 +lightgreenmdisk,2260,0 +lightgreenmdisc,2260,0 +lightgreenmcd,2260,0 +lgreenmrecord,2260,0 +lgreenmdisk,2260,0 +lgreenmdisc,2260,0 +lgreenmcd,2260,0 +lightgrmrecord,2260,0 +lightgrmdisk,2260,0 +lightgrmdisc,2260,0 +lightgrmcd,2260,0 +farmrecord,2260,0 +farmdisk,2260,0 +farmdisc,2260,0 +farmcd,2260,0 +lgrmrecord,2260,0 +lgrmdisk,2260,0 +lgrmdisc,2260,0 +lgrmcd,2260,0 +lightgreenrecord,2260,0 +lightgreendisk,2260,0 +lightgreendisc,2260,0 +lightgreencd,2260,0 +lgreenrecord,2260,0 +lgreendisk,2260,0 +lgreendisc,2260,0 +lgreencd,2260,0 +lightgrrecord,2260,0 +lightgrdisk,2260,0 +lightgrdisc,2260,0 +lightgrcd,2260,0 +farrecord,2260,0 +fardisk,2260,0 +fardisc,2260,0 +farcd,2260,0 +lgrrecord,2260,0 +lgrdisk,2260,0 +lgrdisc,2260,0 +lgrcd,2260,0 record5,2260,0 +disk5,2260,0 +disc5,2260,0 +cd5,2260,0 +5record,2260,0 +5disk,2260,0 +5disc,2260,0 +5cs,2260,0 +purplemusicrecord,2261,0 +purplemusicdisk,2261,0 +purplemusicdisc,2261,0 +purplemusiccd,2261,0 +mallmusicrecord,2261,0 +mallmusicdisk,2261,0 +mallmusicdisc,2261,0 +mallmusiccd,2261,0 +pumusicrecord,2261,0 +pumusicdisk,2261,0 +pumusicdisc,2261,0 +pumusiccd,2261,0 +purplemrecord,2261,0 +purplemdisk,2261,0 +purplemdisc,2261,0 +purplemcd,2261,0 +mallmrecord,2261,0 +mallmdisk,2261,0 +mallmdisc,2261,0 +mallmcd,2261,0 +pumrecord,2261,0 +pumdisk,2261,0 +pumdisc,2261,0 +pumcd,2261,0 +purplerecord,2261,0 +purpledisk,2261,0 +purpledisc,2261,0 +purplecd,2261,0 +mallrecord,2261,0 +malldisk,2261,0 +malldisc,2261,0 +mallcd,2261,0 +purecord,2261,0 +pudisk,2261,0 +pudisc,2261,0 +pucd,2261,0 record6,2261,0 +disk6,2261,0 +disc6,2261,0 +cd6,2261,0 +6record,2261,0 +6disk,2261,0 +6disc,2261,0 +6cd,2261,0 +pinkmusicrecord,2262,0 +pinkmusicdisk,2262,0 +pinkmusicdisc,2262,0 +pinkmusiccd,2262,0 +mellohimusicrecord,2262,0 +mellohimusicdisk,2262,0 +mellohimusicdisc,2262,0 +mellohimusiccd,2262,0 +pimusicrecord,2262,0 +pimusicdisk,2262,0 +pimusicdisc,2262,0 +pimusiccd,2262,0 +pinkmrecord,2262,0 +pinkmdisk,2262,0 +pinkmdisc,2262,0 +pinkmcd,2262,0 +mellohimrecord,2262,0 +mellohimdisk,2262,0 +mellohimdisc,2262,0 +mellohimcd,2262,0 +pimrecord,2262,0 +pimdisk,2262,0 +pimdisc,2262,0 +pimcd,2262,0 +pinkrecord,2262,0 +pinkdisk,2262,0 +pinkdisc,2262,0 +pinkcd,2262,0 +mellohirecord,2262,0 +mellohidisk,2262,0 +mellohidisc,2262,0 +mellohicd,2262,0 +pirecord,2262,0 +pidisk,2262,0 +pidisc,2262,0 +picd,2262,0 record7,2262,0 +disk7,2262,0 +disc7,2262,0 +cd7,2262,0 +7record,2262,0 +7disk,2262,0 +7disc,2262,0 +7cd,2262,0 +blackmusicrecord,2263,0 +blackmusicdisk,2263,0 +blackmusicdisc,2263,0 +blackmusiccd,2263,0 +stalmusicrecord,2263,0 +stalmusicdisk,2263,0 +stalmusicdisc,2263,0 +stalmusiccd,2263,0 +blmusicrecord,2263,0 +blmusicdisk,2263,0 +blmusicdisc,2263,0 +blmusiccd,2263,0 +blackmrecord,2263,0 +blackmdisk,2263,0 +blackmdisc,2263,0 +blackmcd,2263,0 +stalmrecord,2263,0 +stalmdisk,2263,0 +stalmdisc,2263,0 +stalmcd,2263,0 +blmrecord,2263,0 +blmdisk,2263,0 +blmdisc,2263,0 +blmcd,2263,0 +blackrecord,2263,0 +blackdisk,2263,0 +blackdisc,2263,0 +blackcd,2263,0 +stalrecord,2263,0 +staldisk,2263,0 +staldisc,2263,0 +stalcd,2263,0 +blrecord,2263,0 +bldisk,2263,0 +bldisc,2263,0 +blcd,2263,0 record8,2263,0 +disk8,2263,0 +disc8,2263,0 +cd8,2263,0 +8record,2263,0 +8disk,2263,0 +8disc,2263,0 +8cd,2263,0 +whitemusicrecord,2264,0 +whitemusicdisk,2264,0 +whitemusicdisc,2264,0 +whitemusiccd,2264,0 +stradmusicrecord,2264,0 +stradmusicdisk,2264,0 +stradmusicdisc,2264,0 +stradmusiccd,2264,0 +whmusicrecord,2264,0 +whmusicdisk,2264,0 +whmusicdisc,2264,0 +whmusiccd,2264,0 +whitemrecord,2264,0 +whitemdisk,2264,0 +whitemdisc,2264,0 +whitemcd,2264,0 +stradmrecord,2264,0 +stradmdisk,2264,0 +stradmdisc,2264,0 +stradmcd,2264,0 +whmrecord,2264,0 +whmdisk,2264,0 +whmdisc,2264,0 +whmcd,2264,0 +whiterecord,2264,0 +whitedisk,2264,0 +whitedisc,2264,0 +whitecd,2264,0 +stradrecord,2264,0 +straddisk,2264,0 +straddisc,2264,0 +stradcd,2264,0 +whrecord,2264,0 +whdisk,2264,0 +whdisc,2264,0 +whcd,2264,0 record9,2264,0 +disk9,2264,0 +disc9,2264,0 +cd9,2264,0 +9record,2264,0 +9disk,2264,0 +9disc,2264,0 +9cd,2264,0 +darkgreenmusicrecord,2265,0 +darkgreenmusicdisk,2265,0 +darkgreenmusicdisc,2265,0 +darkgreenmusiccd,2265,0 +dgreenmusicrecord,2265,0 +dgreenmusicdisk,2265,0 +dgreenmusicdisc,2265,0 +dgreenmusiccd,2265,0 +darkgrmusicrecord,2265,0 +darkgrmusicdisk,2265,0 +darkgrmusicdisc,2265,0 +darkgrmusiccd,2265,0 +wardmusicrecord,2265,0 +wardmusicdisk,2265,0 +wardmusicdisc,2265,0 +wardmusiccd,2265,0 +dgrmusicrecord,2265,0 +dgrmusicdisk,2265,0 +dgrmusicdisc,2265,0 +dgrmusiccd,2265,0 +darkgreenmrecord,2265,0 +darkgreenmdisk,2265,0 +darkgreenmdisc,2265,0 +darkgreenmcd,2265,0 +dgreenmrecord,2265,0 +dgreenmdisk,2265,0 +dgreenmdisc,2265,0 +dgreenmcd,2265,0 +darkgrmrecord,2265,0 +darkgrmdisk,2265,0 +darkgrmdisc,2265,0 +darkgrmcd,2265,0 +wardmrecord,2265,0 +wardmdisk,2265,0 +wardmdisc,2265,0 +wardmcd,2265,0 +dgrmrecord,2265,0 +dgrmdisk,2265,0 +dgrmdisc,2265,0 +dgrmcd,2265,0 +darkgreenrecord,2265,0 +darkgreendisk,2265,0 +darkgreendisc,2265,0 +darkgreencd,2265,0 +dgreenrecord,2265,0 +dgreendisk,2265,0 +dgreendisc,2265,0 +dgreencd,2265,0 +darkgrrecord,2265,0 +darkgrdisk,2265,0 +darkgrdisc,2265,0 +darkgrcd,2265,0 +wardrecord,2265,0 +warddisk,2265,0 +warddisc,2265,0 +wardcd,2265,0 +dgrrecord,2265,0 +dgrdisk,2265,0 +dgrdisc,2265,0 +dgrcd,2265,0 record10,2265,0 +disk10,2265,0 +disc10,2265,0 +cd10,2265,0 +10record,2265,0 +10disk,2265,0 +10disc,2265,0 +10cs,2265,0 +crackedmusicrecord,2266,0 +crackedmusicdisk,2266,0 +crackedmusicdisc,2266,0 +crackedmusiccd,2266,0 +crackmusicrecord,2266,0 +crackmusicdisk,2266,0 +crackmusicdisc,2266,0 +crackmusiccd,2266,0 +11musicrecord,2266,0 +11musicdisk,2266,0 +11musicdisc,2266,0 +11musiccd,2266,0 +cmusicrecord,2266,0 +cmusicdisk,2266,0 +cmusicdisc,2266,0 +cmusiccd,2266,0 +crackedmrecord,2266,0 +crackedmdisk,2266,0 +crackedmdisc,2266,0 +crackedmcd,2266,0 +crackmrecord,2266,0 +crackmdisk,2266,0 +crackmdisc,2266,0 +crackmcd,2266,0 +11mrecord,2266,0 +11mdisk,2266,0 +11mdisc,2266,0 +11mcd,2266,0 +cmrecord,2266,0 +cmdisk,2266,0 +cmdisc,2266,0 +cmcd,2266,0 +crackedrecord,2266,0 +crackeddisk,2266,0 +crackeddisc,2266,0 +crackedcd,2266,0 +crackrecord,2266,0 +crackdisk,2266,0 +crackdisc,2266,0 +crackcd,2266,0 +crecord,2266,0 +cdisk,2266,0 +cdisc,2266,0 +ccd,2266,0 record11,2266,0 +disk11,2266,0 +disc11,2266,0 +cd11,2266,0 +11record,2266,0 +11disk,2266,0 +11disc,2266,0 +11cd,2266,0
\ No newline at end of file diff --git a/Essentials/src/messages.properties b/Essentials/src/messages.properties index c059c3e48..15b63260d 100644 --- a/Essentials/src/messages.properties +++ b/Essentials/src/messages.properties @@ -12,6 +12,7 @@ alertUsed=used: autoAfkKickReason=You have been kicked for idling more than {0} minutes. backAfterDeath=\u00a77Use the /back command to return to your death point. backUsageMsg=\u00a77Returning to previous location. +backupDisabled=An external backup script has not been configured. backupFinished=Backup finished backupStarted=Backup started balance=\u00a77Balance: {0} @@ -30,10 +31,11 @@ buildAlert=\u00a7cYou are not permitted to build bukkitFormatChanged=Bukkit version format changed. Version not checked. burnMsg=\u00a77You set {0} on fire for {1} seconds. canTalkAgain=\u00a77You can talk again -cantFindGeoIpDB=Can''t find GeoIP database! +cantFindGeoIpDB=Can't find GeoIP database! cantReadGeoIpDB=Failed to read GeoIP database! cantSpawnItem=\u00a7cYou are not allowed to spawn the item {0} chatTypeLocal=[L] +chatTypeAdmin=[A] chatTypeSpy=[Spy] commandFailed=Command {0} failed: commandHelpFailedForPlugin=Error getting help for: {0} @@ -41,7 +43,7 @@ commandNotLoaded=\u00a7cCommand {0} is improperly loaded. compassBearing=\u00a77Bearing: {0} ({1} degrees). configFileMoveError=Failed to move config.yml to backup location. configFileRenameError=Failed to rename temp file to config.yml -connectedPlayers=Connected players: +connectedPlayers=Connected players: connectionFailed=Failed to open connection. cooldownWithMessage=\u00a7cCooldown: {0} corruptNodeInConfig=\u00a74Notice: Your configuration file has a corrupt {0} node. @@ -50,6 +52,7 @@ creatingConfigFromTemplate=Creating config from template: {0} creatingEmptyConfig=Creating empty config: {0} creative=creative currency={0}{1} +currentWorld=Current World: {0} day=day days=days defaultBanReason=The Ban Hammer has spoken! @@ -71,6 +74,7 @@ disabledToSpawnMob=Spawning this mob was disabled in the config file. dontMoveMessage=\u00a77Teleportation will commence in {0}. Don''t move. downloadingGeoIp=Downloading GeoIP database ... this might take a while (country: 0.6 MB, city: 20MB) duplicatedUserdata=Duplicated userdata: {0} and {1} +durability=\u00a77This tool has \u00a7c{0}\u00a77 uses left enableUnlimited=\u00a77Giving unlimited amount of {0} to {1}. enabled=enabled enchantmentApplied = \u00a77The enchantment {0} has been applied to your item in hand. @@ -83,15 +87,19 @@ errorWithMessage=\u00a7cError: {0} essentialsHelp1=The file is broken and Essentials can't open it. Essentials is now disabled. If you can't fix the file yourself, go to http://tiny.cc/EssentialsChat essentialsHelp2=The file is broken and Essentials can't open it. Essentials is now disabled. If you can't fix the file yourself, either type /essentialshelp in game or go to http://tiny.cc/EssentialsChat essentialsReload=\u00a77Essentials Reloaded {0} +exp=\u00a7c{0} \u00a77has\u00a7c {1} \u00a77exp (level\u00a7c {2}\u00a77) and needs\u00a7c {3} \u00a77more exp to level up. +expSet=\u00a7c{0} \u00a77now has\u00a7c {1} \u00a77exp. extinguish=\u00a77You extinguished yourself. extinguishOthers=\u00a77You extinguished {0}. failedToCloseConfig=Failed to close config {0} failedToCreateConfig=Failed to create config {0} failedToWriteConfig=Failed to write config {0} -false=false +false=\u00a74false\u00a7f feed=\u00a77Your appetite was sated. feedOther=\u00a77Satisfied {0}. fileRenameError=Renaming file {0} failed +flyMode=\u00a77Set fly mode {0} for {1}. +flying=flying foreverAlone=\u00a7cYou have nobody to whom you can reply. freedMemory=Freed {0} MB. gameMode=\u00a77Set game mode {0} for {1}. @@ -106,13 +114,20 @@ geoipJoinFormat=Player {0} comes from {1} godDisabledFor=disabled for {0} godEnabledFor=enabled for {0} godMode=\u00a77God mode {0}. +hatArmor=\u00a7cError, you cannot use this item as a hat! +hatEmpty=\u00a7cYou are not wearing a hat. +hatFail=\u00a7cYou must have something to wear in your hand. +hatPlaced=\u00a7eEnjoy your new hat! haveBeenReleased=\u00a77You have been released heal=\u00a77You have been healed. healOther=\u00a77Healed {0}. helpConsole=To view help from the console, type ?. +helpFrom=\u00a77Commands from {0}: helpLine=\u00a76/{0}\u00a7f: {1} +helpMatching=\u00a77Commands matching "{0}": helpOp=\u00a7c[HelpOp]\u00a7f \u00a77{0}:\u00a7f {1} helpPages=Page \u00a7c{0}\u00a7f of \u00a7c{1}\u00a7f: +helpPlugin=\u00a74{0}\u00a7f: Plugin Help: /help {1} holeInFloor=Hole in floor homeSet=\u00a77Home set. homeSetToBed=\u00a77Your home is now set to this bed. @@ -124,14 +139,14 @@ illegalDate=Illegal date format. infoChapter=Select chapter: infoChapterPages=Chapter {0}, page \u00a7c{1}\u00a7f of \u00a7c{2}\u00a7f: infoFileDoesNotExist=File info.txt does not exist. Creating one for you. -infoPages=Page \u00a7c{0}\u00a7f of \u00a7c{1}\u00a7f: +infoPages=\u00a7e ---- \u00a76{2} \u00a7e--\u00a76 Page \u00a74{0}\u00a76/\u00a74{1} \u00a7e---- infoUnknownChapter=Unknown chapter. invBigger=The other users inventory is bigger than yours. invRestored=Your inventory has been restored. invSee=You see the inventory of {0}. invSeeHelp=Use /invsee to restore your inventory. invalidCharge=\u00a7cInvalid charge. -invalidHome=Home {0} doesn't exist +invalidHome=Home {0} doesn''t exist invalidMob=Invalid mob type. invalidServer=Invalid server! invalidSignLine=Line {0} on sign is invalid. @@ -156,18 +171,19 @@ jailReleased=\u00a77Player \u00a7e{0}\u00a77 unjailed. jailReleasedPlayerNotify=\u00a77You have been released! jailSentenceExtended=Jail time extend to: {0) jailSet=\u00a77Jail {0} has been set -jumpError=That would hurt your computer''s brain. +jumpError=That would hurt your computer's brain. kickDefault=Kicked from server kickExempt=\u00a7cYou can not kick that person. +kickedAll=\u00a7cKicked all players from server kill=\u00a77Killed {0}. kitError2=\u00a7cThat kit does not exist or is improperly defined. kitError=\u00a7cThere are no valid kits. kitErrorHelp=\u00a7cPerhaps an item is missing a quantity in the configuration? kitGive=\u00a77Giving kit {0}. -InvFull=\u00a7cYour inventory was full, dropping items on the floor +kitInvFull=\u00a7cYour inventory was full, placing kit on the floor kitTimed=\u00a7cYou can''t use that kit again for another {0}. kits=\u00a77Kits: {0} -lightningSmited=\u00a77You have just been smited +lightningSmited=\u00a77Thou hast been smitten lightningUse=\u00a77Smiting {0} listAfkTag = \u00a77[AFK]\u00a7f listAmount = \u00a79There are \u00a7c{0}\u00a79 out of maximum \u00a7c{1}\u00a79 players online. @@ -205,7 +221,6 @@ mutedPlayer=Player {0} muted. mutedPlayerFor=Player {0} muted for {1}. mutedUserSpeaks={0} tried to speak, but is muted. nearbyPlayers=Players nearby: {0} -needTpohere=You need access to /tpohere to teleport other players. negativeBalanceError=User is not allowed to have a negative balance. nickChanged=Nickname changed. nickDisplayName=\u00a77You have to enable change-displayname in Essentials config. @@ -218,6 +233,7 @@ noAccessCommand=\u00a7cYou do not have access to that command. noAccessPermission=\u00a7cYou do not have permission to access that {0}. noBreakBedrock=You are not allowed to destroy bedrock. noDestroyPermission=\u00a7cYou do not have permission to destroy that {0}. +noDurability=\u00a7cThis item does not have a durability. noGodWorldWarning=\u00a7cWarning! God mode in this world disabled. noHelpFound=\u00a7cNo matching commands. noHomeSet=You have not set a home. @@ -229,7 +245,7 @@ noMotd=\u00a7cThere is no message of the day. noNewMail=\u00a77You have no new mail. noPendingRequest=You do not have a pending request. noPerm=\u00a7cYou do not have the \u00a7f{0}\u00a7c permission. -noPermToSpawnMob=\u00a7cYou don''t have permission to spawn this mob. +noPermToSpawnMob=\u00a7cYou don't have permission to spawn this mob. noPlacePermission=\u00a7cYou do not have permission to place a block near that sign. noPowerTools=You have no power tools assigned. noRules=\u00a7cThere are no rules specified yet. @@ -239,6 +255,7 @@ notAllowedToQuestion=\u00a7cYou are not authorized to use question. notAllowedToShout=\u00a7cYou are not authorized to shout. notEnoughExperience=You do not have enough experience. notEnoughMoney=You do not have sufficient funds. +notFlying=not flying notRecommendedBukkit= * ! * Bukkit version is not the recommended build for Essentials. notSupportedYet=Not supported yet. nothingInHand = \u00a7cYou have nothing in your hand. @@ -252,7 +269,7 @@ orderBalances=Ordering balances of {0} users, please wait ... pTimeCurrent=\u00a7e{0}''s\u00a7f time is {1}. pTimeCurrentFixed=\u00a7e{0}''s\u00a7f time is fixed to {1}. pTimeNormal=\u00a7e{0}''s\u00a7f time is normal and matches the server. -pTimeOthersPermission=\u00a7cYou are not authorized to set other players'' time. +pTimeOthersPermission=\u00a7cYou are not authorized to set other players' time. pTimePlayers=These players have their own time: pTimeReset=Player time has been reset for: \u00a7e{0} pTimeSet=Player time is set to \u00a73{0}\u00a7f for: \u00a7e{1} @@ -272,7 +289,7 @@ playerNotFound=\u00a7cPlayer not found. playerUnmuted=\u00a77You have been unmuted pong=Pong! possibleWorlds=\u00a77Possible worlds are the numbers 0 through {0}. -powerToolAir=Command can''t be attached to air. +powerToolAir=Command can't be attached to air. powerToolAlreadySet=Command \u00a7c{0}\u00a7f is already assigned to {1}. powerToolAttach=\u00a7c{0}\u00a7f command assigned to {1}. powerToolClearAll=All powertool commands have been cleared. @@ -303,7 +320,6 @@ requiredBukkit= * ! * You need atleast build {0} of CraftBukkit, download it fro returnPlayerToJailError=Error occurred when trying to return player {0} to jail: {1} second=second seconds=seconds -seenBanReason=Reason: {0} seenOffline=Player {0} is offline since {1} seenOnline=Player {0} is online since {1} serverFull=Server is full @@ -334,7 +350,6 @@ teleportDisabled={0} has teleportation disabled. teleportHereRequest=\u00a7c{0}\u00a7c has requested that you teleport to them. teleportNewPlayerError=Failed to teleport new player teleportRequest=\u00a7c{0}\u00a7c has requested to teleport to you. -teleportRequestsCancelledWorldChange=\u00a77Pending teleport requests have been cancelled on world change. teleportRequestTimeoutInfo=\u00a77This request will timeout after {0} seconds. teleportTop=\u00a77Teleporting to top. teleportationCommencing=\u00a77Teleportation commencing... @@ -354,12 +369,13 @@ timeSet=Time set in all worlds. timeSetPermission=\u00a7cYou are not authorized to set the time. timeWorldCurrent=The current time in {0} is \u00a73{1} timeWorldSet=The time was set to {0} in: \u00a7c{1} +tps=Current TPS = {0} tradeCompleted=\u00a77Trade completed. tradeSignEmpty=The trade sign has nothing available for you. tradeSignEmptyOwner=There is nothing to collect from this trade sign. treeFailure=\u00a7cTree generation failure. Try again on grass or dirt. treeSpawned=\u00a77Tree spawned. -true=true +true=\u00a72true\u00a7f typeTpaccept=\u00a77To teleport, type \u00a7c/tpaccept\u00a77. typeTpdeny=\u00a77To deny this request, type \u00a7c/tpdeny\u00a77. typeWorldName=\u00a77You can also type the name of a specific world. @@ -373,6 +389,8 @@ unknownItemName=Unknown item name: {0} unlimitedItemPermission=\u00a7cNo permission for unlimited item {0}. unlimitedItems=Unlimited items: unmutedPlayer=Player {0} unmuted. +unvanished=\u00a7aYou are once again visible. +unvanishedReload=\u00a7cA reload has forced you to become visible. upgradingFilesError=Error while upgrading the files userDoesNotExist=The user {0} does not exist. userIsAway={0} is now AFK @@ -382,35 +400,39 @@ userUsedPortal={0} used an existing exit portal. userdataMoveBackError=Failed to move userdata/{0}.tmp to userdata/{1} userdataMoveError=Failed to move userdata/{0} to userdata/{1}.tmp usingTempFolderForTesting=Using temp folder for testing: +vanished=\u00a7aYou have now been vanished. versionMismatch=Version mismatch! Please update {0} to the same version. versionMismatchAll=Version mismatch! Please update all Essentials jars to the same version. voiceSilenced=\u00a77Your voice has been silenced warpDeleteError=Problem deleting the warp file. warpListPermission=\u00a7cYou do not have Permission to list warps. warpNotExist=That warp does not exist. +warpOverwrite=\u00a7cYou cannot overwrite that warp. warpSet=\u00a77Warp {0} set. warpUsePermission=\u00a7cYou do not have Permission to use that warp. warpingTo=\u00a77Warping to {0}. warps=Warps: {0} warpsCount=\u00a77There are {0} warps. Showing page {1} of {2}. -warpOverwrite=\u00a7cYou cannot overwrite that warp. weatherStorm=\u00a77You set the weather to storm in {0} weatherStormFor=\u00a77You set the weather to storm in {0} for {1} seconds weatherSun=\u00a77You set the weather to sun in {0} weatherSunFor=\u00a77You set the weather to sun in {0} for {1} seconds -whoisBanned=\u00a79 - Banned: {0} -whoisGamemode=\u00a79 - Gamemode: {0} -whoisGeoLocation=\u00a79 - Location: {0} -whoisGod=\u00a79 - God mode: {0} -whoisHealth=\u00a79 - Health: {0}/20 -whoisIPAddress=\u00a79 - IP Address: {0} -whoisIs={0} is {1} -whoisJail=\u00a79 - Jail: {0} -whoisLocation=\u00a79 - Location: ({0}, {1}, {2}, {3}) -whoisMoney=\u00a79 - Money: {0} -whoisOP=\u00a79 - OP: {0} -whoisStatusAvailable=\u00a79 - Status: Available -whoisStatusAway=\u00a79 - Status: \u00a7cAway\u00a7f +whoisAFK=\u00a76 - AFK:\u00a7f {0} +whoisBanned=\u00a76 - Banned:\u00a7f {0} +whoisExp=\u00a76 - Exp:\u00a7f {0} (Level {1}) +whoisFly=\u00a76 - Fly mode:\u00a7f {0} ({1}) +whoisGamemode=\u00a76 - Gamemode:\u00a7f {0} +whoisGeoLocation=\u00a76 - Location:\u00a7f {0} +whoisGod=\u00a76 - God mode:\u00a7f {0} +whoisHealth=\u00a76 - Health:\u00a7f {0}/20 +whoisIPAddress=\u00a76 - IP Address:\u00a7f {0} +whoisJail=\u00a76 - Jail:\u00a7f {0} +whoisLocation=\u00a76 - Location:\u00a7f ({0}, {1}, {2}, {3}) +whoisMoney=\u00a76 - Money:\u00a7f {0} +whoisMuted=\u00a76 - Muted:\u00a7f {0} +whoisNick=\u00a76 - Nick:\u00a7f {0} +whoisOp=\u00a76 - OP:\u00a7f {0} +whoisTop=\u00a76 ====== WhoIs:\u00a7f {0} \u00a76====== worth=\u00a77Stack of {0} worth \u00a7c{1}\u00a77 ({2} item(s) at {3} each) worthMeta=\u00a77Stack of {0} with metadata of {1} worth \u00a7c{2}\u00a77 ({3} item(s) at {4} each) worthSet=Worth value set @@ -418,4 +440,5 @@ year=year years=years youAreHealed=\u00a77You have been healed. youHaveNewMail=\u00a7cYou have {0} messages!\u00a7f Type \u00a77/mail read\u00a7f to view your mail. - +hatRemoved=\u00a7eYour hat has been removed. +banFormat=Banned: {0} diff --git a/Essentials/src/messages_cs.properties b/Essentials/src/messages_cs.properties new file mode 100644 index 000000000..3a20bf6cb --- /dev/null +++ b/Essentials/src/messages_cs.properties @@ -0,0 +1,447 @@ +#version: ${build.number} +# Single quotes have to be doubled: '' +# Translations start here +# 0.1 version: tomasara413 - Tento preklad neni 100% presny to se opravi v dalsich verzich prekladu +# 0.2 version: optimized by mdojcar (modojcar@seznam.cz) - mirne fixy a trochu jsem preklad vylepsil +# nektere vyrazy jako "Kicknut" jsou v anglickem zneni (zni to mnohem prirozeneji) +# 0.3 tommymortago - Pro upravy kontaktujte na skype: tomasperzl/ Korektura: Sejsel +action=* {0} {1} +addedToAccount=\u00a7a{0} bylo pripsano na tvuj ucet. +addedToOthersAccount=\u00a7a{0} bylo pripsano na {1}\u00a7a ucet. Nova hodnota: {2} +alertBroke=zniceno: +alertFormat=\u00a73[{0}] \u00a7f {1} \u00a76 {2} v: {3} +alertPlaced=polozeno: +alertUsed=pouzito: +autoAfkKickReason=Byl jsi vyhozen za neaktivitu delsi nez {0} minut. +backAfterDeath=\u00a77Pouzij /back, aby ses vratil na misto sve smrti. +backUsageMsg=\u00a77Vracis se na svou minulou pozici. +backupDisabled=Externi zalohovaci script neni nastaven. +backupFinished=Zaloha dokoncena +backupStarted=Probiha zaloha +balance=\u00a77Ucet: {0} +balanceTop=\u00a77Nejbohatsi hraci ({0}) +banExempt=\u00a7cNemuzes zabanovat tohoto hrace. +banFormat=Banned: {0} +banIpAddress=\u00a77IP Adresa byla zabanovana +bannedIpsFileError=Chyba pri nacitani banned-ips.txt +bannedIpsFileNotFound=Soubor banned-ips.txt nebyl nazen. +bannedPlayersFileError=Chyba pri nacitani banned-players.txt +bannedPlayersFileNotFound=Soubor banned-players.txt nebyl nalezen +bigTreeFailure=\u00a7cProblem pri vytvareni velkeho stromu. Zkuste znovu na trave nebo hline. +bigTreeSuccess= \u00a77Velky strom vytvoren. +blockList=Essentials prenechal nasledujici prikazy jinemu pluginu: +broadcast=[\u00a7cSdeleni\u00a7f]\u00a7a {0} +buildAlert=\u00a7cNemas dovoleno stavet. +bukkitFormatChanged=Format kontroly verze Bukkitu zmenen. Verze nebyla zkontrolovana. +burnMsg=\u00a77Zapalil jsi {0} na dobu {1} sekund. +canTalkAgain=\u00a77Muzes opet mluvit. +cantFindGeoIpDB=Nemohu najit GeoIP databazi! +cantReadGeoIpDB=Nemohu precist GeoIP databazi! +cantSpawnItem=\u00a7cNejsi dovoleny spawnout item: {0} +chatTypeLocal=[L] +chatTypeAdmin=[A] +chatTypeSpy=[Spy] +commandFailed=Prikaz {0} selhal. +commandHelpFailedForPlugin=Chyba pri ziskavani pomoci: {0} +commandNotLoaded=\u00a7cPrikaz {0} je nespravne nacteny. +compassBearing=\u00a77Zmena orientace: {0} ({1} stupnu). +configFileMoveError=Chyba pri presouvani config.yml do slozky se zalohou. +configFileRenameError=Chyba pri pokusu o prejmenovani docasneho souboru na config.yml +connectedPlayers=Pripojeni hraci: +connectionFailed=Pokus o otevreni spojeni selhal. +cooldownWithMessage=\u00a7cOdpocet: {0} +corruptNodeInConfig=\u00a74Pozor: Vas konfiguracni soubor ma chybnou {0} poznamku. +couldNotFindTemplate=Nemohu naleznout sablonu: {0} +creatingConfigFromTemplate=Vytvarim config ze sablony: {0} +creatingEmptyConfig=Vytvarim prazdny config: {0} +creative=creative +currency={0}{1} +currentWorld=Current World: {0} +day=den +days=dny +defaultBanReason=Banovaci kladivo promluvilo! +deleteFileError=Nemohu smazat soubor: {0} +deleteHome=\u00a77Domov {0} byl uspesne odstranen. +deleteJail=\u00a77Jail {0} byl uspesne odstranen. +deleteWarp=\u00a77Warp {0} byl uspesne odstranen. +deniedAccessCommand=Hraci {0} byl zablokovan prikaz. +dependancyDownloaded=[Essentials] Zavislost {0} uspesne stazena. +dependancyException=[Essentials] Nastala chyba pri pokusu o stazeni zavilosti. +dependancyNotFound=[Essentials] Pozadovana zavilost nenalezena, stahuji nyni. +depth=\u00a77Jsi na urovni more. +depthAboveSea=\u00a77Jsi {0} kostek nad urovni more. +depthBelowSea=\u00a77Jsi {0} kostek pod urovni more. +destinationNotSet=Destinace neni nastavena. +disableUnlimited=\u00a77Zablokovano neomezene pokladani {0} hraci {1}. +disabled=zablokovano +disabledToSpawnMob=Spawnuti tohoto moba je zakazno v configuracnim souboru. +dontMoveMessage=\u00a77Teleport bude zahajen za {0}. Nehybej se. +downloadingGeoIp=Stahuji GeoIP databazi ... muze to chvilku trvat (staty: 0.6 MB, mesta: 20MB) +duplicatedUserdata=Duplikovane data hrace: {0} and {1} +durability=\u00a77This tool has \u00a7c{0}\u00a77 uses left +enableUnlimited=\u00a77Davam neomezene mnozstvi {0} hraci {1}. +enabled=povoleno +enchantmentApplied = \u00a77Enchant {0} byl aplikovan na tvuj nastroj v ruce. +enchantmentNotFound = \u00a7cTento enchant neexistuje +enchantmentPerm = \u00a7cNemas opravneni na enchant: {0} +enchantmentRemoved = \u00a77Enchant {0} byl odstranen z tveho nastroje v ruce. +enchantments = \u00a77Enchantmenty: {0} +errorCallingCommand=Chyba pri volani prikazu /{0} +errorWithMessage=\u00a7cChyba: {0} +essentialsHelp1=Soubor je poskozen a Essentials jej nemuze otevrit. Essentials jsou zablokovany. Pokud nemuzete soubor opravit sami, navstivte http://tiny.cc/EssentialsChat +essentialsHelp2=Soubor je poskozen a Essentials jej nemuze otevrit. Essentials jsou zablokovany. Pokud nemuzete soubor opravit sami, pak napiste /essentialshelp ve hre nebo navstivte http://tiny.cc/EssentialsChat +essentialsReload=\u00a77Essentials znovu nacteny. {0} +exp=\u00a7c{0} \u00a77has\u00a7c {1} \u00a77exp (level\u00a7c {2}\u00a77) and needs\u00a7c {3} \u00a77more exp to level up. +expSet=\u00a7c{0} \u00a77now has\u00a7c {1} \u00a77exp. +extinguish=\u00a77Uhasil ses. +extinguishOthers=\u00a77Uhasil jsi hrace {0}. +failedToCloseConfig=Chyba pri uzavreni configu {0} +failedToCreateConfig=Chyba pri vytvoreni configu {0} +failedToWriteConfig=Chyba pri zapisovani do configu {0} +false=\u00a74false\u00a7f +feed=\u00a77Nasytil jsi se. +feedOther=\u00a77Nasytil jsi hrace {0}. +fileRenameError=Prejmenovani souboru {0} selhalo. +flyMode=\u00a77Povolil jsi letani hraci {0} na {1}. +flying=flying +foreverAlone=\u00a7cNemas komu odepsat. +freedMemory=Uvolneno {0} MB. +gameMode=\u00a77Nastavil jsi herni mod z {0} na {1}. +gcchunks= chunky, +gcentities= entity +gcfree=Volna pamet: {0} MB +gcmax=Dostupna pamet: {0} MB +gctotal=Vyuzita pamet: {0} MB +geoIpUrlEmpty=Odkaz na stazeni GeoIP je prazdny. +geoIpUrlInvalid=Odkaz na stazeni GeoIP je chybny. +geoipJoinFormat=Hrac {0} prichazi z {1} +godDisabledFor=zakazan pro {0} +godEnabledFor=povolen pro {0} +godMode=\u00a77God mode {0}. +hatArmor=\u00a7cError, you cannot use this item as a hat! +hatEmpty=\u00a7cYou are not wearing a hat. +hatFail=\u00a7cYou must have something to wear in your hand. +hatPlaced=\u00a7eEnjoy your new hat! +hatRemoved=\u00a7eYour hat has been removed. +haveBeenReleased=\u00a77Byl jsi uvolnen +heal=\u00a77Byl jsi uzdraven. +healOther=\u00a77Uzdravil jsi hrace {0}. +helpConsole=Pokud chces videt napovedu z konzole, napis ?. +helpFrom=\u00a77Prikazy od{0}: +helpLine=\u00a76/{0}\u00a7f: {1} +helpMatching=\u00a77Prikazy odpovidajici "{0}": +helpOp=\u00a7c[HelpOp]\u00a7f \u00a77{0}:\u00a7f {1} +helpPages=Strana \u00a7c{0}\u00a7f z \u00a7c{1}\u00a7f: +helpPlugin=\u00a74{0}\u00a7f: Napoveda pluginu: /help {1} +holeInFloor=Dira v podlaze +homeSet=\u00a77Domov nastaven. +homeSetToBed=\u00a77Tvuj domov je nastaven na tuto postel. +homes=Domovy: {0} +hour=hodina +hours=hodiny +ignorePlayer=Odted jsi zacal ignorovat hrace {0}. +illegalDate=Nespravny format data. +infoChapter=Vyberte kapitolu: +infoChapterPages=Kapitola {0}, strana \u00a7c{1}\u00a7f z \u00a7c{2}\u00a7f: +infoFileDoesNotExist=Soubor info.txt neexistuje. Vytvarim novy. +infoPages=\u00a7e ---- \u00a76{2} \u00a7e--\u00a76 Strana \u00a74{0}\u00a76/\u00a74{1} \u00a7e---- +infoUnknownChapter=Neznama kapitola. +invBigger=Inventar druheho hrace je vetsi nez tvuj. +invRestored=Tvuj inventar byl obnoven. +invSee=Nyni mas inventar hrace {0}. +invSeeHelp=Pouzij znovu /invsee aby jsi mel zpatky svuj inventar. +invalidCharge=\u00a7cNeplatny poplatek. +invalidHome=Domov {0} neexistuje. +invalidMob=Nespravny typ moba. +invalidServer=Nespravny server! +invalidSignLine=Radek {0} je chybne vyplnen. +invalidWorld=\u00a7cNespravny svet! +inventoryCleared=\u00a77Inventar smazan. +inventoryClearedOthers=\u00a77Inventar hrace \u00a7c{0}\u00a77 vymazan. +is=je +itemCannotBeSold=Tento item nelze prodat serveru. +itemMustBeStacked=Itemy musi byt vymeneny ve stacku. +itemNotEnough1=\u00a7cNemas dostatek tohoto itemu, aby jsi jej mohl prodat. +itemNotEnough2=\u00a77Pokud jsi chtel prodat vsechny itemy tohoto typu, pouzij /sell nazevitemu +itemNotEnough3=\u00a77/sell nazevnitemu -1 proda vse ale pouze jeden item atd. +itemSellAir=Vazne jsi se pokusil prodat Vzduch? Vezmi si neco do ruky. +itemSold=\u00a77Prodal za \u00a7c{0} \u00a77({1} {2} za cenu {3} kus) +itemSoldConsole={0} Prodal {1} za \u00a77{2} \u00a77({3} za cenu {4} kus) +itemSpawn=\u00a77Davam {0} {1} +itemsCsvNotLoaded=Nelze nacist soubor items.csv. +jailAlreadyIncarcerated=\u00a7cTento hrace ja jiz uveznen: {0} +jailMessage=\u00a7cPorusil jsi pravidla, ted si to odsedis! +jailNotExist=Toto vezeni neexistuje. +jailReleased=\u00a77Hrac \u00a7e{0}\u00a77 byl propusten na svobodu. +jailReleasedPlayerNotify=\u00a77Byl jsi propusten na svobodu! +jailSentenceExtended=Cas ve vezeni prodlouzen na: {0) +jailSet=\u00a77Vezeni {0} bylo vytvoreno. +jumpError=Tohle by tvuj procesor nemusel rozdychat. +kickDefault=Vyhozen ze serveru +kickExempt=\u00a7cNemuzes vyhodit tuhle osobu. +kickedAll=\u00a7cKicked all players from server +kill=\u00a77Zabit {0}. +kitError2=\u00a7cTento kit neexistuje, nebo je chybne definovan. +kitError=\u00a7cNejsou zadne validni kity. +kitErrorHelp=\u00a7cPravdepodobne item nema vyplnene mnozstvi v configu? +kitGive=\u00a77Davam kit {0}. +kitInvFull=\u00a7cMel jsi plny inventar, obsah kitu je na zemi. +kitTimed=\u00a7cNemuzes pouzit tento kit po dalsich {0}. +kits=\u00a77Kity: {0} +lightningSmited=\u00a77Byl jsi zasazen bleskem. +lightningUse=\u00a77Zasadil jsi bleskem hrace {0} +listAfkTag = \u00a77[AFK]\u00a7f +listAmount = \u00a79Je tu \u00a7c{0}\u00a79 z maxima \u00a7c{1}\u00a79 hracu online. +listAmountHidden = \u00a79Je tu \u00a7c{0}\u00a77/{1}\u00a79 z maxima \u00a7c{2}\u00a79 hracu online. +listGroupTag={0}\u00a7f: +listHiddenTag = \u00a77[HIDDEN]\u00a7f +loadWarpError=Chyba pri nacitani warpu: {0} +localFormat=Jazyk: <{0}> {1} +mailClear=\u00a7cPokud chces vymazat mail, napis /mail clear. +mailCleared=\u00a77Mail vymazan! +mailSent=\u00a77Mail odeslan! +markMailAsRead=\u00a7cPokud chces mail oznacit jako precteny, napis /mail clear +markedAsAway=\u00a77Jsi oznacen jako "Pryc". +markedAsNotAway=\u00a77Jiz nejsi oznacen jako "Pryc". +maxHomes=Nemuzes si nastavit vice nez {0} domovu. +mayNotJail=\u00a7cNesmis uveznit tuto postavu +me=ja +minute=minuta +minutes=minuty +missingItems=Nemas {0}x {1}. +missingPrefixSuffix=Chybi prefix nebo suffix pro {0} +mobSpawnError=Chyba pri pokusu o zmenu mob spawneru. +mobSpawnLimit=Pocet mobu limitovan serverem. +mobSpawnTarget=Musis se divat na spawner. +mobsAvailable=\u00a77Mobove: {0} +moneyRecievedFrom=\u00a7a{0} jsi obdrzel od hrace {1} +moneySentTo=\u00a7a{0} bylo odeslano hraci: {1} +moneyTaken={0} bylo odebrano z tveho uctu. +month=mesic +months=mesice +moreThanZero=Mnozstvi musi byt vetsi nez 0. +msgFormat=\u00a77[{0}\u00a77 -> {1}\u00a77] \u00a7f{2} +muteExempt=\u00a7cTohoto hrace nemuzes umlcet. +mutedPlayer=Hrac {0} byl umlcen. +mutedPlayerFor=Hrac {0} umlcen za {1}. +mutedUserSpeaks={0} se pokusil promluvit, ale je umlcen. +nearbyPlayers=Hraci v okoli: {0} +negativeBalanceError=Hrac nemuze mit zapornou hodnotu uctu. +nickChanged=Nickname zmenen. +nickDisplayName=\u00a77Musis nejdrive povolit change-displayname v Essentials configu. +nickInUse=\u00a7cTento nick jiz nekdo ma. +nickNamesAlpha=\u00a7cNick musi byt alfanumericky. +nickNoMore=\u00a77Uz nemas zadny nick. +nickOthersPermission=\u00a7cNemas opravneni menit ostatnim nick. +nickSet=\u00a77Nyni mas nickname: \u00a7c{0} +noAccessCommand=\u00a7cNemas povoleni na tento prikaz. +noAccessPermission=\u00a7cNemas povoleni k tomuto {0}. +noBreakBedrock=Nemas opravneni nicit bedrock. +noDestroyPermission=\u00a7cNemas povoleni nicit ten {0}. +noDurability=\u00a7cThis item does not have a durability. +noGodWorldWarning=\u00a7cVarovani! God-mode je v tomto svete zakazan. +noHelpFound=\u00a7cZadne shodujici prikazy. +noHomeSet=Nemas nastaveny zadny domov. +noHomeSetPlayer=Hrac nema nastaveny zadny domov. +noKitPermission=\u00a7cPotrebujes \u00a7c{0}\u00a7c permission, aby jsi mohl pouzit tento kit. +noKits=\u00a77Nejsou zadne dostupne kity. +noMail=Nemas zadny mail. +noMotd=\u00a7cNeni zadna zprava dne. +noNewMail=\u00a77Nemas zadny novy mail. +noPendingRequest=Nemas zadne neuzavrene zadosti. +noPerm=\u00a7cNemas \u00a7f{0}\u00a7c permici. +noPermToSpawnMob=\u00a7cNemas povoleni k spawnovani mobu. +noPlacePermission=\u00a7cNemas povoleni pokladat nebo nicit cokoliv blizko teto cedule. +noPowerTools=Nemas zadny mocny nastroj. +noRules=\u00a7cNejsou nastaveny zadne pravidla. +noWarpsDefined=Nejsou nastaveny zadne warpy. +none=zadny +notAllowedToQuestion=\u00a7cNejsi opravnen pouzit otazku. +notAllowedToShout=\u00a7cNejsi opravnen pouzit kriceni. +notEnoughExperience=Nemas dostatek zkusenosti. +notEnoughMoney=Nemas dostatecny financni obnos. +notFlying=not flying +notRecommendedBukkit=* ! * Verze bukkitu neni doporucena pro Essentials. +notSupportedYet=Jeste neni podporovano. +nothingInHand = \u00a7cNedrzis nic v ruce. +now=nyni +nuke=Prsi na tebe smrt :) +numberRequired=Hlupaku, musis vyplnit cislo. +onlyDayNight=/time podporuje pouze day/night. +onlyPlayers=Pouze hraci ve hre mohou pouzit: {0}. +onlySunStorm=/weather podporuje pouze sun/storm. +orderBalances=Usporadavam bohatstvi {0} hracu, prosim vydrz ... +pTimeCurrent=\u00a7eCas hrace u00a7f je {1}. //??? +pTimeCurrentFixed=\u00a7eCas hrace {0} u00a7f je nastaven na {1}. +pTimeNormal=\u00a7eCas hrace {0}\u00a7f je normalni a souhlasi s casem serveru. +pTimeOthersPermission=\u00a7cNejsi opravnen menit cizim hracum cas. +pTimePlayers=Tihle hraci maji nastaveny svuj cas: +pTimeReset=Cas hrace byl obnoven za: \u00a7e{0} +pTimeSet=Cas hrace je nastaven na \u00a73{0}\u00a7f za: \u00a7e{1} +pTimeSetFixed=Cas hrace je fixne nastaven na \u00a73{0}\u00a7f za: \u00a7e{1} +parseError=Chyba pri parsovani {0} na radku {1} +pendingTeleportCancelled=\u00a7cNevyresena zadost o teleportaci byla zrusena. +permissionsError=Chybi Permissions/GroupManager; prefixy/suffixy v chatu budou zablokovany. +playerBanned=\u00a7cAdmin {0} zabanoval {1} za {2} +playerInJail=\u00a7cHrac je jiz uveznen {0}. +playerJailed=\u00a77Hrac {0} byl uveznen. +playerJailedFor= \u00a77Hrac {0} uveznen za {1}. +playerKicked=\u00a7cAdmin {0} vyhodil {1} za {2} +playerMuted=\u00a77Byl jsi umlcen. +playerMutedFor=\u00a77Byl jsi umlcen za {0} +playerNeverOnServer=\u00a7cHrac {0} nebyl nikdy na serveru. +playerNotFound=\u00a7cHrac nenalezen. +playerUnmuted=\u00a77Byl jsi odmlcen. +pong=Pong! +possibleWorlds=\u00a77Mozne svety jsou cisla 0 az {0}. +powerToolAir=Prikaz nemuze byt spojen se vzduchem. +powerToolAlreadySet=Prikaz \u00a7c{0}\u00a7f je jiz spojen s {1}. +powerToolAttach=\u00a7c{0}\u00a7f prikaz pripsan k {1}. +powerToolClearAll=Vsechny mocne nastroje byli smazany. +powerToolList=Hrac {1} ma tyto prikazy: \u00a7c{0}\u00a7f. +powerToolListEmpty={0} nema pripsany zadne prikazy. +powerToolNoSuchCommandAssigned=Prikaz \u00a7c{0}\u00a7f nebyl pripsan k {1}. +powerToolRemove=Prikaz \u00a7c{0}\u00a7f odstranen z {1}. +powerToolRemoveAll=Vsechny prikazy zruseny od {0}. +powerToolsDisabled=Vsechny tve mocne nastroje byli zablokovany. +powerToolsEnabled=Vsechny tve mocne nastroje byli povoleny. +protectionOwner=\u00a76[EssentialsProtect] Majitel ochrany: {0} +questionFormat=\u00a77[Otazka]\u00a7f {0} +readNextPage=Napis /{0} {1} pro precteni dalsi stranky. +reloadAllPlugins=\u00a77Znovu nacteny vsechny pluginy. +removed=\u00a77Odstraneno {0} entitit. +repair=Uspesne jsi opravil svuj nastroj: \u00a7e{0}. +repairAlreadyFixed=\u00a77Tento item nepotrebuje opravu. +repairEnchanted=\u00a77Nemas opravneni opravovat enchantovane itemy. +repairInvalidType=\u00a7cTento item nemuze byt opraven. +repairNone=Nemas zadne itemy, ktere potrebuji opravit. +requestAccepted=\u00a77Zadost o teleport prijata. +requestAcceptedFrom=\u00a77{0} prijal tvou zadost o teleport. +requestDenied=\u00a77Zadost o teleport zamitnuta. +requestDeniedFrom=\u00a77{0} odmitl tvou zadost o teleport. +requestSent=\u00a77Zadost odeslana hraci {0}\u00a77. +requestTimedOut=\u00a7cZadost o teleportaci vyprsela. +requiredBukkit= * ! * Potrebujete minimalne verzi {0} Bukkitu, stahnete si ji z http://dl.bukkit.org/downloads/craftbukkit/ +returnPlayerToJailError=Nastala chyba pri pokusu navraceni hrace {0} do vezeni: {1} +second=sekunda +seconds=sekundy +seenOffline=Hrac {0} je offline od {1} +seenOnline=Hrac {0} je online od {1} +serverFull=Server je plny +serverTotal=Maximum serveru: {0} +setSpawner=Zmenil jsi spawner na: {0} +sheepMalformedColor=Deformovana barva. +shoutFormat=\u00a77[Shout]\u00a7f {0} +signFormatFail=\u00a74[{0}] +signFormatSuccess=\u00a71[{0}] +signFormatTemplate=[{0}] +signProtectInvalidLocation=\u00a74Nemas opravneni vytvaret zde cedule. +similarWarpExist=Warp s podobnym nebo stejnym jmenem jiz existuje. +slimeMalformedSize=Zdeformovana velikost. +soloMob=Tento mob ma rad, kdyz je sam. +spawnSet=\u00a77Spawn-lokace nastavena pro skupinu: {0}. +spawned=spawnut +sudoExempt=Nemuzes ovladat tohoto hrace +sudoRun=Nutis hrace {0} k behu: /{1} {2} +suicideMessage=\u00a77Sbohem kruty svete... +suicideSuccess= \u00a77{0} si vzal svuj zivot +survival=survival +takenFromAccount=\u00a7c{0} bylo odecteno z tveho uctu. +takenFromOthersAccount=\u00a7c{0} bylo odebrano z {1}\u00a7c uctu. Nova hodnota: {2} +teleportAAll=\u00a77Zadost o teleportaci odeslana vsem hracum... +teleportAll=\u00a77Teleportuji v\u00c5\u00a1echny hrace... +teleportAtoB=\u00a77{0}\u00a77 vas teleportoval k {1}\u00a77. +teleportDisabled={0} mas teleportaci zablokovanou. +teleportHereRequest=\u00a7c{0}\u00a7c vas pozadal aby jste se warpnul k nemu. +teleportNewPlayerError=Teleportace noveho hrace selhala +teleportRequest=\u00a7c{0}\u00a7c se chce teleportovat k tobe. +teleportRequestTimeoutInfo=\u00a77Tato zadost vyprsi za {0} sekund. +teleportTop=\u00a77Teleportuji na vrch. +teleportationCommencing=\u00a77Teleportace zahajena... +teleportationDisabled=\u00a77Teleportace zakazana. +teleportationEnabled=\u00a77Teleportace povolena. +teleporting=\u00a77Teleportuji... +teleportingPortal=\u00a77Teleportuji pres portal. +tempBanned=Docasne zabanovany na dobu {0} +tempbanExempt=\u00a77Nemel by jsi docasne zabanovat tohoto hrace. +thunder= Nastavil jsi {0} bouri ve tvem svete. +thunderDuration=Nastavil jsi {0} bouri ve svete po {1} sekund. +timeBeforeHeal=Potrebny cas pro dalsi uzdraveni: {0} +timeBeforeTeleport=Potrebny cas pro dalsi teleport: {0} +timeFormat=\u00a73{0}\u00a7f nebo \u00a73{1}\u00a7f nebo \u00a73{2}\u00a7f +timePattern=(?:([0-9]+)\\s*y[a-z]*[,\\s]*)?(?:([0-9]+)\\s*mo[a-z]*[,\\s]*)?(?:([0-9]+)\\s*w[a-z]*[,\\s]*)?(?:([0-9]+)\\s*d[a-z]*[,\\s]*)?(?:([0-9]+)\\s*h[a-z]*[,\\s]*)?(?:([0-9]+)\\s*m[a-z]*[,\\s]*)?(?:([0-9]+)\\s*(?:s[a-z]*)?)? +timeSet=Cas nastaven ve vsech svetech. +timeSetPermission=\u00a7cNejsi autorizovany ke zmene casu. +timeWorldCurrent=Ve svete {0} je prave \u00a73{1} +timeWorldSet=Cas byl nastaven na {0} ve: \u00a7c{1} +tps=Current TPS = {0} +tradeCompleted=\u00a77Vymena kompletni. +tradeSignEmpty=Tato cedule jiz nema dostupny material na vymenu. +tradeSignEmptyOwner=Na teto ceduli dosel material. +treeFailure=\u00a7cNepodarilo se vytvorit strom. Zkus to znovu na trave nebo hline. +treeSpawned=\u00a77Strom vytvoren. +true=\u00a72true\u00a7f +typeTpaccept=\u00a77Pro prijmuti zadosti napis \u00a7c/tpaccept\u00a77. +typeTpdeny=\u00a77Pokud chces odmitnout zadost napis \u00a7c/tpdeny\u00a77. +typeWorldName=\u00a77Muzes take napsat specificky nazev sveta. +unableToSpawnMob=Nemozne spawnout moba. +unbannedIP=Unbanovana IP adresa. +unbannedPlayer=Hrac odbanovan. +unignorePlayer=Prestal jsi ignorovat hrace {0}. +unknownItemId=Nezname ID itemu: {0} +unknownItemInList=Neznamy item {0} v {1} seznamu. +unknownItemName=Neznamy nazev itemu: {0} +unlimitedItemPermission=\u00a7cNemas opravneni pro neomezeny item: {0}. +unlimitedItems=Neomezene itemy: +unmutedPlayer=Hrac {0} byl umlcen. +unvanished=\u00a7aYou are once again visible. +unvanishedReload=\u00a7cA reload has forced you to become visible. +upgradingFilesError=Chyba pri updatovani souboru. +userDoesNotExist=Uzivatel {0} neexistuje. +userIsAway={0} je AFK. +userIsNotAway={0} se vratil. +userJailed=\u00a77Byl jsi uveznen. +userUsedPortal={0} pouzil portal pro vychod. +userdataMoveBackError=Chyba pri pokusu o presun userdata/{0}.tmp do userdata/{1} +userdataMoveError=Chyba pri pokusu o presun userdata/{0} do userdata/{1}.tmp +usingTempFolderForTesting=Pouzivam docasnou slozku pro testovani: +vanished=\u00a7aYou have now been vanished. +versionMismatch=Chyba verzi! Prosim updatuj {0} na stejnou verzi. +versionMismatchAll=Chyba verzi! Prosim, updatuj vsechny Essentials .jar na stejnou verzi. +voiceSilenced=\u00a77Byl jsi ztisen. +warpDeleteError=Vyskytl se problem pri mazani warpu. +warpListPermission=\u00a7cNemas opravneni listovat warpami. +warpNotExist=Tento warp neexistuje. +warpOverwrite=\u00a7cNemuzes prepsat tento warp. +warpSet=\u00a77Warp {0} vytvoren. +warpUsePermission=\u00a7cNemas opravneni pouzit tento warp. +warpingTo=\u00a77Warpuji te do {0}. +warps=Warpy: {0} +warpsCount=\u00a77Mame zde {0} warpu. Strana {1} z {2}. +weatherStorm=\u00a77Nastavil jsi bourku v {0} +weatherStormFor=\u00a77Nastavil jsi bourku v {0} na {1} sekund. +weatherSun=\u00a77Nastavil jsi slunecne pocasi v {0} +weatherSunFor=\u00a77Nastavil jsi slunecne pocasi v {0} na {1} sekund +whoisAFK=\u00a76 - AFK:\u00a7f {0} +whoisBanned=\u00a76 - Zabanovan:\u00a7f {0} +whoisExp=\u00a76 - Exp:\u00a7f {0} (Uroven {1}) +whoisFly=\u00a76 - Fly mode:\u00a7f {0} ({1}) +whoisGamemode=\u00a76 - Herni mod:\u00a7f {0} +whoisGeoLocation=\u00a76 - Puvod:\u00a7f {0} +whoisGod=\u00a76 - God mode:\u00a7f {0} +whoisHealth=\u00a76 - Zdravi:\u00a7f {0}/20 +whoisIPAddress=\u00a76 - IP Adresa:\u00a7f {0} +whoisJail=\u00a76 - Jail:\u00a7f {0} +whoisLocation=\u00a76 - Pozice:\u00a7f ({0}, {1}, {2}, {3}) +whoisMoney=\u00a76 - Penize:\u00a7f {0} +whoisMuted=\u00a76 - Muted:\u00a7f {0} +whoisNick=\u00a76 - Nick:\u00a7f {0} +whoisOp=\u00a76 - OP:\u00a7f {0} +whoisTop=\u00a76 ====== WhoIs:\u00a7f {0} \u00a76====== +worth=\u00a77Stack {0} ceny \u00a7c{1}\u00a77 ({2} kus(u) za {3} kus) +worthMeta=\u00a77Stack {0} s metadaty {1} ceny \u00a7c{2}\u00a77 ({3} kus(u) za {4} kus) +worthSet=Hodnota ceny nastavena +year=rok +years=roky +youAreHealed=\u00a77Byl jsi uzdraven. +youHaveNewMail=\u00a7cMas {0} zprav!\u00a7f Napis \u00a77/mail read\u00a7f aby jsi si precetl sve zpravy. diff --git a/Essentials/src/messages_da.properties b/Essentials/src/messages_da.properties index 698388590..cb1ee1056 100644 --- a/Essentials/src/messages_da.properties +++ b/Essentials/src/messages_da.properties @@ -12,6 +12,7 @@ alertUsed=brugte: autoAfkKickReason=Du er blevet kicked for at idle mere end {0} minutter. backAfterDeath=\u00a77Brug /back kommandoen for at teleportere til dit d\u00f8dspunkt. backUsageMsg=\u00a77Teleporterer til tidligere placering. +backupDisabled=An external backup script has not been configured. backupFinished=Backup sluttet backupStarted=Backup startet balance=\u00a77Saldo: {0} @@ -34,6 +35,7 @@ cantFindGeoIpDB=Kan ikke finde GeoIP database! cantReadGeoIpDB=Fejl ved afl\u00e6sning af GeoIP database! cantSpawnItem=\u00a7cDu har ikke tilladelse til at skabe tingen.{0} chatTypeLocal=[L] +chatTypeAdmin=[A] chatTypeSpy=[Spy] commandFailed=Kommandoen {0} fejlede: commandHelpFailedForPlugin=Fejl ved hentning af hj\u00e6lp til: {0} @@ -41,7 +43,7 @@ commandNotLoaded=\u00a7cKommando {0} er ikke indl\u00e6st korrekt. compassBearing=\u00a77B\u00e6rer: {0} ({1} grader). (Oversat korrekt?) configFileMoveError=Kunne ikke flytte config.yml til backup placering. configFileRenameError=Kunne ikke omd\u00f8be temp fil til config.yml -connectedPlayers=Tilsluttede spillere: +connectedPlayers=Tilsluttede spillere: connectionFailed=Kunne ikke \u00e5bne forbindelse. cooldownWithMessage=\u00a7cCooldown: {0} corruptNodeInConfig=\u00a74Notits: Din konfigurationsfil har en korrupt {0} linje. @@ -50,6 +52,7 @@ creatingConfigFromTemplate=Opretter config fra skabelon: {0} creatingEmptyConfig=Opretter tom config: {0} creative=creative currency={0}{1} +currentWorld=Current World: {0} day=dag days=dage defaultBanReason=Banhammeren har talt! @@ -71,6 +74,7 @@ disabledToSpawnMob=Skabelse af denne mob er deaktiveret i configfilen. dontMoveMessage=\u00a77Teleportering vil begynde om {0}. Bev\u00e6g dig ikke. downloadingGeoIp=Downloader GeoIP database... det her kan tage et stykke tid (land: 0.6 MB, by: 27MB) duplicatedUserdata=Duplikerede userdata: {0} og {1} +durability=\u00a77This tool has \u00a7c{0}\u00a77 uses left enableUnlimited=\u00a77Giver ubegr\u00e6nset m\u00e6ngde af {0} til {1}. enabled=aktiveret enchantmentApplied = \u00a77Enchantment {0} er blevet tilf\u00c3\u00b8jet til tingen i din h\u00c3\u00a5nd. @@ -83,15 +87,19 @@ errorWithMessage=\u00a7cFejl: {0} essentialsHelp1=Denne fil er \u00c3\u00b8delagt og Essentials kan ikke \u00c3\u00a5bne den. Essentials er nu deaktiveret. Kan du ikke ordne denne fil selv, kan du f\u00c3\u00a5 hj\u00c3\u00a6lp p\u00c3\u00a5 http://tiny.cc/EssentialsChat essentialsHelp2=Filen er \u00c3\u00b8delagt og Essentials kan ikke \u00c3\u00a5bne den. Essentials er nu deaktiveret. Kan du ikke ordne denne fil selv, skriv enten /essentialshelp ingame eller f\u00c3\u00a5 hj\u00c3\u00a6lp p\u00c3\u00a5 http://tiny.cc/EssentialsChat essentialsReload=\u00a77Essentials Genindl\u00e6st {0}. +exp=\u00a7c{0} \u00a77has\u00a7c {1} \u00a77exp (level\u00a7c {2}\u00a77) and needs\u00a7c {3} \u00a77more exp to level up. +expSet=\u00a7c{0} \u00a77now has\u00a7c {1} \u00a77exp. extinguish=\u00a77Du slukkede ilden i dig selv. extinguishOthers=\u00a77Du slukkede ilden i {0}. failedToCloseConfig=Fejlede i at lukke config {0} failedToCreateConfig=Fejlede i oprettelse af config {0} failedToWriteConfig=Fejlede i at skrive til config {0} -false=false +false=\u00a74false\u00a7f feed=\u00a77Your appetite was sated. feedOther=\u00a77Satisfied {0}. fileRenameError=Omd\u00c3\u00b8bning af fil {0} fejlede. +flyMode=\u00a77Set fly mode {0} for {1}. +flying=flying foreverAlone=\u00a7cDu har ingen til hvem du kan svare. freedMemory=Frigjorde {0} MB. gameMode=\u00a77Satte game mode {0} for {1}. @@ -106,13 +114,20 @@ geoipJoinFormat=Spilleren {0} kommer fra {1} godDisabledFor=deaktiveret for {0} godEnabledFor=aktiveret for {0} godMode=\u00a77Gud mode {0}. +hatArmor=\u00a7cError, you cannot use this item as a hat! +hatEmpty=\u00a7cYou are not wearing a hat. +hatFail=\u00a7cYou must have something to wear in your hand. +hatPlaced=\u00a7eEnjoy your new hat! haveBeenReleased=\u00a77Du er blevet l\u00f8sladt heal=\u00a77Du er blevet healed. healOther=\u00a77Healed {0}. helpConsole=For at se hj\u00e6lp fra konsolen, skriv ?. +helpFrom=\u00a77Commands from {0}: helpLine=\u00a76/{0}\u00a7f: {1} +helpMatching=\u00a77Commands matching "{0}": helpOp=\u00a7c[HelpOp]\u00a7f \u00a77{0}:\u00a7f {1} helpPages=Side \u00a7c{0}\u00a7f af \u00a7c{1}\u00a7f: +helpPlugin=\u00a74{0}\u00a7f: Plugin Help: /help {1} holeInFloor=Hul i gulv homeSet=\u00a77Hjem sat. homeSetToBed=\u00a77Dit hjem er nu sat til denne seng. @@ -124,7 +139,7 @@ illegalDate=Forkert datoformat. infoChapter=V\u00e6lg kapitel: infoChapterPages=Kapitel {0}, side \u00a7c{1}\u00a7f af \u00a7c{2}\u00a7f: infoFileDoesNotExist=Fil info.txt eksisterer ikke. Fixer liiige en for dig. -infoPages=Side \u00a7c{0}\u00a7f af \u00a7c{1}\u00a7f: +infoPages=\u00a7e ---- \u00a76{2} \u00a7e--\u00a76 Side \u00a74{0}\u00a76/\u00a74{1} \u00a7e---- infoUnknownChapter=Ukendt kapitel. invBigger=Den anden brugers inventory er st\u00f8rre end din. invRestored=Din inventory er blevet genoprettet. @@ -159,12 +174,13 @@ jailSet=\u00a77F\u00e6ngsel {0} er blevet sat. jumpError=Dette vil skade din computer''s hjerne. kickDefault=Kicked fra serveren. kickExempt=\u00a77Du kan ikke kicke denne spiller. +kickedAll=\u00a7cKicked all players from server kill=\u00a77dr\u00e6bte {0}. kitError2=\u00a7cDette kit eksisterer ikke eller er forkert defineret. kitError=\u00a7cDer er ikke nogen gyldige kits. kitErrorHelp=\u00a7cM\u00e5ske mangler en ting en m\u00e6ngde i konfigurationen? Eller m\u00c3\u00a5ske er der nisser p\u00c3\u00a5 spil? kitGive=\u00a77Giver kit til {0} (oversat korrekt?). -InvFull=\u00a7cYour inventory was full, dropping items on the floor +kitInvFull=\u00a7cDin inventory er fuld, placerer kit p\u00e5 gulvet. kitTimed=\u00a7cDu kan ikke benytte dette kit igen i {0}. kits=\u00a77Kits: {0} lightningSmited=\u00a77Du er blevet ramt af Guds vrede (din admin) @@ -205,7 +221,6 @@ mutedPlayer=Spiller {0} muted. mutedPlayerFor=Spiller {0} muted i {1}. mutedUserSpeaks={0} pr\u00f8vede at snakke, men er muted. nearbyPlayers=Spillere i n\u00c3\u00a6rheden: {0} -needTpohere=Du skal have adgang til /tpohere for at teleportere andre spillere. negativeBalanceError=Brugeren har ikke tilladelse til at have en negativ saldo. nickChanged=Nickname \u00e6ndret. nickDisplayName=\u00a77Du bliver n\u00c3\u00b8dt til at aktivere change-displayname i Essentials config. @@ -218,6 +233,7 @@ noAccessCommand=\u00a7cDu har ikke adgang til denne kommando. noAccessPermission=\u00a7cDu har ikke tilladelse til at f\u00e5 adgang til {0}. noBreakBedrock=You are not allowed to destroy bedrock. noDestroyPermission=\u00a7cDu har ikke tilladelse til at \u00f8del\u00e6gge {0}. +noDurability=\u00a7cThis item does not have a durability. noGodWorldWarning=\u00a7cAdvarsel! God mode er sl\u00c3\u00a5et fra i denne verden. noHelpFound=\u00a7cIngen matchende kommandoer. noHomeSet=Du har sat et nyt hjem. @@ -239,6 +255,7 @@ notAllowedToQuestion=\u00a7cDu har ikke tilladelse til at bruge sp\u00f8rgsm\u00 notAllowedToShout=\u00a7cDu har ikke tilladelse til at r\u00e5be. notEnoughExperience=You do not have enough experience. notEnoughMoney=Du har ikke tilstr\u00e6kkeligt med penge. +notFlying=not flying notRecommendedBukkit=* ! * Bukkit version er ikke den anbefalede build til Essentials. notSupportedYet=Ikke underst\u00f8ttet endnu. nothingInHand = \u00a7cDu har intet i din h\u00c3\u00a5nd. @@ -299,11 +316,10 @@ requestDenied=\u00a77Anmodning om teleport afvist. requestDeniedFrom=\u00a77{0} afviste din anmodning om teleport. requestSent=\u00a77Anmodning sendt til {0}\u00a77. requestTimedOut=\u00a7cTeleport request has timed out -requiredBukkit=* ! * You need atleast build {0} of CraftBukkit, download it from http://ci.bukkit.org. +requiredBukkit= * ! * You need atleast build {0} of CraftBukkit, download it from http://dl.bukkit.org/downloads/craftbukkit/ returnPlayerToJailError=Error occurred when trying to return player {0} to jail: {1} second=sekund seconds=sekunder -seenBanReason=Reason: {0} seenOffline=Spilleren {0} har v\u00c3\u00a6ret offline i {1} seenOnline=Spilleren {0} har v\u00c3\u00a6ret online i {1} serverFull=Serveren er sgu fuld. Den b\u00c3\u00b8r melde sig til AA. @@ -334,7 +350,6 @@ teleportDisabled={0} har ikke teleportation aktiveret. teleportHereRequest=\u00a7c{0}\u00a7c har anmodet om, at du teleporterer dig til ham/hende. teleportNewPlayerError=Fejlede ved teleportering af ny spiller teleportRequest=\u00a7c{0}\u00a7c har anmodet om at teleportere til dig. -teleportRequestsCancelledWorldChange=\u00a77Pending teleport requests have been cancelled on world change. teleportRequestTimeoutInfo=\u00a77This request will timeout after {0} seconds. teleportTop=\u00a77Teleporterer til toppen. teleportationCommencing=\u00a77Teleport begynder... @@ -354,12 +369,13 @@ timeSet=Tid \u00c3\u00a6ndret i alle verdener. timeSetPermission=\u00a7cDu har ikke tilladelse til at \u00c3\u00a6ndre tiden. timeWorldCurrent=Tiden p\u00c3\u00a5 nuv\u00c3\u00a6rende tidspunkt i {0} er \u00a73{1} timeWorldSet=Tiden blev \u00c3\u00a6ndret til {0} i: \u00a7c{1} +tps=Current TPS = {0} tradeCompleted=\u00a77Handel gennemf\u00f8rt. tradeSignEmpty=Handelsskiltet har udsolgt! tradeSignEmptyOwner=Der er intet at hente ved dette handelsskilt. treeFailure=\u00a7cTr\u00e6 genereringsfejl. Pr\u00f8v igen p\u00e5 gr\u00e6s eller jord. treeSpawned=\u00a77Tr\u00e6 spawned. -true=true +true=\u00a72true\u00a7f typeTpaccept=\u00a77For at teleportere, skriv \u00a7c/tpaccept\u00a77. typeTpdeny=\u00a77For at n\u00e6gte denne anmodning om teleport, skriv \u00a7c/tpdeny\u00a77. typeWorldName=\u00a77Du kan ogs\u00e5 skrive navnet p\u00e5 en specifik verden. @@ -373,6 +389,8 @@ unknownItemName=Ukendt ting navn: {0} unlimitedItemPermission=\u00a7cIngen tilladelse til ubegr\u00e6nset ting {0}. unlimitedItems=Ubegr\u00c3\u00a6nsede ting: unmutedPlayer=Spilleren {0} unmuted. +unvanished=\u00a7aYou are once again visible. +unvanishedReload=\u00a7cA reload has forced you to become visible. upgradingFilesError=Fejl under opgradering af filerne. userDoesNotExist=Brugeren {0} eksisterer ikke. userIsAway={0} er nu AFK. Skub ham i havet eller bur ham inde! @@ -382,35 +400,39 @@ userUsedPortal={0} brugte en eksisterende udgangsportal. userdataMoveBackError=Kunne ikke flytte userdata/{0}.tmp til userdata/{1} userdataMoveError=Kunne ikke flytte userdata/{0} til userdata/{1}.tmp usingTempFolderForTesting=Bruger temp-mappe til testing: +vanished=\u00a7aYou have now been vanished. versionMismatch=Versioner matcher ikke! Opdater venligst {0} til den nyeste version. versionMismatchAll=Versioner matcher ikke! Opdater venligst alle Essentials jar-filer til samme version. voiceSilenced=\u00a77Din stemme er blevet gjort stille. warpDeleteError=Ah, shit; kunne sgu ikke fjerne warp-filen. Jeg giver en \u00c3\u00b8l i lufthavnen. warpListPermission=\u00a7cDu har ikke tilladelse til at vise listen over warps. warpNotExist=Den warp eksisterer ikke. +warpOverwrite=\u00a7cYou cannot overwrite that warp. warpSet=\u00a77Warp {0} sat. warpUsePermission=\u00a7cDu har ikke tilladelse til at benytte den warp. warpingTo=\u00a77Warper til {0}. warps=Warps: {0} warpsCount=\u00a77Der er {0} warps. Viser side {1} af {2}. -warpOverwrite=\u00a7cYou cannot overwrite that warp. weatherStorm=\u00a77Du har sat vejret til ''storm'' i {0} weatherStormFor=\u00a77Du har sat vejret til ''storm'' i {0} i {1} sekunder weatherSun=\u00a77Du har sat vejret til ''sol'' i {0} weatherSunFor=\u00a77Du har sat vejret til ''sol'' i {0} i {1} sekunder -whoisBanned=\u00a79 - Banned: {0} -whoisGamemode=\u00a79 - Gamemode: {0} -whoisGeoLocation=\u00a79 - Placering: {0} -whoisGod=\u00a79 - God mode: {0} -whoisHealth=\u00a79 - Health: {0}/20 -whoisIPAddress=\u00a79 - IP-Adresse: {0} -whoisIs={0} er {1} -whoisJail=\u00a79 - Jail: {0} -whoisLocation=\u00a79 - Placering: ({0}, {1}, {2}, {3}) -whoisMoney=\u00a79 - Saldo: {0} -whoisOP=\u00a79 - OP: {0} -whoisStatusAvailable=\u00a79 - Status: Tilg\u00e6ngelig -whoisStatusAway=\u00a79 - Status: \u00a7cAFK\u00a7f +whoisAFK=\u00a76 - AFK:\u00a7f {0} +whoisBanned=\u00a76 - Banned:\u00a7f {0} +whoisExp=\u00a76 - Exp:\u00a7f {0} (Level {1}) +whoisFly=\u00a76 - Fly mode:\u00a7f {0} ({1}) +whoisGamemode=\u00a76 - Gamemode:\u00a7f {0} +whoisGeoLocation=\u00a76 - Placering:\u00a7f {0} +whoisGod=\u00a76 - God mode:\u00a7f {0} +whoisHealth=\u00a76 - Health:\u00a7f {0}/20 +whoisIPAddress=\u00a76 - IP-Adresse:\u00a7f {0} +whoisJail=\u00a76 - Jail:\u00a7f {0} +whoisLocation=\u00a76 - Placering:\u00a7f ({0}, {1}, {2}, {3}) +whoisMoney=\u00a76 - Saldo:\u00a7f {0} +whoisMuted=\u00a76 - Muted:\u00a7f {0} +whoisNick=\u00a76 - Nick:\u00a7f {0} +whoisOp=\u00a76 - OP:\u00a7f {0} +whoisTop=\u00a76 ====== WhoIs:\u00a7f {0} \u00a76====== worth=\u00a77Stack af {0} er v\u00e6rd \u00a7c{1}\u00a77 ({2} ting for {3} pr. stk.) worthMeta=\u00a77Stack af {0} med metadata af {1} er v\u00e6rd \u00a7c{2}\u00a77 ({3} ting for {4} pr. stk.) worthSet=V\u00e6rdi \u00c3\u00a6ndret. @@ -418,4 +440,5 @@ year=\u00e5r years=\u00e5r youAreHealed=\u00a77Du er blevet healed. Halleluja! youHaveNewMail=\u00a7cDu har {0} flaskeposter!\u00a7f Type \u00a77/mail read for at se din flaskepost. - +hatRemoved=\u00a7eYour hat has been removed. +banFormat=Banned: {0} diff --git a/Essentials/src/messages_de.properties b/Essentials/src/messages_de.properties index 18df0260b..5b6c8d95d 100644 --- a/Essentials/src/messages_de.properties +++ b/Essentials/src/messages_de.properties @@ -1,7 +1,7 @@ -#version: ${build.number} +# version: 2.9.2 # Single quotes have to be doubled: '' # Translations start here -# by: +# by: xGhOsTkiLLeRx action=* {0} {1} addedToAccount=\u00a7a{0} wurden zu deiner Geldb\u00f6rse hinzugef\u00fcgt. addedToOthersAccount=\u00a7a{0} added to {1}\u00a7a account. New balance: {2} @@ -12,6 +12,7 @@ alertUsed=benutzt: autoAfkKickReason=Du wurdest gekickt, weil du f\u00fcr {0} Minuten inaktiv warst. backAfterDeath=\u00a77Benutze den Befehl /back um zu deinem Todespunkt zur\u00fcck zu kehren. backUsageMsg=\u00a77Kehre zur letzten Position zur\u00fcck. +backupDisabled=Ein externes Backup-Skript wurde nicht konfiguriert. backupFinished=Backup beendet backupStarted=Backup gestartet balance=\u00a77Geldb\u00f6rse: {0} @@ -23,8 +24,8 @@ bannedIpsFileNotFound=banned-ips.txt nicht gefunden bannedPlayersFileError=Fehler beim Lesen von banned-players.txt bannedPlayersFileNotFound=banned-players.txt nicht gefunden bigTreeFailure=\u00a7cFehler beim Pflanzen eines grossen Baums. Versuch es auf Gras oder Dreck. -bigTreeSuccess= \u00a77Grosser Baum gepflanzt. -blockList=Essentials relayed the following commands to another plugin: +bigTreeSuccess= \u00a77Grossen Baum gepflanzt. +blockList=Essentials hat dieses Kommando an ein anderes Plugin weitergeleitet: broadcast=[\u00a7cRundruf\u00a7f]\u00a7a {0} buildAlert=\u00a7cDu hast keine Rechte zum Bauen. bukkitFormatChanged=Bukkit-Versionsformat hat sich ge\u00e4ndert. Version nicht kontrolliert. @@ -34,6 +35,7 @@ cantFindGeoIpDB=Kann GeoIP-Datenbank nicht finden! cantReadGeoIpDB=Fehler beim Einlesen der GeoIP-Datenbank! cantSpawnItem=\u00a7cDu darfst {0} nicht erzeugen. chatTypeLocal=[L] +chatTypeAdmin=[A] chatTypeSpy=[Spy] commandFailed=Befehl {0} scheiterte: commandHelpFailedForPlugin=Fehler beim Abrufen der Hilfe f\u00fcr: {0} @@ -41,15 +43,16 @@ commandNotLoaded=\u00a7cBefehl {0} ist nicht richtig geladen. compassBearing=\u00a77Peilung: {0} ({1} Grad). configFileMoveError=Verschieben von config.yml in den Sicherheitskopien-Ordner gescheitert. configFileRenameError=Verschieben einer tempor\u00e4ren Datei nach config.yml gescheitert. -connectedPlayers=Verbundene Spieler: +connectedPlayers=Verbundene Spieler: connectionFailed=Fehler beim Verbindungsaufbau. cooldownWithMessage=\u00a7cBeschr\u00e4nkung: {0} corruptNodeInConfig=\u00a74Hinweis: Deine Konfigurationsdatei hat einen ung\u00fcltigen Knoten {0}. couldNotFindTemplate=Vorlage {0} konnte nicht gefunden werden. creatingConfigFromTemplate=Erstelle Konfiguration aus Vorlage: {0} creatingEmptyConfig=Erstelle leere Konfiguration: {0} -creative=creative +creative=Creative currency={0}{1} +currentWorld=Aktuelle Welt: {0} day=Tag days=Tage defaultBanReason=Der Bann-Hammer hat gesprochen! @@ -64,37 +67,42 @@ dependancyNotFound=[Essentials] Eine erforderliche Abh\u00e4ngigkeit wurde nicht depth=\u00a77Du bist auf Meeresh\u00f6he. depthAboveSea=\u00a77Du bist {0} Bl\u00f6cke \u00fcber Meeresh\u00f6he. depthBelowSea=\u00a77Du bist {0} Bl\u00f6cke unter Meeresh\u00f6he. -destinationNotSet=Ziel nicht gesetzt +destinationNotSet=Ziel nicht gesetzt. disableUnlimited=\u00a77Deaktiviere unendliches Platzieren von {0} f\u00fcr {1}. disabled=deaktiviert -disabledToSpawnMob=Spawning this mob was disabled in the config file. +disabledToSpawnMob=Dieser Mob Typ wurde in der Konfiguration deaktiviert. dontMoveMessage=\u00a77Teleportvorgang startet in {0}. Beweg dich nicht. downloadingGeoIp=Lade GeoIP-Datenbank ... dies kann etwas dauern (country: 0.6 MB, city: 20MB) duplicatedUserdata=Doppelte Datei in userdata: {0} und {1} +durability=\u00a77Dieses Werkzeug hat \u00a7c{0}\u00a77 Benutzungen \u00fcbrig. enableUnlimited=\u00a77Gebe {1} unendliche Mengen von {0}. enabled=aktiviert -enchantmentApplied = \u00a77The enchantment {0} has been applied to your item in hand. -enchantmentNotFound = \u00a7cEnchantment not found -enchantmentPerm = \u00a7cYou do not have the permission for {0} -enchantmentRemoved = \u00a77The enchantment {0} has been removed from your item in hand. -enchantments = \u00a77Enchantments: {0} +enchantmentApplied = \u00a77Die Verzauberung {0} wurde auf den Gegenstand in deiner Hand angewendet. +enchantmentNotFound = \u00a7cVerzauberung nicht gefunden. +enchantmentPerm = \u00a7cDu hast nicht die Berechtigung f\u00fcr die Verzauberung {0} +enchantmentRemoved = \u00a77Die Verzauberung {0} wurde von dem Gegenstand in deiner Hand entfernt. +enchantments = \u00a77Verzauberungen: {0} errorCallingCommand=Fehler beim Aufrufen des Befehls /{0} errorWithMessage=\u00a7cFehler: {0} -essentialsHelp1=The file is broken and Essentials can't open it. Essentials is now disabled. If you can't fix the file yourself, go to http://tiny.cc/EssentialsChat -essentialsHelp2=The file is broken and Essentials can't open it. Essentials is now disabled. If you can't fix the file yourself, either type /essentialshelp in game or go to http://tiny.cc/EssentialsChat +essentialsHelp1=Die Datei ist kaputt und Essentials kann sie nicht \u00f6ffnen. Essentials wird nun deaktiviert. Wenn du die Datei nicht selber reparieren kannst, gehe auf http://tiny.cc/EssentialsChat +essentialsHelp2=Die Datei ist kaputt und Essentials kann sie nicht \u00f6ffnen. Essentials wird nun deaktiviert. Wenn du die Datei nicht selber reparieren kannst, tippe entweder /essentialshelp oder gehe auf http://tiny.cc/EssentialsChat essentialsReload=\u00a77Essentials neu geladen {0} +exp=\u00a7c{0} \u00a77hat\u00a7c {1} \u00a77Erfahrungspunkte (Level\u00a7c {2}\u00a77) und braucht noch \u00a7c {3} \u00a77 Erfahrungspunkte zum Levelaufstieg. +expSet=\u00a7c{0} \u00a77hat nun\u00a7c {1} \u00a77Erfahrungspunkte. extinguish=\u00a77Du hast dich selbst gel\u00f6scht. extinguishOthers=\u00a77Du hast {0} gel\u00f6scht. failedToCloseConfig=Fehler beim Schliessen der Konfiguration {0} failedToCreateConfig=Fehler beim Erstellen der Konfiguration {0} failedToWriteConfig=Fehler beim Schreiben der Konfiguration {0} -false=false -feed=\u00a77Your appetite was sated. -feedOther=\u00a77Satisfied {0}. +false=\u00a74nein\u00a7f +feed=\u00a77Dein Hunger wurde gestillt. +feedOther={0} \u00a77gef\u00fcttert. fileRenameError=Umbenennen von {0} gescheitert. +flyMode=\u00a77Fliegen {0} f\u00fcr {1}. +flying=fliegt gerade foreverAlone=\u00a7cDu hast niemanden, dem du antworten kannst. freedMemory={0} MB frei gemacht. -gameMode=\u00a77Set game mode {0} for {1}. +gameMode=\u00a77Spielmodus von {1} \u00a77ge\u00e4ndert in {0}. gcchunks= Chunks, gcentities= Einheiten gcfree=Freier Speicher: {0} MB @@ -106,13 +114,20 @@ geoipJoinFormat=Spieler {0} kommt aus {1} godDisabledFor=deaktiviert f\u00fcr {0} godEnabledFor=aktiviert f\u00fcr {0} godMode=\u00a77Unsterblichkeit {0}. +hatArmor=\u00a7cFehler, du kannst dieses Item nicht als Hut tragen. +hatEmpty=\u00a7cDu tr\u00e4gst keinen Hut. +hatFail=\u00a7cDu musst etwas in der Hand halten! +hatPlaced=\u00a7eViel Spass mit deinem Hut. haveBeenReleased=\u00a77Du wurdest frei gelassen. heal=\u00a77Du wurdest geheilt. healOther=\u00a77{0} geheilt. helpConsole=Um die Hilfe der Konsole zu sehen, schreibe ?. +helpFrom=\u00a77Kommandos von {0}: helpLine=\u00a76/{0}\u00a7f: {1} +helpMatching=\u00a77Kommandos \u00fcbereinstimmend mit "{0}": helpOp=\u00a7c[Hilfe]\u00a7f \u00a77{0}:\u00a7f {1} helpPages=Seite \u00a7c{0}\u00a7f von \u00a7c{1}\u00a7f: +helpPlugin=\u00a74{0}\u00a7f: Plugin Hilfe: /help {1} holeInFloor=Loch im Boden homeSet=\u00a77Zuhause gesetzt. homeSetToBed=\u00a77Dein Zuhause ist nun an diesem Bett. @@ -124,15 +139,14 @@ illegalDate=Ung\u00fcltiges Datumsformat. infoChapter=W\u00e4hle Kapitel: infoChapterPages=Kapitel {0}, Seite \u00a7c{1}\u00a7f von \u00a7c{2}\u00a7f: infoFileDoesNotExist=Datei info.txt existiert nicht. Erzeuge eine neue Datei. -infoPages=Seite \u00a7c{0}\u00a7f von \u00a7c{1}\u00a7f: +infoPages=\u00a7e ---- \u00a76{2} \u00a7e--\u00a76 Seite \u00a74{0}\u00a76/\u00a74{1} \u00a7e---- infoUnknownChapter=Unbekanntes Kapitel: invBigger=Das andere Inventar ist gr\u00f6sser als deins. -InvFull=\u00a7cYour inventory was full, dropping items on the floor invRestored=Dein Inventar wurde wieder hergestellt. invSee=Du siehst das Inventar von {0}. invSeeHelp=Benutze /invsee um dein Inventar wiederherzustellen. invalidCharge=\u00a7cUng\u00fcltige Verf\u00fcgung. -invalidHome=Home {0} doesn't exist +invalidHome=Zuhause {0} existiert nicht. invalidMob=Ung\u00fcltiger Monstername. invalidServer=Ung\u00fcltiger Server! invalidSignLine=Die Zeile {0} auf dem Schild ist falsch. @@ -150,7 +164,7 @@ itemSold=\u00a77Verkauft f\u00fcr \u00a7c{0}\u00a77 ({1} {2} Einheiten je {3}) itemSoldConsole={0} verkauft {1} f\u00fcr \u00a77{2}\u00a77 ({3} Einheiten je {4}) itemSpawn=\u00a77Gebe {0}x {1} itemsCsvNotLoaded=Konnte items.csv nicht laden. -jailAlreadyIncarcerated=\u00a7cPerson is already in jail: {0} +jailAlreadyIncarcerated=\u00a7cDie Person ist schon im Gef\u00e4ngnis: {0} jailMessage=\u00a7cDu hast ein Verbrechen begangen, also hast du Zeit. jailNotExist=Dieses Gef\u00e4ngnis existiert nicht. jailReleased=\u00a77Spieler \u00a7e{0}\u00a77 wurde freigelassen. @@ -160,11 +174,13 @@ jailSet=\u00a77Gef\u00e4ngnis {0} wurde erstellt. jumpError=Das w\u00fcrde deinen Computer \u00fcberlasten. kickDefault=Vom Server geworfen kickExempt=\u00a7cDu kannst diesen Spieler nicht rauswerfen. +kickedAll=\u00a7cAlle Spieler vom Server geworfen. kill=\u00a77{0} get\u00f6tet. kitError2=\u00a7cDiese Ausr\u00fcstung existiert nicht oder ist ung\u00fcltig. kitError=\u00a7cEs gibt keine g\u00fcltigen Ausr\u00fcstungen. kitErrorHelp=\u00a7cEventuell fehlt bei einem Gegenstand die Menge? kitGive=\u00a77Gebe Ausr\u00fcstung {0}. +kitInvFull=\u00a7cDein Inventar ist voll, lege Ausr\u00fcstung auf den Boden kitTimed=\u00a7cDu kannst diese Ausr\u00fcstung nicht innerhalb von {0} anfordern. kits=\u00a77Ausr\u00fcstungen: {0} lightningSmited=\u00a77Du wurdest gepeinigt. @@ -191,7 +207,7 @@ missingItems=Du ben\u00f6tigst {0}x {1}. missingPrefixSuffix=Prefix/Suffix fehlt f\u00fcr {0} mobSpawnError=Fehler beim \u00e4ndern des Monster-Spawner. mobSpawnLimit=Anzahl an Monster auf Serverlimit beschr\u00e4nkt -mobSpawnTarget=Zielblock, muss ein Monster-Spawner sein. +mobSpawnTarget=Zielblock muss ein Monster-Spawner sein. mobsAvailable=\u00a77Mobs: {0} moneyRecievedFrom=\u00a7a{1} hat dir {0} gegeben. moneySentTo=\u00a7aDu hast {1} {0} gegeben. @@ -201,11 +217,10 @@ months=Monate moreThanZero=Anzahl muss gr\u00f6sser als 0 sein. msgFormat=\u00a77[{0}\u00a77 -> {1}\u00a77] \u00a7f{2} muteExempt=\u00a7cDu darfst diesen Spieler nicht stumm machen. -mutedPlayer=Player {0} ist nun stumm. -mutedPlayerFor=Player {0} ist nun stumm f\u00fcr {1}. +mutedPlayer=Spieler {0} ist nun stumm. +mutedPlayerFor=Spieler {0} ist nun stumm f\u00fcr {1}. mutedUserSpeaks={0} versuchte zu sprechen, aber ist stumm geschaltet. -nearbyPlayers=Players nearby: {0} -needTpohere=Du brauchst Zugriff auf /tpohere um andere Spieler teleportieren zu k\u00f6nnen. +nearbyPlayers=Spieler in der Umgebung: {0} negativeBalanceError=Spieler darf keine Schulden machen. nickChanged=Nickname ge\u00e4ndert. nickDisplayName=\u00a77Du musst \u00a7fchange-displayname\u00a7c in der Essentials-Config aktivieren. @@ -216,9 +231,10 @@ nickOthersPermission=\u00a7cDu hast keine Rechte um den Nicknamen von anderen zu nickSet=\u00a77Dein Nickname ist nun \u00a7c{0} noAccessCommand=\u00a7cDu hast keinen Zugriff auf diesen Befehl. noAccessPermission=\u00a7cDu hast keine Rechte, den Block {0} zu \u00f6ffnen. -noBreakBedrock=You are not allowed to destroy bedrock. +noBreakBedrock=Du darfst Bedrock nicht abbauen. noDestroyPermission=\u00a7cDu hast keine Rechte, den Block {0} zu zerst\u00f6ren. -noGodWorldWarning=\u00a7cWarning! God mode in this world disabled. +noDurability=\u00a7cDieser Gegenstand hat keine Haltbarkeit. +noGodWorldWarning=\u00a7cWarnung! Unsterblichkeit ist in dieser Welt deaktiviert. noHelpFound=\u00a7cKeine \u00fcbereinstimmenden Kommandos. noHomeSet=Du hast kein Zuhause gesetzt. noHomeSetPlayer=Spieler hat kein Zuhause gesetzt. @@ -229,7 +245,7 @@ noMotd=\u00a7cEs existiert keine Willkommensnachricht. noNewMail=\u00a77Du hast keine Nachrichten. noPendingRequest=Du hast keine Teleportierungsanfragen. noPerm=\u00a7cDu hast die Rechte \u00a7f{0}\u00a7c nicht. -noPermToSpawnMob=\u00a7cYou don''t have permission to spawn this mob. +noPermToSpawnMob=\u00a7cDu hast nicht die Rechte um diesen Mob zu erzeugen. noPlacePermission=\u00a7cDu hast keine Rechte, einen Block in der N\u00e4he des Schildes zu platzieren. noPowerTools=Du hast keine Powertools zugewiesen. noRules=\u00a7cEs wurden keine Regeln definiert. @@ -237,19 +253,20 @@ noWarpsDefined=Keine Warp-Punkte erstellt. none=keine notAllowedToQuestion=\u00a7cDu bist nicht berechtigt zu fragen. notAllowedToShout=\u00a7cDu bist nicht berechtigt zu schreien. -notEnoughExperience=You do not have enough experience. +notEnoughExperience=Du hast nicht genug Erfahrungspunkte. notEnoughMoney=Du hast nicht genug Geld. +notFlying=fliegt nicht notRecommendedBukkit=* ! * Die verwendete Bukkit-Version ist nicht f\u00fcr Essentials empfohlen. notSupportedYet=Noch nicht verf\u00fcgbar. -nothingInHand = \u00a7cYou have nothing in your hand. +nothingInHand = \u00a7cDu hast nichts in deiner Hand. now=jetzt -nuke=May death rain upon them +nuke=M\u00f6ge Tod auf sie regnen. numberRequired=Ein Zahl wird ben\u00f6tigt. onlyDayNight=/time unterst\u00fctzt nur day und night. onlyPlayers=Nur Spieler k\u00f6nnen {0} benutzen. onlySunStorm=/weather unterst\u00fctzt nur sun und storm. -orderBalances=Ordering balances of {0} users, please wait ... -pTimeCurrent=\u00a7e{0}''s\u00a7f time is {1}. +orderBalances=Lade die Geldb\u00f6rsen von {0} Spielern, bitte warten... +pTimeCurrent=\u00a7e{0}'\u00a7f Zeit ist {1}. pTimeCurrentFixed=\u00a7e{0}''s\u00a7f Zeit wurde zu {1} gesetzt. pTimeNormal=\u00a7e{0}''s\u00a7f Zeit ist normal und entspricht der Serverzeit. pTimeOthersPermission=\u00a7cDu hast keine Berechtigung die Zeit von anderen Spielern zu \u00e4ndern. @@ -260,7 +277,7 @@ pTimeSetFixed=Spielerzeit ist festgesetzt zu \u00a73{0}\u00a7f f\u00fcr: \u00a7e parseError=Fehler beim Parsen von {0} in Zeile {1} pendingTeleportCancelled=\u00a7cLaufende Teleportierung abgebrochen. permissionsError=Permissions/GroupManager fehlt; Chat-Prefixe/-Suffixe sind ausgeschaltet. -playerBanned=\u00a7cSpieler {0} gesperrt: {1} +playerBanned=\u00a7cSpieler {0} hat {1} gesperrt. Grund: {2} playerInJail=\u00a7cSpieler ist bereits in Gef\u00e4ngnis {0}. playerJailed=\u00a77Spieler {0} eingesperrt. playerJailedFor= \u00a77Spieler {0} eingesperrt f\u00fcr {1}. @@ -285,12 +302,12 @@ powerToolsDisabled=Alle deine Powertools wurden deaktiviert. powerToolsEnabled=Alle deine Powertools wurden aktiviert. protectionOwner=\u00a76[EssentialsProtect] Besitzer dieses Blocks: {0} questionFormat=\u00a77[Frage]\u00a7f {0} -readNextPage=Type /{0} {1} to read the next page -reloadAllPlugins=\u00a77Alle plugins neu geladen. -removed=\u00a77Removed {0} entities. +readNextPage=Tippe /{0} {1} um die n\u00e4chste Seite zu lesen +reloadAllPlugins=\u00a77Alle Plugins neu geladen. +removed=\u00a77{0} Wesen entfernt. repair=Du hast erfolgreich deine {0} repariert. repairAlreadyFixed=\u00a77Dieser Gegenstand ben\u00f6tigt keine Reparatur. -repairEnchanted=\u00a77You are not allowed to repair enchanted items. +repairEnchanted=\u00a77Du darfst keine verzauberten Gegenst\u00e4nde reparieren. repairInvalidType=\u00a7cDieser Gegenstand kann nicht repariert werden. repairNone=Es sind keine Gegenst\u00e4nde vorhanden, die repariert werden k\u00f6nnen. requestAccepted=\u00a77Teleportierungsanfrage akzeptiert. @@ -298,12 +315,11 @@ requestAcceptedFrom=\u00a77{0} hat deine Teleportierungsanfrage angenommen. requestDenied=\u00a77Teleportierungsanfrage verweigert. requestDeniedFrom=\u00a77{0} hat deine Teleportierungsanfrage abgelehnt. requestSent=\u00a77Anfrage gesendet an {0}\u00a77. -requestTimedOut=\u00a7cTeleport request has timed out -requiredBukkit=* ! * You need atleast build {0} of CraftBukkit, download it from http://ci.bukkit.org. -returnPlayerToJailError=Error occurred when trying to return player {0} to jail: {1} +requestTimedOut=\u00a7cTeleportierungsanfrage abgebrochen wegen Zeit\u00fcberschreitung +requiredBukkit= * ! * Du ben\u00f6tigst mind. Version {0} von CraftBukkit, downloade CraftBukkit von http://dl.bukkit.org/downloads/craftbukkit/ +returnPlayerToJailError=Fehler aufgetreten als Spieler {0} zum Gef\u00e4ngnis {1} zur\u00fcckkehrte. second=Sekunde seconds=Sekunden -seenBanReason=Reason: {0} seenOffline=Spieler {0} ist offline seit {1} seenOnline=Spieler {0} ist online seit {1} serverFull=Server ist voll @@ -320,13 +336,13 @@ slimeMalformedSize=Ung\u00fcltige Gr\u00f6sse. soloMob=Das Monster m\u00f6chte allein sein. spawnSet=\u00a77Spawn-Punkt gesetzt f\u00fcr Gruppe {0}. spawned=erzeugt -sudoExempt=You cannot sudo this user -sudoRun=Forcing {0} to run: /{1} {2} +sudoExempt=Du kannst diesen Spieler nicht sudo machen +sudoRun=Zwinge {0} den Befehl auszuf\u00fchren: /{1} {2} suicideMessage=\u00a77Lebewohl grausame Welt... suicideSuccess= \u00a77{0} hat sich das Leben genommen. -survival=survival +survival=Survival takenFromAccount=\u00a7c{0} wurden aus deiner Geldb\u00f6rse genommen. -takenFromOthersAccount=\u00a7c{0} taken from {1}\u00a7c account. New balance: {2} +takenFromOthersAccount=\u00a7c{0} aus der Geldb\u00f6rse von {1}\u00a7c genommen. Neues Guthaben: {2} teleportAAll=\u00a77Teleportierungsanfrage zu allen Spielern gesendet... teleportAll=\u00a77Teleportiere alle Spieler... teleportAtoB=\u00a77{0}\u00a77 teleportiert dich zu {1}\u00a77. @@ -334,8 +350,7 @@ teleportDisabled={0} verweigert die Teleportierung. teleportHereRequest=\u00a7c{0}\u00a7c fragt, ob du dich zu ihm teleportierst. teleportNewPlayerError=Fehler beim Teleportieren eines neuen Spielers teleportRequest=\u00a7c{0}\u00a7c fragt, ob er sich zu dir teleportieren darf. -teleportRequestsCancelledWorldChange=\u00a77Pending teleport requests have been cancelled on world change. -teleportRequestTimeoutInfo=\u00a77This request will timeout after {0} seconds. +teleportRequestTimeoutInfo=\u00a77Diese Anfrage wird nach {0} Sekunden auslaufen. teleportTop=\u00a77Teleportiere nach oben. teleportationCommencing=\u00a77Teleportierung gestartet... teleportationDisabled=\u00a77Teleportierung deaktiviert. @@ -344,7 +359,7 @@ teleporting=\u00a77Teleportiere... teleportingPortal=\u00a77Teleportiere durch Portal. tempBanned=Zeitlich gesperrt vom Server f\u00fcr {0} tempbanExempt=\u00a77Du kannst diesen Spieler nicht zeitlich sperren. -thunder= Es donnert nun in deiner Welt {0}. +thunder=Es donnert nun in deiner Welt {0}. thunderDuration=Es donnert nun f\u00fcr {1} Sekunden in deiner Welt {0}. timeBeforeHeal=Zeit bis zur n\u00e4chsten Heilung: {0} timeBeforeTeleport=Zeit bis zum n\u00e4chsten Teleport: {0} @@ -354,12 +369,13 @@ timeSet=Zeit in allen Welten gesetzt. timeSetPermission=\u00a7cDu hast keine Berechtigung die Zeit zu \u00e4ndern. timeWorldCurrent=Die momentane Zeit in {0} ist \u00a73{1} timeWorldSet=Die Zeit in \u00a7c{1}\u00a7f wurde zu {0} gesetzt. +tps=Aktuelle TPS (Ticks pro Sekunde) = {0} tradeCompleted=\u00a77Handel abgeschlossen. tradeSignEmpty=Der Bestand des Trade-Schild ist aufgebraucht. tradeSignEmptyOwner=Es gibt nichts mehr zu Sammeln von diesem Trade-Schild. treeFailure=\u00a7cBaumpflanzung gescheitert. Versuche es auf Gras oder Dreck. treeSpawned=\u00a77Baum gepflanzt. -true=true +true=\u00a72ja\u00a7f typeTpaccept=\u00a77Um zu teleportieren, schreibe \u00a7c/tpaccept\u00a77. typeTpdeny=\u00a77Um diese Anfrage abzulehnen, schreibe \u00a7c/tpdeny\u00a77. typeWorldName=\u00a77Du kannst auch den Namen der Welt eingeben. @@ -373,6 +389,8 @@ unknownItemName=Unbekannter Gegenstand: {0} unlimitedItemPermission=\u00a7cDu hast keine Rechte f\u00fcr {0}. unlimitedItems=Unendliche Objekte: unmutedPlayer=Spieler {0} ist nicht mehr stumm. +unvanished=\u00a7aDu bist wieder sichtbar. +unvanishedReload=\u00a7cEin Neustart hat dich sichtbar gemacht. upgradingFilesError=Fehler beim Aktualisieren der Dateien userDoesNotExist=Spieler {0} existiert nicht. userIsAway={0} ist abwesend. @@ -382,39 +400,45 @@ userUsedPortal={0} benutzt ein vorhandenes Ausgangsportal. userdataMoveBackError=Verschieben von userdata/{0}.tmp nach userdata/{1} gescheitert. userdataMoveError=Verschieben von userdata/{0} nach userdata/{1}.tmp gescheitert. usingTempFolderForTesting=Benutze tempor\u00e4ren Ordner zum Testen: +vanished=\u00a7aDu bist nun unsichtbar! versionMismatch=Versionen nicht identisch! Bitte aktualisiere {0}. versionMismatchAll=Versionen ungleich! Bitte aktualisiere alle Essentials jars auf die gleiche Version. voiceSilenced=\u00a77Du bist stumm warpDeleteError=Fehler beim L\u00f6schen der Warp-Datei. warpListPermission=\u00a7cDu hast keine Berechtigung, die Warp-Punkte anzuzeigen. warpNotExist=Warp-Punkt existiert nicht. +warpOverwrite=\u00a7cDu kannst diesen Warp-Punkt nicht \u00fcberschreiben. warpSet=\u00a77Warp-Punkt {0} wurde erstellt. warpUsePermission=\u00a7cDu hast keinen Zugriff f\u00fcr diesen Warp-Punkt. warpingTo=\u00a77Teleportiere zu Warp-Punkt {0}. warps=Warps: {0} warpsCount=\u00a77Es gibt {0} Warp-Punkte. Zeige Seite {1} von {2}. -warpOverwrite=\u00a7cYou cannot overwrite that warp. weatherStorm=\u00a77In {0} st\u00fcrmt es nun. weatherStormFor=\u00a77In {0} st\u00fcrmt es nun f\u00fcr {1} Sekunden. weatherSun=\u00a77In {0} scheint nun die Sonne. weatherSunFor=\u00a77In {0} scheint nun f\u00fcr {1} Sekunden die Sonne. -whoisBanned=\u00a79 - Banned: {0} -whoisGamemode=\u00a79 - Gamemode: {0} -whoisGeoLocation=\u00a79 - Herkunft: {0} -whoisGod=\u00a79 - God mode: {0} -whoisHealth=\u00a79 - Gesundheit: {0}/20 -whoisIPAddress=\u00a79 - IP-Adresse: {0} -whoisIs={0} ist {1} -whoisJail=\u00a79 - Jail: {0} -whoisLocation=\u00a79 - Position: ({0}, {1}, {2}, {3}) -whoisMoney=\u00a79 - Geldb\u00f6rse: {0} -whoisOP=\u00a79 - OP: {0} -whoisStatusAvailable=\u00a79 - Status: Anwesend -whoisStatusAway=\u00a79 - Status: \u00a7cAbwesend\u00a7f -worth=\u00a77Ein Stapel von {0} ist \u00a7c{1}\u00a77 wert ({2} Einheiten je {3}) +whoisAFK=\u00a76 - AFK:\u00a7f {0} +whoisBanned=\u00a76 - Gebannt:\u00a7f {0} +whoisExp=\u00a76 - Erfahrungspunkte:\u00a7f {0} (Level {1}) +whoisFly=\u00a76 - Fliegen:\u00a7f {0} ({1}) +whoisGamemode=\u00a76 - Gamemode:\u00a7f {0} +whoisGeoLocation=\u00a76 - Herkunft:\u00a7f {0} +whoisGod=\u00a76 - Unsterblichkeit:\u00a7f {0} +whoisHealth=\u00a76 - Gesundheit:\u00a7f {0}/20 +whoisIPAddress=\u00a76 - IP-Adresse:\u00a7f {0} +whoisJail=\u00a76 - Jail:\u00a7f {0} +whoisLocation=\u00a76 - Position:\u00a7f ({0}, {1}, {2}, {3}) +whoisMoney=\u00a76 - Geldb\u00f6rse:\u00a7f {0} +whoisMuted=\u00a76 - Stumm:\u00a7f {0} +whoisNick=\u00a76 - Nick:\u00a7f {0} +whoisOp=\u00a76 - OP:\u00a7f {0} +whoisTop=\u00a76 ====== WhoIs:\u00a7f {0} \u00a76====== +worth=\u00a77Der Wert von {0} betr\u00e4gt: \u00a7c{1}\u00a77 ({3} pro {2} Gegenst\u00e4nde) worthMeta=\u00a77Ein Stapel von {0} mit Metadaten {1} ist \u00a7c{2}\u00a77 wert. ({3} Einheiten je {4}) worthSet=Wert des Gegenstands gesetzt. year=Jahr years=Jahre youAreHealed=\u00a77Du wurdest geheilt. youHaveNewMail=\u00a7cDu hast {0} Nachrichten!\u00a7f Schreibe \u00a77/mail read\u00a7f um deine Nachrichten anzuzeigen. +hatRemoved=\u00a7eDein Hut wurde entfernt. +banFormat=Gesperrt: {0}
\ No newline at end of file diff --git a/Essentials/src/messages_en.properties b/Essentials/src/messages_en.properties index 478bc9713..15b63260d 100644 --- a/Essentials/src/messages_en.properties +++ b/Essentials/src/messages_en.properties @@ -12,6 +12,7 @@ alertUsed=used: autoAfkKickReason=You have been kicked for idling more than {0} minutes. backAfterDeath=\u00a77Use the /back command to return to your death point. backUsageMsg=\u00a77Returning to previous location. +backupDisabled=An external backup script has not been configured. backupFinished=Backup finished backupStarted=Backup started balance=\u00a77Balance: {0} @@ -30,10 +31,11 @@ buildAlert=\u00a7cYou are not permitted to build bukkitFormatChanged=Bukkit version format changed. Version not checked. burnMsg=\u00a77You set {0} on fire for {1} seconds. canTalkAgain=\u00a77You can talk again -cantFindGeoIpDB=Can''t find GeoIP database! +cantFindGeoIpDB=Can't find GeoIP database! cantReadGeoIpDB=Failed to read GeoIP database! cantSpawnItem=\u00a7cYou are not allowed to spawn the item {0} chatTypeLocal=[L] +chatTypeAdmin=[A] chatTypeSpy=[Spy] commandFailed=Command {0} failed: commandHelpFailedForPlugin=Error getting help for: {0} @@ -41,7 +43,7 @@ commandNotLoaded=\u00a7cCommand {0} is improperly loaded. compassBearing=\u00a77Bearing: {0} ({1} degrees). configFileMoveError=Failed to move config.yml to backup location. configFileRenameError=Failed to rename temp file to config.yml -connectedPlayers=Connected players: +connectedPlayers=Connected players: connectionFailed=Failed to open connection. cooldownWithMessage=\u00a7cCooldown: {0} corruptNodeInConfig=\u00a74Notice: Your configuration file has a corrupt {0} node. @@ -50,6 +52,7 @@ creatingConfigFromTemplate=Creating config from template: {0} creatingEmptyConfig=Creating empty config: {0} creative=creative currency={0}{1} +currentWorld=Current World: {0} day=day days=days defaultBanReason=The Ban Hammer has spoken! @@ -71,6 +74,7 @@ disabledToSpawnMob=Spawning this mob was disabled in the config file. dontMoveMessage=\u00a77Teleportation will commence in {0}. Don''t move. downloadingGeoIp=Downloading GeoIP database ... this might take a while (country: 0.6 MB, city: 20MB) duplicatedUserdata=Duplicated userdata: {0} and {1} +durability=\u00a77This tool has \u00a7c{0}\u00a77 uses left enableUnlimited=\u00a77Giving unlimited amount of {0} to {1}. enabled=enabled enchantmentApplied = \u00a77The enchantment {0} has been applied to your item in hand. @@ -83,15 +87,19 @@ errorWithMessage=\u00a7cError: {0} essentialsHelp1=The file is broken and Essentials can't open it. Essentials is now disabled. If you can't fix the file yourself, go to http://tiny.cc/EssentialsChat essentialsHelp2=The file is broken and Essentials can't open it. Essentials is now disabled. If you can't fix the file yourself, either type /essentialshelp in game or go to http://tiny.cc/EssentialsChat essentialsReload=\u00a77Essentials Reloaded {0} +exp=\u00a7c{0} \u00a77has\u00a7c {1} \u00a77exp (level\u00a7c {2}\u00a77) and needs\u00a7c {3} \u00a77more exp to level up. +expSet=\u00a7c{0} \u00a77now has\u00a7c {1} \u00a77exp. extinguish=\u00a77You extinguished yourself. extinguishOthers=\u00a77You extinguished {0}. failedToCloseConfig=Failed to close config {0} failedToCreateConfig=Failed to create config {0} failedToWriteConfig=Failed to write config {0} -false=false +false=\u00a74false\u00a7f feed=\u00a77Your appetite was sated. feedOther=\u00a77Satisfied {0}. fileRenameError=Renaming file {0} failed +flyMode=\u00a77Set fly mode {0} for {1}. +flying=flying foreverAlone=\u00a7cYou have nobody to whom you can reply. freedMemory=Freed {0} MB. gameMode=\u00a77Set game mode {0} for {1}. @@ -106,13 +114,20 @@ geoipJoinFormat=Player {0} comes from {1} godDisabledFor=disabled for {0} godEnabledFor=enabled for {0} godMode=\u00a77God mode {0}. +hatArmor=\u00a7cError, you cannot use this item as a hat! +hatEmpty=\u00a7cYou are not wearing a hat. +hatFail=\u00a7cYou must have something to wear in your hand. +hatPlaced=\u00a7eEnjoy your new hat! haveBeenReleased=\u00a77You have been released heal=\u00a77You have been healed. healOther=\u00a77Healed {0}. helpConsole=To view help from the console, type ?. +helpFrom=\u00a77Commands from {0}: helpLine=\u00a76/{0}\u00a7f: {1} +helpMatching=\u00a77Commands matching "{0}": helpOp=\u00a7c[HelpOp]\u00a7f \u00a77{0}:\u00a7f {1} helpPages=Page \u00a7c{0}\u00a7f of \u00a7c{1}\u00a7f: +helpPlugin=\u00a74{0}\u00a7f: Plugin Help: /help {1} holeInFloor=Hole in floor homeSet=\u00a77Home set. homeSetToBed=\u00a77Your home is now set to this bed. @@ -124,14 +139,14 @@ illegalDate=Illegal date format. infoChapter=Select chapter: infoChapterPages=Chapter {0}, page \u00a7c{1}\u00a7f of \u00a7c{2}\u00a7f: infoFileDoesNotExist=File info.txt does not exist. Creating one for you. -infoPages=Page \u00a7c{0}\u00a7f of \u00a7c{1}\u00a7f: +infoPages=\u00a7e ---- \u00a76{2} \u00a7e--\u00a76 Page \u00a74{0}\u00a76/\u00a74{1} \u00a7e---- infoUnknownChapter=Unknown chapter. invBigger=The other users inventory is bigger than yours. invRestored=Your inventory has been restored. invSee=You see the inventory of {0}. invSeeHelp=Use /invsee to restore your inventory. invalidCharge=\u00a7cInvalid charge. -invalidHome=Home {0} doesn't exist +invalidHome=Home {0} doesn''t exist invalidMob=Invalid mob type. invalidServer=Invalid server! invalidSignLine=Line {0} on sign is invalid. @@ -156,18 +171,19 @@ jailReleased=\u00a77Player \u00a7e{0}\u00a77 unjailed. jailReleasedPlayerNotify=\u00a77You have been released! jailSentenceExtended=Jail time extend to: {0) jailSet=\u00a77Jail {0} has been set -jumpError=That would hurt your computer''s brain. +jumpError=That would hurt your computer's brain. kickDefault=Kicked from server kickExempt=\u00a7cYou can not kick that person. +kickedAll=\u00a7cKicked all players from server kill=\u00a77Killed {0}. kitError2=\u00a7cThat kit does not exist or is improperly defined. kitError=\u00a7cThere are no valid kits. kitErrorHelp=\u00a7cPerhaps an item is missing a quantity in the configuration? kitGive=\u00a77Giving kit {0}. -InvFull=\u00a7cYour inventory was full, dropping items on the floor +kitInvFull=\u00a7cYour inventory was full, placing kit on the floor kitTimed=\u00a7cYou can''t use that kit again for another {0}. kits=\u00a77Kits: {0} -lightningSmited=\u00a77You have just been smited +lightningSmited=\u00a77Thou hast been smitten lightningUse=\u00a77Smiting {0} listAfkTag = \u00a77[AFK]\u00a7f listAmount = \u00a79There are \u00a7c{0}\u00a79 out of maximum \u00a7c{1}\u00a79 players online. @@ -205,7 +221,6 @@ mutedPlayer=Player {0} muted. mutedPlayerFor=Player {0} muted for {1}. mutedUserSpeaks={0} tried to speak, but is muted. nearbyPlayers=Players nearby: {0} -needTpohere=You need access to /tpohere to teleport other players. negativeBalanceError=User is not allowed to have a negative balance. nickChanged=Nickname changed. nickDisplayName=\u00a77You have to enable change-displayname in Essentials config. @@ -218,6 +233,7 @@ noAccessCommand=\u00a7cYou do not have access to that command. noAccessPermission=\u00a7cYou do not have permission to access that {0}. noBreakBedrock=You are not allowed to destroy bedrock. noDestroyPermission=\u00a7cYou do not have permission to destroy that {0}. +noDurability=\u00a7cThis item does not have a durability. noGodWorldWarning=\u00a7cWarning! God mode in this world disabled. noHelpFound=\u00a7cNo matching commands. noHomeSet=You have not set a home. @@ -229,7 +245,7 @@ noMotd=\u00a7cThere is no message of the day. noNewMail=\u00a77You have no new mail. noPendingRequest=You do not have a pending request. noPerm=\u00a7cYou do not have the \u00a7f{0}\u00a7c permission. -noPermToSpawnMob=\u00a7cYou don''t have permission to spawn this mob. +noPermToSpawnMob=\u00a7cYou don't have permission to spawn this mob. noPlacePermission=\u00a7cYou do not have permission to place a block near that sign. noPowerTools=You have no power tools assigned. noRules=\u00a7cThere are no rules specified yet. @@ -239,6 +255,7 @@ notAllowedToQuestion=\u00a7cYou are not authorized to use question. notAllowedToShout=\u00a7cYou are not authorized to shout. notEnoughExperience=You do not have enough experience. notEnoughMoney=You do not have sufficient funds. +notFlying=not flying notRecommendedBukkit= * ! * Bukkit version is not the recommended build for Essentials. notSupportedYet=Not supported yet. nothingInHand = \u00a7cYou have nothing in your hand. @@ -252,7 +269,7 @@ orderBalances=Ordering balances of {0} users, please wait ... pTimeCurrent=\u00a7e{0}''s\u00a7f time is {1}. pTimeCurrentFixed=\u00a7e{0}''s\u00a7f time is fixed to {1}. pTimeNormal=\u00a7e{0}''s\u00a7f time is normal and matches the server. -pTimeOthersPermission=\u00a7cYou are not authorized to set other players'' time. +pTimeOthersPermission=\u00a7cYou are not authorized to set other players' time. pTimePlayers=These players have their own time: pTimeReset=Player time has been reset for: \u00a7e{0} pTimeSet=Player time is set to \u00a73{0}\u00a7f for: \u00a7e{1} @@ -272,7 +289,7 @@ playerNotFound=\u00a7cPlayer not found. playerUnmuted=\u00a77You have been unmuted pong=Pong! possibleWorlds=\u00a77Possible worlds are the numbers 0 through {0}. -powerToolAir=Command can''t be attached to air. +powerToolAir=Command can't be attached to air. powerToolAlreadySet=Command \u00a7c{0}\u00a7f is already assigned to {1}. powerToolAttach=\u00a7c{0}\u00a7f command assigned to {1}. powerToolClearAll=All powertool commands have been cleared. @@ -299,11 +316,10 @@ requestDenied=\u00a77Teleport request denied. requestDeniedFrom=\u00a77{0} denied your teleport request. requestSent=\u00a77Request sent to {0}\u00a77. requestTimedOut=\u00a7cTeleport request has timed out -requiredBukkit= * ! * You need atleast build {0} of CraftBukkit, download it from http://ci.bukkit.org. +requiredBukkit= * ! * You need atleast build {0} of CraftBukkit, download it from http://dl.bukkit.org/downloads/craftbukkit/ returnPlayerToJailError=Error occurred when trying to return player {0} to jail: {1} second=second seconds=seconds -seenBanReason=Reason: {0} seenOffline=Player {0} is offline since {1} seenOnline=Player {0} is online since {1} serverFull=Server is full @@ -334,7 +350,6 @@ teleportDisabled={0} has teleportation disabled. teleportHereRequest=\u00a7c{0}\u00a7c has requested that you teleport to them. teleportNewPlayerError=Failed to teleport new player teleportRequest=\u00a7c{0}\u00a7c has requested to teleport to you. -teleportRequestsCancelledWorldChange=\u00a77Pending teleport requests have been cancelled on world change. teleportRequestTimeoutInfo=\u00a77This request will timeout after {0} seconds. teleportTop=\u00a77Teleporting to top. teleportationCommencing=\u00a77Teleportation commencing... @@ -354,12 +369,13 @@ timeSet=Time set in all worlds. timeSetPermission=\u00a7cYou are not authorized to set the time. timeWorldCurrent=The current time in {0} is \u00a73{1} timeWorldSet=The time was set to {0} in: \u00a7c{1} +tps=Current TPS = {0} tradeCompleted=\u00a77Trade completed. tradeSignEmpty=The trade sign has nothing available for you. tradeSignEmptyOwner=There is nothing to collect from this trade sign. treeFailure=\u00a7cTree generation failure. Try again on grass or dirt. treeSpawned=\u00a77Tree spawned. -true=true +true=\u00a72true\u00a7f typeTpaccept=\u00a77To teleport, type \u00a7c/tpaccept\u00a77. typeTpdeny=\u00a77To deny this request, type \u00a7c/tpdeny\u00a77. typeWorldName=\u00a77You can also type the name of a specific world. @@ -373,6 +389,8 @@ unknownItemName=Unknown item name: {0} unlimitedItemPermission=\u00a7cNo permission for unlimited item {0}. unlimitedItems=Unlimited items: unmutedPlayer=Player {0} unmuted. +unvanished=\u00a7aYou are once again visible. +unvanishedReload=\u00a7cA reload has forced you to become visible. upgradingFilesError=Error while upgrading the files userDoesNotExist=The user {0} does not exist. userIsAway={0} is now AFK @@ -382,35 +400,39 @@ userUsedPortal={0} used an existing exit portal. userdataMoveBackError=Failed to move userdata/{0}.tmp to userdata/{1} userdataMoveError=Failed to move userdata/{0} to userdata/{1}.tmp usingTempFolderForTesting=Using temp folder for testing: +vanished=\u00a7aYou have now been vanished. versionMismatch=Version mismatch! Please update {0} to the same version. versionMismatchAll=Version mismatch! Please update all Essentials jars to the same version. voiceSilenced=\u00a77Your voice has been silenced warpDeleteError=Problem deleting the warp file. warpListPermission=\u00a7cYou do not have Permission to list warps. warpNotExist=That warp does not exist. +warpOverwrite=\u00a7cYou cannot overwrite that warp. warpSet=\u00a77Warp {0} set. warpUsePermission=\u00a7cYou do not have Permission to use that warp. warpingTo=\u00a77Warping to {0}. warps=Warps: {0} warpsCount=\u00a77There are {0} warps. Showing page {1} of {2}. -warpOverwrite=\u00a7cYou cannot overwrite that warp. weatherStorm=\u00a77You set the weather to storm in {0} weatherStormFor=\u00a77You set the weather to storm in {0} for {1} seconds weatherSun=\u00a77You set the weather to sun in {0} weatherSunFor=\u00a77You set the weather to sun in {0} for {1} seconds -whoisBanned=\u00a79 - Banned: {0} -whoisGamemode=\u00a79 - Gamemode: {0} -whoisGeoLocation=\u00a79 - Location: {0} -whoisGod=\u00a79 - God mode: {0} -whoisHealth=\u00a79 - Health: {0}/20 -whoisIPAddress=\u00a79 - IP Address: {0} -whoisIs={0} is {1} -whoisJail=\u00a79 - Jail: {0} -whoisLocation=\u00a79 - Location: ({0}, {1}, {2}, {3}) -whoisMoney=\u00a79 - Money: {0} -whoisOP=\u00a79 - OP: {0} -whoisStatusAvailable=\u00a79 - Status: Available -whoisStatusAway=\u00a79 - Status: \u00a7cAway\u00a7f +whoisAFK=\u00a76 - AFK:\u00a7f {0} +whoisBanned=\u00a76 - Banned:\u00a7f {0} +whoisExp=\u00a76 - Exp:\u00a7f {0} (Level {1}) +whoisFly=\u00a76 - Fly mode:\u00a7f {0} ({1}) +whoisGamemode=\u00a76 - Gamemode:\u00a7f {0} +whoisGeoLocation=\u00a76 - Location:\u00a7f {0} +whoisGod=\u00a76 - God mode:\u00a7f {0} +whoisHealth=\u00a76 - Health:\u00a7f {0}/20 +whoisIPAddress=\u00a76 - IP Address:\u00a7f {0} +whoisJail=\u00a76 - Jail:\u00a7f {0} +whoisLocation=\u00a76 - Location:\u00a7f ({0}, {1}, {2}, {3}) +whoisMoney=\u00a76 - Money:\u00a7f {0} +whoisMuted=\u00a76 - Muted:\u00a7f {0} +whoisNick=\u00a76 - Nick:\u00a7f {0} +whoisOp=\u00a76 - OP:\u00a7f {0} +whoisTop=\u00a76 ====== WhoIs:\u00a7f {0} \u00a76====== worth=\u00a77Stack of {0} worth \u00a7c{1}\u00a77 ({2} item(s) at {3} each) worthMeta=\u00a77Stack of {0} with metadata of {1} worth \u00a7c{2}\u00a77 ({3} item(s) at {4} each) worthSet=Worth value set @@ -418,3 +440,5 @@ year=year years=years youAreHealed=\u00a77You have been healed. youHaveNewMail=\u00a7cYou have {0} messages!\u00a7f Type \u00a77/mail read\u00a7f to view your mail. +hatRemoved=\u00a7eYour hat has been removed. +banFormat=Banned: {0} diff --git a/Essentials/src/messages_es.properties b/Essentials/src/messages_es.properties index d334f7330..640707b2b 100644 --- a/Essentials/src/messages_es.properties +++ b/Essentials/src/messages_es.properties @@ -12,6 +12,7 @@ alertUsed=usado: autoAfkKickReason=Has sido echado por ausentarte mas de {0} minutos. backAfterDeath=\u00a77Usa el comando /back para volver al punto en el que moriste. backUsageMsg=\u00a77Volviendo a la localizacion anterior. +backupDisabled=An external backup script has not been configured. backupFinished=Copia de seguridad completada backupStarted=Comenzando copia de seguridad balance=\u00a77Cantidad: {0} @@ -22,26 +23,27 @@ bannedIpsFileError=Error leyendo banned-ips.txt bannedIpsFileNotFound=banned-ips.txt no encontrado bannedPlayersFileError=Error leyendo banned-players.txt bannedPlayersFileNotFound=banned-players.txt no encontrado -bigTreeFailure=\u00a7cBig Generacion de arbol fallida. Prueba de nuevo en hierba o arena. -bigTreeSuccess= \u00a77Big Arbol generado. -blockList=Essentials relayed the following commands to another plugin: +bigTreeFailure=\u00a7cGeneracion de arbol grande fallida. Prueba de nuevo en hierba o arena. +bigTreeSuccess= \u00a77Arbol grande generado. +blockList=Essentials ha pasado los siguientes comandos a otro plugin: broadcast=[\u00a7cBroadcast\u00a7f]\u00a7a {0} buildAlert=\u00a7cNo tienes permisos para construir bukkitFormatChanged=Version de formato de Bukkit cambiado. Version no comprobada. burnMsg=\u00a77Has puesto {0} en fuego durante {1} segundos. canTalkAgain=\u00a77Ya puedes hablar de nuevo -cantFindGeoIpDB=No se puede encontrar la bases de datos del Geo IP -cantReadGeoIpDB=Error al intentar leer la base de datos del Geo IP +cantFindGeoIpDB=No se puede encontrar la bases de datos de Geo IP +cantReadGeoIpDB=Error al intentar leer la base de datos de Geo IP cantSpawnItem=\u00a7cNo tienes acceso para producir este objeto {0} chatTypeLocal=[L] +chatTypeAdmin=[A] chatTypeSpy=[Spy] commandFailed=Command {0} fallado: commandHelpFailedForPlugin=Error obteniendo ayuda para: {0} -commandNotLoaded=\u00a7cCommand {0} esta cargado incorrectamente. -compassBearing=\u00a77Bearing: {0} ({1} grados). +commandNotLoaded=\u00a7cEl comando {0} esta cargado incorrectamente. +compassBearing=\u00a77Marcacion del compas: {0} ({1} grados). configFileMoveError=Error al mover config.yml para hacer una copia de seguridad de la localizacion. configFileRenameError=Error al renombrar archivo temp a config.yml -connectedPlayers=Jugadores conectados: +connectedPlayers=Jugadores conectados: connectionFailed=Error al abrir conexion. cooldownWithMessage=\u00a7cCooldown: {0} corruptNodeInConfig=\u00a74Notice: Tu archivo de configuracion tiene un nodo {0} incorrecto. @@ -50,6 +52,7 @@ creatingConfigFromTemplate=Creando configuracion desde el template: {0} creatingEmptyConfig=Creando configuracion vacia: {0} creative=creative currency={0}{1} +currentWorld=Current World: {0} day=dia days=dias defaultBanReason=Baneado por incumplir las normas! @@ -67,34 +70,39 @@ depthBelowSea=\u00a77Estas {0} bloque(s) por debajo del mar. destinationNotSet=Destino no establecido. disableUnlimited=\u00a77Desactivando colocacion ilimitada de {0} para {1}. disabled=desactivado -disabledToSpawnMob=Spawning this mob was disabled in the config file. +disabledToSpawnMob=La creacion de este mob fue desactivada en el archivo de configuracion. dontMoveMessage=\u00a77Teletransporte comenzara en {0}. No te muevas. downloadingGeoIp=Descargando base de datos de GeoIP ... puede llevar un tiempo (pais: 0.6 MB, ciudad: 20MB) duplicatedUserdata=Datos de usuario duplicados: {0} y {1} +durability=\u00a77Esta herramienta tiene \u00a7c{0}\u00a77 usos restantes. enableUnlimited=\u00a77Dando cantidad ilimitada de {0} a {1}. enabled=activado -enchantmentApplied = \u00a77The enchantment {0} has been applied to your item in hand. -enchantmentNotFound = \u00a7cEnchantment not found -enchantmentPerm = \u00a7cYou do not have the permission for {0} -enchantmentRemoved = \u00a77The enchantment {0} has been removed from your item in hand. -enchantments = \u00a77Enchantments: {0} +enchantmentApplied = \u00a77El encantamiento "{0}" fue aplicado al item en tus manos. +enchantmentNotFound = \u00a7cEncantamiento no encontrado +enchantmentPerm = \u00a7cNo tienes permiso para {0} +enchantmentRemoved = \u00a77El encantamiento "{0}" fue removido del item en tus manos. +enchantments = \u00a77Encantamientos: {0} errorCallingCommand=Error al ejecutar el comando /{0} errorWithMessage=\u00a7cError: {0} -essentialsHelp1=The file is broken and Essentials can't open it. Essentials is now disabled. If you can't fix the file yourself, go to http://tiny.cc/EssentialsChat -essentialsHelp2=The file is broken and Essentials can't open it. Essentials is now disabled. If you can't fix the file yourself, either type /essentialshelp in game or go to http://tiny.cc/EssentialsChat +essentialsHelp1=El archivo esta roto y Essentials no puede abrirlo. Essentials se ha desactivado. Si no puedes arreglar el archivo por tu cuenta, ve a http://tiny.cc/EssentialsChat +essentialsHelp2=El archivo esta roto y Essentials no puede abrirlo. Essentials se ha desactivado. Si no puedes arreglar el archivo por tu cuenta, intenta escribir /essentialshelp en juego o ir a http://tiny.cc/EssentialsChat essentialsReload=\u00a77Essentials Recargado {0} -extinguish=\u00a77Te has suicidado. -extinguishOthers=\u00a77Has matado a {0}. +exp=\u00a7c{0} \u00a77tiene\u00a7c {1} \u00a77exp (nivel\u00a7c {2}\u00a77) y necesita\u00a7c {3} \u00a77 mas experiencia para subir de nivel. +expSet=\u00a7c{0} \u00a77tiene\u00a7c {1} \u00a77exp ahora. +extinguish=\u00a77Has extinguido tu fuego. +extinguishOthers=\u00a77Has extinguido el fuego de {0}. failedToCloseConfig=Error al cerrar configuracion {0} failedToCreateConfig=Error al crear configuracion {0} failedToWriteConfig=Error al escribir configuracion {0} -false=false -feed=\u00a77Your appetite was sated. -feedOther=\u00a77Satisfied {0}. +false=\u00a74falso\u00a7f +feed=\u00a77Tu apetito fue saciado. +feedOther=\u00a77Satisfecho {0}. fileRenameError=Error al renombrar el archivo {0} +flyMode=\u00a77Modo volador para {1}: {0}. +flying=volando foreverAlone=\u00a7cNo tienes nadie a quien puedas responder. freedMemory= {0} MB libres. -gameMode=\u00a77Set game mode {0} for {1}. +gameMode=\u00a77Cambiado modo de juego {0} para {1}. gcchunks= pixeles, gcentities= entidades gcfree=Memoria libre: {0} MB @@ -106,13 +114,20 @@ geoipJoinFormat=El jugador {0} viene de {1} godDisabledFor=Desactivado para {0} godEnabledFor=Activado para {0} godMode=\u00a77Modo Dios {0}. +hatArmor=\u00a7cError, no puedes usar este item como sombrero! +hatEmpty=\u00a7cNo estas llevando un sombrero. +hatFail=\u00a7cDebes tener algo que puedas vestir en tus manos. +hatPlaced=\u00a7eDisfruta tu nuevo sombrero! haveBeenReleased=\u00a77Has sido liberado heal=\u00a77Has sido curado. healOther=\u00a77Has curado a {0}. helpConsole=Para obtener ayuda de la consola, escribe ?. +helpFrom=\u00a77Comandos desde {0}: helpLine=\u00a76/{0}\u00a7f: {1} +helpMatching=\u00a77Comandos incluyendo "{0}": helpOp=\u00a7c[HelpOp]\u00a7f \u00a77{0}:\u00a7f {1} helpPages=Pagina \u00a7c{0}\u00a7f de \u00a7c{1}\u00a7f: +helpPlugin=\u00a74{0}\u00a7f: Ayuda del plugin: /help {1} holeInFloor=Agujero en el suelo homeSet=\u00a77Hogar establecido. homeSetToBed=\u00a77Tu hogar esta ahora establecido a esta cama. @@ -124,14 +139,14 @@ illegalDate=Forma de fecha ilegal. infoChapter=Selecciona una seccion: infoChapterPages=Seccion {0}, pagina \u00a7c{1}\u00a7f of \u00a7c{2}\u00a7f: infoFileDoesNotExist=El archivo info.txt no existe. Creando uno para ti. -infoPages=Pagina \u00a7c{0}\u00a7f de \u00a7c{1}\u00a7f: +infoPages=\u00a7e ---- \u00a76{2} \u00a7e--\u00a76 Pagina \u00a74{0}\u00a76/\u00a74{1} \u00a7e---- infoUnknownChapter=Seccion desconocida. invBigger=El inventario del otro usuario es mas grande que el tuyo invRestored=Tu inventario ha sido recuperado. invSee=Estas viendo el inventario de {0}. invSeeHelp=Usa /invsee para recuperar tu inventario. invalidCharge=\u00a7cCargo invalido. -invalidHome=Home {0} doesn't exist +invalidHome=El hogar {0} no existe. invalidMob=Mob invalido. invalidServer=Servidor invalido! invalidSignLine=Linea {0} en el signo es invalida. @@ -159,22 +174,23 @@ jailSet=\u00a77Carcel {0} ha sido puesta jumpError=Eso es demasiado para tu ordenador! kickDefault=Echado del servidor. kickExempt=\u00a7cNo puedes echar a esa persona. +kickedAll=\u00a7cEchados todos los jugadores del servidor. kill=\u00a77ha matado a {0}. kitError2=\u00a7cEse kit no existe o esta mal escrito. kitError=\u00a7cNo hay ningun kit valido. -kitErrorHelp=\u00a7cPerhaps an item is missing a quantity in the configuration? +kitErrorHelp=\u00a7cQuizas un item no tiene cantidad en la configuracion? kitGive=\u00a77Dando kit a {0}. -InvFull=\u00a7cYour inventory was full, dropping items on the floor +kitInvFull=\u00a7cTu inventario esta lleno, su kit se pondra en el suelo kitTimed=\u00a7c No puedes usar ese kit de nuevo para otro{0}. kits=\u00a77Kits: {0} lightningSmited=\u00a77Acabas de ser golpeado lightningUse=\u00a77Golpeando a {0} listAfkTag = \u00a77[AFK]\u00a7f -listAmount = \u00a79There are \u00a7c{0}\u00a79 out of maximum \u00a7c{1}\u00a79 players online. -listAmountHidden = \u00a79There are \u00a7c{0}\u00a77/{1}\u00a79 out of maximum \u00a7c{2}\u00a79 players online. +listAmount = \u00a79Hay \u00a7c{0}\u00a79 del maximo de \u00a7c{1}\u00a79 jugadores conectados. +listAmountHidden = \u00a79Hay \u00a7c{0}\u00a77/{1}\u00a79 del maximo de \u00a7c{2}\u00a79 jugadores conectados. listGroupTag={0}\u00a7f: -listHiddenTag = \u00a77[HIDDEN]\u00a7f -loadWarpError=Error al cargar el tenetransporte {0} +listHiddenTag = \u00a77[OCULTO]\u00a7f +loadWarpError=Error al cargar el teletransporte {0} localFormat=Local: <{0}> {1} mailClear=\u00a7cPara marcar tu email como leido, escribe /mail clear mailCleared=\u00a77Email limpiado! @@ -193,7 +209,7 @@ mobSpawnError=Error al cambiar la localizacion para el nacimiento de los mobs. mobSpawnLimit=Cantidad de Mobs limitados al limite del server mobSpawnTarget=El block seleccionado sera el lugar donde van a nacer los mobs. mobsAvailable=\u00a77Mobs: {0} -moneyRecievedFrom=\u00a7a{0} ha sido recivido de {1} +moneyRecievedFrom=\u00a7a{0} ha sido recibido de {1} moneySentTo=\u00a7a{0} ha sido enviado a {1} moneyTaken={0} han sido sacados de tu cuenta bancaria. month=mes @@ -204,8 +220,7 @@ muteExempt=\u00a7cNo puedes silenciar a ese jugador. mutedPlayer=Player {0} silenciado. mutedPlayerFor=Player {0} silenciado durante {1}. mutedUserSpeaks={0} intento hablar, pero esta silenciado. -nearbyPlayers=Players nearby: {0} -needTpohere=Necesitas acceso a /tpohere para teletransportar a otros jugadores. +nearbyPlayers=Jugadores cercanos: {0} negativeBalanceError=El usuario no tiene permitido tener un saldo negativo. nickChanged=Nombre de jugador cambiado. nickDisplayName=\u00a77Tienes que habilitar cambio de nombre de usuario en la configuracion de Essentials. @@ -218,45 +233,47 @@ noAccessCommand=\u00a7cNo tienes acceso a ese comando. noAccessPermission=\u00a7cNo tienes permisos para hacer eso {0}. noBreakBedrock=You are not allowed to destroy bedrock. noDestroyPermission=\u00a7cNo tienes permisos para destrozar eso {0}. -noGodWorldWarning=\u00a7cWarning! God mode in this world disabled. +noDurability=\u00a7cThis item does not have a durability. +noGodWorldWarning=\u00a7cAdvertencia! El modo dios esta desactivado en este mundo. noHelpFound=\u00a7cNo hay comandos relacionados. noHomeSet=No has establecido un hogar. noHomeSetPlayer=El jugador no ha establecido un hogar. noKitPermission=\u00a7cNecesitas los \u00a7c{0}\u00a7c permisos para usar ese kit. noKits=\u00a77No hay kits disponibles todavia -noMail=No tienes ningun email recivido +noMail=No tienes ningun email recibido noMotd=\u00a7cNo hay ningun mensaje del dia. noNewMail=\u00a77No tienes ningun correo nuevo. noPendingRequest=No tienes ninguna peticion pendiente. noPerm=\u00a7cNo tienes el permiso de \u00a7f{0}\u00a7c. -noPermToSpawnMob=\u00a7cYou don''t have permission to spawn this mob. +noPermToSpawnMob=\u00a7cNo tienes permiso para crear este mob. noPlacePermission=\u00a7cNo tienes permiso para situar ese bloque en ese lugar. -noPowerTools=You have no power tools assigned. +noPowerTools=No tienes powertools asignadas. noRules=\u00a7cNo hay reglas especificadas todavia. noWarpsDefined=No hay teletransportes definidos aun none=ninguno -notAllowedToQuestion=\u00a7cYou estas autorizado para usar las preguntas. +notAllowedToQuestion=\u00a7cNo estas autorizado para hacer preguntas. notAllowedToShout=\u00a7cNo estas autorizado para gritar. -notEnoughExperience=You do not have enough experience. +notEnoughExperience=No tienes suficiente experiencia. notEnoughMoney=No tienes el dinero suficiente. +notFlying=no volando notRecommendedBukkit=* ! * La version de bukkit no es la recomendada para esta version de Essentials. notSupportedYet=No esta soportado aun. -nothingInHand = \u00a7cYou have nothing in your hand. +nothingInHand = \u00a7cNo tienes nada en tus manos. now=ahora -nuke=May death rain upon them +nuke=Que la muerte llueva sobre ellos. numberRequired=Un numero es necesario, amigo. onlyDayNight=/time solo soporta day/night. (dia/noche) onlyPlayers=Solo los jugadores conectados pueden usar {0}. onlySunStorm=/weather solo soporta sun/storm. (sol/tormenta) -orderBalances=Ordering balances of {0} users, please wait ... +orderBalances=Ordenando balances de {0} usuarios, por favor espere... pTimeCurrent=\u00a7e{0}''s\u00a7f la hora es {1}. pTimeCurrentFixed=\u00a7e{0}''s\u00a7f la hora ha sido cambiada a {1}. pTimeNormal=\u00a7e{0}''s\u00a7f el tiempo es normal y coincide con el servidor. -pTimeOthersPermission=\u00a7cNo estas autorizado para especificar'' la hora de otros usuarios. +pTimeOthersPermission=\u00a7cNo estas autorizado para especificar la hora de otros usuarios. pTimePlayers=Estos usuarios tienen su propia hora: pTimeReset=La hora del usuario ha sido reiniciada a las: \u00a7e{0} -pTimeSet=La hora del jugador ha sido cambiada para las: \u00a73{0}\u00a7f for: \u00a7e{1} -pTimeSetFixed=La hora del jugador ha sido arreglada para las: \u00a73{0}\u00a7f for: \u00a7e{1} +pTimeSet=La hora del jugador ha sido cambiada para las: \u00a73{0}\u00a7f por: \u00a7e{1} +pTimeSetFixed=La hora del jugador ha sido arreglada para las: \u00a73{0}\u00a7f por: \u00a7e{1} parseError=error analizando {0} en la linea {1} pendingTeleportCancelled=\u00a7cPeticion de teletransporte pendiente cancelado. permissionsError=Falta el plugin Permissions/GroupManager; Los prefijos/sufijos de chat seran desactivados. @@ -269,10 +286,10 @@ playerMuted=\u00a77Has sido silenciado playerMutedFor=\u00a77Has sido silenciado durante {0} playerNeverOnServer=\u00a7cEl jugador {0} nunca estuvo en este servidor. playerNotFound=\u00a7cJugador no encontrado. -playerUnmuted=\u00a77Has sido desmuteado. -pong=Tkm mi ninio! +playerUnmuted=\u00a77Has sido des-silenciado. +pong=Pong! possibleWorlds=\u00a77Los mundos posibles son desde el numero 0 hasta el {0}. -powerToolAir=El comando no se puede ejecutar en el aire. +powerToolAir=El comando no se puede asignar al aire. powerToolAlreadySet=El comando \u00a7c{0}\u00a7f ya esta asignado a {1}. powerToolAttach=\u00a7c{0}\u00a7f comando asignado a {1}. powerToolClearAll=Todos los comandos de powertool han sido borrados. @@ -283,14 +300,14 @@ powerToolRemove=Comando \u00a7c{0}\u00a7f borrado desde {1}. powerToolRemoveAll=Todos los comandos borrados desde {0}. powerToolsDisabled=All of your power tools have been disabled. powerToolsEnabled=All of your power tools have been enabled. -protectionOwner=\u00a76[EssentialsProtect] Dueño de la proteccion: {0} +protectionOwner=\u00a76[EssentialsProtect] Due\u00f1o de la proteccion: {0} questionFormat=\u00a77[Pregunta]\u00a7f {0} -readNextPage=Type /{0} {1} to read the next page +readNextPage=Escribe /{0} {1} para leer la siguiente pagina. reloadAllPlugins=\u00a77Todos los plugins recargados. -removed=\u00a77Removed {0} entities. +removed=\u00a77Eliminadas {0} entidades. repair=Has reparado satisfactoriamente tu: \u00a7e{0}. repairAlreadyFixed=\u00a77Este objeto no necesita de reparado. -repairEnchanted=\u00a77You are not allowed to repair enchanted items. +repairEnchanted=\u00a77No tienes permiutido reparar items encantados. repairInvalidType=\u00a7cEste objeto no puede ser reparado. repairNone=No habia objetos que necesitasen ser reparados. requestAccepted=\u00a77Peticion de teletransporte aceptada. @@ -298,19 +315,18 @@ requestAcceptedFrom=\u00a77{0} acepto tu peticion de teletransporte. requestDenied=\u00a77Peticion de teletransporte denegada. requestDeniedFrom=\u00a77{0} ha denegado tu peticion de teletransporte. requestSent=\u00a77Peticion enviada a {0}\u00a77. -requestTimedOut=\u00a7cTeleport request has timed out -requiredBukkit=* ! * You need atleast build {0} of CraftBukkit, download it from http://ci.bukkit.org. -returnPlayerToJailError=Error occurred when trying to return player {0} to jail: {1} +requestTimedOut=\u00a7cLa peticion de teletransporte ha expirado. +requiredBukkit= * ! * Necesitas por lo menos el build {0} de CraftBukkit, se puede descargar desde: http://dl.bukkit.org/downloads/craftbukkit/ +returnPlayerToJailError=Ha ocurrido un error al traer de volver a encarcelar a {0}: {1} second=segundo seconds=segundos -seenBanReason=Reason: {0} seenOffline=El jugador {0} esta desconectado desde {1} seenOnline=El jugador {0} lleva conectado desde {1} serverFull=Servidor lleno serverTotal=Server Total: {0} -setSpawner=Cambiado tipo de lugar de nacimiento a {0} +setSpawner=Cambiado tipo de spawner a {0} sheepMalformedColor=Color malformado. -shoutFormat=\u00a77[Shout]\u00a7f {0} +shoutFormat=\u00a77[Grito]\u00a7f {0} signFormatFail=\u00a74[{0}] signFormatSuccess=\u00a71[{0}] signFormatTemplate=[{0}] @@ -320,13 +336,13 @@ slimeMalformedSize=Medidas malformadas. soloMob=A este mob le gusta estar solo spawnSet=\u00a77El lugar de nacimiento ha sido puesto para el grupo {0}. spawned=nacido -sudoExempt=You cannot sudo this user -sudoRun=Forcing {0} to run: /{1} {2} +sudoExempt=No puedes usar sudo con este usuario. +sudoRun=Forzando {0} a correr: /{1} {2} suicideMessage=\u00a77Adios mundo cruel... suicideSuccess= \u00a77{0} se quito su propia vida survival=survival takenFromAccount=\u00a7c{0} ha sido sacado de tu cuenta. -takenFromOthersAccount=\u00a7c{0} taken from {1}\u00a7c account. New balance: {2} +takenFromOthersAccount=\u00a7c{0} sacados de la cuenta de {1}\u00a7c. Nuevo balance: {2} teleportAAll=\u00a77Peticion de teletransporte enviada a todos los jugadores... teleportAll=\u00a77Teletransportando a todos los jugadores... teleportAtoB=\u00a77{0}\u00a77 te teletransporto a {1}\u00a77. @@ -334,8 +350,7 @@ teleportDisabled={0} tiene desactivado los teletransportes. teleportHereRequest=\u00a7c{0}\u00a7c ha pedido que te teletransportes con el. teleportNewPlayerError=Error al teletransportar al nuevo jugador teleportRequest=\u00a7c{0}\u00a7c te ha pedido teletransportarse contigo. -teleportRequestsCancelledWorldChange=\u00a77Pending teleport requests have been cancelled on world change. -teleportRequestTimeoutInfo=\u00a77This request will timeout after {0} seconds. +teleportRequestTimeoutInfo=\u00a77Esta peticion expirara despues de {0} segundos. teleportTop=\u00a77Teletransportandote a la cima. teleportationCommencing=\u00a77Comenzando teletransporte... teleportationDisabled=\u00a77Teletransporte desactivado. @@ -345,21 +360,22 @@ teleportingPortal=\u00a77Teletransportando via portal. tempBanned=Baneado temporalmente del servidor por {0} tempbanExempt=\u00a77No puedes banear temporalmente a ese jugador thunder= Tu has {0} los truenos en tu mundo. -thunderDuration=Tu has {0} los truenos en tu mundo durante {1} seconds. +thunderDuration=Tu has {0} los truenos en tu mundo durante {1} segundos. timeBeforeHeal=Tiempo antes de la siguiente curacion: {0} timeBeforeTeleport=Tiempo antes del proximo teletransporte: {0} timeFormat=\u00a73{0}\u00a7f or \u00a73{1}\u00a7f or \u00a73{2}\u00a7f timePattern=(?:([0-9]+)\\s*y[a-z]*[,\\s]*)?(?:([0-9]+)\\s*mo[a-z]*[,\\s]*)?(?:([0-9]+)\\s*w[a-z]*[,\\s]*)?(?:([0-9]+)\\s*d[a-z]*[,\\s]*)?(?:([0-9]+)\\s*h[a-z]*[,\\s]*)?(?:([0-9]+)\\s*m[a-z]*[,\\s]*)?(?:([0-9]+)\\s*(?:s[a-z]*)?)? -timeSet=Time establecido en todos los mundos. +timeSet=Hora establecida en todos los mundos. timeSetPermission=\u00a7cNo estas autorizado para establecer la hora. timeWorldCurrent=La hora actual en {0} es \u00a73{1} timeWorldSet=La hora ha sido establecido a {0} en: \u00a7c{1} +tps=TPS actuales = {0} tradeCompleted=\u00a77Intercambio completado. tradeSignEmpty=Esta tienda no tiene nada disponible para ti. tradeSignEmptyOwner=No hay nada que recojer de esta tienda. treeFailure=\u00a7cError al generar arbol. Prueba de nuevo en tierra o hierba. treeSpawned=\u00a77Arbol puesto. -true=true +true=\u00a72verdadero\u00a7f typeTpaccept=\u00a77Para teletransportarte, escribe \u00a7c/tpaccept\u00a77. typeTpdeny=\u00a77Para denegar esta peticion, escribe \u00a7c/tpdeny\u00a77. typeWorldName=\u00a77Tu tambien puedes escribir el nombre de un mundo especifico. @@ -372,7 +388,9 @@ unknownItemInList=Objeto desconocido {0} en {1} lista. unknownItemName=Nombre de objeto desconocido: {0} unlimitedItemPermission=\u00a7cNo tienes permiso para objetos ilimitados {0}. unlimitedItems=Objetos ilimitados. -unmutedPlayer=Jugador {0} desmuteado. +unmutedPlayer=Jugador {0} des-silenciado. +unvanished=\u00a7aEres visible otra vez. +unvanishedReload=\u00a7cUna recarga te ha forzado a ser vissible. upgradingFilesError=Error mientras se actualizaban los archivos userDoesNotExist=El usuario {0} no existe userIsAway={0} esta ahora ausente! @@ -382,39 +400,45 @@ userUsedPortal={0} uso un portal de salida existente. userdataMoveBackError=Error al mover userdata/{0}.tmp a userdata/{1} userdataMoveError=Error al mover userdata/{0} a userdata/{1}.tmp usingTempFolderForTesting=Usando carpeta temporal para pruebas: +vanished=\u00a7aTe has vuelto invisible. versionMismatch=La version no coincide! Por favor actualiza {0} a la misma version. versionMismatchAll=La version no coincide! Por favor actualiza todos los jars de Essentials a la misma version. voiceSilenced=\u00a77Tu voz ha sido silenciada warpDeleteError=Problema al borrar el archivo de teletransporte. warpListPermission=\u00a7cNo tienes permiso para listar esos teletransportes. warpNotExist=Ese teletransporte no existe. +warpOverwrite=\u00a7cNo puedes reemplazar ese teletransporte. warpSet=\u00a77Teletransporte {0} establecido. warpUsePermission=\u00a7cNo tienes permisos para usar ese teletransporte. warpingTo=\u00a77Teletransportandote a {0}. warps=Warps: {0} warpsCount=\u00a77Hay {0} teletransportes. Mostrando pagina {1} de {2}. -warpOverwrite=\u00a7cYou cannot overwrite that warp. weatherStorm=\u00a77Has establecido el tiempo a tormenta en este mundo. weatherStormFor=\u00a77Has establecido el tiempo a tormenta en este {1} durante {0} segundos. weatherSun=\u00a77Has establecido el tiempo a sol en este mundo. weatherSunFor=\u00a77Has establecido el tiempo a sol en este {1} durante {0} segundos. -whoisBanned=\u00a79 - Banned: {0} -whoisGamemode=\u00a79 - Gamemode: {0} -whoisGeoLocation=\u00a79 - Localizacion: {0} -whoisGod=\u00a79 - God mode: {0} -whoisHealth=\u00a79 - Salud: {0}/20 -whoisIPAddress=\u00a79 - Direccion IP: {0} -whoisIs={0} es {1} -whoisJail=\u00a79 - Jail: {0} -whoisLocation=\u00a79 - Localizacion: ({0}, {1}, {2}, {3}) -whoisMoney=\u00a79 - Dinero: {0} -whoisOP=\u00a79 - OP: {0} -whoisStatusAvailable=\u00a79 - Estado: Disponible -whoisStatusAway=\u00a79 - Status: \u00a7cAusente\u00a7f +whoisAFK=\u00a76 - AFK:\u00a7f {0} +whoisBanned=\u00a76 - Baneado:\u00a7f {0} +whoisExp=\u00a76 - Exp:\u00a7f {0} (Level {1}) +whoisFly=\u00a76 - Modo volador:\u00a7f {0} ({1}) +whoisGamemode=\u00a76 - Modo de juego:\u00a7f {0} +whoisGeoLocation=\u00a76 - Geolocalizacion:\u00a7f {0} +whoisGod=\u00a76 - Modo dios:\u00a7f {0} +whoisHealth=\u00a76 - Salud:\u00a7f {0}/20 +whoisIPAddress=\u00a76 - Direccion IP:\u00a7f {0} +whoisJail=\u00a76 - Carcel:\u00a7f {0} +whoisLocation=\u00a76 - Localizacion:\u00a7f ({0}, {1}, {2}, {3}) +whoisMoney=\u00a76 - Dinero:\u00a7f {0} +whoisMuted=\u00a76 - Silenciado:\u00a7f {0} +whoisNick=\u00a76 - Nick:\u00a7f {0} +whoisOp=\u00a76 - OP:\u00a7f {0} +whoisTop=\u00a76 ====== WhoIs:\u00a7f {0} \u00a76====== worth=\u00a77Pila de {0} con valor de \u00a7c{1}\u00a77 ({2} objeto(s) a {3} cada uno) worthMeta=\u00a77Pila de {0} con metadata de {1} , con valor de \u00a7c{2}\u00a77 ({3} objeto(s) a {4} cada uno) worthSet=Establecer el valor de un valor -year=año -years=años +year=a\u00f1o +years=a\u00f1os youAreHealed=\u00a77Has sido curado. youHaveNewMail=\u00a7cTienes {0} mensajes!\u00a7f Pon \u00a77/mail read\u00a7f para ver tus emails no leidos!. +hatRemoved=\u00a7eTu sombrero fue removido. +banFormat=Baneado: {0}
\ No newline at end of file diff --git a/Essentials/src/messages_fi.properties b/Essentials/src/messages_fi.properties new file mode 100644 index 000000000..f56a0a00b --- /dev/null +++ b/Essentials/src/messages_fi.properties @@ -0,0 +1,438 @@ +#version: ${build.number} +# Single quotes have to be doubled: '' +# Translations start here +# by: +action=* {0} {1} +addedToAccount=\u00a7a{0} on lis\u00e4tty sinun tilillesi. +addedToOthersAccount=\u00a7a{0} lis\u00e4tty {1}\u00a7a tilille. Uusi rahatilanne: {2} +alertBroke=rikkoi: +alertFormat=\u00a73[{0}] \u00a7f {1} \u00a76 {2} sijainnissa: {3} +alertPlaced=laittoi: +alertUsed=k\u00e4ytti: +autoAfkKickReason=Sinut on potkittu, koska olit tekem\u00e4tt\u00e4 mit\u00e4\u00e4n {0} minuuttia. +backAfterDeath=\u00a77K\u00e4yt\u00e4 /back komentoa p\u00e4\u00e4st\u00e4ksesi takaisin sijaintiin, jossa kuolit. +backUsageMsg=\u00a77Palautetaan \u00e4skeiseen sijaintiin. +backupDisabled=Ulkoista varmuuskopio koodia ei ole konfiguroitu. +backupFinished=Varmuuskopiointi suoritettu +backupStarted=Varmuuskopiointi aloitettu +balance=\u00a77Rahatilanne: {0} +balanceTop=\u00a77Top rahatilanteet ({0}) +banExempt=\u00a7cEt voi bannia pelaajaa. +banIpAddress=\u00a77Bannattu IP osoite +bannedIpsFileError=Virhe luettaessa banned-ips.txt tiedostoa +bannedIpsFileNotFound=banned-ips.txt tiedostoa ei l\u00f6ydy +bannedPlayersFileError=Virhe luettaessa banned-players.txt tiedostoa +bannedPlayersFileNotFound=banned-players.txt ei l\u00f6ydy +bigTreeFailure=\u00a7cIson puun luominen ep\u00e4onnistui. Yrit\u00e4 uudelleen nurmikolla tai mullalla. +bigTreeSuccess= \u00a77Iso puu luotu. +blockList=Essentials siirsi seuraavat komennot muihin plugineihin: +broadcast=[\u00a7cIlmoitus\u00a7f]\u00a7a {0} +buildAlert=\u00a7cSinulla ei ole oikeuksia rakentaa +bukkitFormatChanged=Bukkitin versiomuoto muuttui. Versiota ei ole tarkistettu. +burnMsg=\u00a77Asetit pelaajan {0} tuleen {1} sekunniksi. +canTalkAgain=\u00a77Voit taas puhua +cantFindGeoIpDB=Ei l\u00f6ydetty GeoIP tietokantaa! +cantReadGeoIpDB=Ei pystytty lukemaan GeoIP tietokantaa! +cantSpawnItem=\u00a7cSinulla ei ole oikeutta luoda tavaraa {0} +chatTypeLocal=[L] +chatTypeSpy=[Spy] +commandFailed=Komento {0} ep\u00e4onnistui: +commandHelpFailedForPlugin=Virhe haettaessa apua komennoista: {0} +commandNotLoaded=\u00a7cKomento {0} on v\u00e4\u00e4rin ladattu. +compassBearing=\u00a77Osoittaa: {0} ({1} astetta). +configFileMoveError=Virhe siirrett\u00e4ess\u00e4 tiedostoa config.yml varmuuskopio sijaintiin. +configFileRenameError=Virhe nimett\u00e4ess\u00e4 tiedostoa temp tiedostoon config.yml +connectedPlayers=Liittyneet pelaajat: +connectionFailed=Virhe avattaessa yhteytt\u00e4. +cooldownWithMessage=\u00a7cJ\u00e4\u00e4htyminen: {0} +corruptNodeInConfig=\u00a74Huom: Sinun konfigurointi tiedostossa on virhe {0}. +couldNotFindTemplate=Ei l\u00f6ydetty mallia {0} +creatingConfigFromTemplate=Luodaan config tiedostoa mallista: {0} +creatingEmptyConfig=Luodaan tyhj\u00e4\u00e4 config tiedostoa: {0} +creative=luova +currency={0}{1} +currentWorld=T\u00e4m\u00e4nhetkinen maailma: {0} +day=p\u00e4iv\u00e4 +days=p\u00e4iv\u00e4\u00e4 +defaultBanReason=Ban Nuija on puhunut! +deleteFileError=Ei voida poistaa tiedostoa: {0} +deleteHome=\u00a77Koti {0} on poistettu. +deleteJail=\u00a77Vankila {0} on poistettu. +deleteWarp=\u00a77Warp {0} on poistettu. +deniedAccessCommand={0} p\u00e4\u00e4sy komentoon ev\u00e4ttiin. +dependancyDownloaded=[Essentials] Tarvittu tiedosto {0} ladattu onnistuneesti. +dependancyException=[Essentials] Virhe ladattaessa tarvittua tiedostoa +dependancyNotFound=[Essentials] Tarvittua tiedostoa ei l\u00f6ydy, ladataan nyt. +depth=\u00a77Olet merenpinnan tasolla. +depthAboveSea=\u00a77Olet {0} palikkaa meritason yl\u00e4puolella. +depthBelowSea=\u00a77Olet {0} palikkaa meritason alapuolella. +destinationNotSet=Sijaintia ei ole m\u00e4\u00e4ritetty +disableUnlimited=\u00a77Poistettu k\u00e4yt\u00f6st\u00e4 loputon laittaminen tavaralta "{0}", pelaajalta {1}. +disabled=poissa k\u00e4yt\u00f6st\u00e4 +disabledToSpawnMob=T\u00e4m\u00e4n mobin luominen on poistettu k\u00e4yt\u00f6st\u00e4 config tiedostossa. +dontMoveMessage=\u00a77Teleportataan {0} kuluttua. \u00c4l\u00e4 liiku. +downloadingGeoIp=Ladataan GeoIP tietokantaa ... t\u00e4m\u00e4 voi vied\u00e4 hetken (maa: 0.6 MB, kaupunki: 20MB) +duplicatedUserdata=Kopioitu k\u00e4ytt\u00e4j\u00e4n tiedot: {0} ja {1} +durability=\u00a77T\u00e4ll\u00e4 ty\u00f6kalulla on \u00a7c{0}\u00a77 k\u00e4ytt\u00f6kertaa j\u00e4ljell\u00e4 +enableUnlimited=\u00a77Annetaan loputon m\u00e4\u00e4r\u00e4 tavaraa "{0}" pelaajalle {1}. +enabled=k\u00e4yt\u00f6ss\u00e4 +enchantmentApplied = \u00a77Parannus "{0}" on lis\u00e4tty tavaraan k\u00e4dess\u00e4si. +enchantmentNotFound = \u00a7cParannusta ei l\u00f6ydetty +enchantmentPerm = \u00a7cSinulla ei ole oikeutta {0} +enchantmentRemoved = \u00a77Parannus {0} on poistettu tavarasta k\u00e4dess\u00e4si. +enchantments = \u00a77Parannukset: {0} +errorCallingCommand=Virhe kutsuttaessa komentoa /{0} +errorWithMessage=\u00a7cVirhe: {0} +essentialsHelp1=Tiedosto on viallinen ja Essentials ei voi avata sit\u00e4. Essentials on nyt poistettu k\u00e4yt\u00f6st\u00e4. Jos et voi korjata tiedostoa itse, mene osoitteeseen http://tiny.cc/EssentialsChat +essentialsHelp2=Tiedosto on viallinen ja Essentials ei voi avata sit\u00e4. Essentials on nyt poistettu k\u00e4yt\u00f6st\u00e4. Jos et voi korjata tiedostoa itse, kirjoita /essentialshelp peliss\u00e4 tai mene osoitteeseen http://tiny.cc/EssentialsChat +essentialsReload=\u00a77Essentials ladattu uudelleen. Versio: {0} +exp=Pelaajalla \u00a7c{0} \u00a77on\u00a7c {1} \u00a77expi\u00e4 (taso\u00a7c {2}\u00a77) ja tarvitsee\u00a7c {3} \u00a77lis\u00e4\u00e4 expi\u00e4 seuravaan tasoon. +expSet=Pelaajalla\u00a7c{0} \u00a77on nyt\u00a7c {1} \u00a77expi\u00e4. +extinguish=\u00a77Sammutit itsesi. +extinguishOthers=\u00a77Sammutit pelaajan {0}. +failedToCloseConfig=Virhe suljettaessa tiedostoa config {0} +failedToCreateConfig=Virhe luotaessa tiedostoa config {0} +failedToWriteConfig=Virhe muokattaessa tiedostoa config {0} +false=v\u00e4\u00e4r\u00e4 +feed=\u00a77Ruokahalusi on tyydytetty. +feedOther=\u00a77Tyydytit ruokahalun pelaajalta {0}. +fileRenameError={0} uudelleen nime\u00e4minen ep\u00e4onnistui +flyMode=\u00a77Lento {0} pelaajalla {1}. +foreverAlone=\u00a7cSinulla ei ole ket\u00e4\u00e4n kenelle vastata. +freedMemory=Vapaata muistia {0} MB. +gameMode=\u00a77Asetit pelimuodon "{0}" pelaajalle {1}. +gcchunks= chunkkia, +gcentities= kokonaisuutta +gcfree=Vapaa muisti: {0} MB +gcmax=Maksimi muisti: {0} MB +gctotal=Sallittu muisti: {0} MB +geoIpUrlEmpty=GeoIP latausosoite on tyhj\u00e4. +geoIpUrlInvalid=GeoIP latausosoite on viallinen. +geoipJoinFormat=Pelaaja {0} tulee maasta {1} +godDisabledFor=poistettu pelaajalta {0} +godEnabledFor=laitettu pelaajalle {0} +godMode=\u00a77God muoto {0}. +hatArmor=\u00a7cVirhe, et voi k\u00e4ytt\u00e4\u00e4 t\u00e4t\u00e4 tavaraa hattuna! +hatFail=\u00a7cSinulla tulee olla jotain k\u00e4dess\u00e4si, mit\u00e4 k\u00e4ytt\u00e4\u00e4 hattuna. +hatPlaced=\u00a7eNauti uudesta hatustasi! +haveBeenReleased=\u00a77Sinut on vapautettu +heal=\u00a77Sinut on parannettu. +healOther=\u00a77Paransit pelaajan {0}. +helpConsole=Katsoaksesi apua konsolista, kirjoita ?. +helpFrom=\u00a77Komennot {0}: +helpLine=\u00a76/{0}\u00a7f: {1} +helpMatching=\u00a77Komennot "{0}": +helpOp=\u00a7c[HelpOp]\u00a7f \u00a77{0}:\u00a7f {1} +helpPages=Sivu \u00a7c{0}\u00a7f / \u00a7c{1}\u00a7f: +helpPlugin=\u00a74{0}\u00a7f: Plugin apu: /help {1} +holeInFloor=Reik\u00e4 lattiassa +homeSet=\u00a77Koti asetettu. +homeSetToBed=\u00a77Sinun koti on nyt asetettu t\u00e4h\u00e4n s\u00e4nkyyn. +homes=Kodit: {0} +hour=tunti +hours=tunnit +ignorePlayer=J\u00e4tit huomiotta pelaajan {0}. +illegalDate=Laiton p\u00e4iv\u00e4m\u00e4\u00e4r\u00e4n muoto. +infoChapter=Valitse luku: +infoChapterPages=Luku {0}, sivu \u00a7c{1}\u00a7f / \u00a7c{2}\u00a7f: +infoFileDoesNotExist=Tiedostoa info.txt ei ole olemassa. Luodaan. +infoPages=\u00a7e ---- \u00a76{2} \u00a7e--\u00a76 Sivu \u00a74{0}\u00a76/\u00a74{1} \u00a7e---- +infoUnknownChapter=Tuntematon luku. +invBigger=Toisen pelaajan reppu on isompi kuin sinun. +invRestored=Sinun reppusi on palautettu. +invSee=N\u00e4et pelaajan {0} repun. +invSeeHelp=K\u00e4yt\u00e4 /invsee kun haluat palauttaa oman reppusi. +invalidCharge=\u00a7cMit\u00e4t\u00f6n m\u00e4\u00e4r\u00e4ys. +invalidHome=Kotia {0} ei ole olemassa +invalidMob=Kelvoton mobin tyyppi. +invalidServer=Kelvoton palvelin! +invalidSignLine=Kyltin rivi {0} on viallinen. +invalidWorld=\u00a7cKelvoton maailma. +inventoryCleared=\u00a77Reppu tyhjennetty. +inventoryClearedOthers=\u00a77Pelaajan \u00a7c{0}\u00a77 reppu on tyhjennetty. +is=on +itemCannotBeSold=Tuota tavaraa ei voi myyd\u00e4 t\u00e4ll\u00e4 palvelimella. +itemMustBeStacked=Tavara pit\u00e4\u00e4 vaihtaa pakattuina. M\u00e4\u00e4r\u00e4 2s olisi kaksi pakettia, jne. +itemNotEnough1=\u00a7cSinulla ei ole tarpeeksi tavaraa jota myyd\u00e4. +itemNotEnough2=\u00a77Jos haluat myyd\u00e4 kaikki tuon tyypin tavarat, k\u00e4yt\u00e4 /sell tavarannimi +itemNotEnough3=\u00a77/sell itemname -1 myy kaiken paitsi yhden, jne. +itemSellAir=Yritit myyd\u00e4 ilmaa? Laita tavara k\u00e4teesi ja yrit\u00e4 uudelleen. +itemSold=\u00a77Myy \u00a7c{0} \u00a77({1} {2} hintaan {3} kpl) +itemSoldConsole={0} sold {1} for \u00a77{2} \u00a77({3} items at {4} each) +itemSpawn=\u00a77Annetaan {0} kpl {1} +itemsCsvNotLoaded=Ei voida ladata tiedostoa items.csv. +jailAlreadyIncarcerated=\u00a7cPelaaja on jo vankilassa: {0} +jailMessage=\u00a7cSin\u00e4 teet rikoksen, istut my\u00f6s sen mukaan. +jailNotExist=Tuota vankilaa ei ole olemassa. +jailReleased=\u00a77Pelaaja \u00a7e{0}\u00a77 vapautettu. +jailReleasedPlayerNotify=\u00a77Sinut on vapautettu! +jailSentenceExtended=Vankila aika pidennetty: {0) +jailSet=\u00a77Vankila {0} on asetettu +jumpError=Tuo vahingoittaisi koneesi aivoja. +kickDefault=Potkittu palvelimelta +kickExempt=\u00a7cEt voi potkia h\u00e4nt\u00e4. +kickedAll=\u00a7cPotkittu kaikki pelaajat palvelimelta +kill=\u00a77Tappoi {0}. +kitError2=\u00a7cTuota pakkausta ei ole olemassa tai se on v\u00e4\u00e4rin muokattu. +kitError=\u00a7cEi ole sopivia pakkauksia. +kitErrorHelp=\u00a7cEhk\u00e4 tavaralle ei ole m\u00e4\u00e4ritetty m\u00e4\u00e4r\u00e4\u00e4 configissa? +kitGive=\u00a77Annetaan pakkausta "{0}". +kitInvFull=\u00a7cSinun reppusi on t\u00e4ynn\u00e4, laitetaan tavarat maahan +kitTimed=\u00a7cAika, jota ennen et voi k\u00e4ytt\u00e4\u00e4 t\u00e4t\u00e4 pakkausta uudelleen: {0}. +kits=\u00a77Pakkaukset: {0} +lightningSmited=\u00a77Sinut on salamoitu +lightningUse=\u00a77Salamoidaan {0} +listAfkTag = \u00a77[AFK]\u00a7f +listAmount = \u00a79Pelaajia palvelimella \u00a7c{0}\u00a79 / \u00a7c{1}\u00a79. +listAmountHidden = \u00a79Pelaajia palvelimella \u00a7c{0}\u00a77/{1}\u00a79 / \u00a7c{2}\u00a79. +listGroupTag={0}\u00a7f: +listHiddenTag = \u00a77[HIDDEN]\u00a7f +loadWarpError=Virhe ladattaessa warppia {0} +localFormat=Paikallinen: <{0}> {1} +mailClear=\u00a7cPoistaaksesi viestisi, kirjoita /mail clear +mailCleared=\u00a77Viestit poistettu! +mailSent=\u00a77Viesti l\u00e4hetetty! +markMailAsRead=\u00a7cMerkitse viestit luetuiksi, kirjoita /mail clear +markedAsAway=\u00a77Sinut on laitettu poissaolevaksi. +markedAsNotAway=\u00a77Sinua ei ole en\u00e4\u00e4 laitettu poissaolevaksi. +maxHomes=Voit asettaa maksimissaan {0} kotia. +mayNotJail=\u00a7cEt voi laittaa tuota pelaajaa vankilaan +me=min\u00e4 +minute=minuutti +minutes=minuuttia +missingItems=Sinulla ei ole {0}kpl {1}. +missingPrefixSuffix=Puuttuu etuliite tai takaliite {0} +mobSpawnError=Virhe vaihdettaessa mob-luojan tyyppi\u00e4. +mobSpawnLimit=Mobien m\u00e4\u00e4r\u00e4 rajoitettu palvelimen maksimim\u00e4\u00e4r\u00e4\u00e4n +mobSpawnTarget=Kohteen pit\u00e4\u00e4 olla mob-luoja palikka. +mobsAvailable=\u00a77Mobit: {0} +moneyRecievedFrom=\u00a7a{0} on vastaanotettu pelaajalta {1} +moneySentTo=\u00a7a{0} on l\u00e4hetetty pelaajalle {1} +moneyTaken={0} veloitettiin sinun tililt\u00e4si. +month=kuukausi +months=kuukaudet +moreThanZero=M\u00e4\u00e4r\u00e4n pit\u00e4\u00e4 olla enemm\u00e4n kuin 0. +msgFormat=\u00a77[{0}\u00a77 -> {1}\u00a77] \u00a7f{2} +muteExempt=\u00a7cEt voi hiljent\u00e4\u00e4 tuota pelaajaa. +mutedPlayer=Pelaaja {0} hiljennetty. +mutedPlayerFor=Pelaaja {0} hiljennetty, koska {1}. +mutedUserSpeaks={0} yritti puhua, mutta oli hiljennetty. +nearbyPlayers=Pelaajat l\u00e4hell\u00e4: {0} +negativeBalanceError=Pelaajalla ei ole mahdollista olla negatiivist\u00e4 m\u00e4\u00e4r\u00e4\u00e4 rahaa. +nickChanged=Lempinimi vaihdettu. +nickDisplayName=\u00a77Sinun tulee ottaa k\u00e4ytt\u00f6\u00f6n change-displayname Essentialsin config-tiedostosta. +nickInUse=\u00a7cSe nimi on jo k\u00e4yt\u00f6ss\u00e4. +nickNamesAlpha=\u00a7cLempinimen pit\u00e4\u00e4 olla aakkosista. +nickNoMore=\u00a77Sinulla ei ole en\u00e4\u00e4 lempinime\u00e4. +nickOthersPermission=\u00a7cSinulla ei ole oikeutta vaihtaa muiden lempinimi\u00e4 +nickSet=\u00a77Lempinimesi on nyt \u00a7c{0} +noAccessCommand=\u00a7cSinulla ei ole oikeutta tuohon komentoon. +noAccessPermission=\u00a7cSinulla ei ole oikeutta tuohon {0}. +noBreakBedrock=Sinulla ei ole lupaa tuhota bedrock-palikoita. +noDestroyPermission=\u00a7cSinulla ei ole lupaa tuhota sit\u00e4 {0}. +noDurability=\u00a7cT\u00e4ll\u00e4 tavaralla ei ole kestoa. +noGodWorldWarning=\u00a7cVaroitus! God muoto ei ole k\u00e4yt\u00f6ss\u00e4 t\u00e4ss\u00e4 maailmassa. +noHelpFound=\u00a7cEi komentoja. +noHomeSet=Et ole asettanut kotia. +noHomeSetPlayer=Pelaaja ei ole asettanut kotia. +noKitPermission=\u00a7cTarvitset \u00a7c{0}\u00a7c oikeuden, jotta voit k\u00e4ytt\u00e4\u00e4 tuota pakkausta. +noKits=\u00a77Ei pakkauksia saatavilla viel\u00e4 +noMail=Ei uusia viestej\u00e4 +noMotd=\u00a7cEi ole p\u00e4iv\u00e4n viesti\u00e4. +noNewMail=\u00a77Ei viestej\u00e4. +noPendingRequest=Sinulla ei ole odottavia pyynt\u00f6j\u00e4. +noPerm=\u00a7cSinulla ei ole \u00a7f{0}\u00a7c oikeuksia. +noPermToSpawnMob=\u00a7cSinulla ei ole lupaa luoda t\u00e4t\u00e4 mobia. +noPlacePermission=\u00a7cSinulla ei ole lupaa laittaa palikoita l\u00e4helle tuota kyltti\u00e4. +noPowerTools=Ei voimaty\u00f6kaluja laitettu. +noRules=\u00a7cEi ole s\u00e4\u00e4nt\u00f6j\u00e4 viel\u00e4. +noWarpsDefined=Ei warppeja +none=ei mit\u00e4\u00e4n +notAllowedToQuestion=\u00a7cSinulla ei ole lupaa k\u00e4ytt\u00e4\u00e4 kysymyst\u00e4. +notAllowedToShout=\u00a7cSinulla ei ole lupaa huutaa. +notEnoughExperience=Sinulla ei ole tarpeeksi kokemusta. +notEnoughMoney=Sinulla ei ole riitt\u00e4v\u00e4sti rahaa. +notRecommendedBukkit= * ! * Bukkit versio ei ole suositeltu t\u00e4m\u00e4n Essentials version kanssa. +notSupportedYet=Ei tueta viel\u00e4. +nothingInHand = \u00a7cSinulla ei ole mit\u00e4\u00e4n k\u00e4dess\u00e4si. +now=nyt +nuke=Antaa kuoleman sateen kohdata heid\u00e4t +numberRequired=Numero menee tuohon, h\u00f6lm\u00f6. +onlyDayNight=/time tukee vain day/night. +onlyPlayers=Vain peliss\u00e4 olevat pelaajat voivat k\u00e4ytt\u00e4\u00e4 {0}. +onlySunStorm=/weather tukee vain sun/storm. +orderBalances=J\u00e4rjestet\u00e4\u00e4n rahatilanteita {0}, odota... +pTimeCurrent=Pelaajan \u00a7e{0}\u00a7f aika on {1}. +pTimeCurrentFixed=Pelaajan \u00a7e{0}\u00a7f aika on korjattu {1}. +pTimeNormal=Pelaajan \u00a7e{0}\u00a7f aika on normaali ja vastaa palvelimen aikaa. +pTimeOthersPermission=\u00a7cSinulla ei ole lupaa muokata muiden pelaajien aikaa. +pTimePlayers=N\u00e4ill\u00e4 pelaajilla on k\u00e4yt\u00f6ss\u00e4 heid\u00e4n oma aika: +pTimeReset=Pelaajan aika on resetoitu: \u00a7e{0} +pTimeSet=Pelaajan aika on asetettu \u00a73{0}\u00a7f koska: \u00a7e{1} +pTimeSetFixed=Pelaajan aika on korjattu \u00a73{0}\u00a7f koska: \u00a7e{1} +parseError=Virhe tarkistettaessa {0} rivill\u00e4 {1} +pendingTeleportCancelled=\u00a7cOdottava teleporttipyynt\u00f6 peruttu. +permissionsError=Puuttuu Permissions/GroupManager; keskustelun etu- ja takaliitteet poistettu k\u00e4yt\u00f6st\u00e4. +playerBanned=\u00a7cPelaaja {0} bannasi pelaajan {1} syyst\u00e4 {2} +playerInJail=\u00a7cPelaaja on jo vankilassa {0}. +playerJailed=\u00a77Pelaaja {0} laitettu vankilaan. +playerJailedFor= \u00a77Pelaaja {0} laitettu vankilaan, koska {1}. +playerKicked=\u00a7cPelaaja {0} potki pelaajan {1} koska {2} +playerMuted=\u00a77Sinut on hiljennetty +playerMutedFor=\u00a77Sinut on hiljennetty, koska {0} +playerNeverOnServer=\u00a7cPelaaja {0} ei ole koskaan ollut t\u00e4ll\u00e4 palvelimella. +playerNotFound=\u00a7cPelaajaa ei l\u00f6ydetty. +playerUnmuted=\u00a77Sin\u00e4 voit taas puhua +pong=Pong! +possibleWorlds=\u00a77Mahdollisia maailmoja on numerot v\u00e4lilt\u00e4 0 - {0}. +powerToolAir=Komentoa ei voi liitt\u00e4\u00e4 k\u00e4teen. +powerToolAlreadySet=Komento \u00a7c{0}\u00a7f on liitetty kohteeseen {1}. +powerToolAttach=\u00a7c{0}\u00a7f komento liitetty kohteeseen {1}. +powerToolClearAll=Kaikki voimaty\u00f6kalun komennot on poistettu. +powerToolList={1} omistaa seuraavat komennot: \u00a7c{0}\u00a7f. +powerToolListEmpty={0} ei ole komentoja liitetty. +powerToolNoSuchCommandAssigned=Komentoa \u00a7c{0}\u00a7f ei ole liitetty kohteeseen {1}. +powerToolRemove=Komento \u00a7c{0}\u00a7f poistettu kohteesta {1}. +powerToolRemoveAll=Kaikki komennot poistettu kohteesta {0}. +powerToolsDisabled=Kaikki voimaty\u00f6kalut on poistettu k\u00e4yt\u00f6st\u00e4. +powerToolsEnabled=Kaikki voimaty\u00f6alut on otettu k\u00e4ytt\u00f6\u00f6n. +protectionOwner=\u00a76[EssentialsProtect] Suojauksen omistaja: {0} +questionFormat=\u00a77[Question]\u00a7f {0} +readNextPage=Kirjoita /{0} {1} lukeaksesi seuraavan sivun +reloadAllPlugins=\u00a77Kaikki pluginit uudelleen ladattu. +removed=\u00a77Poistettu {0} kokonaisuutta. +repair=Onnistuneesti korjasit ty\u00f6kalun: \u00a7e{0}. +repairAlreadyFixed=\u00a77T\u00e4m\u00e4 tavara ei kaipaa korjaamista. +repairEnchanted=\u00a77Sinulla ei ole lupaa korjata kehitettyj\u00e4 tavaroita. +repairInvalidType=\u00a7cT\u00e4t\u00e4 tavaraa ei voi korjata. +repairNone=Ei ollut tavaroita, jotka olivat korjauksen tarpeessa. +requestAccepted=\u00a77Teleporttaus pyynt\u00f6 hyv\u00e4ksytty. +requestAcceptedFrom=\u00a77{0} hyv\u00e4ksyi sinun teleportti pyynn\u00f6n. +requestDenied=\u00a77Teleporttaus pyynt\u00f6 kielletty. +requestDeniedFrom=\u00a77{0} kielt\u00e4ytyi sinun teleportti pyynn\u00f6st\u00e4. +requestSent=\u00a77Pyynt\u00f6 l\u00e4hetetty pelaajalle {0}\u00a77. +requestTimedOut=\u00a7cTeleportti pyynt\u00f6 aikakatkaistiin +requiredBukkit= * ! * Tarvitset v\u00e4hint\u00e4\u00e4n {0} version CraftBukkitista, lataa se osoitteesta http://dl.bukkit.org/downloads/craftbukkit/ +returnPlayerToJailError=Virhe laitettaessa pelaaja {0} takaisin vankilaan: {1} +second=sekunti +seconds=sekuntia +seenOffline=Pelaaja {0} on ollut offline jo {1} +seenOnline=Pelaaja {0} on ollut online jo {1} +serverFull=Palvelin on t\u00e4ynn\u00e4 +serverTotal=Palvelimen kokonaism\u00e4\u00e4r\u00e4m\u00e4\u00e4r\u00e4: {0} +setSpawner=Vaihdettu mob-luojan tyyppi {0} +sheepMalformedColor=Viallinen v\u00e4ri. +shoutFormat=\u00a77[Huuto]\u00a7f {0} +signFormatFail=\u00a74[{0}] +signFormatSuccess=\u00a71[{0}] +signFormatTemplate=[{0}] +signProtectInvalidLocation=\u00a74Sinulla ei ole lupaa laittaa kyltti\u00e4 t\u00e4h\u00e4n. +similarWarpExist=Tuon niminen warp on jo olemassa. +slimeMalformedSize=Viallinen koko. +soloMob=Tuo mob tykk\u00e4\u00e4 olevan yksin +spawnSet=\u00a77Spawn sijainti m\u00e4\u00e4ritetty ryhm\u00e4lle {0}. +spawned=luotu +sudoExempt=Et voi sudoa t\u00e4t\u00e4 pelaajaa +sudoRun=Pakotetaan {0} suorittamaan: /{1} {2} +suicideMessage=\u00a77Hyv\u00e4sti julma maailma... +suicideSuccess= \u00a77{0} riisti oman henkens\u00e4 +survival=selviytyminen +takenFromAccount=\u00a7c{0} on veloitettu tililt\u00e4si. +takenFromOthersAccount=\u00a7c{0} veloitettu pelaajan {1}\u00a7c tililt\u00e4. Uusi rahatilanne: {2} +teleportAAll=\u00a77Teleporttaus pyynt\u00f6 l\u00e4hetetty kaikille pelaajille... +teleportAll=\u00a77Teleportataan kaikki pelaajat... +teleportAtoB=\u00a77{0}\u00a77 teleporttasi sinun luokse {1}\u00a77. +teleportDisabled=Pelaajalla {0} on teleporttaus poissa k\u00e4yt\u00f6st\u00e4. +teleportHereRequest=\u00a7c{0}\u00a7c on pyyt\u00e4nyt, ett\u00e4 sin\u00e4 teleporttaat heid\u00e4n luokseen. +teleportNewPlayerError=Virhe teleportattaessa uutta pelaajaa +teleportRequest=\u00a7c{0}\u00a7c on pyyt\u00e4nyt lupaa sinun luokse teleporttaamiseen. +teleportRequestTimeoutInfo=\u00a77T\u00e4m\u00e4 pyynt\u00f6 aikakatkaistaan {0} sekunnin kuluttua. +teleportTop=\u00a77Teleportataan p\u00e4\u00e4lle. +teleportationCommencing=\u00a77Teleportataan... +teleportationDisabled=\u00a77Teleporttaus poistettu k\u00e4yt\u00f6st\u00e4. +teleportationEnabled=\u00a77Teleportation otettu k\u00e4ytt\u00f6\u00f6n. +teleporting=\u00a77Teleportataan... +teleportingPortal=\u00a77Teleportataan portaalin kautta. +tempBanned=Olet v\u00e4liaikaisesti bannattu palvelimelta, koska {0} +tempbanExempt=\u00a77Et voi bannia tuota pelaajaa +thunder= Myrsky {0} maailmassasi +thunderDuration=Myrsky {0} maailmassasi {1} sekuntia. +timeBeforeHeal=Aika ennen seuraavaa parannusta: {0} +timeBeforeTeleport=Aika ennen seuraavaa teleporttausta: {0} +timeFormat=\u00a73{0}\u00a7f tai \u00a73{1}\u00a7f tai \u00a73{2}\u00a7f +timePattern=(?:([0-9]+)\\s*y[a-z]*[,\\s]*)?(?:([0-9]+)\\s*mo[a-z]*[,\\s]*)?(?:([0-9]+)\\s*w[a-z]*[,\\s]*)?(?:([0-9]+)\\s*d[a-z]*[,\\s]*)?(?:([0-9]+)\\s*h[a-z]*[,\\s]*)?(?:([0-9]+)\\s*m[a-z]*[,\\s]*)?(?:([0-9]+)\\s*(?:s[a-z]*)?)? +timeSet=Aika asetettu kaikissa maailmoissa. +timeSetPermission=\u00a7cSinulla ei ole lupaa vaihtaa aikaa. +timeWorldCurrent=T\u00e4m\u00e4nhetkinen aika maailmassa {0} on \u00a73{1} +timeWorldSet=Aika vaihdettiin {0} maailmassa: \u00a7c{1} +tps=T\u00e4m\u00e4nhetkinen TPS = {0} +tradeCompleted=\u00a77Vaihto suoritettu. +tradeSignEmpty=Vaihtokyltill\u00e4 ei ole mit\u00e4\u00e4n tarjolla sinulle. +tradeSignEmptyOwner=Ei ole mit\u00e4\u00e4n mit\u00e4 ker\u00e4t\u00e4 t\u00e4st\u00e4 vaihtokyltist\u00e4. +treeFailure=\u00a7cPuun luominen ep\u00e4onnistui. Yrit\u00e4 uudelleen nurmikolla tai mullalla. +treeSpawned=\u00a77Puu luotu. +true=totta +typeTpaccept=\u00a77Hyv\u00e4ksy\u00e4ksesi, kirjoita \u00a7c/tpaccept\u00a77. +typeTpdeny=\u00a77Kielt\u00e4\u00e4ksesi, kirjoita \u00a7c/tpdeny\u00a77. +typeWorldName=\u00a77Voit my\u00f6s laittaa maailman nimen. +unableToSpawnMob=Ei voida luoda mobia. +unbannedIP=Unbanned IP osoite. +unbannedPlayer=Unbanned pelaaja. +unignorePlayer=Otat taas huomioon pelaajan {0}. +unknownItemId=Tuntematon tavaran ID: {0} +unknownItemInList=Tuntematon tavara {0} listassa {1}. +unknownItemName=Tuntematon tavaran nimi: {0} +unlimitedItemPermission=\u00a7cEi lupaa loputtomalle tavaralle {0}. +unlimitedItems=Loputtomat tavarat: +unmutedPlayer=Pelaajat {0} voi taas puhua. +unvanished=\u00a7aOlet taas n\u00e4kyvill\u00e4. +unvanishedReload=\u00a7cSinut on pakotettu taas n\u00e4kyv\u00e4ksi uudelleen latauksen vuoksi. +upgradingFilesError=Virhe p\u00e4ivitett\u00e4ess\u00e4 tiedostoja +userDoesNotExist=Pelaajaa {0} ei ole olemassa. +userIsAway={0} on nyt AFK +userIsNotAway={0} ei ole en\u00e4\u00e4 AFK +userJailed=\u00a77Sinut on laitettu vankilaan +userUsedPortal={0} k\u00e4ytti portaalia. +userdataMoveBackError=Virhe siirrett\u00e4ess\u00e4 k\u00e4ytt\u00e4j\u00e4n tietoja/{0}.tmp k\u00e4ytt\u00e4j\u00e4n tietoihin/{1} +userdataMoveError=Virhe siirrett\u00e4ess\u00e4 k\u00e4ytt\u00e4j\u00e4n tietoja/{0} k\u00e4ytt\u00e4j\u00e4n tietoihin/{1}.tmp +usingTempFolderForTesting=K\u00e4ytet\u00e4\u00e4n v\u00e4liaikaista kansiota testaukseen: +vanished=\u00a7aOlet n\u00e4kym\u00e4t\u00f6n. +versionMismatch=Versiot eiv\u00e4t t\u00e4sm\u00e4\u00e4! P\u00e4ivit\u00e4 {0} samaan versioon. +versionMismatchAll=Versiot eiv\u00e4t t\u00e4sm\u00e4\u00e4! P\u00e4ivit\u00e4 kaikki Essentialsin jar tiedostot samaan versioon. +voiceSilenced=\u00a77Sinun \u00e4\u00e4ni on hiljennetty +warpDeleteError=Virhe poistettaessa warp tiedostoa. +warpListPermission=\u00a7cSinulla ei ole oikeuksia n\u00e4hd\u00e4 warp-listaa. +warpNotExist=Tuota warppia ei ole olemassa. +warpOverwrite=\u00a7cEt voi korvata tuota warppia. +warpSet=\u00a77Warp {0} asetettu. +warpUsePermission=\u00a7cSinulla ei ole oikeutta k\u00e4ytt\u00e4\u00e4 tuota warppia. +warpingTo=\u00a77Sinut warpataan pian kohteeseen {0}. +warps=Warpit: {0} +warpsCount=\u00a77Warppeja on {0} kpl. N\u00e4ytet\u00e4\u00e4n sivu {1} / {2}. +weatherStorm=\u00a77Laitoit myrskyn maailmaan {0} +weatherStormFor=\u00a77Laitoit myrskyn maailmaan {0} {1} sekunniksi +weatherSun=\u00a77Laitoit auringon paistamaan maailmaan {0} +weatherSunFor=\u00a77Laitoit auringon paistamaan maailmaan {0} {1} sekunniksi +whoisBanned=\u00a79 - Bannattu: {0} +whoisExp=\u00a79 - Exp: {0} (Taso {1}) +whoisGamemode=\u00a79 - Pelimuoto: {0} +whoisGeoLocation=\u00a79 - Sijainti: {0} +whoisGod=\u00a79 - God muoto: {0} +whoisHealth=\u00a79 - Terveys: {0}/20 +whoisIPAddress=\u00a79 - IP Osoite: {0} +whoisIs={0} on {1} +whoisJail=\u00a79 - Vankila: {0} +whoisLocation=\u00a79 - Sijainti: ({0}, {1}, {2}, {3}) +whoisMoney=\u00a79 - Raha: {0} +whoisOP=\u00a79 - OP: {0} +whoisStatusAvailable=\u00a79 - Tilanne: Saatavilla +whoisStatusAway=\u00a79 - Tilanne: \u00a7cPoissa\u00a7f +worth=\u00a77Pino tavaraa "{0}" on arvoltaan \u00a7c{1}\u00a77 ({2} tavara(a) = {3} kappale) +worthMeta=\u00a77Pino tavaraa "{0}" metadatan kanssa {1} on arvoltaan \u00a7c{2}\u00a77 ({3} tavara(a) = {4} kappale) +worthSet=Arvo asetettu +year=vuosi +years=vuosia +youAreHealed=\u00a77Sinut on parannettu. +youHaveNewMail=\u00a7cSinulla on {0} viesti(\u00e4)!\u00a7f Kirjoita \u00a77/mail read\u00a7f lukeaksesi viestit. +hatRemoved=\u00a7eYour hat has been removed. +banFormat=Banned: {0} diff --git a/Essentials/src/messages_fr.properties b/Essentials/src/messages_fr.properties index 43edb4e32..d0243cf32 100644 --- a/Essentials/src/messages_fr.properties +++ b/Essentials/src/messages_fr.properties @@ -12,6 +12,7 @@ alertUsed=a utilis\u00e9 : autoAfkKickReason=Vous avez \u00e9t\u00e9 \u00e9ject\u00e9 pour inactivit\u00e9e sup\u00e9rieure \u00e0 {0} minutes. backAfterDeath=\u00a77Utilisez la commande /back pour retourner \u00e0 l''endroit ou vous \u00eates mort. backUsageMsg=\u00a77Retour \u00e0 votre emplacement pr\u00e9c\u00c3\u00a8dent. +backupDisabled=An external backup script has not been configured. backupFinished=Sauvegarde termin\u00e9 backupStarted=D\u00e9but de la sauvegarde... balance=\u00a77Solde : {0} @@ -34,6 +35,7 @@ cantFindGeoIpDB=N'arrive pas \u00e0 trouver la base de donn\u00e9es GeoIP! cantReadGeoIpDB=Echec de la lecture de la base de donn\u00e9es GeoIP! cantSpawnItem=\u00a7cVous n''avez pas le droit de faire appara\u00c3\u00aetre {0} chatTypeLocal=[L] +chatTypeAdmin=[A] chatTypeSpy=[Spy] commandFailed=\u00c9chec de la commande {0} : commandHelpFailedForPlugin=Erreur d''obtention d''aide pour : {0} @@ -41,7 +43,7 @@ commandNotLoaded=\u00a7cLa commande {0} a \u00e9t\u00e9 mal charg\u00e9e. compassBearing=\u00a77Orientation : {0} ({1} degr\u00e9s). configFileMoveError=\u00c9chec du d\u00e9placement de config.yml vers l'emplacement de sauvegarde. configFileRenameError=\u00c9chec du changement de nom du fichier temporaire de config.yml -connectedPlayers=Joueurs connect\u00e9s : +connectedPlayers=Joueurs connect\u00e9s : connectionFailed=\u00c9chec de l'ouverture de la connexion. cooldownWithMessage=\u00a7cR\u00e9utilisation : {0} corruptNodeInConfig=\u00a74Annonce : Votre fichier de configuration a un {0} n\u0153ud corrompu. @@ -50,6 +52,7 @@ creatingConfigFromTemplate=Cr\u00e9ation de la configuration \u00e0 partir du mo creatingEmptyConfig=Cr\u00e9ation d''une configuration vierge : {0} creative=cr\u00e9atif currency={0}{1} +currentWorld=Current World: {0} day=jour days=jours defaultBanReason=Le marteau du bannissement a frapp\u00e9 ! @@ -71,6 +74,7 @@ disabledToSpawnMob=Spawning this mob was disabled in the config file. dontMoveMessage=\u00a77La t\u00e9l\u00e9portation commence dans {0}. Ne bougez pas. downloadingGeoIp=T\u00e9l\u00e9chargement de la base de donn\u00e9es GeoIP ... Cela peut prendre un moment (Pays : 0.6 Mo, villes : 20Mo) duplicatedUserdata=Donn\u00e9e utilisateur dupliqu\u00e9e : {0} et {1} +durability=\u00a77This tool has \u00a7c{0}\u00a77 uses left enableUnlimited=\u00a77Quantit\u00e9 illimit\u00e9e de {0} \u00e0 {1}. enabled=activ\u00e9 enchantmentApplied = \u00a77L''enchantement {0} a \u00e9t\u00e9 appliqu\u00e9 \u00e0 l''objet dans votre main. @@ -83,15 +87,19 @@ errorWithMessage=\u00a7cErreur : {0} essentialsHelp1=Le fichier est corrompuet Essentials ne peut l'ouvrir. Essentials est maintenant d\u00e9sactiv\u00e9. Si vous ne pouvez corriger vous-m\u00eame, aller \u00e0 http://tiny.cc/EssentialsChat essentialsHelp2=Le fichier est corrompuet Essentials ne peut l'ouvrir. Essentials est maintenant d\u00e9sactiv\u00e9. Si vous ne pouvez corriger vous-m\u00eame, tapez /essentialshelp ou aller \u00e0 http://tiny.cc/EssentialsChat essentialsReload=\u00a77Essentials {0} a \u00e9t\u00e9 recharg\u00e9. +exp=\u00a7c{0} \u00a77has\u00a7c {1} \u00a77exp (level\u00a7c {2}\u00a77) and needs\u00a7c {3} \u00a77more exp to level up. +expSet=\u00a7c{0} \u00a77now has\u00a7c {1} \u00a77exp. extinguish=\u00a77Vous cessez de br\u00fbler. extinguishOthers=\u00a77Vous avez \u00e9teint la combustion de {0}. failedToCloseConfig=Echec de la fermeture de la configuration {0} failedToCreateConfig=Echec de la cr\u00e9ation de la configuration {0} failedToWriteConfig=\u00c9chec de l''\u00e9criture de la configuration {0} -false=non +false=\u00a74false\u00a7f feed=\u00a77Vous avez \u00e9t\u00e9 rassasi\u00e9. feedOther=\u00a77 est rassasi\u00e9 {0}. fileRenameError=Echec du changement de nom de {0} +flyMode=\u00a77Set fly mode {0} for {1}. +flying=flying foreverAlone=\u00a7cVous n''avez personne \u00e0 qui r\u00e9pondre freedMemory=A lib\u00e9r\u00e9 {0} Mo. gameMode=\u00a77Mode de jeu {0} pour {1}. @@ -106,13 +114,20 @@ geoipJoinFormat=Joueur {0} vient de {1} godDisabledFor=d\u00e9sactiv\u00e9 pour {0} godEnabledFor=activ\u00e9 pour {0} godMode=\u00a77Mode Dieu {0}. +hatArmor=\u00a7cError, you cannot use this item as a hat! +hatEmpty=\u00a7cYou are not wearing a hat. +hatFail=\u00a7cYou must have something to wear in your hand. +hatPlaced=\u00a7eEnjoy your new hat! haveBeenReleased=\u00a77Vous avez \u00e9t\u00e9 lib\u00e9r\u00e9. heal=\u00a77Vous avez \u00e9t\u00e9 soign\u00e9. healOther=\u00a77{0} a \u00e9t\u00e9 soign\u00e9. helpConsole=Pour voir l''aide tapez ? +helpFrom=\u00a77Commands from {0}: helpLine=\u00a76/{0}\u00a7f: {1} +helpMatching=\u00a77Commands matching "{0}": helpOp=\u00a7c[Aide Admin]\u00a7f \u00a77{0} : \u00a7f {1} helpPages=Page \u00a7c{0}\u00a7f sur \u00a7c{1}\u00a7f. +helpPlugin=\u00a74{0}\u00a7f: Plugin Help: /help {1} holeInFloor=Trou dans le Sol. homeSet=\u00a77R\u00e9sidence d\u00e9finie. homeSetToBed=\u00a77Votre r\u00e9sidence est d\u00e9sormais li\u00e9e \u00e0 ce lit. @@ -124,7 +139,7 @@ illegalDate=Format de date ill\u00e9gal. infoChapter=S\u00e9lectionnez le chapitre : infoChapterPages=Chapitre {0}, page \u00a7c{1}\u00a7f sur \u00a7c{2}\u00a7f: infoFileDoesNotExist=Le fichier info.txt n'existe pas. Le fichier est en cours de cr\u00e9ation pour vous. -infoPages=Page \u00a7c{0}\u00a7f de \u00a7c{1}\u00a7f. +infoPages=\u00a7e ---- \u00a76{2} \u00a7e--\u00a76 Page \u00a74{0}\u00a76/\u00a74{1} \u00a7e---- infoUnknownChapter=Chapitre inconnu. invBigger=Les inventaires des autres joueurs sont plus gros que le v\u00f4tre. invRestored=Votre inventaire vous a \u00e9t\u00e9 rendu. @@ -159,12 +174,13 @@ jailSet=\u00a77La prison {0} a \u00e9t\u00e9 cr\u00e9\u00e9. jumpError=\u00c7a aurait pu faire mal au cerveau de votre ordinateur. kickDefault=\u00c9ject\u00e9 du serveur kickExempt=\u00a77Vous ne pouvez pas \u00e9jecter ce joueur. +kickedAll=\u00a7cKicked all players from server kill=\u00a77Tu\u00e9 {0}. kitError2=\u00a7cCe kit n'existe pas ou a \u00e9t\u00e9 mal d\u00e9fini. kitError=\u00a7cIl n'y a pas de kits valides. kitErrorHelp=\u00a7cPeut-\u00eatre qu'un objet manque d'une quantit\u00e9 dans la configuration ? kitGive=\u00a77Donner le kit {0}. -InvFull=\u00a7cYour inventory was full, dropping items on the floor +kitInvFull=\u00a7cVotre inventaire \u00e9tait plein, le kit est parre-terre. kitTimed=\u00a7cVous ne pouvez pas utiliser ce kit pendant encore {0}. kits=\u00a77Kits :{0} lightningSmited=\u00a77Vous venez d'\u00eatre foudroy\u00e9. @@ -205,7 +221,6 @@ mutedPlayer=Le joueur {0} est d\u00e9sormais muet. mutedPlayerFor={0} a \u00e9t\u00e9 muet pour {1}. mutedUserSpeaks={0} a essay\u00e9 de parler mais est muet. nearbyPlayers=Joueurs dans les environs : {0} -needTpohere=Vous avez besoin de l'acc\u00c3\u00a8s \u00e0 /tpohere pour t\u00e9l\u00e9porter d'autres joueurs. negativeBalanceError=L'utilisateur n'est pas autoris\u00e9 \u00e0 avoir un solde n\u00e9gatif. nickChanged=surnom modifi\u00e9. nickDisplayName=\u00a77Vous devez activer change-displayname dans la configuration Essentials. @@ -218,6 +233,7 @@ noAccessCommand=\u00a7cVous n'avez pas acc\u00c3\u00a8s \u00e0 cette commande. noAccessPermission=\u00a7cVous n''avez pas la permissions d''acc\u00e9der \u00e0 cette {0} noBreakBedrock=You are not allowed to destroy bedrock. noDestroyPermission=\u00a7cVous n''avez pas la permission de d\u00e9truire ce {0}. +noDurability=\u00a7cThis item does not have a durability. noGodWorldWarning=\u00a7cWarning! Le mode Dieu est d\u00e9sactiv\u00e9 dans ce monde. noHelpFound=\u00a7cAucune commande correspondante. noHomeSet=Vous n'avez pas d\u00e9fini de r\u00e9sidence. @@ -239,6 +255,7 @@ notAllowedToQuestion=\u00a7cVous n'\u00eates pas autoris\u00e9 \u00e0 poser des notAllowedToShout=\u00a7cVous n'\u00eates pas autoris\u00e9 \u00e0 crier. notEnoughExperience=Vous n'avez pas assez d'exp\u00e9rience. notEnoughMoney=Vous n'avez pas les fonds n\u00e9cessaires. +notFlying=not flying notRecommendedBukkit=* ! * La version de Bukkit n'est pas celle qui est recommand\u00e9 pour cette version de Essentials. notSupportedYet=Pas encore pris en charge. nothingInHand = \u00a7cVous n'avez rien en main. @@ -299,11 +316,10 @@ requestDenied=\u00a77Demande de t\u00e9l\u00e9portation refus\u00e9e. requestDeniedFrom=\u00a77{0} a refus\u00e9 votre demande de t\u00e9l\u00e9portation. requestSent=\u00a77Requ\u00eate envoy\u00e9e \u00e0 {0}\u00a77. requestTimedOut=\u00a7cLa de mande de t\u00e9l\u00e9portation a expir\u00e9. -requiredBukkit=* ! * Vous avez besoin au moins de la version {0} de CraftBukkit. T\u00e9l\u00e9chargez-la ici http://ci.bukkit.org. +requiredBukkit=* ! * Vous avez besoin au moins de la version {0} de CraftBukkit. T\u00e9l\u00e9chargez-la ici http://dl.bukkit.org/downloads/craftbukkit/ returnPlayerToJailError=Error occurred when trying to return player {0} to jail: {1} second=seconde seconds=secondes -seenBanReason=Reason: {0} seenOffline=Le joueur {0} est hors ligne depuis {1} seenOnline=Le joueur {0} est en ligne depuis {1} serverFull=Le serveur est plein. @@ -334,7 +350,6 @@ teleportDisabled={0} a la t\u00e9l\u00e9portation d\u00e9sactiv\u00e9. teleportHereRequest=\u00a7c{0}\u00a7c Vous a demand\u00e9 de vous t\u00e9l\u00e9porter \u00e0 lui/elle. teleportNewPlayerError=\u00c9chec de la t\u00e9l\u00e9portation du nouveau joueur. teleportRequest=\u00a7c{0}\u00a7c vous demande s''il peut se t\u00e9l\u00e9porter vers vous. -teleportRequestsCancelledWorldChange=\u00a77Pending teleport requests have been cancelled on world change. teleportRequestTimeoutInfo=\u00a77Cette demande de t\u00e9l\u00e9portation expirera dans {0} secondes. teleportTop=\u00a77T\u00e9l\u00e9portation vers le haut. teleportationCommencing=\u00a77D\u00e9but de la t\u00e9l\u00e9portation... @@ -354,12 +369,13 @@ timeSet=Heure r\u00e9gl\u00e9e dans tous les mondes. timeSetPermission=\u00a7cVous n'\u00eates pas autoris\u00e9 \u00e0 r\u00e9gler l'heure. timeWorldCurrent=Il est \u00a73{1}\u00a77 dans \u00a7c{0}. timeWorldSet=L''heure a \u00e9t\u00e9 r\u00e9gl\u00e9e \u00e0 {0} dans : \u00a7c{1} +tps=Current TPS = {0} tradeCompleted=\u00a77\u00c9change termin\u00e9. tradeSignEmpty=Le panneau de vente n'as pas encore assez de stock. tradeSignEmptyOwner=Il n'y a rien \u00e0 collecter de cette pancarte d'\u00e9change commercial. treeFailure=\u00a7cEchec de la g\u00e9n\u00e9ration de l'arbre. Essayez de nouveau sur de l'herbe ou de la terre. treeSpawned=\u00a77Arbre cr\u00e9\u00e9. -true=oui +true=\u00a72true\u00a7f typeTpaccept=\u00a77Pour le t\u00e9l\u00e9porter, utilisez \u00a7c/tpaccept\u00a77. typeTpdeny=\u00a77Pour d\u00e9cliner cette demande, utilisez \u00a7c/tpdeny\u00a77. typeWorldName=\u00a77Vous pouvez aussi taper le nom d'un monde sp\u00e9cifique. @@ -373,6 +389,8 @@ unknownItemName=Nom d''objet inconnu : {0} unlimitedItemPermission=\u00a7cPas de permission pour l''objet illimit\u00e9 {0}. unlimitedItems=Objets illimit\u00e9s: unmutedPlayer=Le joueur {0} n''est plus muet. +unvanished=\u00a7aYou are once again visible. +unvanishedReload=\u00a7cA reload has forced you to become visible. upgradingFilesError=Erreur durant la mise \u00e0 jour des fichiers. userDoesNotExist=L''utilisateur {0} n''existe pas. userIsAway={0} s'est mis en AFK @@ -382,35 +400,39 @@ userUsedPortal={0} a utilis\u00e9 un portail existant. userdataMoveBackError=Echec du d\u00e9placement de userdata/{0}.tmp vers userdata/{1} userdataMoveError=Echec du d\u00e9placement de userdata/{0} vers userdata/{1}.tmp usingTempFolderForTesting=Utilise un fichier temporaire pour un test. +vanished=\u00a7aYou have now been vanished. versionMismatch=Versions diff\u00e9rentes ! Mettez s''il vous plait {0} \u00e0 la m\u00eame version. versionMismatchAll=Mauvaise version ! S'il vous plait mettez des jars Essentials de version identique. voiceSilenced=\u00a77Vous avez \u00e9t\u00e9 r\u00e9duit au silence. warpDeleteError=Probl\u00c3\u00a8me concernant la suppression du fichier warp. warpListPermission=\u00a7cVous n'avez pas la permission d'afficher la liste des points de t\u00e9l\u00e9portation. warpNotExist=Ce point de t\u00e9l\u00e9portation n'existe pas. +warpOverwrite=\u00a7cYou cannot overwrite that warp. warpSet=\u00a77Le point de t\u00e9l\u00e9portation {0} a \u00e9t\u00e9 cr\u00e9\u00e9. warpUsePermission=\u00a7cVous n'avez pas la permission d'utiliser ce point de t\u00e9l\u00e9portation. warpingTo=\u00a77T\u00e9l\u00e9portation vers {0}. warps=point de t\u00e9l\u00e9portations : {0} warpsCount=\u00a77Il y a {0} points de t\u00e9l\u00e9portations. Page {1} sur {2}. -warpOverwrite=\u00a7cYou cannot overwrite that warp. weatherStorm=\u00a77Vous avez programm\u00e9 l''orage dans {0} weatherStormFor=\u00a77Vous avez programm\u00e9 l''orage dans {0} pour {1} secondes. weatherSun=\u00a77Vous avez programm\u00e9 le beau temps dans {0} weatherSunFor=\u00a77Vous avez programm\u00e9 le beau temps dans {0} pour {1} secondes. -whoisBanned=\u00a79 - Banni : {0} -whoisGamemode=\u00a79 - Mode de jeu : {0} -whoisGeoLocation=\u00a79 - Emplacement : {0} -whoisGod=\u00a79 - Mode Dieu : {0} -whoisHealth=\u00a79 - Sant\u00e9 : {0} / 20 -whoisIPAddress=\u00a79 - Adresse IP : {0} -whoisIs={0} est {1} -whoisJail=\u00a79 - Jail: {0} -whoisLocation=\u00a79 - Emplacement : ({0}, {1}, {2}, {3}) -whoisMoney=\u00a79 - Argent : {0} -whoisOP=\u00a79 - OP : {0} -whoisStatusAvailable=\u00a79 - Statut : Disponible -whoisStatusAway=\u00a79 - Statut : \u00a7cAilleurs\u00a7f +whoisAFK=\u00a76 - AFK:\u00a7f {0} +whoisBanned=\u00a76 - Banni:\u00a7f {0} +whoisExp=\u00a76 - Exp:\u00a7f {0} (Level {1}) +whoisFly=\u00a76 - Fly mode:\u00a7f {0} ({1}) +whoisGamemode=\u00a76 - Mode de jeu:\u00a7f {0} +whoisGeoLocation=\u00a76 - Emplacement:\u00a7f {0} +whoisGod=\u00a76 - Mode Dieu:\u00a7f {0} +whoisHealth=\u00a76 - Sant\u00e9:\u00a7f {0} / 20 +whoisIPAddress=\u00a76 - Adresse IP:\u00a7f {0} +whoisJail=\u00a76 - Jail:\u00a7f {0} +whoisLocation=\u00a76 - Emplacement:\u00a7f ({0}, {1}, {2}, {3}) +whoisMoney=\u00a76 - Argent:\u00a7f {0} +whoisMuted=\u00a76 - Muted:\u00a7f {0} +whoisNick=\u00a76 - Nick:\u00a7f {0} +whoisOp=\u00a76 - OP:\u00a7f {0} +whoisTop=\u00a76 ====== WhoIs:\u00a7f {0} \u00a76====== worth=\u00a77Une pile de {0} vaut \u00a7c{1}\u00a77 ({2} objet(s) \u00e0 {3} chacun) worthMeta=\u00a77Une pile de {0} avec la m\u00e9tadonn\u00e9e de {1} vaut \u00a7c{2}\u00a77 ({3} objet(s) \u00e0 {4} chacun) worthSet=Valeur cr\u00e9e @@ -418,3 +440,5 @@ year=ann\u00e9e years=ann\u00e9es youAreHealed=\u00a77Vous avez \u00e9t\u00e9 soign\u00e9. youHaveNewMail=\u00a7cVous avez {0} messages ! \u00a7fEntrez \u00a77/mail read\u00a7f pour voir votre courrier. +hatRemoved=\u00a7eYour hat has been removed. +banFormat=Banned: {0} diff --git a/Essentials/src/messages_it.properties b/Essentials/src/messages_it.properties new file mode 100644 index 000000000..4a966bd50 --- /dev/null +++ b/Essentials/src/messages_it.properties @@ -0,0 +1,444 @@ +#version: ${build.number} +# Single quotes have to be doubled: '' +# Translations start here +# by: +action=* {0} {1} +addedToAccount=\u00a7a{0} e'' stato aggiunto al tuo account. +addedToOthersAccount=\u00a7a{0} e'' stato aggiunto all''account {1}\u00a7a. Nuovo bilancio: {2} +alertBroke=fallito: +alertFormat=\u00a73[{0}] \u00a7f {1} \u00a76 {2} a: {3} +alertPlaced=collocato: +alertUsed=usato: +autoAfkKickReason=Sei stato kickato per inattivita'' oltre i {0} minuti. +backAfterDeath=\u00a77Digita il comando /back per tornare al punto dove sei morto. +backUsageMsg=\u00a77Ritorna alla posizione precedente. +backupDisabled=Un script di backup esterno non e'' stato configurato. +backupFinished=Backup terminato +backupStarted=Backup iniziato +balance=\u00a77Bilancio: {0} +balanceTop=\u00a77Top bilanci ({0}) +banExempt=\u00a7cNon puoi bannare questo player. +banIpAddress=\u00a77IP address bannato +bannedIpsFileError=Errore di lettura banned-ips.txt +bannedIpsFileNotFound=banned-ips.txt non trovato +bannedPlayersFileError=Errore di lettura banned-players.txt +bannedPlayersFileNotFound=banned-players.txt non trovato +bigTreeFailure=\u00a7cCreazione del grande albero fallita. Riprova sull''erba o sul terreno. +bigTreeSuccess= \u00a77Grande albero creato. +blockList=Essentials ha trasmesso i seguenti comandi ad un altro plugin: +broadcast=[\u00a7cBroadcast\u00a7f]\u00a7a {0} +buildAlert=\u00a7cNon hai i permessi per costruire +bukkitFormatChanged=Il formato della versione Bukkit e'' cambiato. Versione non controllata. +burnMsg=\u00a77Hai impostato{0} infuocato per {1} secondi. +canTalkAgain=\u00a77Ora puoi parlare di nuovo +cantFindGeoIpDB=Non trovo il database GeoIP! +cantReadGeoIpDB=Lettura fallita del database GeoIP! +cantSpawnItem=\u00a7cNon sei abilitato a generare l''oggetto {0} +chatTypeLocal=[L] +chatTypeAdmin=[A] +chatTypeSpy=[Spy] +commandFailed=Comando {0} fallito: +commandHelpFailedForPlugin=Errore nella guida di: {0} +commandNotLoaded=\u00a7cIl comando {0} non e'' stato caricato correttamente. +compassBearing=\u00a77Bussola: {0} ({1} gradi). +configFileMoveError=Impossibile spostare config.yml nel backup. +configFileRenameError=Impossibile rinominare il file temporale in config.yml +connectedPlayers=Players connessi: +connectionFailed=Connessione fallita. +cooldownWithMessage=\u00a7cIn esaurimento: {0} +corruptNodeInConfig=\u00a74Avviso: errore nel tuo file di configurazione, nodo {0}. +couldNotFindTemplate=Non trovo il template {0} +creatingConfigFromTemplate=Configurazione dal template: {0} +creatingEmptyConfig=Configurazione vuota creata: {0} +creative=creativo +currency={0}{1} +currentWorld=Current World: {0} +day=giorno +days=giorni +defaultBanReason=Sei stato bannato! +deleteFileError=Impossibile eliminare il file: {0} +deleteHome=\u00a77La home {0} e'' stata rimossa. +deleteJail=\u00a77La prigione {0} e'' stata rimossa. +deleteWarp=\u00a77Il Warp {0} e'' stato rimosso. +deniedAccessCommand={0} Accesso negato al comando. +dependancyDownloaded=[Essentials] Dependancy {0} download effettuato con successo. +dependancyException=[Essentials] Errore durante il download di una dependacy +dependancyNotFound=[Essentials] Una dependancy necessaria non e'' stata trovata, sto effettuando il download.. +depth=\u00a77Sei al livello del mare. +depthAboveSea=\u00a77Sei {0} blocco(i) sopra il livello del mare. +depthBelowSea=\u00a77Sei {0} blocco(i) sotto il livello del mare. +destinationNotSet=Destinazione non impostata +disableUnlimited=\u00a77Collocazione illimitata di {0} per {1} disabilitata. +disabled=disabilitato +disabledToSpawnMob=La creazione di questo mob e'' stata disabilitata nel file config. +dontMoveMessage=\u00a77Il teletrasporto iniziera'' tra {0}. Attendi. +downloadingGeoIp=Download del database GeoIP... potrebbe richiedere del tempo (nazione: 0.6 MB, citta'': 20MB) +duplicatedUserdata=Dati dell''utente duplicati: {0} e {1} +durability=\u00a77This tool has \u00a7c{0}\u00a77 uses left +enableUnlimited=\u00a77Sto inviando una quantita'' illimitata di {0} a {1}. +enabled=abilitato +enchantmentApplied = \u00a77L''incantesimo {0} e'' stato applicato all''oggetto nelle tue mani. +enchantmentNotFound = \u00a7cIncantesimo non trovato +enchantmentPerm = \u00a7cNon hai il permesso per {0} +enchantmentRemoved = \u00a77L''incantesimo {0} e'' stato rimosso dall''oggetto nelle tue mani. +enchantments = \u00a77Incantesimi: {0} +errorCallingCommand=Errore di chiamata del comando /{0} +errorWithMessage=\u00a7cErrore: {0} +essentialsHelp1=File corrotto.. Essentials non riesce ad aprirlo. Essentials ora e'' disabilitato. Se non riesci a riparare il file, vai su http://tiny.cc/EssentialsChat +essentialsHelp2=File corrotto.. Essentials non riesce ad aprirlo. Essentials ora e'' disabilitato. Se non riesci a riparare il file, digita il comando /essentialshelp o vai su http://tiny.cc/EssentialsChat +essentialsReload=\u00a77Essentials Ricaricato {0} +exp=\u00a7c{0} \u00a77has\u00a7c {1} \u00a77exp (level\u00a7c {2}\u00a77) and needs\u00a7c {3} \u00a77more exp to level up. +expSet=\u00a7c{0} \u00a77now has\u00a7c {1} \u00a77exp. +extinguish=\u00a77Hai spento le fiamme. +extinguishOthers=\u00a77Hai spento le fiamme di {0}. +failedToCloseConfig=Chiusura fallita del config {0} +failedToCreateConfig=Creazione fallita del config {0} +failedToWriteConfig=Scrittura fallita del config {0} +false=\u00a74false\u00a7f +feed=\u00a77Ora sei sazio. +feedOther=\u00a77{0} e''stato nutrito. +fileRenameError=Rinomina del file {0} fallita +flyMode=\u00a77Modalita'' volo impostata {0} per {1}. +flying=flying +foreverAlone=\u00a7cNon c''e'' nessuno a cui rispondere. +freedMemory=Liberati {0} MB. +gameMode=\u00a77Modalita''di gioco {0} impostata per {1}. +gcchunks= blocchi, +gcentities= entita'' +gcfree=Memoria libera: {0} MB +gcmax=Memoria massima: {0} MB +gctotal=Memoria allocata: {0} MB +geoIpUrlEmpty=L''url del download di GeoIP e'' vuoto. +geoIpUrlInvalid=L''url del download di GeoIP non e'' valido. +geoipJoinFormat=Il Player {0} proviene da {1} +godDisabledFor=God disabilitato per {0} +godEnabledFor=God abilitato per {0} +godMode=\u00a77Modalita'' God {0}. +hatArmor=\u00a7cError, you cannot use this item as a hat! +hatEmpty=\u00a7cYou are not wearing a hat. +hatFail=\u00a7cYou must have something to wear in your hand. +hatPlaced=\u00a7eEnjoy your new hat! +haveBeenReleased=\u00a77Sei stato scarcerato. +heal=\u00a77Sei stato curato. +healOther=\u00a77{0} e'' stato curato. +helpConsole=Digitare ? per la guida. +helpFrom=\u00a77Comandi da {0}: +helpLine=\u00a76/{0}\u00a7f: {1} +helpMatching=\u00a77Corrispondenza comandi "{0}": +helpOp=\u00a7c[HelpOp]\u00a7f \u00a77{0}:\u00a7f {1} +helpPages=Pagina \u00a7c{0}\u00a7f di \u00a7c{1}\u00a7f: +helpPlugin=\u00a74{0}\u00a7f: Plugin Help: /help {1} +holeInFloor=Buco nel terreno +homeSet=\u00a77Home impostata. +homeSetToBed=\u00a77La tua home e'' ora assegnata a questo letto. +homes=Homes: {0} +hour=ora +hours=ore +ignorePlayer=Da ora in poi ignorerai {0}. +illegalDate=Formato data/ora non riconosciuto. +infoChapter=Seleziona capitolo: +infoChapterPages=Capitolo {0}, pagina \u00a7c{1}\u00a7f di \u00a7c{2}\u00a7f: +infoFileDoesNotExist=Il file info.txt non esiste. Creane uno per te. +infoPages=\u00a7e ---- \u00a76{2} \u00a7e--\u00a76 Pagina \u00a74{0}\u00a76/\u00a74{1} \u00a7e---- +infoUnknownChapter=Capitolo sconosciuto. +invBigger=L''inventario degli altri utenti e'' piu'' grande del tuo. +invRestored=l tuo inventario e'' stato ripristinato. +invSee=Stai guardando l''inventario di {0}. +invSeeHelp=Digita /invsee per ripristinare il tuo inventario. +invalidCharge=\u00a7cIIstruzione non corretta. +invalidHome=La home {0} non esiste +invalidMob=Tipo mob non valido. +invalidServer=Server non valido! +invalidSignLine=Riga {0} non corretta. +invalidWorld=\u00a7cMondo incorretto. +inventoryCleared=\u00a77Inventario cancellato. +inventoryClearedOthers=\u00a77Inventario di \u00a7c{0}\u00a77 cancellato. +is=e'' +itemCannotBeSold=L''oggetto non puo'' essere venduto. +itemMustBeStacked=L''oggetto deve essere commerciato in pile. 2 quantita'' equivalgono a 2 pile, etc. +itemNotEnough1=\u00a7cNon hai abbastanza quantita'' di questo oggetto per venderlo. +itemNotEnough2=\u00a77Se vuoi vendere tutti gli oggetti di quel tipo, digita /sell nomeoggetto +itemNotEnough3=\u00a77/sell nomeoggetto -1 vende tutto tranne quell''oggetto, etc. +itemSellAir=Stai cercando di vendere l''aria? Metti un oggetto nella tua mano. +itemSold=\u00a77Venduto per \u00a7c{0} \u00a77({1} {2} a {3} l''uno) +itemSoldConsole={0} venduto {1} per \u00a77{2} \u00a77({3} oggetti a {4} l''uno) +itemSpawn=\u00a77Inviati {0} di {1} +itemsCsvNotLoaded=Impossibile caricare items.csv. +jailAlreadyIncarcerated=\u00a7cPlayer gia'' in prigione: {0} +jailMessage=\u00a7cAvrai tempo per riflettere..in prigione. +jailNotExist=La prigione dichiarata non esiste. +jailReleased=\u00a77Player \u00a7e{0}\u00a77 scarcerato. +jailReleasedPlayerNotify=\u00a77Sei stato scarcerato! +jailSentenceExtended=Tempo di incarcerazione aumentato di: {0) +jailSet=\u00a77{0} e'' ora una prigione. +jumpError=Cosi'' facendo danneggerai la cpu. +kickDefault=Kickato dal server +kickExempt=\u00a7cNon puoi kickare questo player. +kickedAll=\u00a7cKicked all players from server +kill=\u00a77Ucciso {0}. +kitError2=\u00a7cQuesto kit non esiste o non e'' definito. +kitError=\u00a7cNon ci sono kit validi. +kitErrorHelp=\u00a7cForse una quantita'' manca in un oggetto della configurazione? +kitGive=\u00a77Kit inviato {0}. +kitInvFull=\u00a7cIl tuo inventario e'' pieno, il kit e'' ora per terra. +kitTimed=\u00a7cNon puoi usare il kit per altri {0}. +kits=\u00a77Kits: {0} +lightningSmited=\u00a77Sei stato folgorato! +lightningUse=\u00a77{0} e'' stato folgorato! +listAfkTag = \u00a77[AFK]\u00a7f +listAmount = \u00a79Ci sono \u00a7c{0}\u00a79 players online su un massimo di \u00a7c{1}. +listAmountHidden = \u00a79Ci sono \u00a7c{0}\u00a77/{1}\u00a79 players online su un massimo di \u00a7c{2}. +listGroupTag={0}\u00a7f: +listHiddenTag = \u00a77[HIDDEN]\u00a7f +loadWarpError=Impossibile caricare il warp {0} +localFormat=Formato locale: <{0}> {1} +mailClear=\u00a7cPer cancellare la tua mail, digita /mail clear +mailCleared=\u00a77Mail cancellata! +mailSent=\u00a77Mail inviata! +markMailAsRead=\u00a7cPer contrassegnare la mail come gia'' letta, digita /mail read +markedAsAway=\u00a77Il tuo stato ora e'' "Non al computer". +markedAsNotAway=\u00a77Bentornato! +maxHomes=Non puoi assegnare piu'' di {0} home. +mayNotJail=\u00a7cNon puoi imprigionare questo player. +me=mi +minute=minuto +minutes=minuti +missingItems=Non hai {0}x {1}. +missingPrefixSuffix=Manca un prefisso o un suffisso per {0} +mobSpawnError=Errore durante il cambiamento del generatore di mob. +mobSpawnLimit=Quantita'' Mob limitata dal server +mobSpawnTarget=Il blocco designato deve essere un generatore di mob. +mobsAvailable=\u00a77Mobs: {0} +moneyRecievedFrom=\u00a7a{0} sono stati ricevuti da {1} +moneySentTo=\u00a7a{0} sono stati inviati a {1} +moneyTaken={0} prelevati dal tuo conto in banca. +month=mese +months=mesi +moreThanZero=La quantita'' deve essere maggiore di 0. +msgFormat=\u00a77[{0}\u00a77 -> {1}\u00a77] \u00a7f{2} +muteExempt=\u00a7cNon puoi mutare questo player. +mutedPlayer=Player {0} mutato. +mutedPlayerFor=Player {0} mutato per {1}. +mutedUserSpeaks={0} ha provato a parlare, ma e'' mutato. +nearbyPlayers=Players nelle vicinanze: {0} +negativeBalanceError=User is not allowed to have a negative balance. +nickChanged=Nickname modificato. +nickDisplayName=\u00a77Devi abilitare change-displayname nel config di Essentials. +nickInUse=\u00a7cNickname gia'' in uso. +nickNamesAlpha=\u00a7cI Nickname devono essere alfanumerici. +nickNoMore=\u00a77Non disponi piu'' di un nickname. +nickOthersPermission=\u00a7cNon hai il permesso di cambiare il nickname degli altri +nickSet=\u00a77Il tuo nickname e'' ora \u00a7c{0} +noAccessCommand=\u00a7cNon hai accesso a questo comando. +noAccessPermission=\u00a7cNon hai i permessi di accesso per {0}. +noBreakBedrock=Non sei abilitato a distruggere la bedrock. +noDestroyPermission=\u00a7cNon hai i permessi per distruggere {0}. +noDurability=\u00a7cThis item does not have a durability. +noGodWorldWarning=\u00a7cAttenzione! Modalita'' God disabilitata in questo mondo. +noHelpFound=\u00a7cComandi non trovati. +noHomeSet=Non hai stabilito una home. +noHomeSetPlayer=Il Player non ha stabilito una home. +noKitPermission=\u00a7cHai bisogno del permesso \u00a7c{0}\u00a7c per usare questo kit. +noKits=\u00a77Non ci sono ancora kit disponibili +noMail=Non hai ricevuto nessuna mail +noMotd=\u00a7cNon c''e'' nessun messaggio del giorno. +noNewMail=\u00a77Non hai ricevuto nuove mail. +noPendingRequest=Non hai richieste in sospeso. +noPerm=\u00a7cNon hai questo permesso: \u00a7f{0} +noPermToSpawnMob=\u00a7cNon hai i permessi per generare questo mob. +noPlacePermission=\u00a7cNon hai il permesso di collocare un blocco accanto a quest''insegna. +noPowerTools=Non hai attrezzi assegnati. +noRules=\u00a7cNon ci sono regole specifiche al momento. +noWarpsDefined=Nessun warp definito +none=nessun +notAllowedToQuestion=\u00a7cNon sei autorizzato a fare domande. +notAllowedToShout=\u00a7cNon sei autorizzato a gridare. +notEnoughExperience=Non hai abbastanza esperienza. +notEnoughMoney=Non hai abbastanza denaro. +notFlying=not flying +notRecommendedBukkit=* ! * La versione Bukkit in uso non e'' compatibile con Essentials. +notSupportedYet=Non ancora supportato. +nothingInHand = \u00a7cNon hai niente in mano. +now=adesso +nuke=Un regalino.. radioattivo +numberRequired=Che ne dici di metterci un numero?! +onlyDayNight=/time supporta solo day/night. +onlyPlayers=Solo i players durante il gioco possono usare {0}. +onlySunStorm=/weather supporta solo sun/storm. +orderBalances=Sto ordinando i bilanci di {0} utenti, attendere grazie... +pTimeCurrent=L''orario di \u00a7e{0}\u00a7f e'' {1}. +pTimeCurrentFixed=L''orario di \u00a7e{0}\u00a7f e'' fissato alle {1}. +pTimeNormal=L''orario di \u00a7e{0}\u00a7f e'' normale e corrisponde a quello del server. +pTimeOthersPermission=\u00a7cNon sei autorizzato a definre l''orario degli altri player. +pTimePlayers=Questi player hanno il loro orario: +pTimeReset=L''orario del Player e'' stato resettato alle: \u00a7e{0} +pTimeSet=L''orario del Player e'' stato regolato alle \u00a73{0}\u00a7f per le: \u00a7e{1} +pTimeSetFixed=L''orario del Player e'' stato fissato alle \u00a73{0}\u00a7f per le: \u00a7e{1} +parseError=Errore parsing {0} riga {1} +pendingTeleportCancelled=\u00a7cRichiesta in sospeso di teletrasporto cancellata. +permissionsError=Mancano i permessi per Permissions/GroupManager; i suffissi e prefissi in chat verrano disabilitati. +playerBanned=\u00a7cIl Player {0} e'' bannato {1} motivo: {2} +playerInJail=\u00a7cIl Player e'' gia'' nella prigione ({0}). +playerJailed=\u00a77Il Player {0} e'' stato messo in prigione. +playerJailedFor= \u00a77Il Player {0} e'' in prigione. motivo: {1}. +playerKicked=\u00a7cIl Player {0} e'' stato kickato {1} motivo: {2} +playerMuted=\u00a77Sei stato mutato +playerMutedFor=\u00a77Sei stato mutato per {0} +playerNeverOnServer=\u00a7cIl Player {0} non e'' mai stato su questo server. +playerNotFound=\u00a7cPlayer non trovato. +playerUnmuted=\u00a77Sei stato smutato +pong=Pong! +possibleWorlds=\u00a77I mondi sono numerati da 0 a {0}. +powerToolAir=Il comando non puo'' essere collegato all''aria. +powerToolAlreadySet=Il comando \u00a7c{0}\u00a7f e'' gia'' stato assegnato a {1}. +powerToolAttach=Il comando \u00a7c{0}\u00a7f e'' stato assegnato a {1}. +powerToolClearAll=Tutti i comandi per gli attrezzi sono stati cancellati. +powerToolList=L''attrezzo {1} ha i seguenti comandi: \u00a7c{0}\u00a7f. +powerToolListEmpty=L''attrezzo {0} non dispone di comandi assegnati. +powerToolNoSuchCommandAssigned=Il comando \u00a7c{0}\u00a7f non e'' stato assegnato a {1}. +powerToolRemove=Il comando \u00a7c{0}\u00a7f e'' stato rimosso da {1}. +powerToolRemoveAll=Tutti i comandi sono stati rimossi da {0}. +powerToolsDisabled=Tutti i tuoi attrezzi sono stati disabilitati. +powerToolsEnabled=Tutti i tuoi attrezzi sono stati abilitati. +protectionOwner=\u00a76[EssentialsProtect] Protetto dal proprietario: {0} +questionFormat=\u00a77[Domanda]\u00a7f {0} +readNextPage=Digita /{0} {1} per la pagina successiva +reloadAllPlugins=\u00a77Tutti i plugins ricaricati. +removed=\u00a77Rimosse {0} entitita''. +repair=Hai riparato con successo il tuo: \u00a7e{0}. +repairAlreadyFixed=\u00a77Questo oggetto non richiede riparazioni. +repairEnchanted=\u00a77Non sei abilitato a riparare oggetti magici. +repairInvalidType=\u00a7cQuesto oggetto non puo'' essere riparato. +repairNone=Non ci sono oggetti da riparare. +requestAccepted=\u00a77Richiesta di teletrasporto accettata. +requestAcceptedFrom=\u00a77{0} ha accettato la tua richiesta di teletrasporto. +requestDenied=\u00a77Richiesta di teletrasporto rifiutata. +requestDeniedFrom=\u00a77{0} ha rifiutato la tua richiesta di teletrasporto. +requestSent=\u00a77Richiesta inviata a {0}\u00a77. +requestTimedOut=\u00a7cRichiesta di teletrasporto scaduta. +requiredBukkit=* ! * e'' necessaria la versione {0} o superiore di CraftBukkit, scaricabile da http://dl.bukkit.org/downloads/craftbukkit/ +returnPlayerToJailError=Riscontrato errore nell''invio del player {0} alla prigione: {1} +second=secondo +seconds=secondi +seenOffline=Il Player {0} e'' offline da {1} +seenOnline=Il Player {0} e'' online da {1} +serverFull=Il Server e'' pieno +serverTotal=Totale Server: {0} +setSpawner=Tipo generatore modificato in {0} +sheepMalformedColor=Colore non valido. +shoutFormat=\u00a77[Grido!]\u00a7f {0} +signFormatFail=\u00a74[{0}] +signFormatSuccess=\u00a71[{0}] +signFormatTemplate=[{0}] +signProtectInvalidLocation=\u00a74Non hai il permesso per creare segnaposti qui. +similarWarpExist=Il nome del warp e'' stato gia'' utilizzato. +slimeMalformedSize=Dimensione non valida. +soloMob=Quel mob sembra essere solo +spawnSet=\u00a77Punto di rigenerazione creato per il gruppo {0}. +spawned=creato +sudoExempt=Impossibile applicare il sudo a questo utente +sudoRun=Sto obbligando {0} ad eseguire: /{1} {2} +suicideMessage=\u00a77Addio mondo crudele... +suicideSuccess= \u00a77{0} si e'' suicidato.. +survival=sopravvivenza +takenFromAccount=\u00a7c{0} sono stati prelevati dal tuo conto. +takenFromOthersAccount=\u00a7c{0} taken from {1}\u00a7c account. New balance: {2} +teleportAAll=\u00a77Richiesta di teletrasporto inviata a tutti i players... +teleportAll=\u00a77Sto teletrasportando tutti i players... +teleportAtoB=\u00a77{0}\u00a77 ti ha teletrasportato a {1}\u00a77. +teleportDisabled={0} ha il teletrasporto disabilitato. +teleportHereRequest=\u00a7c{0}\u00a7c ha richiesto di teletrasportati da loro. +teleportNewPlayerError=Teletrasporto del nuovo player fallito +teleportRequest=\u00a7c{0}\u00a7c ha richiesto di teletrasportati da te. +teleportRequestTimeoutInfo=\u00a77Questa richiesta scadra'' tra {0} secondi. +teleportTop=\u00a77Teletrasporto in cima. +teleportationCommencing=\u00a77Inizio teletrasporto... +teleportationDisabled=\u00a77Teletrasporto disabilitato. +teleportationEnabled=\u00a77Teletrasporto abilitato. +teleporting=\u00a77Teletrasporto in corso... +teleportingPortal=\u00a77Teletrasporto tramite portale. +tempBanned=Bannato temporaneamente dal server per {0} +tempbanExempt=\u00a77Non puoi bannare questo player +thunder=Abilita i filmini dal cielo: {0} +thunderDuration=Abilita i filmini dal cielo: {0} per {1} secondi. +timeBeforeHeal=Tempo rimanente alla prossima cura: {0} +timeBeforeTeleport=Tempo rimanente al prossimo teletrasporto: {0} +timeFormat=\u00a73{0}\u00a7f oppure \u00a73{1}\u00a7f oppure \u00a73{2}\u00a7f +timePattern=(?:([0-9]+)\\s*y[a-z]*[,\\s]*)?(?:([0-9]+)\\s*mo[a-z]*[,\\s]*)?(?:([0-9]+)\\s*w[a-z]*[,\\s]*)?(?:([0-9]+)\\s*d[a-z]*[,\\s]*)?(?:([0-9]+)\\s*h[a-z]*[,\\s]*)?(?:([0-9]+)\\s*m[a-z]*[,\\s]*)?(?:([0-9]+)\\s*(?:s[a-z]*)?)? +timeSet=Orario definito in tutti i mondi. +timeSetPermission=\u00a7cNon sei autorizzato a regolare l''orario. +timeWorldCurrent=L''orario attuale in {0} e'' \u00a73{1} +timeWorldSet=L''orario e'' stato regolato alle {0} in: \u00a7c{1} +tps=Current TPS = {0} +tradeCompleted=\u00a77Affare concluso. +tradeSignEmpty=L''insegna non dispone di forniture sufficienti. +tradeSignEmptyOwner=Non c''e'' niente da raccogliare da quest''insegna. +treeFailure=\u00a7cCreazione dell''albero fallita. Riprova sull''erba o sul terreno. +treeSpawned=\u00a77Albero generato. +true=\u00a72true\u00a7f +typeTpaccept=\u00a77Per accetare il teletrasprto, digita \u00a7c/tpaccept\u00a77. +typeTpdeny=\u00a77Per rifiutare il teletrasporto, digita \u00a7c/tpdeny\u00a77. +typeWorldName=\u00a77Puoi digitare anche il nome di un mondo. +unableToSpawnMob=Impossibile generare il mob. +unbannedIP=IP address abilitato. +unbannedPlayer=Player abilitato. +unignorePlayer=Non stai piu'' ignorando il player {0}. +unknownItemId=ID oggetto sconosciuto: {0} +unknownItemInList=Oggetto {0} sconosciuto nella lista {1}. +unknownItemName=Nome oggetto sconosciuto: {0} +unlimitedItemPermission=\u00a7cNessun permesso per l''oggetto {0} illimitato. +unlimitedItems=Oggetti illimitati: +unmutedPlayer=Player {0} smutato. +unvanished=\u00a7aYou are once again visible. +unvanishedReload=\u00a7cA reload has forced you to become visible. +upgradingFilesError=Errore durante l''aggiornamento dei file +userDoesNotExist=L''utente {0} non esiste. +userIsAway={0} e'' AFK +userIsNotAway={0} non e'' piu'' AFK +userJailed=\u00a77Sei stato messo in prigione +userUsedPortal={0} ha usato un portale. +userdataMoveBackError=Errore durante lo spostamento di userdata/{0}.tmp a userdata/{1} +userdataMoveError=Errore durante lo spostamento di userdata/{0} a userdata/{1}.tmp +usingTempFolderForTesting=Sto usando la cartella temporale per il test: +vanished=\u00a7aYou have now been vanished. +versionMismatch=Versione incorretta! Aggiornare {0} alla stessa versione. +versionMismatchAll=Versione incorretta! Aggiornare tutti i jar Essentials alla stessa versione. +voiceSilenced=\u00a77La tua voce e'' stata silenziata +warpDeleteError=Problema nell''eliminazione del file warp. +warpListPermission=\u00a7cNon hai i permessi per consultare la lista warps. +warpNotExist=Questo warp non esiste. +warpOverwrite=\u00a7cNon puoi sovrascrivere il warp. +warpSet=\u00a77Warp {0} definito. +warpUsePermission=\u00a7cNon hai i permessi per usare questo warp. +warpingTo=\u00a77Warping a {0}. +warps=Warps: {0} +warpsCount=\u00a77Ci sono {0} warps. Pagina {1} of {2}. +weatherStorm=\u00a77Hai regolato il tempo in tempesta in {0} +weatherStormFor=\u00a77Hai cambiato il tempo in tempesta in {0} per {1} secondi +weatherSun=\u00a77Hai cambiato il tempo in soleggiato in {0} +weatherSunFor=\u00a77Hai cambiato il tempo in soleggiato in {0} per {1} secondi +whoisAFK=\u00a76 - AFK:\u00a7f {0} +whoisBanned=\u00a76 - Bannati:\u00a7f {0} +whoisExp=\u00a76 - Exp:\u00a7f {0} (Livello {1}) +whoisFly=\u00a76 - Fly mode:\u00a7f {0} ({1}) +whoisGamemode=\u00a76 - Gamemode:\u00a7f {0} +whoisGeoLocation=\u00a76 - Posizione:\u00a7f {0} +whoisGod=\u00a76 - God mode:\u00a7f {0} +whoisHealth=\u00a76 - Health:\u00a7f {0}/20 +whoisIPAddress=\u00a76 - IP Address:\u00a7f {0} +whoisJail=\u00a76 - Imprigionati:\u00a7f {0} +whoisLocation=\u00a76 - Posizione:\u00a7f ({0}, {1}, {2}, {3}) +whoisMoney=\u00a76 - Denaro:\u00a7f {0} +whoisMuted=\u00a76 - Muted:\u00a7f {0} +whoisNick=\u00a76 - Nick:\u00a7f {0} +whoisOp=\u00a76 - OP:\u00a7f {0} +whoisTop=\u00a76 ====== WhoIs:\u00a7f {0} \u00a76====== +worth=\u00a77Pila di {0} valore \u00a7c{1}\u00a77 ({2} oggetto(i) a {3} l''uno) +worthMeta=\u00a77Pila di {0} con metadati di {1} valore \u00a7c{2}\u00a77 ({3} oggetto(i) a {4} l''uno) +worthSet=Valore definito +year=anno +years=anni +youAreHealed=\u00a77Sei stato curato. +youHaveNewMail=\u00a7cHai {0} messaggi!\u00a7f digita \u00a77/mail read\u00a7f per consultare la tua mail. +hatRemoved=\u00a7eYour hat has been removed. +banFormat=Banned: {0} diff --git a/Essentials/src/messages_nl.properties b/Essentials/src/messages_nl.properties index c29947b8c..5f90dba67 100644 --- a/Essentials/src/messages_nl.properties +++ b/Essentials/src/messages_nl.properties @@ -3,100 +3,108 @@ # Translations start here # by: Geertje123 action=* {0} {1} -addedToAccount=\u00a7a{0} is gestort op je account. -addedToOthersAccount=\u00a7a{0} added to {1}\u00a7a account. New balance: {2} +addedToAccount=\u00a7a{0} is gestort op je rekening. +addedToOthersAccount=\u00a7a{0} toegevoegd aan {1}\u00a7a zijn rekening. Nieuw balans: {2} alertBroke=gebroken: alertFormat=\u00a73[{0}] \u00a7f {1} \u00a76 {2} bij: {3} alertPlaced=geplaatst: alertUsed=gebruikt: -autoAfkKickReason=You have been kicked for idling more than {0} minutes. -backAfterDeath=\u00a77Gebruik het /back command om terug te keren naar je sterfplaats. +autoAfkKickReason=Je bent van de server afgeschopt omdat je niets hebt gedaan voor meer dan {0} minuten. +backAfterDeath=\u00a77Gebruik het /back commando om terug te keren naar je sterfplaats. backUsageMsg=\u00a77Naar de vorige locatie aan het gaan. -backupFinished=Backup voltooid -backupStarted=Backup gestart +backupDisabled=Een extern backup script is niet geconfigureerd. +backupFinished=Backup voltooid. +backupStarted=Backup gestart. balance=\u00a77Saldo: {0} -balanceTop=\u00a77 Top saldi ({0}) +balanceTop=\u00a77 Top saldo ({0}) banExempt=\u00a77Je kunt deze speler niet verbannen. -banIpAddress=\u00a77Verbannen IP-adres +banIpAddress=\u00a77Verbannen IP-adres. bannedIpsFileError=Fout bij het lezen van banned-ips.txt -bannedIpsFileNotFound=banned-ips.txt werd niet gevonden +bannedIpsFileNotFound=banned-ips.txt werd niet gevonden. bannedPlayersFileError=Fout bij het lezen van banned-players.txt -bannedPlayersFileNotFound=banned-players.txt werd niet gevonden +bannedPlayersFileNotFound=banned-players.txt werd niet gevonden. bigTreeFailure=\u00a7cMaken van een grote boom is mislukt. Probeer het opnieuw op gras of dirt. bigTreeSuccess= \u00a77Grote boom gemaakt. -blockList=Essentials relayed the following commands to another plugin: -broadcast=[\u00a7cBroadcast\u00a7f]\u00a7a {0} -buildAlert=\u00a7cJe bent niet bevoegd om te bouwen +blockList=Essentials heeft de volgende commandos doorgegeven naar een andere plugin: +broadcast=[\u00a7Uitzending\u00a7f]\u00a7a {0} +buildAlert=\u00a7cJe bent niet bevoegd om te bouwen. bukkitFormatChanged=Bukkit versie formaat veranderd. Versie niet nagekeken. -burnMsg=\u00a77Je hebt {0} voor {1} seconde(n) in de fik gezet. +burnMsg=\u00a77Je hebt {0} voor {1} seconde(n) in brand gezet. canTalkAgain=\u00a77Je kan weer praten. cantFindGeoIpDB=De GeoIP database kon niet gevonden worden! cantReadGeoIpDB=Fout bij het lezen van de GeoIP database! cantSpawnItem=\u00a7cJe bent niet bevoegd om {0} te spawnen. chatTypeLocal=[L] +chatTypeAdmin=[A] chatTypeSpy=[Spy] -commandFailed=Opdracht {0} mislukt: +commandFailed=Opdracht {0} is mislukt: commandHelpFailedForPlugin=Fout bij het \u200b\u200bkrijgen van hulp voor: {0} commandNotLoaded=\u00a7cOpdracht {0} is fout geladen. compassBearing=\u00a77Ligging: {0} ({1} graden). configFileMoveError=Het verplaatsen van config.yml naar de backup locatie is mislukt. configFileRenameError=Fout bij het hernoemen van de tijdelijke map naar config.yml -connectedPlayers=Spelers online: +connectedPlayers=Spelers online: connectionFailed=Fout bij het verbinden. cooldownWithMessage=\u00a7cAfkoeltijd: {0} corruptNodeInConfig=\u00a74Waarschuwing: Het configuratiebestand bevat een fout {0}. -couldNotFindTemplate=Het sjabloon kon niet worden gevonden {0} +couldNotFindTemplate=Het sjabloon kon niet worden gevonden {0}. creatingConfigFromTemplate=Bezig met aanmaken van een config vanaf sjabloon: {0} creatingEmptyConfig=Bezig met een lege config aanmaken: {0} creative=creative currency={0}{1} +currentWorld=Actuele Wereld: {0} day=dag days=dagen -defaultBanReason=De Ban Hamer heeft gesproken! +defaultBanReason=De Verbannings Hamer heeft gesproken! deleteFileError=Het bestand kon niet verwijderd worden: {0} -deleteHome=\u00a77Home {0} has been removed. +deleteHome=\u00a77Huis {0} is verwijdered. deleteJail=\u00a77Gevangenis {0} is verwijderd. deleteWarp=\u00a77Warp {0} is verwijderd. deniedAccessCommand={0} was de toegang verboden tot het commando. dependancyDownloaded=[Essentials] Afhankelijkheid {0} succesvol gedownload. -dependancyException=[Essentials] Er is een fout opgetreden bij het downloaden van de afhankelijkheid +dependancyException=[Essentials] Er is een fout opgetreden bij het downloaden van de afhankelijkheid. dependancyNotFound=[Essentials] Een afhankelijkheid is niet gevonden. Start downloaden. depth=\u00a77Je zit op zeeniveau. depthAboveSea=\u00a77Je zit {0} blok(ken) boven zeeniveau. depthBelowSea=\u00a77Je zit {0} blok(ken) onder zeeniveau. -destinationNotSet=Bestemming niet ingesteld +destinationNotSet=Bestemming niet ingesteld. disableUnlimited=\u00a77Oneindig plaatsen van {0} uitgeschakeld voor {1}. disabled=uitgeschakeld -disabledToSpawnMob=Spawning this mob was disabled in the config file. +disabledToSpawnMob=Het voortbrengen van mobs is uitgeschakeld in het configuratie bestand. dontMoveMessage=\u00a77Beginnen met teleporteren in {0}. Niet bewegen. downloadingGeoIp=Bezig met downloaden van GeoIP database ... Dit kan een tijdje duren (country: 0.6 MB, city: 20MB) -duplicatedUserdata=Dubbele userdata: {0} en {1}. +duplicatedUserdata=Dubbele gebruikersdata: {0} en {1}. +durability=\u00a77Dit gereedschap kan nog \u00a7c{0}\u00a77 gebruikt worden. enableUnlimited=\u00a77Oneindig aantal {0} aan {1} gegeven. enabled=ingeschakeld -enchantmentApplied = \u00a77The enchantment {0} has been applied to your item in hand. -enchantmentNotFound = \u00a7cEnchantment not found -enchantmentPerm = \u00a7cYou do not have the permission for {0} -enchantmentRemoved = \u00a77The enchantment {0} has been removed from your item in hand. -enchantments = \u00a77Enchantments: {0} +enchantmentApplied = \u00a77De betovering {0} is toegepast aan het voorwerp in je hand. +enchantmentNotFound = \u00a7Betovering niet gevonden. +enchantmentPerm = \u00a7cJe hebt geen toestemming voor {0}. +enchantmentRemoved = \u00a77De betovering {0} is verwijderd van het voorwerp in je hand. +enchantments = \u00a77Betoveringen: {0} errorCallingCommand=Fout bij het aanroepen van de opdracht /{0} errorWithMessage=\u00a7cFout: {0} -essentialsHelp1=The file is broken and Essentials can't open it. Essentials is now disabled. If you can't fix the file yourself, go to http://tiny.cc/EssentialsChat -essentialsHelp2=The file is broken and Essentials can't open it. Essentials is now disabled. If you can't fix the file yourself, either type /essentialshelp in game or go to http://tiny.cc/EssentialsChat +essentialsHelp1=Het bestand is beschadigd en Essentials kan het niet openenen. Essentials is nu uitgeschakeld. Als je dit probleem niet zelf kan oplossing ga dan naar http://tiny.cc/EssentialsChat +essentialsHelp2=Het bestand is beschadigd en Essentials kan het niet openenen. Essentials is nu uitgeschakeld. Als je dit probleem niet zelf kan oplossing ga dan naar http://tiny.cc/EssentialsChat of typ /essentialshelp in het spel. essentialsReload=\u00a77Essentials is herladen {0} +exp=\u00a7c{0} \u00a77heeft\u00a7c {1} \u00a77exp (level\u00a7c {2}\u00a77) en heeft nog\u00a7c {3} \u00a77exp meer nodig om een level hoger te gaan. +expSet=\u00a7c{0} \u00a77heeft nu\u00a7c {1} \u00a77exp. extinguish=\u00a77Je hebt jezelf geblust. extinguishOthers=\u00a77Je hebt {0} geblust. failedToCloseConfig=Fout bij het sluiten van config {0} failedToCreateConfig=Fout tijdens het aanmaken van config {0} failedToWriteConfig=Fout bij het cre\u00ebren van config {0} -false=false -feed=\u00a77Your appetite was sated. -feedOther=\u00a77Satisfied {0}. +false=\u00a74Onjuist\u00a7f +feed=\u00a77Jouw honger is verzadigd. +feedOther=\u00a7Verzadigd {0}. fileRenameError=Hernoemen van {0} mislukt +flyMode=\u00a77Zet vlieg modus {0} voor {1}. +flying=vliegen foreverAlone=\u00a7cJe hebt niemand waarnaar je kan reageren. freedMemory={0} MB gelost. -gameMode=\u00a77Set game mode {0} for {1}. +gameMode=\u00a77Zet spel modus {0} voor {1}. gcchunks= chunks, -gcentities= entities +gcentities= entiteiten gcfree=Vrij geheugen: {0} MB gcmax=Maximaal geheugen: {0} MB gctotal=Gealloceerd geheugen: {0} MB @@ -105,14 +113,21 @@ geoIpUrlInvalid=GeoIP download url is ongeldig. geoipJoinFormat=Speler {0} komt uit {1} godDisabledFor=uitgeschakeld voor {0} godEnabledFor=ingeschakeld voor {0} -godMode=\u00a77God mode {0}. +godMode=\u00a77God modus {0}. +hatArmor=\u00a7cFout, je kunt dit voorwerp niet als hoed gebruiken. +hatEmpty=\u00a7cJe draagt geen hoed. +hatFail=\u00a7cJe hebt iets nodig om te dragen als hoed. +hatPlaced=\u00a7eGeniet van je nieuwe hoed! haveBeenReleased=\u00a77Je bent bevrijdt heal=\u00a77Je bent genezen. healOther=\u00a77Je geneezde {0}. helpConsole=type ? om de consolehelp weer te geven. +helpFrom=\u00a77Commands from {0}: helpLine=\u00a76/{0}\u00a7f: {1} +helpMatching=\u00a77Commandos overeenkomen met "{0}": helpOp=\u00a7c[HelpOp]\u00a7f \u00a77{0}:\u00a7f {1} helpPages=Pagina \u00a7c{0}\u00a7f van de \u00a7c{1}\u00a7f: +helpPlugin=\u00a74{0}\u00a7f: Plugin Help: /help {1} holeInFloor=Gat in de vloer homeSet=\u00a77Home ingesteld. homeSetToBed=\u00a77Je home is is nu verplaatst naar dit bed. @@ -124,20 +139,20 @@ illegalDate=Illegaal data formaat. infoChapter=Selecteer hoofdstuk: infoChapterPages=Hoofdstuk {0}, Pagina \u00a7c{1}\u00a7f van de \u00a7c{2}\u00a7f: infoFileDoesNotExist=Bestand info.txt bestaat niet. Bezig met aanmaken. -infoPages=Pagina \u00a7c{0}\u00a7f van de \u00a7c{1}\u00a7f: +infoPages=\u00a7e ---- \u00a76{2} \u00a7e--\u00a76 Pagina \u00a74{0}\u00a76/\u00a74{1} \u00a7e---- infoUnknownChapter=Onbekend hoofdstuk. -invBigger=De inventory van de andere speler is groter dan die van jou. -invRestored=Je inventory is hersteld. +invBigger=De inventaris van de andere speler is groter dan die van jou. +invRestored=Je inventaris is hersteld. invSee=Je kijkt naar de inventory van {0}. -invSeeHelp=Type /invsee om je inventory te herstellen. +invSeeHelp=Type /invsee om je inventaris te herstellen. invalidCharge=\u00a7cOngeldig te laden. -invalidHome=Home {0} doesn't exist +invalidHome=Huis {0} Bestaat niet. invalidMob=Ongeldig mob type. invalidServer=Ongeldige server! invalidSignLine=Regel {0} op het bordje is ongeldig. invalidWorld=\u00a7cOngeldige wereld. -inventoryCleared=\u00a77inventory leeggemaakt. -inventoryClearedOthers=\u00a77inventory van \u00a7c{0}\u00a77 leeggemaakt. +inventoryCleared=\u00a7inventaris leeggemaakt. +inventoryClearedOthers=\u00a7inventaris van \u00a7c{0}\u00a77 leeggemaakt. is=is itemCannotBeSold=Dat voorwerp kan niet aan de server worden verkocht. itemMustBeStacked=Voorwerp moet geruild worden als stapel. Een hoeveelheid van 2 moet dus geruild worden als twee stapels, etc. @@ -149,79 +164,80 @@ itemSold=\u00a77Verkocht voor \u00a7c{0} \u00a77({1} {2} voorwerpen voor {3} per itemSoldConsole={0} verkocht {1} voor \u00a77{2} \u00a77({3} voorwerpen voor {4} per stuk) itemSpawn=\u00a77Geeft {0} {1} itemsCsvNotLoaded=De item kunnen niet geladen worden.csv. -jailAlreadyIncarcerated=\u00a7cPerson is already in jail: {0} -jailMessage=\u00a7cYou do the crime, you do the time. +jailAlreadyIncarcerated=\u00a7cDeze persoon zit al in de gevangenis: {0} +jailMessage=\u00a7cJij begaat het misdrijf, jij zit je tijd uit. jailNotExist=Die gevangenis bestaat niet. -jailReleased=\u00a77Player \u00a7e{0}\u00a77 unjailed. -jailReleasedPlayerNotify=\u00a77You have been released! -jailSentenceExtended=Jail time extend to: {0) +jailReleased=\u00a77Speler \u00a7e{0}\u00a77 vrijgelaten. +jailReleasedPlayerNotify=\u00a77Je bent vrijgelaten! +jailSentenceExtended=Gevangenistijd verlengt tot: {0) jailSet=\u00a77Gevangenis {0} is ingesteld jumpError=Dat zou je computers hersenen beschadigen. -kickDefault=Gekicked van de server -kickExempt=\u00a77Je kunt die speler niet schoppen. +kickDefault=Je bent van de server afgeschopt. +kickExempt=\u00a77Je kunt die speler niet van de server afschoppen. +kickedAll=\u00a7cAlle spelers van de server afgeschopt. kill=\u00a77Jij doodde {0}. kitError2=\u00a7cDie kit bestaat niet of is verkeerde beschreven. kitError=\u00a7cEr zijn geen geldige kits. kitErrorHelp=\u00a7cMisschien mist er een hoeveelheid van het item in de configuratie? kitGive=\u00a77Kit {0} wordt gegeven. -InvFull=\u00a7cYour inventory was full, dropping items on the floor +kitInvFull=\u00a7cJe inventaris was vol, de kit wordt op de grond geplaatst kitTimed=\u00a7cJe kan die kit pas weer gebruiken over {0}. kits=\u00a77Kits: {0} lightningSmited=\u00a77Je bent zojuist verbrand lightningUse=\u00a77Brand {0} listAfkTag = \u00a77[AFK]\u00a7f -listAmount = \u00a79There are \u00a7c{0}\u00a79 out of maximum \u00a7c{1}\u00a79 players online. -listAmountHidden = \u00a79There are \u00a7c{0}\u00a77/{1}\u00a79 out of maximum \u00a7c{2}\u00a79 players online. +listAmount = \u00a79Er zijn \u00a7c{0}\u00a79 van het maximum \u00a7c{1}\u00a79 spelers online. +listAmountHidden = \u00a79Er zijn \u00a7c{0}\u00a77/{1}\u00a79 van het maximum \u00a7c{2}\u00a79 spelers online. listGroupTag={0}\u00a7f: -listHiddenTag = \u00a77[HIDDEN]\u00a7f +listHiddenTag = \u00a77[VERBORGEN]\u00a7f loadWarpError=Fout bij het laden van warp {0} -localFormat=Local: <{0}> {1} -mailClear=\u00a7cType /mail clear, om ej berichten als gelezen te markeren. +localFormat=Lokaal: <{0}> {1} +mailClear=\u00a7cType /mail clear, om je berichten als gelezen te markeren. mailCleared=\u00a77Bericht geklaard! mailSent=\u00a77Bericht verzonden! markMailAsRead=\u00a7cType /mail clear, om je berichten als gelezen te markeren markedAsAway=\u00a77Je staat nu als afwezig gemeld. markedAsNotAway=\u00a77Je staat niet meer als afwezig gemeld. -maxHomes=You cannot set more than {0} homes. +maxHomes=Je kunt niet meer dan {0} huizen zetten. mayNotJail=\u00a7cJe mag die speler niet in de gevangenis zetten. me=me minute=minuut minutes=minuten missingItems=Je hebt geen {0}x {1}. -missingPrefixSuffix=Er mist een prefix of suffix voor {0} +missingPrefixSuffix=Er mist een voorvoegsel of navoegsel voor {0} mobSpawnError=Fout bij het veranderen van de mob spawner. -mobSpawnLimit=Grootte van de mob hang af van het server limiet +mobSpawnLimit=Grootte van de mob hang af van het server limiet. mobSpawnTarget=Target blok moet een mob spawner zijn. mobsAvailable=\u00a77Mobs: {0} moneyRecievedFrom=\u00a7a{0} is ontvangen van {1} moneySentTo=\u00a7a{0} is verzonden naar {1} -moneyTaken={0} van je bankrekening afgehaald. +moneyTaken={0} van je rekening afgehaald. month=maand months=maanden moreThanZero=Het aantal moet groter zijn dan 0. msgFormat=\u00a77[{0}\u00a77 -> {1}\u00a77] \u00a7f{2} -muteExempt=\u00a7cJe kan deze speler niet muten. -mutedPlayer=Speler {0} gemute. -mutedPlayerFor=Speler {0} is gemute voor {1}. -mutedUserSpeaks={0} probeerde te praten, maar is gemute. -nearbyPlayers=Players nearby: {0} -needTpohere=Je moet toegang krijgen tot /tpohere om naar andere spelers te teleporteren. +muteExempt=\u00a7cJe kan deze speler niet dempen. +mutedPlayer=Speler {0} gedempt. +mutedPlayerFor=Speler {0} is gedempt voor {1}. +mutedUserSpeaks={0} probeerde te praten, maar is gedempt. +nearbyPlayers=Spelers kortbij: {0} negativeBalanceError=Speler is niet toegestaan om een negatief saldo te hebben. -nickChanged=Nickname veranderd. -nickDisplayName=\u00a77You have to enable change-displayname in Essentials config. +nickChanged=Bijnaam veranderd. +nickDisplayName=\u00a77Je moet 'change-displayname' inschakelen in de Essentials configuratie. nickInUse=\u00a7cDie naam is al in gebruik. -nickNamesAlpha=\u00a7cNicknames moeten alfanumeriek zijn. -nickNoMore=\u00a7Je hebt geen nickname meer. -nickOthersPermission=\u00a7cJe hebt geen toestemming om de nickname van anderen te veranderen -nickSet=\u00a77Je nickname is nu \u00a7c{0} +nickNamesAlpha=\u00a7cBijnamen moeten alfanumeriek zijn. +nickNoMore=\u00a7Je hebt geen bijnaam meer. +nickOthersPermission=\u00a7cJe hebt geen toestemming om de bijnaam van anderen te veranderen +nickSet=\u00a77Je bijnaam is nu \u00a7c{0} noAccessCommand=\u00a7cJe hebt geen toegang tot die opdracht. noAccessPermission=\u00a7cJe hebt hier geen toegang voor {0}. -noBreakBedrock=You are not allowed to destroy bedrock. +noBreakBedrock=Je bent niet toegestaan om grondgesteente te breken. noDestroyPermission=\u00a7cJe hebt geen toegang om dat te vernietigen {0}. -noGodWorldWarning=\u00a7cWarning! God mode in this world disabled. -noHelpFound=\u00a7cNo matching commands. -noHomeSet=Je hebt geen home gemaakt. -noHomeSetPlayer=Speler heeft geen home. +noDurability=\u00a7cDit voorwerp heeft geen durabiliteit. +noGodWorldWarning=\u00a7cWaarschuwing! God modus is uitgeschakeld in deze wereld. +noHelpFound=\u00a7cGeen overeenkomende commandos. +noHomeSet=Je hebt geen huis. +noHomeSetPlayer=Speler heeft geen huis. noKitPermission=\u00a7cJe hebt de \u00a7c{0}\u00a7c toestemming nodig om die kit te gebruiken. noKits=\u00a77Er zijn nog geen kits beschikbaar noMail=Je hebt geen berichten @@ -229,30 +245,31 @@ noMotd=\u00a7cEr is geen bericht van de dag. noNewMail=\u00a77Je hebt geen nieuwe berichten. noPendingRequest=Je hebt geen aanvragen. noPerm=\u00a7cJe hebt de \u00a7f{0}\u00a7c toestemming niet. -noPermToSpawnMob=\u00a7cYou don''t have permission to spawn this mob. +noPermToSpawnMob=\u00a7cJe hebt geen toestemming om deze mob voort te brengen. noPlacePermission=\u00a7cJe hebt geen toestemming om een blok naast die sign te plaatsen. -noPowerTools=You have no power tools assigned. +noPowerTools=Je hebt geen powertools toegewezen. noRules=\u00a7cEr zijn nog geen regels gegeven. noWarpsDefined=Geen warps gedefinieerd none=geen notAllowedToQuestion=\u00a7cJe bent niet bevoegd om de vraag functie te gebruiken. notAllowedToShout=\u00a7cJe bent niet bevoegd om de roep functie te gebruiken. -notEnoughExperience=You do not have enough experience. +notEnoughExperience=Je hebt niet genoeg ervaring. notEnoughMoney=Je hebt niet voldoende middelen. +notFlying=Niet aan het vliegen. notRecommendedBukkit=* ! * De Bukkit versie is niet de aangeraden build voor Essentials. notSupportedYet=Nog niet ondersteund. -nothingInHand = \u00a7cYou have nothing in your hand. +nothingInHand = \u00a7cJe hebt niks in je hand. now=nu -nuke=May death rain upon them +nuke=Moge de dood op hen neerregenen. numberRequired=Er moet daar een nummer, grapjas. onlyDayNight=/time ondersteund alleen day/night. onlyPlayers=Alleen in-game spelers kunnen {0} gebruiken. -onlySunStorm=/weather only supports sun/storm. -orderBalances=Ordering balances of {0} users, please wait ... -pTimeCurrent=\u00a7e{0}''s\u00a7f time is {1}. -pTimeCurrentFixed=\u00a7e{0}''s\u00a7f time is fixed to {1}. -pTimeNormal=\u00a7e{0}''s\u00a7f time is normal and matches the server. -pTimeOthersPermission=\u00a7cYou are not authorized to set other players'' time. +onlySunStorm=/weather ondersteunt alleen sun/storm. +orderBalances=Rekeningen bestellen van {0} gebruikers, Watch A.U.B ... +pTimeCurrent=\u00a7e{0}'s\u00a7f tijd is {1}. +pTimeCurrentFixed=\u00a7e{0}'s\u00a7f tijd is vastgezet op {1}. +pTimeNormal=\u00a7e{0}'s\u00a7f tijd is normaal en komt overeen met de server. +pTimeOthersPermission=\u00a7cJe bent niet bevoegd om een andere spelers' tijd te veranderen. pTimePlayers=These players have their own time: pTimeReset=Player time has been reset for: \u00a7e{0} pTimeSet=Player time is set to \u00a73{0}\u00a7f for: \u00a7e{1} @@ -260,83 +277,81 @@ pTimeSetFixed=Player time is fixed to \u00a73{0}\u00a7f for: \u00a7e{1} parseError=Fout bij ontleding {0} op regel {1} pendingTeleportCancelled=\u00a7cAangevraagde teleportatie afgelast. permissionsError=Permissions/GroupManager ontbreekt; chat prefixes/suffixes worden uitgeschakeld. -playerBanned=\u00a7cPlayer {0} banned {1} for {2} +playerBanned=\u00a7cSpeler {0} verbant {1} voor {2} playerInJail=\u00a7cSpeler zit al in de gevangenis {0}. playerJailed=\u00a77Speler {0} is in de gevangenis gezet. playerJailedFor= \u00a77Speler {0} is in de gevangenis gezet voor {1}. -playerKicked=\u00a7cPlayer {0} kicked {1} for {2} +playerKicked=\u00a7cSpeler {0} Schopt {1} van de server voor {2} playerMuted=\u00a77Je kreeg het zwijgen opgelegd. playerMutedFor=\u00a77Je kreeg het zwijgen opgelegd voor {0} playerNeverOnServer=\u00a7cSpeler {0} is nooit op deze server geweest. playerNotFound=\u00a7cSpeler niet gevonden. playerUnmuted=\u00a77Speler mag weer praten pong=Pong! -possibleWorlds=\u00a77Mogelijk zijn de werelden de nummer 0 tot en met {0}. -powerToolAir=Command kan niet worden bevestigd aan lucht. -powerToolAlreadySet=Command \u00a7c{0}\u00a7f is already assigned to {1}. -powerToolAttach=\u00a7c{0}\u00a7f command assigned to {1}. -powerToolClearAll=All powertool commands have been cleared. -powerToolList={1} has the following commands: \u00a7c{0}\u00a7f. -powerToolListEmpty={0} has no commands assigned. -powerToolNoSuchCommandAssigned=Command \u00a7c{0}\u00a7f has not been assigned to {1}. -powerToolRemove=Command \u00a7c{0}\u00a7f removed from {1}. -powerToolRemoveAll=All commands removed from {0}. -powerToolsDisabled=All of your power tools have been disabled. -powerToolsEnabled=All of your power tools have been enabled. +possibleWorlds=\u00a77Mogelijke werelden zijn de nummers 0 tot en met {0}. +powerToolAir=Commando kan niet worden bevestigd aan lucht. +powerToolAlreadySet=Commando \u00a7c{0}\u00a7f is al toegewezen aan {1}. +powerToolAttach=\u00a7c{0}\u00a7f commando toegewezen aan {1}. +powerToolClearAll=Alle powertool commandos zijn verwijderd. +powerToolList={1} heef de volgende commandos: \u00a7c{0}\u00a7f. +powerToolListEmpty={0} heeft geen commandos toegewezen. +powerToolNoSuchCommandAssigned=Commando \u00a7c{0}\u00a7f is niet toegewezen aan {1}. +powerToolRemove=Commando \u00a7c{0}\u00a7f verwijderd van {1}. +powerToolRemoveAll=Alle commandos verwijderd van {0}. +powerToolsDisabled=Al jouw powertools zijn uitgeschakeld. +powerToolsEnabled=Al jouw powertools zijn ingeschakeld. protectionOwner=\u00a76[EssentialsProtect] Beschermingeigenaar: {0} questionFormat=\u00a77[Vraag]\u00a7f {0} -readNextPage=Type /{0} {1} to read the next page +readNextPage=Type /{0} {1} om de volgende pagina te lezen. reloadAllPlugins=\u00a77Alle plugins zijn herladen. -removed=\u00a77Removed {0} entities. -repair=You have successfully repaired your: \u00a7e{0}. -repairAlreadyFixed=\u00a77This item does not need repairing. -repairEnchanted=\u00a77You are not allowed to repair enchanted items. -repairInvalidType=\u00a7cThis item cannot be repaired. +removed=\u00a77{0} entiteiten verwijderd. +repair=Je hebt succesvol je \u00a7e{0} \u00a7fverwijderd. +repairAlreadyFixed=\u00a77Dit voorwerp hoeft niet gerepareerd te worden. +repairEnchanted=\u00a77Je bent niet toegestaan om dit voorwerp te repareren. +repairInvalidType=\u00a7cDit voorwerp kan niet gerepareerd worden. repairNone=There were no items that needing repairing. requestAccepted=\u00a77Teleporteer aanvraag geaccepteerd. requestAcceptedFrom=\u00a77{0} accepted your teleport request. requestDenied=\u00a77Teleporteer aanvraag geweigerd. requestDeniedFrom=\u00a77{0} denied your teleport request. requestSent=\u00a77Aanvraag verstuurd naar {0}\u00a77. -requestTimedOut=\u00a7cTeleport request has timed out -requiredBukkit=* ! * You need atleast build {0} of CraftBukkit, download it from http://ci.bukkit.org. +requestTimedOut=\u00a7cTeleportatie verzoek is verlopen. +requiredBukkit=* ! * You need atleast build {0} of CraftBukkit, download it from http://dl.bukkit.org/downloads/craftbukkit/ returnPlayerToJailError=Error occurred when trying to return player {0} to jail: {1} second=seconde seconds=seconde -seenBanReason=Reason: {0} seenOffline=Speler {0} is offline vanaf {1} seenOnline=Speler {0} is online vanaf {1} serverFull=Server is vol -serverTotal=Server Total: {0} -setSpawner=Changed spawner type to {0} -sheepMalformedColor=Misvoormde kleur. -shoutFormat=\u00a77[Shout]\u00a7f {0} +serverTotal=Server Totaal: {0} +setSpawner=Voortbrenger type veranderd tot {0} +sheepMalformedColor=Misvormde kleur. +shoutFormat=\u00a77[Schreeuw]\u00a7f {0} signFormatFail=\u00a74[{0}] signFormatSuccess=\u00a71[{0}] signFormatTemplate=[{0}] -signProtectInvalidLocation=\u00a74You are not allowed to create sign here. +signProtectInvalidLocation=\u00a74Je bent niet bevoegd om hier een bord te plaatsen. similarWarpExist=Er bestaat al een warp met dezelfde naam. -slimeMalformedSize=Misvoormde grootte. -soloMob=Die mob is liever in zijn eentje +slimeMalformedSize=Misvormde grootte. +soloMob=Die mob is liever in zijn eentje. spawnSet=\u00a77Spawn locatie voor de groep {0} ingesteld. -spawned=gespawned -sudoExempt=You cannot sudo this user -sudoRun=Forcing {0} to run: /{1} {2} +spawned=voortgebracht +sudoExempt=Je kunt deze speler niet sudo\u00ebn +sudoRun={0} Forceren om te gebruiken: /{1} {2} suicideMessage=\u00a77Vaarwel vreedzame wereld... suicideSuccess= \u00a77{0} pleegde zelfmoord survival=survival -takenFromAccount=\u00a7c{0} is van je bank rekening afgehaald. -takenFromOthersAccount=\u00a7c{0} taken from {1}\u00a7c account. New balance: {2} -teleportAAll=\u00a77Teleporting request sent to all players... +takenFromAccount=\u00a7c{0} is van je rekening afgehaald. +takenFromOthersAccount=\u00a7c{0} is van {1}\u00a7c's rekening gehaald. Nieuw saldo: {2} +teleportAAll=\u00a77Teleportatie verzoek verzonden naar alle spelers... teleportAll=\u00a77Bezig met teleporteren van alle spelers... teleportAtoB=\u00a77{0}\u00a77 is naar {1}\u00a77 geteleporteerd. teleportDisabled={0} heeft teleporteren uit gezet. teleportHereRequest=\u00a7c{0}\u00a7c Heeft gevraagd of hij/zij naar jou mag teleporteren. teleportNewPlayerError=Fout bij het teleporteren van nieuwe speler. teleportRequest=\u00a7c{0}\u00a7c vraagt of hij jou kan teleporteren. -teleportRequestsCancelledWorldChange=\u00a77Pending teleport requests have been cancelled on world change. -teleportRequestTimeoutInfo=\u00a77This request will timeout after {0} seconds. -teleportTop=\u00a77Bezig met teleporteren naar de top. +teleportRequestTimeoutInfo=\u00a77Dit verzoekt verloopt over {0} seconden. +teleportTop=\u00a77Bezig met teleporteren naar het hoogste punt. teleportationCommencing=\u00a77Aan het beginnen met teleporteren... teleportationDisabled=\u00a77Teleportatie uitgeschakeld. teleportationEnabled=\u00a77Teleportatie ingeschakeld. @@ -351,16 +366,17 @@ timeBeforeTeleport=Afkoeltijd tot de volgende teleport: {0} timeFormat=\u00a73{0}\u00a7f or \u00a73{1}\u00a7f or \u00a73{2}\u00a7f timePattern=(?:([0-9]+)\\s*[yj][a-z]*[,\\s]*)?(?:([0-9]+)\\s*m[oa][a-z]*[,\\s]*)?(?:([0-9]+)\\s*w[a-z]*[,\\s]*)?(?:([0-9]+)\\s*d[a-z]*[,\\s]*)?(?:([0-9]+)\\s*[hu][a-z]*[,\\s]*)?(?:([0-9]+)\\s*m[a-z]*[,\\s]*)?(?:([0-9]+)\\s*(?:s[a-z]*)?)? timeSet=Tijd ingesteld in alle werelden. -timeSetPermission=\u00a7cYou are not authorized to set the time. -timeWorldCurrent=The current time in {0} is \u00a73{1} -timeWorldSet=The time was set to {0} in: \u00a7c{1} +timeSetPermission=\u00a7cJe bent niet bevoegd om de tijd te veranderen. +timeWorldCurrent=De actuele tijd in {0} is \u00a73{1} +timeWorldSet=De tijd was veranderd naar {0} in: \u00a7c{1} +tps=Huidige TPS = {0} tradeCompleted=\u00a77Ruil verricht. -tradeSignEmpty=Het handelsbordje heeft een te kleine voorraad. -tradeSignEmptyOwner=There is nothing to collect from this trade sign. -treeFailure=\u00a7cFout bij het genereren van boom. Pobeer het opnieuw op gras of dirt. -treeSpawned=\u00a77Boom gespawned. -true=true -typeTpaccept=\u00a77Om te teleporten, type \u00a7c/tpaccept\u00a77. +tradeSignEmpty=Dit handelsbord heeft een te kleine voorraad. +tradeSignEmptyOwner=Er is niks te verzamelen bij dit handelsbord. +treeFailure=\u00a7cFout bij het genereren van boom. Pobeer het opnieuw op gras of modder. +treeSpawned=\u00a77Boom gegenereerd. +true=\u00a72juist\u00a7f +typeTpaccept=\u00a77Om te accepteren, type \u00a7c/tpaccept\u00a77. typeTpdeny=\u00a77Om te weigeren, type \u00a7c/tpdeny\u00a77. typeWorldName=\u00a77Je kan ook de exacte naam van de wereld typen. unableToSpawnMob=De mob kan niet gespawned worden. @@ -373,44 +389,50 @@ unknownItemName=Onbekende voorwerp naam: {0} unlimitedItemPermission=\u00a7cOnbevoegd om oneindig {0} te hebben. unlimitedItems=Oneindige voorwerpen: unmutedPlayer=Speler {0} mag weer spreken. +unvanished=\u00a7aYou are once again visible. +unvanishedReload=\u00a7cEen herlading heeft je geforceerd om zichtbaar te worden. upgradingFilesError=Fout tijdens het upgraden van de bestanden userDoesNotExist=Speler {0} bestaat niet. -userIsAway={0} is nu AFK -userIsNotAway={0} is niet meer AFK +userIsAway={0} is nu afwezing. +userIsNotAway={0} is niet meer afwezig. userJailed=\u00a77Je bent in de gevangenis gezet. userUsedPortal={0} gebruikte een bestaande uitgangs portal. userdataMoveBackError=Fout bij het verplaasten van userdata/{0}.tmp naar userdata/{1} userdataMoveError=Fout bij het verplaasten van userdata/{0} naar userdata/{1}.tmp usingTempFolderForTesting=Tijdelijke map om te testen: +vanished=\u00a7aJe bent nu verborgen. versionMismatch=Verkeerde versie! Update {0} naar dezelfde versie. versionMismatchAll=Verkeerde versie! Update alle Essentials jars naar dezelfde versie. voiceSilenced=\u00a77Je kan niet meer praten warpDeleteError=Fout bij het verwijderen van het warp bestand. warpListPermission=\u00a7cJe hebt geen toegang om die warp te maken. warpNotExist=Die warp bestaat niet. +warpOverwrite=\u00a7cJe kunt deze warp niet overschrijven. warpSet=\u00a77Warp {0} ingesteld. warpUsePermission=\u00a7cOnbevoegd om die warp te gebruiken. warpingTo=\u00a77Aan het warpen naar {0}. warps=Warps: {0} -warpsCount=\u00a77There are {0} warps. Showing page {1} of {2}. -warpOverwrite=\u00a7cYou cannot overwrite that warp. -weatherStorm=\u00a77Je hebt het weer naar storm gezet in de {0} -weatherStormFor=\u00a77Je hebt het weer in de {0} naar storm gezet voor {1} seconde -weatherSun=\u00a77Je hebt het weer naar zon gezet in de {0} -weatherSunFor=\u00a77Je hebt het weer in de {0} naar zon gezet voor {1} seconde -whoisBanned=\u00a79 - Banned: {0} -whoisGamemode=\u00a79 - Gamemode: {0} -whoisGeoLocation=\u00a79 - Locatie: {0} -whoisGod=\u00a79 - God mode: {0} -whoisHealth=\u00a79 - Levens: {0}/20 -whoisIPAddress=\u00a79 - IP Adres: {0} -whoisIs={0} is {1} -whoisJail=\u00a79 - Jail: {0} -whoisLocation=\u00a79 - Locatie: ({0}, {1}, {2}, {3}) -whoisMoney=\u00a79 - Geld: {0} -whoisOP=\u00a79 - OP: {0} -whoisStatusAvailable=\u00a79 - Status: Beschikbaar -whoisStatusAway=\u00a79 - Status: \u00a7cWeg\u00a7f +warpsCount=\u00a77Er zijn {0} warps. Weergegeven pagina {1} van de {2}. +weatherStorm=\u00a77Je hebt het weer naar stormachtig gezet in de {0} +weatherStormFor=\u00a77Je hebt het weer in de {0} naar stormachtig gezet voor {1} seconde +weatherSun=\u00a77Je hebt het weer naar zonnig gezet in de {0} +weatherSunFor=\u00a77Je hebt het weer in de {0} naar zonnig gezet voor {1} seconde +whoisAFK=\u00a76 - Afwezing:\u00a7f {0} +whoisBanned=\u00a76 - Verbannen:\u00a7f {0} +whoisExp=\u00a76 - Exp:\u00a7f {0} (Level {1}) +whoisFly=\u00a76 - Vlieg modus:\u00a7f {0} ({1}) +whoisGamemode=\u00a76 - Spelmodus:\u00a7f {0} +whoisGeoLocation=\u00a76 - Locatie:\u00a7f {0} +whoisGod=\u00a76 - God modus:\u00a7f {0} +whoisHealth=\u00a76 - Levens:\u00a7f {0}/20 +whoisIPAddress=\u00a76 - IP Adres:\u00a7f {0} +whoisJail=\u00a76 - Gevangenis:\u00a7f {0} +whoisLocation=\u00a76 - Locatie:\u00a7f ({0}, {1}, {2}, {3}) +whoisMoney=\u00a76 - Geld:\u00a7f {0} +whoisMuted=\u00a76 - Gedempt:\u00a7f {0} +whoisNick=\u00a76 - Naam:\u00a7f {0} +whoisOp=\u00a76 - OP:\u00a7f {0} +whoisTop=\u00a76 ====== WhoIs:\u00a7f {0} \u00a76====== worth=\u00a77Stapel {0} met waarde \u00a7c{1}\u00a77 ({2} voorwerp(en) voor {3} per stuk) worthMeta=\u00a77Stapel {0} met een metadata van {1} met waarde \u00a7c{2}\u00a77 ({3} voorwerp(en) voor {4} per stuk) worthSet=Waarde ingesteld @@ -418,4 +440,5 @@ year=jaar years=jaren youAreHealed=\u00a77Je bent genezen. youHaveNewMail=\u00a7cJe hebt {0} berichten!\u00a7f Type \u00a77/mail read\u00a7f om je berichten te bekijken. - +hatRemoved=\u00a7eYour hat has been removed. +banFormat=Banned: {0} diff --git a/Essentials/src/messages_pl.properties b/Essentials/src/messages_pl.properties new file mode 100644 index 000000000..c84d4b1b4 --- /dev/null +++ b/Essentials/src/messages_pl.properties @@ -0,0 +1,444 @@ +#version: ${build.number} +# Single quotes have to be doubled: '' +# Translations start here +# by: losdamianos, edited by Rutr +action=* {0} {1} +addedToAccount=\u00a7a{0} zostalo dodane do twojego konta. +addedToOthersAccount=\u00a7a{0} dodane do konta {1}\u00a7. Nowy stan konta: {2}. +alertBroke=broke: +alertFormat=\u00a73[{0}] \u00a7f {1} \u00a76 {2} at: {3} +alertPlaced=postawil: +alertUsed=uzyl: +autoAfkKickReason=Zostales wyrzucony z serwera za nie ruszanie sie przez wiecej niz {0} minut. +backAfterDeath=\u00a77Uzyj komendy /back aby powrocic na miejsce swojej smierci. +backUsageMsg=\u00a77Transportowanie do poprzedniej lokacji. +backupDisabled=Zewnetrzny skrypt backupu nie zostal skonfigurowany. +backupFinished=Backup zakonczony. +backupStarted=Backup rozpoczety. +balance=\u00a77Stan konta: {0} +balanceTop=\u00a77Najbogatsi gracze ({0}) +banExempt=\u00a7cNie mozesz zbanowac tego gracza. +banIpAddress=\u00a77Zbanowano adress IP +bannedIpsFileError=Blad odczytu banned-ips.txt +bannedIpsFileNotFound=banned-ips.txt nie znaleziony +bannedPlayersFileError=Blad odczytu banned-players.txt +bannedPlayersFileNotFound=banned-players.txt nie znaleziony +bigTreeFailure=\u00a7cNie mozna tutaj postawic duzego drzewa. Sprobuj ponownie na ziemi lub trawie. +bigTreeSuccess= \u00a77Utworzono duze drzewo. +blockList=Essentials przekazuje nastepujace polecenie do innej wtyczki: +broadcast=[\u00a7cOgloszenie\u00a7f]\u00a7a {0} +buildAlert=\u00a7cNie mozesz tu budowac +bukkitFormatChanged=Format wersji Bukkita jest zmieniony. Wersja nie jest sprawdzana. +burnMsg=\u00a77Podpaliles {0} na {1} sekund. +canTalkAgain=\u00a77Znow mozesz mowic. +cantFindGeoIpDB=Nie mozna znalezc bazy danych GeoIP! +cantReadGeoIpDB=Odczytywanie bazy danych GeoIP zawiodlo! +cantSpawnItem=\u00a7cNie mozesz stworzyc przedmiotu {0}. +chatTypeLocal=[L] +chatTypeAdmin=[A] +chatTypeSpy=[Szpieg] +commandFailed=Komenda {0} zawiodla. +commandHelpFailedForPlugin=Blad podczas uzyskiwania pomocy dla: {0} +commandNotLoaded=\u00a7cKomenda {0} nie jest zaladowana! +compassBearing=\u00a77Bearing: {0} ({1} stopni). +configFileMoveError=Nie udalo sie przeniesc config.yml do lokalizacji backupa. +configFileRenameError=Nie udalo sie zmienic nazwy tymczasowego pliku na config.yml +connectedPlayers=Obecni gracze: +connectionFailed=Blad podczas otwierania polaczenia. +cooldownWithMessage=\u00a7cCooldown: {0} +corruptNodeInConfig=\u00a74Notice: Twoj plik konfiguracyjny ma uszkodzony wpis: {0} +couldNotFindTemplate=Nie mozna znajsc szablonu: {0} +creatingConfigFromTemplate=tworzenie konfiguracji z szablonu: {0} +creatingEmptyConfig=Stworzono pusty config: {0} +creative=Kreatywny +currency={0}{1} +currentWorld=Biezacy swiat: {0} +day=dzien +days=dnie +defaultBanReason=Admin ma zawsze racje! +deleteFileError=Nie mozna usunac pliku: {0} +deleteHome=\u00a77Posterunek {0} zostal usuniety +deleteJail=\u00a77Wiezienie {0} zostalo usuniete +deleteWarp=\u00a77Warp {0} zostal usuniety +deniedAccessCommand={0} nie ma dostepu do tego polecenia +dependancyDownloaded=[Essentials] Zaleznosci {0} pobrane prawidlowo. +dependancyException=[Essentials] Wystapil blad w trakcie pobierania zaleznosci. +dependancyNotFound=[Essentials] Wymagana zaleznosc nie zostala znaleziona, pobieranie. +depth=\u00a77Jestes na poziomie morza. +depthAboveSea=\u00a77Jestes {0} blok(ow) nad poziomem morza. +depthBelowSea=\u00a77Jestes {0} blok(ow) pod poziomem morza. +destinationNotSet=Cel nieokreslony. +disableUnlimited=\u00a77Wylaczone nieograniczone tworzenia {0} dla {1}. +disabled=wylaczone +disabledToSpawnMob=Tworzenie tego moba zostalo wylaczone w pliku config. +dontMoveMessage=\u00a77Teleportacja nastapi za {0}. Prosze sie nie ruszac. +downloadingGeoIp=Pobieranie bazy danych GeoIP... To moze zajac chwile (wioska: 0.6 MB, miasto: 20MB) +duplicatedUserdata=Kopiowanie danych uzytkownika: {0} i {1} +durability=\u00a77This tool has \u00a7c{0}\u00a77 uses left +enableUnlimited=\u00a77Przyznano nielimitowane zasoby {0} dla {1}. +enabled=wlaczone +enchantmentApplied = \u00a77Ulepszenie {0} zostalo przyznane przedmiotowi w twoim reku. +enchantmentNotFound = \u00a7cUlepszenie nie odnalezione +enchantmentPerm = \u00a7cNie masz zezwolenia na {0}. +enchantmentRemoved = \u00a77Ulepszenie {0} zostalo usuniete z przedmiotu w twoim reku.. +enchantments = \u00a77Ulepszenia: {0} +errorCallingCommand=Blad wywolywania komendy /{0} +errorWithMessage=\u00a7cBlad: {0} +essentialsHelp1=Plik jest uszkodzony i Essentials nie moze go otworzyc. Essentials jest teraz wylaczone. Jesli nie mozesz samemu naprawic pliku, idz do adresu http://tiny.cc/EssentialsChat +essentialsHelp2=Plik jest uszkodzony i Essentials nie moze go otworzyc. Essentials jest teraz wylaczone. Jesli nie mozesz samemu naprawic pliku, wpisz /essentialshelp w grze lub idz do adresu http://tiny.cc/EssentialsChat +essentialsReload=\u00a77Essentials przeladowalo {0}. +exp=\u00a7c{0} \u00a77ma\u00a7c {1} \u00a77doswiadczenia (poziom\u00a7c {2}\u00a77), potrzebuje\u00a7c {3} \u00a77wiecej doswiadczenia do nastepnego poziomu. +expSet=\u00a7c{0} \u00a77teraz ma\u00a7c {1} \u00a77doswiadczenia. +extinguish=\u00a77Zostales ugaszony. +extinguishOthers=\u00a77Ugasiles {0}. +failedToCloseConfig=Blad podczas zamykania configu {0} +failedToCreateConfig=Blad podczas tworzenia configu {0} +failedToWriteConfig=Blad podczas pisania configu {0} +false=\u00a74false\u00a7f +feed=\u00a77Twoj glod zostal zaspokojony. +feedOther=\u00a77Nakarmiono {0}. +fileRenameError=Blad podczas zmiany nazwy pliku \u0093{0}\u0094. +flyMode=\u00a77Latanie {0} dla {1}. +flying=flying +foreverAlone=\u00a7cNie masz komu odpisac. +freedMemory=Zwolniono {0} MB. +gameMode=\u00a77Ustawiono tryb gry {0} dla {1}. +gcchunks= chunki +gcentities= jednostki +gcfree=Wolna pamiec: {0} MB +gcmax=Maksymalna pamiec: {0} MB +gctotal=Alokowana pamiec: {0} MB +geoIpUrlEmpty=Url pobierania GeoIP jest puste. +geoIpUrlInvalid=Url pobierania GeoIP jest nieprawidlowe. +geoipJoinFormat=Gracz {0} przybyl z {1} +godDisabledFor=Godmode wylaczony dla {0}. +godEnabledFor=Godmode wlaczony dla {0}. +godMode=\u00a77Godmode {0}. +hatArmor=\u00a7cError, you cannot use this item as a hat! +hatEmpty=\u00a7cYou are not wearing a hat. +hatFail=\u00a7cMusisz cos trzymac w dloni. +hatPlaced=\u00a7eCiesz sie nowym kapeluszem! +haveBeenReleased=\u00a77Zostales wypuszczony. +heal=\u00a77Uleczony +healOther=\u00a77Uleczono {0}. +helpConsole=Aby uzyskac pomoc z konsoli, wpisz \u0093????. +helpFrom=\u00a77Komendy od {0}: +helpLine=\u00a76/{0}\u00a7f: {1} +helpMatching=\u00a77Komendy odpowiadajace "{0}": +helpOp=\u00a7c[HelpOp]\u00a7f \u00a77{0}:\u00a7f {1} +helpPages=Strona \u00a7c{0}\u00a7f z \u00a7c{1}\u00a7f: +helpPlugin=\u00a74{0}\u00a7f: Plugin Help: /help {1} +holeInFloor=Kosmos +homeSet=\u00a77Dom ustawiono +homeSetToBed=\u00a77Twoj dom znajduje sie teraz w tym lozku. +homes=Domy: {0} +hour=godzina +hours=godziny +ignorePlayer=Od tej chwili ignorujesz gracza {0}. +illegalDate=Nie prawidlowy format daty. +infoChapter=Wybierz rozdzial: +infoChapterPages=Rozdzial {0}, strona \u00a7c{1}\u00a7f z \u00a7c{2}\u00a7f: +infoFileDoesNotExist=Plik \u0093info.txt\u0094 nie istnieje. Tworzenie tego pliku. +infoPages=\u00a7e ---- \u00a76{2} \u00a7e--\u00a76 Strona \u00a74{0}\u00a76/\u00a74{1} \u00a7e---- +infoUnknownChapter=Nieznany rozdzial. +invBigger=Ekwipunek innego gracza jest wiekszy niz Twoj. +invRestored=Twoj ekwipunek zostal przywrocony. +invSee=Widzisz ekwipunek {0}. +invSeeHelp=Wpisz /invsee aby przywrocic swoj ekwipunek. +invalidCharge=\u00a7cInvalid charge. +invalidHome=Dom {0} nie istnieje. +invalidMob=Niepoprawny typ moba.. +invalidServer=Niepoprawny serwer! +invalidSignLine=Linia {0} na znaku jest bledna. +invalidWorld=\u00a7cNieprawidlowy swiat. +inventoryCleared=\u00a77Ekwipunek oprozniony. +inventoryClearedOthers=\u00a77Ekwipunek \u00a7c{0}\u00a77 oprozniony. +is=jest +itemCannotBeSold=Nie mozesz sprzedac tego przedmiotu do serwera. +itemMustBeStacked=Przedmiotem handluje sie w stackach. Wielkosc 2s to dwa stacki itd. +itemNotEnough1=\u00a7cMasz za malo tego przedmiotu, aby go sprzedac. +itemNotEnough2=\u00a77Jesli chcesz sprzedac wszystkie przedmioty tego typu, wpisz /sell nazwaprzedmiotu +itemNotEnough3=\u00a77/sell nazwaprzedmiotu -1 sprzeda cala ilosc przedmiotu poza 1 sztuka itd. +itemSellAir=Serio probujesz sprzedac powietrze? Miej w reku przedmiot.. +itemSold=\u00a77Sprzedamo za \u00a7c{0} \u00a77({1} {2} po {3} kazdy) +itemSoldConsole={0} Sprzedano {1} za \u00a77{2} \u00a77({3} sztuki po {4} kazda) +itemSpawn=\u00a77Otrzymywanie {0} {1} +itemsCsvNotLoaded=Nie mozna wczytac items.csv. +jailAlreadyIncarcerated=\u00a7cTen gracz jest juz w wiezieniu \u0093{0}\u0094. +jailMessage=\u00a7cZa kazde przewinienie czeka kara. +jailNotExist=Nie ma takiego wiezienia.. +jailReleased=\u00a77Gracz \u00a7e{0}\u00a77 wypuszczony z wiezienia. +jailReleasedPlayerNotify=\u00a77Zostales zwolniony! +jailSentenceExtended=Czas pobyty w wiezieniu zwiekszony do: {0) +jailSet=\u00a77Zostalo stworzone wiezienie \u0093{0}\u0094. +jumpError=To moglo by ci cos zrobic. +kickDefault=Zostales wyrzucony z serwera. +kickExempt=\u00a7cNie mozesz wyrzucic tej osoby. +kickedAll=\u00a7cWyrzucanie wszystki graczy z serwera +kill=\u00a77Zabito {0}. +kitError2=\u00a7cTen zestaw nie istnieje lub zostal zle zdefininowany. +kitError=\u00a7cNie ma prawidlowych zestawow. +kitErrorHelp=\u00a7cByc moze przedmiotowi brakuje ilosci w konfiguracji? +kitGive=\u00a77Przydzielanie zestawu {0}. +kitInvFull=\u00a7cTwoj ekwipuek jest pelen, wyrzucanie zestawu na podloge. +kitTimed=\u00a7cNie mozesz wziasc tego zestawu przez kolejne {0}. +kits=\u00a77Zestawy: {0} +lightningSmited=\u00a77Zostales uderzony piorunem. +lightningUse=\u00a77Uderzanie piorunem {0}. +listAfkTag = \u00a77[AFK]\u00a7f +listAmount = \u00a79Na serwerze jest \u00a7c{0}\u00a79 graczy z maksimum \u00a7c{1}\u00a79 online. +listAmountHidden = \u00a79There are \u00a7c{0}\u00a77/{1}\u00a79 out of maximum \u00a7c{2}\u00a79 players online. +listGroupTag={0}\u00a7f: +listHiddenTag = \u00a77[UKRYTY]\u00a7f +loadWarpError=Blad przy wczytywaniu Warpu {0} +localFormat=Lokalny: <{0}> {1} +mailClear=\u00a7cAby oczyscic skrzynke, wpisz /mail clear +mailCleared=\u00a77Skrzynka oprozniona!! +mailSent=\u00a77Wiadomosc wyslana! +markMailAsRead=\u00a7cAby oczyscic skrzynke, wpisz /mail clear +markedAsAway=\u00a77Zostales oznaczony jako nieobecny. +markedAsNotAway=\u00a77Juz nie jestes nieobecny. +maxHomes=Nie mozesz ustawic wiecej niz {0} domow. +mayNotJail=\u00a7cNie mozesz wtracic do wiezienia tej osoby. +me=ja +minute=minuta +minutes=minuty +missingItems=Nie masz {0}x{1}. +missingPrefixSuffix=Brakuje prefixu lub suffixu dla {0} +mobSpawnError=Blad podczas zmiany spawnera. +mobSpawnLimit=Ilosc mobow ograniczona do limitu serwera. +mobSpawnTarget=Blok musi byc spawnerem. +mobsAvailable=\u00a77Moby: {0} +moneyRecievedFrom=\u00a7a{0} otrzymane od {1} +moneySentTo=\u00a7a{0} zostalo wyslane do {1} +moneyTaken={0} zostalo zabrane z Twoich funduszy.. +month=miesiac +months=miesiecy +moreThanZero=Ilosc musi byc wieksza od 0. +msgFormat=\u00a77[{0}\u00a77 -> {1}\u00a77] \u00a7f{2} +muteExempt=\u00a7cNie mozesz wyciszyc tego gracza.. +mutedPlayer=Gracz {0} wyciszony. +mutedPlayerFor=Gracz {0} wyciszony na {1}. +mutedUserSpeaks={0} probowal sie odezwac, ale jest wyciszony. +nearbyPlayers=Gracze w poblizu: {0} +negativeBalanceError=Gracz nie moze miec ujemnego stanu konta. +nickChanged=Nick zmieniony. +nickDisplayName=\u00a77Musisz wlaczyc \u0093change-displayname\u0094 w configu Essential. +nickInUse=\u00a7cTen pseudonim jest juz w uzyciu. +nickNamesAlpha=\u00a7cPseudonimy musza byc alfanumeryczne. +nickNoMore=\u00a77Nie masz juz pseudonimu. +nickOthersPermission=\u00a7cNie masz uprawnienia do zmiany pseudonimu innym. +nickSet=\u00a77Twoj pseudonim od teraz to \u00a7c{0} +noAccessCommand=\u00a7cNie masz dostepu do tej komendy. +noAccessPermission=\u00a7cNie masz uprawnien do dostepu do {0}. +noBreakBedrock=Nie masz uprawnien do niszczenia bedrocka. +noDestroyPermission=\u00a7cNie masz uprawnien do niszczenia {0}. +noDurability=\u00a7cThis item does not have a durability. +noGodWorldWarning=\u00a7cUwaga! Godmode wylaczony w tym swiecie!. +noHelpFound=\u00a7cNie ma odpowiadajacych komend. +noHomeSet=Nie masz ustawionego domu. +noHomeSetPlayer=Gracz nie ma ustawionego domu. +noKitPermission=\u00a7cMusisz posiadac uprawnienia \u00a7c{0}\u00a7c aby uzywac tego zestawu. +noKits=\u00a77Nie ma jeszcze dostepnych zestawow. +noMail=Nie masz zadnych wiadomosci. +noMotd=\u00a7cNie ma wiadomosci dnia.. +noNewMail=\u00a77Nie masz zadnych nowych wiadomosci. +noPendingRequest=Nie masz oczekuj\u00c3\u00a1cego z\u00c3\u00a1dania. +noPerm=\u00a7cNie masz uprawnien \u00a7f{0}. +noPermToSpawnMob=\u00a7cNie masz uprawnien do tworzenia tego moba.. +noPlacePermission=\u00a7cNie masz uprawnien do stawiania bloku kolo tego znaku.. +noPowerTools=Nie masz przypisanego zadnego power tool. +noRules=\u00a7cNie ustalono jeszcze zadnych zasad. +noWarpsDefined=Nie ma zadnych warpow. +none=zaden +notAllowedToQuestion=\u00a7cNie mozesz zadac tego pytania. +notAllowedToShout=\u00a7cNie mozesz krzyczec.. +notEnoughExperience=Nie masz wystarczajaco duzo doswiadczenia. +notEnoughMoney=Nie masz tyle pieniedzy. +notFlying=not flying +notRecommendedBukkit= * ! * Wersja Bukkita nie jest rekomendowana wersja dla Essentials. +notSupportedYet=Jeszcze nie wspierane. +nothingInHand = \u00a7cNie masz nic w reku.. +now=teraz +nuke=Niech smierc pochlonie caly swiat! +numberRequired=Tutaj powinna byc liczba, gluptasie. +onlyDayNight=/time obsluguje tylko day/night. +onlyPlayers=Tylko gracze w grze moga uzywac {0}. +onlySunStorm=/weather obsluguje tylko sun/storm. +orderBalances=Ordering balances of {0} users, please wait ... +pTimeCurrent=Czas \u00a7e{0} u00a7f to {1}. +pTimeCurrentFixed=Czas \u00a7e{0}\u00a7f przywrocony do {1}. +pTimeNormal=Czas \u00a7e{0}'s\u00a7f jest normalny i odpowiada serwerowemu. +pTimeOthersPermission=\u00a7cNie masz uprawnien do zmiany czasu innym. +pTimePlayers=Ci gracze beda miec wlasny czas: +pTimeReset=Czas gracza zostal zresetowany dla \u00a7e{0} +pTimeSet=Czas gracza ustawiony na \u00a73{0}\u00a7f dla \u00a7e{1} +pTimeSetFixed=Czas gracza przywrocony do \u00a73{0}\u00a7f dla \u00a7e{1} +parseError=Blad skladniowy {0} w linii {1}. +pendingTeleportCancelled=\u00a7cOczekujace zapytanie teleportacji odrzucone. +permissionsError=Brakuje Permissions/GroupManager; prefixy/suffixy czatu zostana wylaczone. +playerBanned=\u00a7c{0} zbanowal {1} za {2}. +playerInJail=\u00a7cGracz jest juz w wiezieniu \u0093{0}\u0094. +playerJailed=\u00a77Gracz {0} wtracony do wiezienia. +playerJailedFor= \u00a77Gracz {0} wtracony do wiezienia na {1}. +playerKicked=\u00a7c{0} wyrzucil {1} za {2}. +playerMuted=\u00a77Zostales wyciszony. +playerMutedFor=\u00a77Zostales wyciszony na {0}. +playerNeverOnServer=\u00a7cGracz {0} nigdy nie byl na tym serwerze. +playerNotFound=\u00a7cNie odnaleziono gracza. +playerUnmuted=\u00a77Zostales przywrocony do glosu. +pong=Pong! +possibleWorlds=\u00a77Mozliwe swiaty maja numery od 0 do {0}. +powerToolAir=Nie zartuj, chcesz przypisac polecenie do powietrza? +powerToolAlreadySet=Polecenie \u00a7c{0}\u00a7f jest juz przypisane do {1}. +powerToolAttach=\u00a7c{0}\u00a7f polecenie przypisane do {1}. +powerToolClearAll=Wszystkie przypisane polecenia zostaly usuniete! +powerToolList={1} zawiera nastepujace polecenia: \u00a7c{0}\u00a7f. +powerToolListEmpty={0} nie ma przypisanych polecen. +powerToolNoSuchCommandAssigned=Polecenie \u00a7c{0}\u00a7f nie moze byc przypisane do {1}. +powerToolRemove=Polecenie \u00a7c{0}\u00a7f usuniete z {1}. +powerToolRemoveAll=Wszystkie polecenia zostaly usuniete z {0}. +powerToolsDisabled=Wszystkie twoje podpiecia zostaly zdezaktywowane. +powerToolsEnabled=Wszystkie twoje podpiecia zostaly aktywowane. +protectionOwner=\u00a76[EssentialsProtect] Wlasciciel zabezpieczen: {0} +questionFormat=\u00a77[Question]\u00a7f {0} +readNextPage=Wpisz /{0} {1} aby przeczytac nastepna strone +reloadAllPlugins=\u00a77Przeladowano wszystkie wtyczki +removed=\u00a77Usunieto {0} byty. +repair=Udalo sie naprawic twoj: \u00a7e{0}. +repairAlreadyFixed=\u00a77Ten przedmiot nie potrzebuje naprawy +repairEnchanted=\u00a77Nie masz zezwolenia do naprawiania ulepszonych przedmiotow. +repairInvalidType=\u00a7cTen przedmiot nie moze byc naprawiony. +repairNone=Zaden przedmiot nie wymagal naprawy. +requestAccepted=\u00a77Zadanie teleportacji - zaakceptowano. +requestAcceptedFrom=\u00a77{0} zaakceptowal Twoje z\u00c3\u00a1danie teleportacji. +requestDenied=\u00a77Zadanie teleportacji - odrzucone. +requestDeniedFrom=\u00a77{0} odrzucil Twoje z\u00c3\u00a1danie teleportacji. +requestSent=\u00a77zZ\u00c3\u00a1danie wyslania do {0}\u00a77. +requestTimedOut=\u00a7cZ\u00c3\u00a1danie teleportacji - przedawnione. +requiredBukkit= * ! * Potrzebujesz najnowszego {0} CraftBukkit-a, pobierz go z http://dl.bukkit.org/downloads/craftbukkit/ +returnPlayerToJailError=Wystapil blad podczas powrotu gracza {0} do wiezienia: {1} +second=sekunda +seconds=sekund +seenOffline=Gracz {0} jest offline od {1} +seenOnline=Gracz {0} jest online od {1} +serverFull=Serwer jest pelen graczy, sprobuj pozniej. +serverTotal=Podsumowanie serwera: {0} +setSpawner=Ustawiono spawn na {0}. +sheepMalformedColor=Niewlasciwa barwa. +shoutFormat=\u00a77[Shout]\u00a7f {0} +signFormatFail=\u00a74[{0}] +signFormatSuccess=\u00a71[{0}] +signFormatTemplate=[{0}] +signProtectInvalidLocation=\u00a74Nie masz zezwolenia do tworzenia tutaj znakow. +similarWarpExist=Warp o tej nazwie juz istnieje. +slimeMalformedSize=Niewlasciwy rozmiar. +soloMob=Ten mob lubi byc sam. +spawnSet=\u00a77Ustawiono punkt spawnu dla grupy {0}. +spawned=stworzono +sudoExempt=Nie mozesz podniesc uprawnien tego uzytkownika. +sudoRun=Probuje {0} uruchomic: /{1} {2} +suicideMessage=\u00a77Zegnaj okrutny swiecie. +suicideSuccess= \u00a77{0} dokonal zamachu na swoje zycie +survival=survival +takenFromAccount=\u00a7c{0} zostalo pobrane z konta. +takenFromOthersAccount=\u00a7c{0} zostalo pobrane z {1}\u00a7c konta. Nowy stan konta: {2} +teleportAAll=\u00a77Zadanie teleportacji - wyslano do wszystkich graczy. +teleportAll=\u00a77Teleportowanie wszystkich graczy. +teleportAtoB=\u00a77{0}\u00a77 przeteleportowal Ciebie do {1}\u00a77. +teleportDisabled={0} ma zdezaktywowana teleportacje. +teleportHereRequest=\u00a7c{0}\u00a7c ma zadanie przeteleportowac cie do nich. +teleportNewPlayerError=Blad przy teleportowniu nowego gracza. +teleportRequest=\u00a7c{0}\u00a7c zazadal teleportacji do Ciebie. +teleportRequestTimeoutInfo=\u00a77 Zadanie teleportacji przedawni sie za {0} sekund. +teleportTop=\u00a77Teleportacja na wierzch. +teleportationCommencing=\u00a77Teleport rozgrzewa sie... +teleportationDisabled=\u00a77Teleportacja - zdezaktywowana. +teleportationEnabled=\u00a77Teleportacja - aktywowana. +teleporting=\u00a77Teleportacja... +teleportingPortal=\u00a77Teleportacja przez portal. +tempBanned=Tymczasowo zbanowany na serwerze przez {0}. +tempbanExempt=\u00a77Nie mozesz tymczasowo zbanowac tego gracza. +thunder= {0} przywowlal burze. +thunderDuration={0} przywolal burze na {1} sekund. +timeBeforeHeal=Czas przed nastepnym uzdrowieniem: {0}. +timeBeforeTeleport=Czas przed nastepnym teleportem:{0}. +timeFormat=\u00a73{0}\u00a7f or \u00a73{1}\u00a7f or \u00a73{2}\u00a7f +timePattern=(?:([0-9]+)\\s*y[a-z]*[,\\s]*)?(?:([0-9]+)\\s*mo[a-z]*[,\\s]*)?(?:([0-9]+)\\s*w[a-z]*[,\\s]*)?(?:([0-9]+)\\s*d[a-z]*[,\\s]*)?(?:([0-9]+)\\s*h[a-z]*[,\\s]*)?(?:([0-9]+)\\s*m[a-z]*[,\\s]*)?(?:([0-9]+)\\s*(?:s[a-z]*)?)? +timeSet=Czas ustawiono we wszystkich swiatach. +timeSetPermission=\u00a7cNie masz uprawnien do ustawiania czasu. +timeWorldCurrent=Obecny czas {0} to \u00a73{1}. +timeWorldSet=Czas ustawiono {0} w: \u00a7c{1}. +tps=Current TPS = {0} +tradeCompleted=\u00a77Handel zakonczono. +tradeSignEmpty=Tabliczka handlowa nie jest dostepna dla Ciebie. +tradeSignEmptyOwner=Nie ma nic do pobrania z tej tabliczki. +treeFailure=\u00a7cUtworzenie drzewa nie powiodlo sie, sprobuj na trawie lub ziemi. +treeSpawned=\u00a77Drzewo utworzono. +true=\u00a72true\u00a7f +typeTpaccept=\u00a77Aby zaakceptowac teleport, wpisz \u00a7c/tpaccept\u00a77. +typeTpdeny=\u00a77Aby odmowic teleportacji, wpisz \u00a7c/tpdeny\u00a77. +typeWorldName=\u00a77Mozesz rowniez wpisac nazwe danego swiata. +unableToSpawnMob=Nie udalo sie stworzyc potwora. +unbannedIP=Odbanowana gracza o danym adresie IP. +unbannedPlayer=Odbanowano gracza. +unignorePlayer=Nie ignorujesz juz gracza {0}. +unknownItemId=Nieznane id przedmiotu: {0}. +unknownItemInList=Nieznany przedmiot {0} w liscie {1} . +unknownItemName=Nieznana nazwa przedmiotu: {0}. +unlimitedItemPermission=\u00a7cBrak uprawnien dla nielimitowanego przedmiotu {0}. +unlimitedItems=Nielimitowane przedmioty: +unmutedPlayer=Gracz {0} moze znowu mowic. +unvanished=\u00a7aZn\u00c3\u00b3w jestes widoczny. +unvanishedReload=\u00a7cReload spowodowal ze cie widac. +upgradingFilesError=Wystapil blad podczas aktualizowaniu plik\u00c3\u00b3w. +userDoesNotExist=Uzytkownik {0} nie istnieje w bazie danych. +userIsAway={0} jest teraz AFK. +userIsNotAway={0} nie jest juz AFK. +userJailed=\u00a77Zostales zamkniety w wiezieniu. +userUsedPortal={0} uzyl istniejacego portalu wyjscia. +userdataMoveBackError=Nie udalo sie przeniesc userdata/{0}.tmp do userdata/{1} +userdataMoveError=Nie udalo sie przeniesc userdata/{0} do userdata/{1}.tmp +usingTempFolderForTesting=Uzywam tymczasowego folderu dla testu: +vanished=\u00a7aJuz jestes niewidoczny. +versionMismatch=Niepoprawna wersja! Prosze zaktualizowac {0} do tej samej wersji co inne pliki. +versionMismatchAll=Niepoprawna wersja! Prosze zaktualizowac wszystkie pliki Essentials do tej samej wersji. +voiceSilenced=\u00a77Twe usta zostaly zaszyte. +warpDeleteError=Wystapil problem podczas usuwania pliku z Warpami. +warpListPermission=\u00a7cNie masz pozwolenia na sprawdzenie listy Warp\u00c3\u00b3w.. +warpNotExist=Ten Warp nie istnieje. +warpOverwrite=\u00a7cNie mozesz nadpisac tego Warpa. +warpSet=\u00a77Warp {0} stworzony. +warpUsePermission=\u00a7cNie masz pozwolenie na korzystanie z tego Warpa. +warpingTo=\u00a77Teleportuje do {0}. +warps=Warpy: {0} +warpsCount=\u00a77Istnieje {0} warp\u00c3\u00b3w. Pokazuje strone {1} z {2}. +weatherStorm=\u00a77Ustawiles burze w {0}. +weatherStormFor=\u00a77Ustawiles burze w {0} na {1} sekund. +weatherSun=\u00a77Ustawiles bezchmurna pogode w {0}. +weatherSunFor=\u00a77Ustawiles bezchmurna pogode w {0} na {1} sekund. +whoisAFK=\u00a76 - AFK:\u00a7f {0} +whoisBanned=\u00a76 - Zbanowany:\u00a7f {0}. +whoisExp=\u00a76 - Punkty Doswiadczenia:\u00a7f {0} (Poziom {1}). +whoisFly=\u00a76 - Fly mode:\u00a7f {0} ({1}) +whoisGamemode=\u00a76 - Tryb Gry:\u00a7f {0}. +whoisGeoLocation=\u00a76 - Lokalizacja:\u00a7f {0}. +whoisGod=\u00a76 - Godmode:\u00a7f {0}. +whoisHealth=\u00a76 - Zdrowie:\u00a7f {0}/20. +whoisIPAddress=\u00a76 - Adres IP:\u00a7f {0}. +whoisJail=\u00a76 - W wiezieniu:\u00a7f {0}. +whoisLocation=\u00a76 - Lokalizacja:\u00a7f ({0}, {1}, {2}, {3}) +whoisMoney=\u00a76 - Pieniadze:\u00a7f {0}. +whoisMuted=\u00a76 - Muted:\u00a7f {0} +whoisNick=\u00a76 - Nick:\u00a7f {0} +whoisOp=\u00a76 - OP:\u00a7f {0} +whoisTop=\u00a76 ====== WhoIs:\u00a7f {0} \u00a76====== +worth=\u00a77Stack {0} jest warty \u00a7c{1}\u00a77 ({2}rzedmiot(y) po {3} kazdy) +worthMeta=\u00a77Stack {0} z metadata {1} jest warty \u00a7c{2}\u00a77 ({3} przedmiot(y) po {4} kazdy) +worthSet=Cena przedmiotu ustawiona. +year=rok +years=lat +youAreHealed=\u00a77Zostales/as uleczony/na. +youHaveNewMail=\u00a7cMasz {0} wiadomosci!\u00a7f napisz \u00a77/mail read\u00a7f aby je przeczytac. +hatRemoved=\u00a7eYour hat has been removed. +banFormat=Banned: {0} diff --git a/Essentials/src/messages_pt.properties b/Essentials/src/messages_pt.properties new file mode 100644 index 000000000..e4ccd73a7 --- /dev/null +++ b/Essentials/src/messages_pt.properties @@ -0,0 +1,444 @@ +#version: ${build.number} +# Single quotes have to be doubled: '' +# Translations start here +# by: FurmigaHumana, completed by Iaccidentally +action=* {0} {1} +addedToAccount=\u00a7a{0} foi adicionado a sua conta. +addedToOthersAccount=\u00a7a{0} adicionado a {1}\u00a7a saldo. Novo saldo: {2} +alertBroke=Quebrou: +alertFormat=\u00a73[{0}] \u00a7f {1} \u00a76 {2} em: {3} +alertPlaced=Colocou: +alertUsed=Usou: +autoAfkKickReason=Voc\u00ea foi kickado por estar inativo a mais de {0} minutos. +backAfterDeath=\u00a77Use o comando /back para voltar onde morreu. +backUsageMsg=\u00a77Retornando a posi\u00e7ao anterior... +backupDisabled=Um script de backup externo nao foi configurado. +backupFinished=Backup conclu\u00eddo +backupStarted=Backup iniciado +balance=\u00a77Saldo: {0} +balanceTop=\u00a77 Saldos superiores ({0}) +banExempt=\u00a7cVoc\u00ea nao pode banir este jogador. +banIpAddress=\u00a77Endere\u00e7o de IP banido +bannedIpsFileError=Erro ao ler o arquivo banned-ips.txt +bannedIpsFileNotFound=banned-ips.txt nao encontrado +bannedPlayersFileError=Erro ao ler o arquivo banned-players.txt +bannedPlayersFileNotFound=banned-players.txt nao encontrado +bigTreeFailure=\u00a7cFalha na gera\u00e7ao da \u00e1rvore grande. Tente de novo na terra ou grama. +bigTreeSuccess= \u00a77\u00c1rvore grande gerada. +blockList=Essentials passou o seguinte comando a outro plugin: +broadcast=[\u00a7cBroadcast\u00a7f]\u00a7a {0} +buildAlert=\u00a7cVoc\u00ea nao tem permissao de construir. +bukkitFormatChanged=Bukkit: formato da versao alterada. Versao nao verificada. +burnMsg=\u00a77Voc\u00ea {0} foi incendiado por {1} segundos. +canTalkAgain=\u00a77Voc\u00ea pode falar de novo +cantFindGeoIpDB=Nao foi poss\u00edvel encontrar o GeoIP database! +cantReadGeoIpDB=Falhou em ler a GeoIP database! +cantSpawnItem=\u00a7cVoc\u00ea nao tem permissao de pegar este item {0} +chatTypeLocal=[L] +chatTypeAdmin=[A] +chatTypeSpy=[Spy] +commandFailed=Comando {0} falhou: +commandHelpFailedForPlugin=Erro ao obter ajuda para: {0} +commandNotLoaded=\u00a7cCommando {0} provavelmente esta carregado. +compassBearing=\u00a77Inclina\u00e7ao: {0} ({1} graus). +configFileMoveError=Falha ao mover arquivo config.yml ao local de backup. +configFileRenameError=Falha em renomear arquivo temporario em config.yml +connectedPlayers=Jogadores conectados: +connectionFailed=Falha ao abrir conexao. +cooldownWithMessage=\u00a7cTempo de espera: {0} +corruptNodeInConfig=\u00a74Aviso: Seu arquivo de configura\u00e7ao tem uma parte {0} corrompida. +couldNotFindTemplate=Nao foi poss\u00edvel encontrar o modelo {0} +creatingConfigFromTemplate=Criando arquivo de configura\u00e7ao com o modelo: {0} +creatingEmptyConfig=Criando arquivo de configura\u00e7ao vazio: {0} +creative=creative +currency={0}{1} +currentWorld=Current World: {0} +day=dia +days=dias +defaultBanReason=O martelo proibicao falou! +deleteFileError=Nao \u00e9 poss\u00edvel deletar arquivo: {0} +deleteHome=\u00a77Casa {0} foi removida. +deleteJail=\u00a77prisao {0} foi removida. +deleteWarp=\u00a77Warp {0} foi removido. +deniedAccessCommand={0} Acesso negado ao comando. +dependancyDownloaded=[Essentials] Dependencia {0} baixada com sucesso. +dependancyException=[Essentials] Ocorreu um erro ao tentar baixar uma dependencia +dependancyNotFound=[Essentials] Uma dependencia necess\u00e1ria nao foi encontrada. Baixando agora. +depth=\u00a77Voc\u00ea esta no nivel do mar. +depthAboveSea=\u00a77Voc\u00ea esta a {0} bloco(s) acima do nivel do mar. +depthBelowSea=\u00a77Voc\u00ea esta a {0} bloco(s) abaixo do nivel do mar. +destinationNotSet=Destino nao definido. +disableUnlimited=\u00a77Desativada itens ilimitados de {0} para {1}. +disabled=desativado +disabledToSpawnMob=Desovar este mob esta desativado nas configura\u00e7\u00f5es. +dontMoveMessage=\u00a77Teleporte vai come\u00e7ar em {0}. Nao se mova. +downloadingGeoIp=Baixando GeoIP database ... pode demorar um pouco (Pais: 0.6 MB, Cidade: 20MB) +duplicatedUserdata=Dado de usu\u00e1rio duplicado: {0} e {1} +durability=\u00a77This tool has \u00a7c{0}\u00a77 uses left +enableUnlimited=\u00a77Colocando quantidade ilimitada de {0} para {1}. +enabled=ativado +enchantmentApplied = \u00a77O encantamento {0} foi aplicado ao item na sua mao. +enchantmentNotFound = \u00a7cEncantamento nao encontrado. +enchantmentPerm = \u00a7cVoc\u00ea nao tem permissao para {0} +enchantmentRemoved = \u00a77O encantamento {0} foi removido do item na sua mao. +enchantments = \u00a77Encantamentos: {0} +errorCallingCommand=Erro no comando /{0} +errorWithMessage=\u00a7cErro: {0} +essentialsHelp1=O arquivo esta quebrado e o essentials nao consegue abrilo. Essentials esta desativado agora. Se voc\u00ea nao consegue arrumar o arquivo, va para http://tiny.cc/EssentialsChat +essentialsHelp2=O arquivo esta quebrado e o essentials nao consegue abrilo. Essentials esta desativado agora. Se voc\u00ea nao consegue arrumar o arquivo, tente digitar /essentialshelp no jogo ou va para http://tiny.cc/EssentialsChat +essentialsReload=\u00a77Essentials recarregado {0} +exp=\u00a7c{0} \u00a77has\u00a7c {1} \u00a77exp (level\u00a7c {2}\u00a77) and needs\u00a7c {3} \u00a77more exp to level up. +expSet=\u00a7c{0} \u00a77now has\u00a7c {1} \u00a77exp. +extinguish=\u00a77Voce se extinguiu. +extinguishOthers=\u00a77Voce foi extinguido {0}. +failedToCloseConfig=Falha em fechar o arquivo de configura\u00e7ao {0} +failedToCreateConfig=Falha em criar o arquivo de configura\u00e7ao {0} +failedToWriteConfig=Falha em escrever no arquivo de configura\u00e7ao {0} +false=\u00a74false\u00a7f +feed=\u00a77Seu apetite foi saciado. +feedOther=\u00a77Satisfeito {0}. +fileRenameError=Falha ao renomear o arquivo {0}. +flyMode=\u00a77Definir o modo de voar {0} para {1}. +flying=flying +foreverAlone=\u00a7cVoc\u00ea nao tem ninguem a quem responder. +freedMemory=Livre {0} MB. +gameMode=\u00a77Gamemode {0} definido para {1}. +gcchunks= chunks, +gcentities= entidades +gcfree=Memoria livre: {0} MB +gcmax=Mem\u00f3ria Maxima: {0} MB +gctotal=Mem\u00f3ria alocada: {0} MB +geoIpUrlEmpty=GeoIP url de download esta vazia. +geoIpUrlInvalid=GeoIP url de download e invalida. +geoipJoinFormat=Jogador {0} veio do {1} +godDisabledFor=desativado para {0} +godEnabledFor=ativado para {0} +godMode=\u00a77Modo Deus {0}. +hatArmor=\u00a7cDe erro, voce nao pode usar este item como um chapeu! +hatEmpty=\u00a7cYou are not wearing a hat. +hatFail=\u00a7cVoce deve ter algo para vestir na sua mao. +hatPlaced=\u00a7eAproveite o seu novo chapeu! +haveBeenReleased=\u00a77Voc\u00ea foi liberado. +heal=\u00a77Voc\u00ea foi curado. +healOther=\u00a77Curado {0}. +helpConsole=Para ver ajuda do console, digite ?. +helpFrom=\u00a77Comandos a partir de {0}: +helpLine=\u00a76/{0}\u00a7f: {1} +helpMatching=\u00a77Comandos correspondentes "{0}": +helpOp=\u00a7c[HelpOp]\u00a7f \u00a77{0}:\u00a7f {1} +helpPages=P\u00e1gina \u00a7c{0}\u00a7f of \u00a7c{1}\u00a7f: +helpPlugin=\u00a74{0}\u00a7f: Ajuda Plugin: /help {1} +holeInFloor=Buraco no chao +homeSet=\u00a77Casa definida. +homeSetToBed=\u00a77Sua casa agora esta definida a esta cama. +homes=Casa: {0} +hour=hora +hours=horas +ignorePlayer=Voc\u00ea esta ignorando o jogador {0} agora. +illegalDate=Formato de data \u00edlegal. +infoChapter=Selecione o cap\u00edtulo: +infoChapterPages=Cap\u00edtulo {0}, pagina \u00a7c{1}\u00a7f de \u00a7c{2}\u00a7f: +infoFileDoesNotExist=Arquivo info.txt nao existe. Criando um para voc\u00ea. +infoPages=\u00a7e ---- \u00a76{2} \u00a7e--\u00a76 Page \u00a74{0}\u00a76/\u00a74{1} \u00a7e---- +infoUnknownChapter=Cap\u00edtulo desconhecido. +invBigger=O invent\u00e1rio do outro usu\u00e1rio e maior que o seu. +invRestored=Seu invent\u00e1rio foi restaurado. +invSee=Voc\u00ea v\u00ea o invent\u00e1rio de {0}. +invSeeHelp=Use /invsee para voltar ao seu invent\u00e1rio. +invalidCharge=\u00a7cCarga invalida. +invalidHome=Home {0} nao existe +invalidMob=Tipo de mob inv\u00e1lido. +invalidServer=Servidor inv\u00e1lido! +invalidSignLine=Linha {0} da placa e inv\u00e1lida. +invalidWorld=\u00a7cMundo inv\u00e1lido. +inventoryCleared=\u00a77Invent\u00e1rio limpo. +inventoryClearedOthers=\u00a77Invent\u00e1rio de \u00a7c{0}\u00a77 limpo. +is=\u00e9 +itemCannotBeSold=Este item nao pode ser vendido para o servidor. +itemMustBeStacked=O item deve ser negociado em pacotes. A qantidade de 2s seria dois pacotes, etc. +itemNotEnough1=\u00a7cVoc\u00ea nao tem esta quantidade de itens para vender. +itemNotEnough2=\u00a77Se voc\u00ea quer vender todos os itens deste tipo, use /sell NomeDoItem +itemNotEnough3=\u00a77/sell NomeDoItem -1 vai vender tudo mais um item, etc. +itemSellAir=Voc\u00ea realmente tentou vender ar? Coloque um item na sua mao. +itemSold=\u00a77Vendido para \u00a7c{0} \u00a77({1} {2} a {3} cada) +itemSoldConsole={0} vendido {1} para \u00a77{2} \u00a77({3} itens a {4} cada) +itemSpawn=\u00a77Dando {0} de {1} +itemsCsvNotLoaded=nao foi poss\u00edvel carregar items.csv. +jailAlreadyIncarcerated=\u00a7cEsta pessoa j\u00e1 esta na cadeia: {0} +jailMessage=\u00a7cVoc\u00ea faz o crime, voc\u00ea cumpre a pena. +jailNotExist=esta cadeia nao existe. +jailReleased=\u00a77Player \u00a7e{0}\u00a77 libertado. +jailReleasedPlayerNotify=\u00a77Voc\u00ea foi solto! +jailSentenceExtended=Tempo de prisao estendido para: {0) +jailSet=\u00a77Cela {0} foi definida +jumpError=Isso prejudica o c\u00e9rebro do seu computador. +kickDefault=Kickado do servidor. +kickExempt=\u00a7cVoc\u00ea nao pode kickar esta pessoa. +kickedAll=\u00a7cKicked all players from server +kill=\u00a77Assassinado {0}. +kitError2=\u00a7cEsse kit nao existe ou foi definido impropiamente. +kitError=\u00a7cNao existe kits v\u00e1lidos. +kitErrorHelp=\u00a7cTalvez um item esta faltando a quantidade nas configura\u00e7\u00f5es? +kitGive=\u00a77Dando kit {0}. +kitInvFull=\u00a7cSeu invent\u00e1rio esta cheio, colocando kit no chao +kitTimed=\u00a7cVoc\u00ea nao pode usar este kit denovo por {0}. +kits=\u00a77Kits: {0} +lightningSmited=\u00a77YVoc\u00ea acaba de ser castigado +lightningUse=\u00a77Castigando {0} +listAfkTag = \u00a77[Ausente]\u00a7f +listAmount = \u00a79Aqui tem \u00a7c{0}\u00a79 do m\u00e1ximo de \u00a7c{1}\u00a79 jogadores online. +listAmountHidden = \u00a79Aqui tem \u00a7c{0}\u00a77/{1}\u00a79 do maximo de \u00a7c{2}\u00a79 jogadores online. +listGroupTag={0}\u00a7f: +listHiddenTag = \u00a77[ESCONDIDO]\u00a7f +loadWarpError=Falha ao carregar warp {0} +localFormat=Local: <{0}> {1} +mailClear=\u00a7cPara marcar seu email como lido, use /mail clear +mailCleared=\u00a77eMail limpo! +mailSent=\u00a77eMail enviado! +markMailAsRead=\u00a7cPara marcar seu email como lido, use /mail clear +markedAsAway=\u00a77[AFK] Agora voc\u00ea esta marcado como aus\u00eante. +markedAsNotAway=\u00a77[AFK] Voc\u00ea nao esta mais marcado como aus\u00eante. +maxHomes=Voc\u00ea nao pode definir mais de {0} casas. +mayNotJail=\u00a7cVoc\u00ea nao pode prender esta pessoa +me=eu +minute=minuto +minutes=minutos +missingItems=Voc\u00ea nao tem {0}x {1}. +missingPrefixSuffix=Faltando um prefixo ou sufixo para {0} +mobSpawnError=Erro ao mudar o mob spawner. +mobSpawnLimit=Quantidade de mob limitada pelo servidor +mobSpawnTarget=Bloco de destino deve ser um mob spawner. +mobsAvailable=\u00a77Mobs: {0} +moneyRecievedFrom=\u00a7a{0} foi recebido de {1} +moneySentTo=\u00a7a{0} foi enviado para {1} +moneyTaken={0} tirado da sua conta. +month=m\u00eas +months=meses +moreThanZero=Quantidade deve ser maior que 0. +msgFormat=\u00a77[{0}\u00a77 -> {1}\u00a77] \u00a7f{2} +muteExempt=\u00a7cVoc\u00ea nao pode mutar este jogador. +mutedPlayer=Player {0} mutado. +mutedPlayerFor=Player {0} mutado por {1}. +mutedUserSpeaks={0} tentou falar, mas esta mutado. +nearbyPlayers=Jogadores por perto: {0} +negativeBalanceError=Nao \u00e9 permitido ter um saldo negativo. +nickChanged=Apelido modificado. +nickDisplayName=\u00a77Voc\u00ea deve ativar change-displayname nas configura\u00e7\u00f5es do Essentials. +nickInUse=\u00a7cEste nome j\u00e1 esta em uso. +nickNamesAlpha=\u00a7cApelidos devem ser alfanumericos. +nickNoMore=\u00a77Voc\u00ea nao tem mais um apelido. +nickOthersPermission=\u00a7cVoc\u00ea nao tem permissao para mudar o apelido dos outros. +nickSet=\u00a77Agora seu apelido \u00e9 \u00a7c{0} +noAccessCommand=\u00a7cVoc\u00ea nao tem acesso a este comando. +noAccessPermission=\u00a7cVoc\u00ea nao tem permissao para acessar isso {0}. +noBreakBedrock=Voce nao tem permissao para destruir bedrock. +noDestroyPermission=\u00a7cVoc\u00ea nao tem permissao para destruir isso {0}. +noDurability=\u00a7cThis item does not have a durability. +noGodWorldWarning=\u00a7cAviso! Modo Deus neste mundo esta desativado. +noHelpFound=\u00a7cNenhum comando correspondente. +noHomeSet=Voc\u00ea nao definiu nenhuma casa. +noHomeSetPlayer=Jogador nao definiu nenhuma casa. +noKitPermission=\u00a7cVoc\u00ea precisa da permissao \u00a7c{0}\u00a7c para usar este kit. +noKits=\u00a77Ainda nao tem nenhum item disponivel +noMail=Voc\u00ea nao tem nenhum email +noMotd=\u00a7cNao h\u00e1 nenhuma mensagem do dia. +noNewMail=\u00a77Voc\u00ea nao tem nenhum novo email. +noPendingRequest=Voc\u00ea nao tem um pedido pendente. +noPerm=\u00a7cVoc\u00ea nao tem a permissao \u00a7f{0}\u00a7c. +noPermToSpawnMob=\u00a7cVoc\u00ea nao tem permissao para desovar este mob. +noPlacePermission=\u00a7cVoc\u00ea nao tem permissao de por um bloco perto daquela placa. +noPowerTools=Voc\u00ea nao tem nenhuma super ferramenta definida. +noRules=\u00a7cAinda nao foi definida as regras. +noWarpsDefined=Nenhum warp definido +none=nenhum +notAllowedToQuestion=\u00a7cVoc\u00ea nao esta autorizado a usar pergunta. +notAllowedToShout=\u00a7cVoc\u00ea nao esta autorizado a gritar. +notEnoughExperience=Voc\u00ea nao tem experiencia suficiente. +notEnoughMoney=Voc\u00ea nao tem dinheiro suficiente. +notFlying=not flying +notRecommendedBukkit=* ! * Versao do bukkit nao \u00e9 a recomendada para o essentials. +notSupportedYet=Ainda nao suportado. +nothingInHand = \u00a7cVoc\u00ea nao tem nada em sua mao. +now=agora +nuke=Pode chover a morte sobre eles +numberRequired=Um numero vai aqui, bobinho. +onlyDayNight=/time apenas suporta day/night. +onlyPlayers=Apenas jogadores no jogo pode usar {0}. +onlySunStorm=/weather apenas suporta sun/storm. +orderBalances=Ordenando saldos de {0} usuarios, aguarde ... +pTimeCurrent=\u00a7e{0}''s\u00a7f horario e {1}. +pTimeCurrentFixed=\u00a7e{0}''s\u00a7f hor\u00e1rio foi fixado para {1}. +pTimeNormal=\u00a7e{0}''s\u00a7f o tempo esta normal e sincronisado com o servidor. +pTimeOthersPermission=\u00a7cVoc\u00ea nao esta autorisado para definir o tempo dos outros jogadores. +pTimePlayers=Estes jogadores tem seus propios hor\u00e1rios: +pTimeReset=Hor\u00e1rio do jogador foi recetado para: \u00a7e{0} +pTimeSet=Hor\u00e1rio do jogador foi definido para \u00a73{0}\u00a7f por: \u00a7e{1} +pTimeSetFixed=Hor\u00e1rio do jogador foi fixado para \u00a73{0}\u00a7f por: \u00a7e{1} +parseError=Analise de erro {0} na linha {1} +pendingTeleportCancelled=\u00a7cPedido de teleporte pendente cancelado. +permissionsError=Faltando Permissions/GroupManager; chat prefixos/sufixos serao desativados. +playerBanned=\u00a7cJogador {0} banido {1} por {2} +playerInJail=\u00a7cJogador j\u00e1 esta na cadeia {0}. +playerJailed=\u00a77Jogador {0} preso. +playerJailedFor= \u00a77Player {0} condenado por {1}. +playerKicked=\u00a7cPlayer {0} kickado {1} por {2} +playerMuted=\u00a77Voce foi desmutado +playerMutedFor=\u00a77Voce foi mutado por {0} +playerNeverOnServer=\u00a7cJogador {0} nunca esteve no servidor. +playerNotFound=\u00a7cJogador nao encontrado. +playerUnmuted=\u00a77Foi desmutado +pong=Pong! +possibleWorlds=\u00a77Mundos poss\u00edveis sao 0 at\u00e9 {0}. +powerToolAir=Comando nao pode ser definido para o ar. +powerToolAlreadySet=Comando \u00a7c{0}\u00a7f j\u00e1 esta definido para {1}. +powerToolAttach=\u00a7c{0}\u00a7f comando definido para {1}. +powerToolClearAll=Todas superferramentas foram limpas. +powerToolList={1} tem os seguintes comandos: \u00a7c{0}\u00a7f. +powerToolListEmpty={0} nenhum comando definido. +powerToolNoSuchCommandAssigned=Comando \u00a7c{0}\u00a7f nao foi definido para {1}. +powerToolRemove=Comando \u00a7c{0}\u00a7f removido do {1}. +powerToolRemoveAll=Todos comandos removidos do {0}. +powerToolsDisabled=Todas suas super ferramentas foram habilitadas. +powerToolsEnabled=Todas suas super ferramentas foram desabilitadas. +protectionOwner=\u00a76[EssentialsProtect] Dono da prote\u00e7ao: {0} +questionFormat=\u00a77[Pergunta]\u00a7f {0} +readNextPage=Digite /{0} {1} para ler a pr\u00f3xima p\u00e1gina +reloadAllPlugins=\u00a77Todos plugins recarregados. +removed=\u00a77Removido {0} entidades. +repair=Voc\u00ea reparou com sucesso sua: \u00a7e{0}. +repairAlreadyFixed=\u00a77Esse item nao precisa ser reparado. +repairEnchanted=\u00a77Voc\u00ea nao pode reparar itens encantados. +repairInvalidType=\u00a7cEsse item nao pode ser reparado. +repairNone=Nao ha itens que precisam ser reparados. +requestAccepted=\u00a77Pedido de teleporte aceito. +requestAcceptedFrom=\u00a77{0} aceitou seu pedido de teleporte. +requestDenied=\u00a77Pedido de teleporte recusado. +requestDeniedFrom=\u00a77{0} recusou seu pedido de teleporte +requestSent=\u00a77Pedindo enviado para {0}\u00a77. +requestTimedOut=\u00a7cPedido de teleporte passou o limite de tempo +requiredBukkit=* ! * Voc\u00ea precisa da ultima build {0} do CraftBukkit, baixa ela em http://dl.bukkit.org/downloads/craftbukkit/ +returnPlayerToJailError=Erro ocorreu ao tentar retornar jogador {0} para a cadeia: {1} +second=segundo +seconds=segundos +seenOffline=Jogador {0} esta offline desde {1} +seenOnline=Jogador {0} esta online desde {1} +serverFull=O servidor esta cheio +serverTotal=Server Total: {0} +setSpawner=Spawner modificado para {0} +sheepMalformedColor=Cor malformada. +shoutFormat=\u00a77[GRITAR]\u00a7f {0} +signFormatFail=\u00a74[{0}] +signFormatSuccess=\u00a71[{0}] +signFormatTemplate=[{0}] +signProtectInvalidLocation=\u00a74Voc\u00ea nao pode criar placas aqui. +similarWarpExist=Um warp com um nome parecido j\u00e1 existe. +slimeMalformedSize=Tamanho malformado. +soloMob=Este mob gosta de ficar sozinho +spawnSet=\u00a77Ponto de spawn definido para o grupo {0}. +spawned=desovado +sudoExempt=voce nao pode sudo este usuario +sudoRun=Forcing {0} to run: /{1} {2} +suicideMessage=\u00a77Adeus mundo cruel... +suicideSuccess= \u00a77{0} tirou sua propia vida +survival=survival +takenFromAccount=\u00a7c{0} foi tirado da sua conta. +takenFromOthersAccount=\u00a7c{0} tirado de {1}\u00a7c conta. Novo saldo: {2} +teleportAAll=\u00a77Pedido de teleporte enviado a todos os jogadores... +teleportAll=\u00a77Teleportando todos os jogadores... +teleportAtoB=\u00a77{0}\u00a77 teleportou voc\u00ea para {1}\u00a77. +teleportDisabled={0} tem o teleporte desativado. +teleportHereRequest=\u00a7c{0}\u00a7c solicitou que voc\u00ea se teleporte para ele. +teleportNewPlayerError=Falha para teleportar novo jogador +teleportRequest=\u00a7c{0}\u00a7c solicitou para se teleportar at\u00e9 voc\u00ea. +teleportRequestTimeoutInfo=\u00a77Este pedido vai acabar em {0} segundos. +teleportTop=\u00a77Teleportando para o alto. +teleportationCommencing=\u00a77Iniciando teleporte... +teleportationDisabled=\u00a77Teleporte desativado. +teleportationEnabled=\u00a77Teleporte ativado. +teleporting=\u00a77Teleportando... +teleportingPortal=\u00a77Teleportando via portal. +tempBanned=Banido temporariamente do servidor por {0} +tempbanExempt=\u00a77Voc\u00ea nao pode banir este jogador temporariamente +thunder= Voc\u00ea {0} trovejou no seu mundo +thunderDuration=Voc\u00ea {0} trovejou no seu mundo por {1} segundos. +timeBeforeHeal=Tempo at\u00e9 a proxima cura: {0} +timeBeforeTeleport=Tempo antes do proximo teleporte: {0} +timeFormat=\u00a73{0}\u00a7f or \u00a73{1}\u00a7f or \u00a73{2}\u00a7f +timePattern=(?:([0-9]+)\\s*y[a-z]*[,\\s]*)?(?:([0-9]+)\\s*mo[a-z]*[,\\s]*)?(?:([0-9]+)\\s*w[a-z]*[,\\s]*)?(?:([0-9]+)\\s*d[a-z]*[,\\s]*)?(?:([0-9]+)\\s*h[a-z]*[,\\s]*)?(?:([0-9]+)\\s*m[a-z]*[,\\s]*)?(?:([0-9]+)\\s*(?:s[a-z]*)?)? +timeSet=Horario definido em todos os mundos. +timeSetPermission=\u00a7cVoc\u00ea nao tem autoriza\u00e7ao para modificar o hor\u00e1rio. +timeWorldCurrent=O hor\u00e1rio atual no mundo {0} e \u00a73{1} +timeWorldSet=O hor\u00e1rio foi definido para {0} no: \u00a7c{1} +tps=Current TPS = {0} +tradeCompleted=\u00a77Compra concluida. +tradeSignEmpty=A placa de troca nao tem abastecimento suficiente. +tradeSignEmptyOwner=Nao a nada para recolher desta placa de compra. +treeFailure=\u00a7cFalha ao gerar \u00e1rvore. Tente denovo na terra ou grama. +treeSpawned=\u00a77\u00c1rvore gerada. +true=\u00a72true\u00a7f +typeTpaccept=\u00a77Para aceitar o teleporte, digite \u00a7c/tpaccept\u00a77. +typeTpdeny=\u00a77Para recusar o teleporte, digite \u00a7c/tpdeny\u00a77. +typeWorldName=\u00a77Voc\u00ea tambem pode digitar o nome do mundo. +unableToSpawnMob=Incapaz de gerar o mob. +unbannedIP=Endereco de IP desbanido. +unbannedPlayer=Jogador desbanido. +unignorePlayer=Agora voc\u00ea nao esta mais ignorando o {0}. +unknownItemId=ID do item desconhecido: {0} +unknownItemInList=Item desconhecido {0} em {1} lista. +unknownItemName=Nome do item desconhecido: {0} +unlimitedItemPermission=\u00a7cSem permissao para item ilimitado {0}. +unlimitedItems=Item ilimitado: +unmutedPlayer=Jogador {0} desmutado. +unvanished=\u00a7aEsta mais uma vez visivel. +unvanishedReload=\u00a7cA recarga foi forcado a se tornar visivel. +upgradingFilesError=Erro ao aprimorar os arquivos +userDoesNotExist=O usu\u00e1rio {0} nao existe. +userIsAway=[AFK]: {0} esta aus\u00eante. +userIsNotAway=[AFK]: {0} nao esta mais aus\u00eante. +userJailed=\u00a77Voc\u00ea foi preso, muaha! +userUsedPortal={0} usou um portal de saida existente. +userdataMoveBackError=Falha ao mover userdata/{0}.tmp para userdata/{1} +userdataMoveError=Falha ao mover userdata/{0} para userdata/{1}.tmp +usingTempFolderForTesting=Usando pasta temporaria para teste: +vanished=\u00a7aVoce agora desapareceu. +versionMismatch=Versao incompativel! Atualise o {0} para mesma versao. +versionMismatchAll=Versao imcompativel! Atualise todos os essentials jars para mesma versao. +voiceSilenced=\u00a77Sua voz foi silenciada +warpDeleteError=Problema ao deletar o arquivo warp. +warpListPermission=\u00a7cVoc\u00ea nao tem permissao para listar os warps. +warpNotExist=Este warp nao existe. +warpOverwrite=\u00a7cVoce nao pode substituir essa warp. +warpSet=\u00a77Warp {0} definido. +warpUsePermission=\u00a7cVoc\u00ea nao tem permissao para usar este warp. +warpingTo=\u00a77Warping para {0}. +warps=Warps: {0} +warpsCount=\u00a77Aqui tem {0} warps. Exibindo p\u00e1gina {1} de {2}. +weatherStorm=\u00a77Voc\u00ea modificou o tempo para chuva em {0} +weatherStormFor=\u00a77Voc\u00ea modificou o tempo para chuva em {0} por {1} segundos +weatherSun=\u00a77Voc\u00ea modificou o tempo para sol em {0} +weatherSunFor=\u00a77Voc\u00ea modificou o tempo para sol em {0} por {1} segundos +whoisAFK=\u00a76 - AFK:\u00a7f {0} +whoisBanned=\u00a76 - Banido:\u00a7f {0} +whoisExp=\u00a76 - Exp:\u00a7f {0} (Level {1}) +whoisFly=\u00a76 - Fly modo:\u00a7f {0} ({1}) +whoisGamemode=\u00a76 - Modo de Jogo:\u00a7f {0} +whoisGeoLocation=\u00a76 - Localizacao:\u00a7f {0} +whoisGod=\u00a76 - Modo Deus:\u00a7f {0} +whoisHealth=\u00a76 - Saude:\u00a7f {0}/20 +whoisIPAddress=\u00a76 - IP:\u00a7f {0} +whoisJail=\u00a76 - Prisao:\u00a7f {0} +whoisLocation=\u00a76 - Localiza\u00e7ao:\u00a7f ({0}, {1}, {2}, {3}) +whoisMoney=\u00a76 - Dinheiro:\u00a7f {0} +whoisMuted=\u00a76 - Silenciado:\u00a7f {0} +whoisNick=\u00a76 - Apelido:\u00a7f {0} +whoisOp=\u00a76 - OP:\u00a7f {0} +whoisTop=\u00a76 ====== WhoIs:\u00a7f {0} \u00a76====== +worth=\u00a77Pilha de {0} vale \u00a7c{1}\u00a77 ({2} item(s) a {3} cada) +worthMeta=\u00a77Pilha de {0} com metadados de {1} vale \u00a7c{2}\u00a77 ({3} item(s) a {4} cada) +worthSet=Definir quanto vale +year=ano +years=anos +youAreHealed=\u00a77Voc\u00ea foi curado. +youHaveNewMail=\u00a7cVoc\u00ea tem {0} mensagens!\u00a7f Digite \u00a77/mail read\u00a7f para ver seu email. +hatRemoved=\u00a7eYour hat has been removed. +banFormat=Banned: {0} diff --git a/Essentials/src/messages_se.properties b/Essentials/src/messages_se.properties new file mode 100644 index 000000000..71d411858 --- /dev/null +++ b/Essentials/src/messages_se.properties @@ -0,0 +1,436 @@ +#version: ${build.number} +# Single quotes have to be doubled: '' +# Translations start here +# by: oggehej, corrected by NeonMaster. +action=* {0} {1} +addedToAccount=\u00a7a{0} har blivit tillagt pรฅ ditt konto. +addedToOthersAccount=\u00a7a{0} har blivit tillagt pรฅ {1}\u00a7a konto. Ny balans: {2} +alertBroke=gjorde sรถnder: +alertFormat=\u00a73[{0}] \u00a7f {1} \u00a76 {2} at: {3} +alertPlaced=placerade: +alertUsed=anvรคnde: +autoAfkKickReason=Du har blivit utsparkad fรถr att ha varit inaktiv i mer รคn {0} minuter. +backAfterDeath=\u00a77Anvรคnd /back kommandot fรถr att komma tillbaka till din dรถdsplats. +backUsageMsg=\u00a77Tar dig tillbaka till din fรถregรฅende position. +backupDisabled=Ett externt backup-skript har inte blivit konfigurerat. +backupFinished=Backup klar +backupStarted=Backup startad +balance=\u00a77Balans: {0} +balanceTop=\u00a77Topp balans ({0}) +banExempt=\u00a7cDu kan inte banna den spelaren. +banIpAddress=\u00a77Bannade IP-adress +bannedIpsFileError=Kunde inte lรคsa banned-ips.txt +bannedIpsFileNotFound=banned-ips.txt hittades inte +bannedPlayersFileError=Kunde inte lรคsa banned-players.txt +bannedPlayersFileNotFound=banned-players.txt hittades inte +bigTreeFailure=\u00a7cEtt stort trรคd kunde inte genereras misslyckades. Fรถsรถk igen pรฅ grรคs eller jord. +bigTreeSuccess= \u00a77Stort trรคd genererat. +blockList=Essentials vidarebefordrade fรถljande kommandon till ett annat insticksprogram: +broadcast=[\u00a7cUtsรคndning\u00a7f]\u00a7a {0} +buildAlert=\u00a7cDu har inte tillรฅtelse att bygga +bukkitFormatChanged=Bukkit versionsformat bytt. Version รคr inte kollad. +burnMsg=\u00a77Du satte eld pรฅ {0} i {1} sekunder. +canTalkAgain=\u00a77Du kan nu prata igen! +cantFindGeoIpDB=Kunde inte hitta GeoIP-databasen! +cantReadGeoIpDB=Kunde inte lรคsa innehรฅll frรฅn GeoIP-databasen! +cantSpawnItem=\u00a7cDu har inte behรถrighet att spawna {0} +chatTypeLocal=[L] +chatTypeSpy=[Spy] +commandFailed=Kommando {0} misslyckades: +commandHelpFailedForPlugin=Kunde inte hitta hjรคlp fรถr: {0} +commandNotLoaded=\u00a7cKommando {0} รคr felaktigt laddat. +compassBearing=\u00a77Bรคring: {0} ({1} grader). +configFileMoveError=Kunde inte flytta config.yml till backup-platsen. +configFileRenameError=Kunde inte byta namn pรฅ temp-filen till config.yml +connectedPlayers=Anslutna spelare: +connectionFailed=Kunde inte รถppna anslutning. +cooldownWithMessage=\u00a7cNedkylning: {0} +corruptNodeInConfig=\u00a74Notice: Din konfigurationsfil har en korrupt {0} nod. +couldNotFindTemplate=Kunde inte hitta mallen {0} +creatingConfigFromTemplate=Skapar konfiguration frรฅn mallen: {0} +creatingEmptyConfig=Skapar tom konfiguration: {0} +creative=kreativ +currency={0}{1} +currentWorld=Nuvarande vรคrld: {0} +day=dag +days=dagar +defaultBanReason=Banhammaren har talat! +deleteFileError=Kunde inte radera filen: {0} +deleteHome=\u00a77Hemmet {0} har tagits bort. +deleteJail=\u00a77Fรคngelset {0} har tagits bort. +deleteWarp=\u00a77Warpen {0} har tagits bort. +deniedAccessCommand={0} nekades รฅtkomst till kommandot. +dependancyDownloaded=[Essentials] Beroende {0} laddades ner framgรฅngsrikt. +dependancyException=[Essentials] Ett fel uppstod nรคr ett beroende laddades ner. +dependancyNotFound=[Essentials] Ett nรถdvรคndigt beroende hittades inte, laddar ner nu. +depth=\u00a77Du รคr pรฅ havsnivรฅn. +depthAboveSea=\u00a77Du รคr {0} block ovanfรถr havsniรฅn. +depthBelowSea=\u00a77Du รคr {0} block under havsnivรฅn. +destinationNotSet=Ingen destination รคr instรคlld. +disableUnlimited=\u00a77Inaktiverade oรคndligt placerande av {0} fรถr {1}. +disabled=inaktiverad +disabledToSpawnMob=Att spawna fram den hรคr moben รคr inaktiverat i configurationsfilen. +dontMoveMessage=\u00a77Teleporteringen pรฅbรถrjas om {0}. Rรถr dig inte. +downloadingGeoIp=Laddar ner GeoIP-databasen... det hรคr kan ta en stund (land: 0.6 MB, stad: 20MB) +duplicatedUserdata=Dublicerad anvรคndardata: {0} och {1} +durability=\u00a77Det hรคr verktyget har \u00a7c{0}\u00a77 anvรคndningar kvar +enableUnlimited=\u00a77Ger oรคndligt av {0} till {1}. +enabled=aktiverad +enchantmentApplied = \u00a77Fรถrtrollningen {0} har blivit tillรคmpad pรฅ saken du har i handen. +enchantmentNotFound = \u00a7cFรถrtrollningen hittades inte +enchantmentPerm = \u00a7cDu har inte behรถrighet att {0} +enchantmentRemoved = \u00a77Fรถrtrollningen {0} har tagits bort frรฅn saken i din hand. +enchantments = \u00a77Fรถrtrollningar: {0} +errorCallingCommand=Kunde inte kontakta kommandot /{0} +errorWithMessage=\u00a7cFel: {0} +essentialsHelp1=Filen รคr trasig och Essentials kan inte รถppna den. Essentials รคr nu inaktiverat. Om du inte kan fixa problemet sjรคlv, gรฅ till http://tiny.cc/EssentialsChat +essentialsHelp2=Filen รคr trasig och Essentials kan inte รถppna den. Essentials รคr nu inaktiverat. Om du inte kan fixa problemet sjรคlv, skriv /essentialshelp i spelet eller gรฅ till http://tiny.cc/EssentialsChat +essentialsReload=\u00a77Essentials Omladdat {0} +exp=\u00a7c{0} \u00a77har\u00a7c {1} \u00a77exp (level\u00a7c {2}\u00a77) och behรถver\u00a7c {3} \u00a77mer erfarenhet fรถr att gรฅ upp en nivรฅ. +expSet=\u00a7c{0} \u00a77har nu\u00a7c {1} \u00a77erfarenhet. +extinguish=\u00a77Du slรคckte dig sjรคlv. +extinguishOthers=\u00a77Du slรคckte {0}. +failedToCloseConfig=Kunde inte stรคnga konfiguration {0} +failedToCreateConfig=Kunde inte skapa konfiguration {0} +failedToWriteConfig=Kunde inte skriva konfiguration {0} +false=falskt +feed=\u00a77Din hunger รคr mรคttad. +feedOther=\u00a77Matade {0}. +fileRenameError=Namnbytet av filen {0} misslyckades +flyMode=\u00a77Aktiverade flyglรคge {0} fรถr {1}. +foreverAlone=\u00a7cDu har ingen att svara. +freedMemory=Befriade {0} MB. +gameMode=\u00a77Satte {0}s spellรคge till {1}. +gcchunks= bitar, +gcentities= enheter +gcfree=Ledigt minne: {0} MB +gcmax=Maximalt minne: {0} MB +gctotal=Tilldelat minne: {0} MB +geoIpUrlEmpty=Nerladdningsadressen fรถr GeoIP รคr tom. +geoIpUrlInvalid=Nerladdningsadressen fรถr GeoIP รคr ogiltig. +geoipJoinFormat=Spelaren {0} kommer frรฅn {1} +godDisabledFor=inaktiverat fรถr {0} +godEnabledFor=aktiverat fรถr {0} +godMode=\u00a77Odรถdlighet {0}. +hatArmor=\u00a7cFel, du kan inte anvรคnda den hรคr saken som en hatt! +hatFail=\u00a7cDu mรฅste ha nรฅgonting att bรคra i din hand. +hatPlaced=\u00a7eNjut av din nya hatt! +haveBeenReleased=\u00a77Du har blivit friad +heal=\u00a77Du har blivit lรคkt. +healOther=\u00a77Lรคkte {0}. +helpConsole=Fรถr att visa hjรคlp frรฅn konsolen, skriv ?. +helpFrom=\u00a77Kommandon frรฅn {0}: +helpLine=\u00a76/{0}\u00a7f: {1} +helpMatching=\u00a77Kommandon matchar "{0}": +helpOp=\u00a7c[OpHjรคlp]\u00a7f \u00a77{0}:\u00a7f {1} +helpPages=Sida \u00a7c{0}\u00a7f av \u00a7c{1}\u00a7f: +helpPlugin=\u00a74{0}\u00a7f: Hjรคlp fรถr insticksprogram: /help {1} +holeInFloor=Hรฅl i golvet +homeSet=\u00a77Hem instรคllt. +homeSetToBed=\u00a77Ditt hem รคr nu instรคllt till den hรคr sรคngen. +homes=Hem: {0} +hour=timme +hours=timmar +ignorePlayer=Du ignorerar spelaren {0} frรฅn och med nu. +illegalDate=Felaktigt datumformat. +infoChapter=Vรคlj kapitel: +infoChapterPages=Kapitel {0}, sida \u00a7c{1}\u00a7f av \u00a7c{2}\u00a7f: +infoFileDoesNotExist=Filen info.txt finns inte. Skapar en fรถr dig. +infoPages=\u00a7e ---- \u00a76{2} \u00a7e--\u00a76 Sida \u00a74{0}\u00a76/\u00a74{1} \u00a7e---- +infoUnknownChapter=Okรคnt kapitel. +invBigger=De andra anvรคndarnas fรถrrรฅd รคr stรถrre รคn ditt. +invRestored=Ditt fรถrrรฅd har blivit รฅterstรคllt. +invSee=Du ser nu {0}s fรถrrรฅd. +invSeeHelp=Anvรคnd /invsee fรถr att รฅterstรคlla ditt fรถrrรฅd. +invalidCharge=\u00a7cOgiltig laddning. +invalidHome=Hemmet {0} finns inte +invalidMob=Ogiltig monster-typ. +invalidServer=Ogiltig server! +invalidSignLine=Rad {0} pรฅ skylten รคr ogiltig. +invalidWorld=\u00a7cOgiltig vรคrld. +inventoryCleared=\u00a77Fรถrrรฅd rensat. +inventoryClearedOthers=\u00a77Fรถrrรฅdet av \u00a7c{0}\u00a77 รคr rensat. +is=รคr +itemCannotBeSold=Det objektet kan inte sรคljas till servern. +itemMustBeStacked=Objektet mรฅste kรถpas i staplar. En mรคngd av 2s kommer bli 2 staplar, etc. +itemNotEnough1=\u00a7cDu har inte tillrรคckligt av den saken fรถr att sรคlja. +itemNotEnough2=\u00a77Om du ville sรคlja alla block av den typen, anvรคnd /sell blocknamn +itemNotEnough3=\u00a77/sell blocknamn -1 kommer att sรคlja allt av den blocktypen fรถrutom 1 o.s.v. +itemSellAir=Fรถrsรถkte du att sรคlja luft? Sรคtt en sak i din hand. +itemSold=\u00a77Sรฅlde fรถr \u00a7c{0} \u00a77({1} {2} fรถr {3} styck) +itemSoldConsole={0} sรฅlde {1} fรถr \u00a77{2} \u00a77({3} saker fรถr {4} styck) +itemSpawn=\u00a77Ger {0} stycken {1} +itemsCsvNotLoaded=Kunde inte ladda items.csv. +jailAlreadyIncarcerated=\u00a7cPersonen รคr redan i fรคngelse: {0} +jailMessage=\u00a7cBryter du mot reglerna, fรฅr du stรฅ ditt kast. +jailNotExist=Det fรคngelset finns inte. +jailReleased=\u00a77Spelaren \u00a7e{0}\u00a77 รคr frislรคppt. +jailReleasedPlayerNotify=\u00a77Du har blivit frislรคppt! +jailSentenceExtended=Fรคngelsestraffet fรถrlรคngt till: {0) +jailSet=\u00a77Fรคngelset {0} har skapats +jumpError=Det skulle skadat din dators hjรคrna. +kickDefault=Utsparkad frรฅn server +kickExempt=\u00a7cDu kan inte sparka ut den spelaren. +kickedAll=\u00a7cSparkade ut alla spelare frรฅn servern +kill=\u00a77Dรถdade {0}. +kitError2=\u00a7cDet kit:et finns inte eller har blivit felaktigt definierat. +kitError=\u00a7cDet finns inga giltiga kit. +kitErrorHelp=\u00a7cKanske en sak fattar mรคngd i konfigurationen? +kitGive=\u00a77Ger kit {0}. +kitInvFull=\u00a7cDitt Fรถrrรฅd var fullt, placerar kit pรฅ golvet +kitTimed=\u00a7cDu kan inte anvรคnda det kit:et igen pรฅ {0}. +kits=\u00a77Kit: {0} +lightningSmited=\u00a77Blixten har slagit ner pรฅ dig +lightningUse=\u00a77En blixt kommer slรฅ ner pรฅ {0} +listAfkTag = \u00a77[AFK]\u00a7f +listAmount = \u00a79Det รคr \u00a7c{0}\u00a79 av maximalt \u00a7c{1}\u00a79 spelare online. +listAmountHidden = \u00a79Det รคr \u00a7c{0}\u00a77/{1}\u00a79 Av maximalt \u00a7c{2}\u00a79 spelare online. +listGroupTag={0}\u00a7f: +listHiddenTag = \u00a77[GรMD]\u00a7f +loadWarpError=Kunde inte ladda warp {0} +localFormat=Lokal: <{0}> {1} +mailClear=\u00a7cFรถr att markera dina meddelanden som lรคsta, skriv /mail clear +mailCleared=\u00a77Meddelanden rensade! +mailSent=\u00a77Meddelandet skickad! +markMailAsRead=\u00a7cFรถr att markera dina meddelanden som lรคsta, skriv /mail clear +markedAsAway=\u00a77Du รคr nu markerad som borta. +markedAsNotAway=\u00a77Du รคr inte lรคngre markerad som borta. +maxHomes=Du kan inte ha fler รคn {0} hem. +mayNotJail=\u00a7cDu fรฅr inte sรคtta den personen i fรคngelse +me=jag +minute=minut +minutes=minuter +missingItems=Du har inte {0}x {1}. +missingPrefixSuffix=Saknar ett prefix eller suffix fรถr {0} +mobSpawnError=Fel nรคr mob-spawnaren fรถrsรถkte att รคndras. +mobSpawnLimit=Mรคngden mobs begrรคnsad till serverns maxgrรคns +mobSpawnTarget=Mรฅlblocket mรฅste vara en mob-spawnare. +mobsAvailable=\u00a77Mobs: {0} +moneyRecievedFrom=\u00a7a{0} har tagits emot frรฅn {1} +moneySentTo=\u00a7a{0} har skickats till {1} +moneyTaken={0} รคr taget frรฅn ditt bankkonto. +month=mรฅnad +months=mรฅnader +moreThanZero=Mรฅngden mรฅste vara stรถrre รคn 0. +msgFormat=\u00a77[{0}\u00a77 -> {1}\u00a77] \u00a7f{2} +muteExempt=\u00a7cDu kan inte tysta den spelaren. +mutedPlayer=Spelaren {0} รคr tystad. +mutedPlayerFor=Spelaren {0} รคr tystad i {1}. +mutedUserSpeaks={0} fรถrsรถkte att prata, men blev tystad. +nearbyPlayers=Spelare i nรคrheten: {0} +negativeBalanceError=Anvรคndaren รคr inte tillรฅten att ha en negativ balans. +nickChanged=Smeknamn รคndrat. +nickDisplayName=\u00a77Du mรฅste aktivera change-displayname i Essentials-konfigurationen. +nickInUse=\u00a7cDet namnet anvรคnds redan. +nickNamesAlpha=\u00a7cSmeknamn mรฅste vara alfanumeriska. +nickNoMore=\u00a77Du har inte ett smeknamn lรคngre +nickOthersPermission=\u00a7cDu har inte tillstรฅnd att รคndra andras smeknamn +nickSet=\u00a77Ditt smeknamn รคr nu \u00a7c{0} +noAccessCommand=\u00a7cDu har inte tillgรฅng till det kommandot. +noAccessPermission=\u00a7cDu har inte tillstรฅnd till att komma รฅt det {0}. +noBreakBedrock=Du har inte tillรฅtelse att fรถrstรถra berggrund. +noDestroyPermission=\u00a7Du har inte tillรฅtelse att fรถrstรถra det {0}. +noDurability=\u00a7cDen saken har inte en hรฅllbarhet. +noGodWorldWarning=\u00a7cVarning! Odรถdlighet i den hรคr vรคrlden รคr inaktiverat. +noHelpFound=\u00a7cInga matchande kommandon. +noHomeSet=Du har inte angett ett hem. +noHomeSetPlayer=Den hรคr spelaren har inte ett hem. +noKitPermission=\u00a7cDu behรถver \u00a7c{0}\u00a7c tillstรฅnd fรถr att anvรคnda det kitet. +noKits=\u00a77Det finns inga kits tillgรคngliga รคn +noMail=Du har inget meddelande +noMotd=\u00a7cDet finns inget meddelande fรถr dagen. +noNewMail=\u00a77Du har inget nytt meddelande. +noPendingRequest=Du har inga vรคntande fรถrfrรฅgan. +noPerm=\u00a7cDu har inte \u00a7f{0}\u00a7c tillรฅtelse. +noPermToSpawnMob=\u00a7cDu har inte tillรฅtelse att spawna den hรคr moben. +noPlacePermission=\u00a7cDu har inte tillรฅtelse att placera ett block nรคra den skylten. +noPowerTools=Du har inga power-tools tilldelade. +noRules=\u00a7cDet finns inga specifierade regler รคn. +noWarpsDefined=Inga warpar รคr definerade +none=inga +notAllowedToQuestion=\u00a7cDu har inte tillstรฅnd att anvรคnda den frรฅgan. +notAllowedToShout=\u00a7cDu har inte tillstรฅnd att ropa. +notEnoughExperience=Du har inte nog med erfarenhet. +notEnoughMoney=Du har inte tillrรคckligt med pengar. +notRecommendedBukkit= * ! * Bukkit-versionen รคr inte rekommenderad fรถr den hรคr versionen av Essentials. +notSupportedYet=Stรถds inte รคn. +nothingInHand = \u00a7cDu har inget i din hand. +now=nu +nuke=Lรฅt dรถd regna รถver dem +numberRequired=Det ska vara ett nummer dรคr, dumbom. +onlyDayNight=/time stรถder bara day(dag) eller night(natt). +onlyPlayers=Bara spelare som รคr online kan anvรคnda {0}. +onlySunStorm=/weather stรถder bara sun(sol) eller storm(storm). +orderBalances=Bestรคller balanser av {0} anvรคndare, vรคnligen vรคnta... +pTimeCurrent=\u00a7e{0}'*s\u00a7f klockan รคr {1}. +pTimeCurrentFixed=\u00a7e{0}''s\u00a7f tiden รคr fixerad till {1}. +pTimeNormal=\u00a7e{0}''s\u00a7f tiden รคr normal och matchar servern. +pTimeOthersPermission=\u00a7cDu har inte behรถrighet att stรคlla in andra spelares tid. +pTimePlayers=Dessa spelare har sin egen tid: +pTimeReset=Spelarens tid har blivit รฅterstรคlld till: \u00a7e{0} +pTimeSet=Spelarens tid รคr instรคlld till \u00a73{0}\u00a7f till: \u00a7e{1} +pTimeSetFixed=Spelarens tid รคr fixerad till \u00a73{0}\u00a7f fรถr: \u00a7e{1} +parseError=Fel vid tolkning av {0} pรฅ rad {1} +pendingTeleportCancelled=\u00a7cAvvaktande teleporteringsbegรคran รคr avbruten. +permissionsError=Saknar Permissions/GroupManager; chattens prefixer/suffixer kommer vara inaktiverade. +playerBanned=\u00a7cSpelaren {0} bannad {1} fรถr {2} +playerInJail=\u00a7cSpelaren รคr redan i fรคngelse {0}. +playerJailed=\u00a77Spelaren {0} fรคngslad. +playerJailedFor= \u00a77Spelaren {0} fรคngslad fรถr {1}. +playerKicked=\u00a7cSpelaren {0} har sparkat ut {1} fรถr {2} +playerMuted=\u00a77Du har blivit tystad +playerMutedFor=\u00a77Du har blivit tystad fรถr {0} +playerNeverOnServer=\u00a7cSpelaren {0} har aldrig varit pรฅ den hรคr servern. +playerNotFound=\u00a7cSpelaren hittades inte. +playerUnmuted=\u00a77Du kan nu prata +pong=Pong! +possibleWorlds=\u00a77Mรถjliga vรคrdar รคr nummer mellan 0 och {0}. +powerToolAir=Kommandot kan inte tilldelas luft. +powerToolAlreadySet=Kommandot \u00a7c{0}\u00a7f รคr redan tilldelat {1}. +powerToolAttach=\u00a7c{0}\u00a7f kommandot tilldelat {1}. +powerToolClearAll=Alla powertool-kommandon har blivit rensade. +powerToolList={1} har fรถljane kommandon: \u00a7c{0}\u00a7f. +powerToolListEmpty={0} har inga kommandon tilldelade. +powerToolNoSuchCommandAssigned=Kommandot \u00a7c{0}\u00a7f har inte blivit tilldelat {1}. +powerToolRemove=Kommandot \u00a7c{0}\u00a7f รคr borttaget frรฅn {1}. +powerToolRemoveAll=Alla kommandon รคr borttagna frรฅn {0}. +powerToolsDisabled=Alla dina powertools har blivit inaktiverade. +powerToolsEnabled=Alla dina powertools har blivit aktiverade. +protectionOwner=\u00a76[EssentialsProtect] Skyddsรคgare: {0} +questionFormat=\u00a77[Frรฅga]\u00a7f {0} +readNextPage=Skriv /{0} {1} fรถr att lรคsa nรคsta sida +reloadAllPlugins=\u00a77Laddade om alla insticksprogram. +removed=\u00a77Tog bort {0} enheter. +repair=Du har reparerat din: \u00a7e{0}. +repairAlreadyFixed=\u00a77Den hรคr saken behรถver inte repareras. +repairEnchanted=\u00a77Du har inte behรถrighet att reparera fรถrtrollade saker. +repairInvalidType=\u00a7cDen hรคr saken kan inte bli reparerad. +repairNone=Det var inga saker som behรถver repareras. +requestAccepted=\u00a77Teleporterings-fรถrfrรฅgan accepterad. +requestAcceptedFrom=\u00a77{0} accepterade din teleportations-fรถrfrรฅgan. +requestDenied=\u00a77Teleportations-fรถrfrรฅgan nekad. +requestDeniedFrom=\u00a77{0} nekade din teleportations-fรถrfrรฅgan. +requestSent=\u00a77Fรถrfrรฅgan skickad till {0}\u00a77. +requestTimedOut=\u00a7cTeleportations-fรถrfrรฅgan har gรฅtt ut +requiredBukkit= * ! * Du behรถver minst bygge {0} av CraftBukkit, ladda ner den frรฅn http://dl.bukkit.org/downloads/craftbukkit/ +returnPlayerToJailError=Ett fel uppstod nรคr spelaren {0} skulle รฅtervรคnda till fรคngelset: {1} +second=sekund +seconds=sekunder +seenOffline=Spelaren {0} รคr offline sedan {1} +seenOnline=Spelaren {0} รคr online sedan {1} +serverFull=Servern รคr full +serverTotal=Totalt pรฅ servern: {0} +setSpawner=Bytte typen av spawnare till {0} +sheepMalformedColor=Felformulerad fรคrg. +shoutFormat=\u00a77[Hojtning]\u00a7f {0} +signFormatFail=\u00a74[{0}] +signFormatSuccess=\u00a71[{0}] +signFormatTemplate=[{0}] +signProtectInvalidLocation=\u00a74Du har inte tillรฅtelse att gรถra skyltar hรคr. +similarWarpExist=En warp med ett liknande namn finns redan. +slimeMalformedSize=Felformulerad storlek. +soloMob=Det hรคr monstret gillar att vara ensam +spawnSet=\u00a77Spawnpunkten instรคlld fรถr gruppen {0}. +spawned=spawnade +sudoExempt=Du kan inte gรถra en sudo pรฅ den hรคr anvรคndaren +sudoRun=Tvingar {0} att springa: /{1} {2} +suicideMessage=\u00a77Adjรถ grymma vรคrld... +suicideSuccess= \u00a77{0} tog sitt eget liv +survival=รถverlevnad +takenFromAccount=\u00a7c{0} har tagits frรฅn ditt konto. +takenFromOthersAccount=\u00a7c{0} taget frรฅn {1}\u00a7c konto. Ny balans: {2} +teleportAAll=\u00a77Teleportations-fรถrfrรฅgan skickad till alla spelare... +teleportAll=\u00a77Teleporterar alla spelare... +teleportAtoB=\u00a77{0}\u00a77 teleporterade dig till {1}\u00a77. +teleportDisabled={0} har teleportering inaktiverat. +teleportHereRequest=\u00a7c{0}\u00a7c har frรฅgat dig om du vill teleportera till dem. +teleportNewPlayerError=Messlyckades med att teleportera ny spelare +teleportRequest=\u00a7c{0}\u00a7c har begรคrt att fรฅ teleportera sig till dig. +teleportRequestTimeoutInfo=\u00a77Den hรคr begรคran kommer att gรฅ ut efter {0} sekunder. +teleportTop=\u00a77Teleporterar till toppen. +teleportationCommencing=\u00a77Teleporteringen pรฅbรถrjas... +teleportationDisabled=\u00a77Teleportering inaktiverat. +teleportationEnabled=\u00a77Teleportering aktiverat. +teleporting=\u00a77Teleporterar... +teleportingPortal=\u00a77Teleporterar via portal. +tempBanned=Temporรคrt bannad frรฅn servern fรถr {0} +tempbanExempt=\u00a77Du kan inte temporรคrt banna den spelaren +thunder= Du {0} รฅska i din vรคrld +thunderDuration=Du {0} i din vรคrld i {1} sekunder. +timeBeforeHeal=Tid fรถre nรคste lรคkning: {0} +timeBeforeTeleport=Tid fรถre nรคsta teleportering: {0} +timeFormat=\u00a73{0}\u00a7f eller \u00a73{1}\u00a7f eller \u00a73{2}\u00a7f +timePattern=(?:([0-9]+)\\s*y[a-z]*[,\\s]*)?(?:([0-9]+)\\s*mo[a-z]*[,\\s]*)?(?:([0-9]+)\\s*w[a-z]*[,\\s]*)?(?:([0-9]+)\\s*d[a-z]*[,\\s]*)?(?:([0-9]+)\\s*h[a-z]*[,\\s]*)?(?:([0-9]+)\\s*m[a-z]*[,\\s]*)?(?:([0-9]+)\\s*(?:s[a-z]*)?)? +timeSet=Tid instรคlld i alla vรคrldar. +timeSetPermission=\u00a7cDu har inte tillstรฅnd att stรคlla in tiden. +timeWorldCurrent=Den nuvarande tiden i {0} รคr \u00a73{1} +timeWorldSet=Tiden รคr nu {0} i: \u00a7c{1} +tps=Nuvarande TPS = {0} +tradeCompleted=\u00a77Kรถp avslutat. +tradeSignEmpty=Kรถpskylten har inget tillgรคngligt fรถr dig. +tradeSignEmptyOwner=Det finns inget att frรฅn den hรคr kรถpskylten. +treeFailure=\u00a7cTrรคdgenereringn misslyckades. Prova igen pรฅ grรคs eller jord. +treeSpawned=\u00a77Trรคd genererat. +true=sant +typeTpaccept=\u00a77Fรถr att teleportera, skriv \u00a7c/tpaccept\u00a77. +typeTpdeny=\u00a77Fรถr att neka denna fรถrfrรฅgan, skriv \u00a7c/tpdeny\u00a77. +typeWorldName=\u00a77Du kan ocksรฅ skriva namnet av en specifik vรคrld. +unableToSpawnMob=Kunde inte spawna moben. +unbannedIP=Tog bort bannlysningen frรฅn IP-adress. +unbannedPlayer=Tog bort bannlysningen frรฅn spelaren. +unignorePlayer=Du ignorerar inte spelaren {0} lรคngre. +unknownItemId=Okรคnt objekt-ID: {0} +unknownItemInList=Okรคnt objekt {0} i listan {1}. +unknownItemName=Okรคnt objektnamn: {0} +unlimitedItemPermission=\u00a7cInget tillstรฅnd fรถr obegrรคnsad tillgรฅng av {0}. +unlimitedItems=Obegrรคnsade objekt: +unmutedPlayer=Spelaren {0} รคr inte bannlyst lรคngre. +unvanished=\u00a7aDu รคr synlig igen. +unvanishedReload=\u00a7cEn omladdning har tvingat dig att bli synlig. +upgradingFilesError=Fel vid uppgradering av filerna +userDoesNotExist=Anvรคndaren {0} existerar inte. +userIsAway={0} รคr nu AFK +userIsNotAway={0} รคr inte lรคngre AFK +userJailed=\u00a77Du har blivit fรคngslad +userUsedPortal={0} anvรคnde en existerande utgรฅngsportal. +userdataMoveBackError=Kunde inte flytta userdata/{0}.tmp till userdata/{1} +userdataMoveError=Kunde inte flytta userdata/{0} till userdata/{1}.tmp +usingTempFolderForTesting=Anvรคnder temporรคr mapp mapp fรถr testning: +vanished=\u00a7aDu รคr nu osynlig. +versionMismatch=Versionerna matchar inte! Vรคnligen uppgradera {0} till samma version. +versionMismatchAll=Versionerna matchar inte! Vรคnligen uppgradera alla Essentials jars till samma version. +voiceSilenced=\u00a77Din rรถst har tystats +warpDeleteError=Problem med att ta bort warp-filen. +warpListPermission=\u00a7cDu har inte tillstรฅnd att lista warparna. +warpNotExist=Den warpen finns inte. +warpOverwrite=\u00a7cDu kan inte skriva รถver den warpen. +warpSet=\u00a77Warpen {0} instรคlld. +warpUsePermission=\u00a7cDU har inte tillstรฅnd att anvรคnda den warpen. +warpingTo=\u00a77Warpar till {0}. +warps=Warpar: {0} +warpsCount=\u00a77Det finns {0} warpar. Visar sida {1} av {2}. +weatherStorm=\u00a77Du har stรคllt in vรคdret till storm i {0} +weatherStormFor=\u00a77Du har stรคllt in vรคdret till storm i {0} fรถr {1} sekunder +weatherSun=\u00a77Du har stรคllt in vรคdret till sol i {0} +weatherSunFor=\u00a77Du har stรคllt in vรคdret till sol i {0} fรถr {1} sekunder +whoisBanned=\u00a79 - Bannade spelare: {0} +whoisExp=\u00a79 - Erfarenhet: {0} (Nivรฅ {1}) +whoisGamemode=\u00a79 - Spellรคge: {0} +whoisGeoLocation=\u00a79 - Plats: {0} +whoisGod=\u00a79 - Odรถdlighet: {0} +whoisHealth=\u00a79 - Hรคlsa: {0}/20 +whoisIPAddress=\u00a79 - IP-Adress: {0} +whoisIs={0} รคr {1} +whoisJail=\u00a79 - Fรคngelse: {0} +whoisLocation=\u00a79 - Plats: ({0}, {1}, {2}, {3}) +whoisMoney=\u00a79 - Pengar: {0} +whoisOP=\u00a79 - Operatรถrer: {0} +whoisStatusAvailable=\u00a79 - Status: Tillgรคnglig +whoisStatusAway=\u00a79 - Status: \u00a7cBorta\u00a7f +worth=\u00a77Stapeln med {0} ({2} objekt) รคr vรคrd \u00a7c{1}\u00a77 ({3} styck) +worthMeta=\u00a77Stapeln med {0} av typ {1} ({3} objekt) รคr vรคrd \u00a7c{2}\u00a77 ({4} styck) +worthSet=Vรคrdet instรคllt +year=รฅr +years=รฅr +youAreHealed=\u00a77Du har blivit lรคkt. +youHaveNewMail=\u00a7cDu har {0} meddelanden!\u00a7f Skriv \u00a77/mail read\u00a7f fรถr att lรคsa dina meddelanden.
\ No newline at end of file diff --git a/Essentials/src/net/ess3/Essentials.java b/Essentials/src/net/ess3/Essentials.java index 12526ffef..56b59b47e 100644 --- a/Essentials/src/net/ess3/Essentials.java +++ b/Essentials/src/net/ess3/Essentials.java @@ -41,6 +41,24 @@ import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; import lombok.Getter; +import lombok.Getter; +import static net.ess3.I18n._; +import net.ess3.api.*; +import net.ess3.backup.Backup; +import net.ess3.commands.EssentialsCommandHandler; +import net.ess3.economy.Economy; +import net.ess3.economy.Trade; +import net.ess3.economy.WorthHolder; +import net.ess3.economy.register.Methods; +import net.ess3.listener.*; +import net.ess3.metrics.Metrics; +import net.ess3.metrics.MetricsListener; +import net.ess3.metrics.MetricsStarter; +import net.ess3.ranks.RanksStorage; +import net.ess3.settings.SettingsHolder; +import net.ess3.settings.SpawnsHolder; +import net.ess3.user.UserMap; +import net.ess3.utils.ExecuteTimer; import org.bukkit.Server; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; @@ -78,6 +96,11 @@ public class Essentials implements IEssentials @Getter private final IPlugin plugin; public static boolean testing; + private transient Metrics metrics; + @Getter + private transient EssentialsTimer timer; + @Getter + private transient List<String> vanishedPlayers = new ArrayList<String>(); public Essentials(final IServer server, final Logger logger, final IPlugin plugin) { @@ -208,9 +231,21 @@ public class Essentials implements IEssentials pm.registerEvents(tntListener, this); - final EssentialsTimer timer = new EssentialsTimer(this); + timer = new EssentialsTimer(this); getPlugin().scheduleSyncRepeatingTask(timer, 1, 100); execTimer.mark("RegListeners"); + + final MetricsStarter metricsStarter = new MetricsStarter(this); + if (metricsStarter.getStart() != null && metricsStarter.getStart() == true) + { + getServer().getScheduler().scheduleAsyncDelayedTask(this, metricsStarter, 1); + } + else if (metricsStarter.getStart() != null && metricsStarter.getStart() == false) + { + final MetricsListener metricsListener = new MetricsListener(this, metricsStarter); + pm.registerEvents(metricsListener, this); + } + final String timeroutput = execTimer.end(); if (getSettings().isDebug()) { @@ -221,6 +256,15 @@ public class Essentials implements IEssentials @Override public void onDisable() { + for (Player p : getServer().getOnlinePlayers()) + { + IUser user = getUser(p); + if (user.isVanished()) + { + user.toggleVanished(); + p.sendMessage(_("unvanishedReload")); + } + } i18n.onDisable(); Trade.closeLog(); } @@ -270,6 +314,24 @@ public class Essentials implements IEssentials } @Override + public Metrics getMetrics() + { + return metrics; + } + + @Override + public void setMetrics(Metrics metrics) + { + this.metrics = metrics; + } + + @Override + public IUser getUser(final Player player) + { + return userMap.getUser(player); + } + + @Override public IUser getUser(final String playerName) { return userMap.getUser(playerName); @@ -315,7 +377,7 @@ public class Essentials implements IEssentials for (Player player : getServer().getOnlinePlayers()) { final IUser user = player.getUser(); - if (!user.isIgnoringPlayer(sender.getName())) + if (!user.isIgnoringPlayer(sender)) { player.sendMessage(message); } diff --git a/Essentials/src/net/ess3/EssentialsTimer.java b/Essentials/src/net/ess3/EssentialsTimer.java index bab8e9e0c..82e708047 100644 --- a/Essentials/src/net/ess3/EssentialsTimer.java +++ b/Essentials/src/net/ess3/EssentialsTimer.java @@ -1,21 +1,21 @@ package net.ess3; +import java.util.*; +import java.util.logging.Level; +import static net.ess3.I18n._; import net.ess3.api.IEssentials; import net.ess3.api.ISettings; import net.ess3.api.IUser; import net.ess3.permissions.Permissions; import net.ess3.user.UserData.TimestampType; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Set; -import java.util.logging.Level; public class EssentialsTimer implements Runnable { private final transient IEssentials ess; private final transient Set<IUser> onlineUsers = new HashSet<IUser>(); + private transient long lastPoll = System.currentTimeMillis(); + private final transient LinkedList<Float> history = new LinkedList<Float>(); EssentialsTimer(final IEssentials ess) { @@ -26,12 +26,30 @@ public class EssentialsTimer implements Runnable public void run() { final long currentTime = System.currentTimeMillis(); + long timeSpent = (currentTime - lastPoll) / 1000; + if (timeSpent == 0) + { + timeSpent = 1; + } + if (history.size() > 10) + { + history.remove(); + } + final float tps = 100f / timeSpent; + if (tps <= 20) + { + history.add(tps); + } + lastPoll = currentTime; for (Player player : ess.getServer().getOnlinePlayers()) { try { final IUser user = player.getUser(); + if (user == null) { + continue; + } onlineUsers.add(user); user.setLastOnlineActivity(currentTime); user.checkActivity(); @@ -48,7 +66,7 @@ public class EssentialsTimer implements Runnable settings.unlock(); } // New mail notification - if (user != null && !mailDisabled && Permissions.MAIL.isAuthorized(user) && !user.gotMailInfo()) + if (!mailDisabled && Permissions.MAIL.isAuthorized(user) && !user.gotMailInfo()) { final List<String> mail = user.getMails(); if (mail != null && !mail.isEmpty()) @@ -75,6 +93,20 @@ public class EssentialsTimer implements Runnable } user.checkMuteTimeout(currentTime); user.checkJailTimeout(currentTime); + user.resetInvulnerabilityAfterTeleport(); + } + } + + public float getAverageTPS() + { + float avg = 0; + for (Float f : history) + { + if (f != null) + { + avg += f; + } } + return avg / history.size(); } } diff --git a/Essentials/src/net/ess3/I18n.java b/Essentials/src/net/ess3/I18n.java index 1aa1906ba..9387c3eda 100644 --- a/Essentials/src/net/ess3/I18n.java +++ b/Essentials/src/net/ess3/I18n.java @@ -1,7 +1,5 @@ package net.ess3; -import net.ess3.api.IEssentials; -import net.ess3.api.II18n; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; @@ -12,6 +10,8 @@ import java.text.MessageFormat; import java.util.*; import java.util.logging.Level; import java.util.logging.Logger; +import net.ess3.api.IEssentials; +import net.ess3.api.II18n; public class I18n implements II18n @@ -116,6 +116,7 @@ public class I18n implements II18n { currentLocale = new Locale(parts[0], parts[1], parts[2]); } + ResourceBundle.clearCache(); Logger.getLogger("Minecraft").log(Level.INFO, String.format("Using locale %s", currentLocale.toString())); customBundle = ResourceBundle.getBundle(MESSAGES, currentLocale, new FileResClassLoader(I18n.class.getClassLoader(), ess)); localeBundle = ResourceBundle.getBundle(MESSAGES, currentLocale); diff --git a/Essentials/src/net/ess3/ItemDb.java b/Essentials/src/net/ess3/ItemDb.java index 1ccc063b1..a47286c3e 100644 --- a/Essentials/src/net/ess3/ItemDb.java +++ b/Essentials/src/net/ess3/ItemDb.java @@ -1,19 +1,21 @@ package net.ess3; -import net.ess3.storage.ManagedFile; -import static net.ess3.I18n._; -import net.ess3.api.IEssentials; -import net.ess3.api.IItemDb; -import net.ess3.api.IUser; import net.ess3.api.server.ItemStack; import net.ess3.api.server.Material; -import net.ess3.permissions.Permissions; import java.util.HashMap; import java.util.List; import java.util.Locale; import java.util.Map; import java.util.regex.Pattern; import lombok.Cleanup; +import static net.ess3.I18n._; +import net.ess3.api.IEssentials; +import net.ess3.api.IItemDb; +import net.ess3.api.IUser; +import net.ess3.permissions.Permissions; +import net.ess3.storage.ManagedFile; +import org.bukkit.Material; +import org.bukkit.inventory.ItemStack; public class ItemDb implements IItemDb diff --git a/Essentials/src/net/ess3/Teleport.java b/Essentials/src/net/ess3/Teleport.java index 83eb8a842..04e47e493 100644 --- a/Essentials/src/net/ess3/Teleport.java +++ b/Essentials/src/net/ess3/Teleport.java @@ -21,6 +21,7 @@ import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; public class Teleport implements Runnable, ITeleport { + private static final double MOVE_CONSTANT = 0.3; @@ -134,6 +135,7 @@ public class Teleport implements Runnable, ITeleport this.ess = ess; } + @Override public void respawn(final Trade chargeFor, TeleportCause cause) throws Exception { final Location bed = user.getBedSpawnLocation(); @@ -141,6 +143,7 @@ public class Teleport implements Runnable, ITeleport teleport(new Target(respawnLoc), chargeFor, cause); } + @Override public void warp(String warp, Trade chargeFor, TeleportCause cause) throws Exception { final Location loc = ess.getWarps().getWarp(warp); @@ -191,6 +194,7 @@ public class Teleport implements Runnable, ITeleport teleport(new Target(loc), chargeFor, TeleportCause.PLUGIN); } + @Override public void teleport(Location loc, Trade chargeFor, TeleportCause cause) throws Exception { teleport(new Target(loc), chargeFor, cause); @@ -203,14 +207,14 @@ public class Teleport implements Runnable, ITeleport private void teleport(Target target, Trade chargeFor, TeleportCause cause) throws Exception { - double delay = ess.getRanks().getTeleportDelay(user); + double tDelay = ess.getRanks().getTeleportDelay(user); if (chargeFor != null) { chargeFor.isAffordableFor(user); } cooldown(true); - if (delay <= 0 || Permissions.TELEPORT_TIMER_BYPASS.isAuthorized(user)) + if (tDelay <= 0 || Permissions.TELEPORT_TIMER_BYPASS.isAuthorized(user)) { cooldown(false); now(target, cause); @@ -223,10 +227,10 @@ public class Teleport implements Runnable, ITeleport cancel(); Calendar c = new GregorianCalendar(); - c.add(Calendar.SECOND, (int)delay); - c.add(Calendar.MILLISECOND, (int)((delay * 1000.0) % 1000.0)); + c.add(Calendar.SECOND, (int)tDelay); + c.add(Calendar.MILLISECOND, (int)((tDelay * 1000.0) % 1000.0)); user.sendMessage(_("dontMoveMessage", DateUtil.formatDateDiff(c.getTimeInMillis()))); - initTimer((long)(delay * 1000.0), target, chargeFor, cause); + initTimer((long)(tDelay * 1000.0), target, chargeFor, cause); teleTimer = ess.getPlugin().scheduleSyncRepeatingTask(this, 10, 10); } @@ -238,6 +242,7 @@ public class Teleport implements Runnable, ITeleport user.getBase().teleport(LocationUtil.getSafeDestination(target.getLocation()), cause); } + @Override public void now(Location loc, boolean cooldown, TeleportCause cause) throws Exception { if (cooldown) @@ -263,6 +268,7 @@ public class Teleport implements Runnable, ITeleport now(new Target(entity), cause); } + @Override public void back(Trade chargeFor) throws Exception { user.acquireReadLock(); @@ -276,6 +282,7 @@ public class Teleport implements Runnable, ITeleport } } + @Override public void back() throws Exception { user.acquireReadLock(); @@ -288,14 +295,10 @@ public class Teleport implements Runnable, ITeleport user.unlock(); } } - - public void home(IUser user, String home, Trade chargeFor) throws Exception + + @Override + public void home(Location loc, Trade chargeFor) throws Exception { - final Location loc = user.getHome(home); - if (loc == null) - { - throw new NotEnoughArgumentsException(); - } teleport(new Target(loc), chargeFor, TeleportCause.COMMAND); } } diff --git a/Essentials/src/net/ess3/api/IEssentials.java b/Essentials/src/net/ess3/api/IEssentials.java index 286d00037..c6cdc8739 100644 --- a/Essentials/src/net/ess3/api/IEssentials.java +++ b/Essentials/src/net/ess3/api/IEssentials.java @@ -6,14 +6,17 @@ import net.ess3.api.server.World; import net.ess3.economy.register.Methods; import net.ess3.listener.TntExplodeListener; import java.util.logging.Logger; +import java.util.List; +import net.ess3.EssentialsTimer; +import net.ess3.economy.register.Methods; +import net.ess3.listener.TntExplodeListener; +import net.ess3.metrics.Metrics; public interface IEssentials extends IComponent { void addReloadListener(IReload listener); - IUser getUser(String playerName); - int broadcastMessage(IUser sender, String message); II18n getI18n(); @@ -61,4 +64,12 @@ public interface IEssentials extends IComponent Logger getLogger(); IPlugin getPlugin(); + + List<String> getVanishedPlayers(); + + EssentialsTimer getTimer(); + + Metrics getMetrics(); + + void setMetrics(Metrics metrics); } diff --git a/Essentials/src/net/ess3/api/IJails.java b/Essentials/src/net/ess3/api/IJails.java index c7b01dfdc..bf616d7ec 100644 --- a/Essentials/src/net/ess3/api/IJails.java +++ b/Essentials/src/net/ess3/api/IJails.java @@ -10,6 +10,8 @@ public interface IJails extends IReload Collection<String> getList() throws Exception; + int getCount(); + void removeJail(String jail) throws Exception; void sendToJail(IUser user, String jail) throws Exception; diff --git a/Essentials/src/net/ess3/api/IKits.java b/Essentials/src/net/ess3/api/IKits.java index 33a609c46..03919f40d 100644 --- a/Essentials/src/net/ess3/api/IKits.java +++ b/Essentials/src/net/ess3/api/IKits.java @@ -1,7 +1,8 @@ package net.ess3.api; -import net.ess3.settings.Kit; import java.util.Collection; +import net.ess3.commands.NoChargeException; +import net.ess3.settings.Kit; public interface IKits extends IReload @@ -15,4 +16,6 @@ public interface IKits extends IReload Collection<String> getList() throws Exception; boolean isEmpty(); + + void checkTime(final IUser user, Kit kit) throws NoChargeException; } diff --git a/Essentials/src/net/ess3/api/IPermission.java b/Essentials/src/net/ess3/api/IPermission.java index 60b0bdb42..987f0b481 100644 --- a/Essentials/src/net/ess3/api/IPermission.java +++ b/Essentials/src/net/ess3/api/IPermission.java @@ -1,16 +1,17 @@ package net.ess3.api; -import net.ess3.api.server.CommandSender; -import net.ess3.api.server.Permission; +import org.bukkit.command.CommandSender; +import org.bukkit.permissions.Permission; +import org.bukkit.permissions.PermissionDefault; public interface IPermission { - String getPermissionName(); + String getPermission(); boolean isAuthorized(CommandSender sender); - Permission getPermission(); + Permission getBukkitPermission(); - Permission.Default getPermissionDefault(); + PermissionDefault getPermissionDefault(); } diff --git a/Essentials/src/net/ess3/api/ITeleport.java b/Essentials/src/net/ess3/api/ITeleport.java index 559a05f39..afec3e213 100644 --- a/Essentials/src/net/ess3/api/ITeleport.java +++ b/Essentials/src/net/ess3/api/ITeleport.java @@ -18,7 +18,7 @@ public interface ITeleport void teleport(Entity entity, Trade chargeFor, TeleportCause cause) throws Exception; - void home(IUser player, String toLowerCase, Trade charge) throws Exception; + void home(Location loc, Trade chargeFor) throws Exception; void respawn(Trade charge, TeleportCause teleportCause) throws Exception; diff --git a/Essentials/src/net/ess3/api/IUser.java b/Essentials/src/net/ess3/api/IUser.java index 30d3fc4f8..257c971cb 100644 --- a/Essentials/src/net/ess3/api/IUser.java +++ b/Essentials/src/net/ess3/api/IUser.java @@ -49,6 +49,8 @@ public interface IUser extends Player, IStorageObjectHolder<UserData>, IReload, void updateActivity(boolean broadcast); void updateDisplayName(); + + void setDisplayNick(); boolean checkJailTimeout(long currentTime); @@ -68,14 +70,12 @@ public interface IUser extends Player, IStorageObjectHolder<UserData>, IReload, boolean isGodModeEnabled(); - boolean isIgnoringPlayer(String name); + boolean isIgnoringPlayer(IUser user); - void setIgnoredPlayer(String name, boolean set); + void setIgnoredPlayer(IUser user, boolean set); Location getAfkPosition(); - - boolean toggleGodModeEnabled(); - + void dispose(); void updateCompass(); @@ -84,13 +84,13 @@ public interface IUser extends Player, IStorageObjectHolder<UserData>, IReload, void addMail(String string); - boolean toggleMuted(); + void setMuted(boolean mute); boolean toggleSocialSpy(); void requestTeleport(IUser user, boolean b); - boolean isTeleportRequestHere(); + boolean isTpRequestHere(); IUser getTeleportRequester(); @@ -107,4 +107,23 @@ public interface IUser extends Player, IStorageObjectHolder<UserData>, IReload, public void updateMoneyCache(double userMoney); public boolean canAfford(double amount, boolean b); + + boolean isVanished(); + + void resetInvulnerabilityAfterTeleport(); + + void toggleVanished(); + + boolean isInvSee(); + + void setInvSee(boolean invsee); + + boolean hasInvulnerabilityAfterTeleport(); + + void update(final Player base); + + void setGodModeEnabled(boolean set); + + void setVanished(boolean set); + } diff --git a/Essentials/src/net/ess3/api/server/IPermission.java b/Essentials/src/net/ess3/api/server/IPermission.java new file mode 100644 index 000000000..23fee3a03 --- /dev/null +++ b/Essentials/src/net/ess3/api/server/IPermission.java @@ -0,0 +1,5 @@ +package net.ess3.api.server; + +public interface IPermission { + +} diff --git a/Essentials/src/net/ess3/api/server/IPlayer.java b/Essentials/src/net/ess3/api/server/IPlayer.java new file mode 100644 index 000000000..4ae44a480 --- /dev/null +++ b/Essentials/src/net/ess3/api/server/IPlayer.java @@ -0,0 +1,5 @@ +package net.ess3.api.server; + +public interface IPlayer { + +} diff --git a/Essentials/src/net/ess3/bukkit/Enchantments.java b/Essentials/src/net/ess3/bukkit/Enchantments.java index f4890848f..b577f06e3 100644 --- a/Essentials/src/net/ess3/bukkit/Enchantments.java +++ b/Essentials/src/net/ess3/bukkit/Enchantments.java @@ -24,47 +24,93 @@ public final class Enchantments ENCHANTMENTS.put("alldamage", Enchantment.DAMAGE_ALL); ENCHANTMENTS.put("alldmg", Enchantment.DAMAGE_ALL); ENCHANTMENTS.put("sharpness", Enchantment.DAMAGE_ALL); + ENCHANTMENTS.put("sharp", Enchantment.DAMAGE_ALL); + ENCHANTMENTS.put("arthropodsdamage", Enchantment.DAMAGE_ARTHROPODS); ENCHANTMENTS.put("ardmg", Enchantment.DAMAGE_ARTHROPODS); ENCHANTMENTS.put("baneofarthropods", Enchantment.DAMAGE_ARTHROPODS); + ENCHANTMENTS.put("baneofarthropod", Enchantment.DAMAGE_ARTHROPODS); + ENCHANTMENTS.put("arthropod", Enchantment.DAMAGE_ARTHROPODS); + ENCHANTMENTS.put("undeaddamage", Enchantment.DAMAGE_UNDEAD); ENCHANTMENTS.put("smite", Enchantment.DAMAGE_UNDEAD); + ENCHANTMENTS.put("digspeed", Enchantment.DIG_SPEED); ENCHANTMENTS.put("efficiency", Enchantment.DIG_SPEED); + ENCHANTMENTS.put("minespeed", Enchantment.DIG_SPEED); + ENCHANTMENTS.put("cutspeed", Enchantment.DIG_SPEED); + ENCHANTMENTS.put("durability", Enchantment.DURABILITY); ENCHANTMENTS.put("dura", Enchantment.DURABILITY); ENCHANTMENTS.put("unbreaking", Enchantment.DURABILITY); + ENCHANTMENTS.put("fireaspect", Enchantment.FIRE_ASPECT); ENCHANTMENTS.put("fire", Enchantment.FIRE_ASPECT); + ENCHANTMENTS.put("meleefire", Enchantment.FIRE_ASPECT); + ENCHANTMENTS.put("meleeflame", Enchantment.FIRE_ASPECT); + ENCHANTMENTS.put("knockback", Enchantment.KNOCKBACK); + ENCHANTMENTS.put("blockslootbonus", Enchantment.LOOT_BONUS_BLOCKS); ENCHANTMENTS.put("fortune", Enchantment.LOOT_BONUS_BLOCKS); + ENCHANTMENTS.put("mobslootbonus", Enchantment.LOOT_BONUS_MOBS); ENCHANTMENTS.put("mobloot", Enchantment.LOOT_BONUS_MOBS); ENCHANTMENTS.put("looting", Enchantment.LOOT_BONUS_MOBS); + ENCHANTMENTS.put("oxygen", Enchantment.OXYGEN); ENCHANTMENTS.put("respiration", Enchantment.OXYGEN); + ENCHANTMENTS.put("breathing", Enchantment.OXYGEN); + ENCHANTMENTS.put("breath", Enchantment.OXYGEN); + ENCHANTMENTS.put("protection", Enchantment.PROTECTION_ENVIRONMENTAL); ENCHANTMENTS.put("prot", Enchantment.PROTECTION_ENVIRONMENTAL); + ENCHANTMENTS.put("protect", Enchantment.PROTECTION_ENVIRONMENTAL); + ENCHANTMENTS.put("explosionsprotection", Enchantment.PROTECTION_EXPLOSIONS); + ENCHANTMENTS.put("explosionprotection", Enchantment.PROTECTION_EXPLOSIONS); ENCHANTMENTS.put("expprot", Enchantment.PROTECTION_EXPLOSIONS); ENCHANTMENTS.put("blastprotection", Enchantment.PROTECTION_EXPLOSIONS); + ENCHANTMENTS.put("blastprotect", Enchantment.PROTECTION_EXPLOSIONS); + ENCHANTMENTS.put("fallprotection", Enchantment.PROTECTION_FALL); ENCHANTMENTS.put("fallprot", Enchantment.PROTECTION_FALL); + ENCHANTMENTS.put("featherfall", Enchantment.PROTECTION_FALL); ENCHANTMENTS.put("featherfalling", Enchantment.PROTECTION_FALL); + ENCHANTMENTS.put("fireprotection", Enchantment.PROTECTION_FIRE); - ENCHANTMENTS.put("fireprot", Enchantment.PROTECTION_FIRE); + ENCHANTMENTS.put("flameprotection", Enchantment.PROTECTION_FIRE); + ENCHANTMENTS.put("fireprotect", Enchantment.PROTECTION_FIRE); + ENCHANTMENTS.put("flameprotect", Enchantment.PROTECTION_FIRE); + ENCHANTMENTS.put("projectileprotection", Enchantment.PROTECTION_PROJECTILE); ENCHANTMENTS.put("projprot", Enchantment.PROTECTION_PROJECTILE); + ENCHANTMENTS.put("silktouch", Enchantment.SILK_TOUCH); + ENCHANTMENTS.put("softtouch", Enchantment.SILK_TOUCH); + ENCHANTMENTS.put("waterworker", Enchantment.WATER_WORKER); ENCHANTMENTS.put("aquaaffinity", Enchantment.WATER_WORKER); + ENCHANTMENTS.put("firearrow", Enchantment.ARROW_FIRE); + ENCHANTMENTS.put("flame", Enchantment.ARROW_FIRE); + ENCHANTMENTS.put("flamearrow", Enchantment.ARROW_FIRE); + ENCHANTMENTS.put("arrowdamage", Enchantment.ARROW_DAMAGE); + ENCHANTMENTS.put("power", Enchantment.ARROW_DAMAGE); + ENCHANTMENTS.put("arrowpower", Enchantment.ARROW_DAMAGE); + ENCHANTMENTS.put("arrowknockback", Enchantment.ARROW_KNOCKBACK); ENCHANTMENTS.put("arrowkb", Enchantment.ARROW_KNOCKBACK); + ENCHANTMENTS.put("punch", Enchantment.ARROW_KNOCKBACK); + ENCHANTMENTS.put("arrowpunch", Enchantment.ARROW_KNOCKBACK); + ENCHANTMENTS.put("infinitearrows", Enchantment.ARROW_INFINITE); ENCHANTMENTS.put("infarrows", Enchantment.ARROW_INFINITE); + ENCHANTMENTS.put("infinity", Enchantment.ARROW_INFINITE); + ENCHANTMENTS.put("infinite", Enchantment.ARROW_INFINITE); + ENCHANTMENTS.put("unlimited", Enchantment.ARROW_INFINITE); + ENCHANTMENTS.put("unlimitedarrows", Enchantment.ARROW_INFINITE); } public static Enchantment getByName(final String name) { diff --git a/Essentials/src/net/ess3/bukkit/Mob.java b/Essentials/src/net/ess3/bukkit/Mob.java index c618a1038..0dd0bfab6 100644 --- a/Essentials/src/net/ess3/bukkit/Mob.java +++ b/Essentials/src/net/ess3/bukkit/Mob.java @@ -1,13 +1,9 @@ package net.ess3.bukkit; -import static net.ess3.I18n._; -import java.util.Collections; -import java.util.HashMap; -import java.util.Locale; -import java.util.Map; -import java.util.Set; +import java.util.*; import java.util.logging.Level; import java.util.logging.Logger; +import static net.ess3.I18n._; import org.bukkit.Location; import org.bukkit.Server; import org.bukkit.entity.EntityType; diff --git a/Essentials/src/net/ess3/commands/Commandafk.java b/Essentials/src/net/ess3/commands/Commandafk.java index 07b452917..97f7b247b 100644 --- a/Essentials/src/net/ess3/commands/Commandafk.java +++ b/Essentials/src/net/ess3/commands/Commandafk.java @@ -28,6 +28,7 @@ public class Commandafk extends EssentialsCommand private void toggleAfk(IUser user) { + user.setDisplayNick(); if (!user.toggleAfk()) { //user.sendMessage(_("markedAsNotAway")); diff --git a/Essentials/src/net/ess3/commands/Commandban.java b/Essentials/src/net/ess3/commands/Commandban.java index 6b6aee9ae..a250b6aeb 100644 --- a/Essentials/src/net/ess3/commands/Commandban.java +++ b/Essentials/src/net/ess3/commands/Commandban.java @@ -21,7 +21,7 @@ public class Commandban extends EssentialsCommand final IUser user = getPlayer(args, 0, true); if (!user.isOnline()) { - if (Permissions.BAN_EXEMPT.isAuthorized(user)) + if (sender instanceof Player && Permissions.BAN_OFFLINE.isAuthorized(user)) { sender.sendMessage(_("banExempt")); return; @@ -29,7 +29,7 @@ public class Commandban extends EssentialsCommand } else { - if (Permissions.BAN_OFFLINE.isAuthorized(sender)) + if (Permissions.BAN_EXEMPT.isAuthorized(sender)) { sender.sendMessage(_("banExempt")); return; @@ -37,21 +37,23 @@ public class Commandban extends EssentialsCommand } user.acquireWriteLock(); + final String senderName = sender instanceof Player ? ((Player)sender).getDisplayName() : Console.NAME; String banReason; user.getData().setBan(new Ban()); if (args.length > 1) { - banReason = getFinalArg(args, 1); + + banReason = _("banFormat", getFinalArg(args, 1), senderName); user.getData().getBan().setReason(banReason); } else { - banReason = _("defaultBanReason"); + banReason = _("banFormat", _("defaultBanReason"), senderName); + user.getData().getBan().setReason(""); } + user.setBanned(true); user.kickPlayer(banReason); - final String senderName = sender instanceof Player ? ((Player)sender).getDisplayName() : Console.NAME; - for (IPlayer onlinePlayer : server.getOnlinePlayers()) { final IUser player = onlinePlayer.getUser(); diff --git a/Essentials/src/net/ess3/commands/Commandbigtree.java b/Essentials/src/net/ess3/commands/Commandbigtree.java index 645113eb3..6d9919753 100644 --- a/Essentials/src/net/ess3/commands/Commandbigtree.java +++ b/Essentials/src/net/ess3/commands/Commandbigtree.java @@ -21,6 +21,10 @@ public class Commandbigtree extends EssentialsCommand { tree = TreeType.BIG_TREE; } + else if (args.length > 0 && args[0].equalsIgnoreCase("jungle")) + { + tree = TreeType.JUNGLE; + } else { throw new NotEnoughArgumentsException(); diff --git a/Essentials/src/net/ess3/commands/Commandbreak.java b/Essentials/src/net/ess3/commands/Commandbreak.java index 340cdea40..996d2a2f8 100644 --- a/Essentials/src/net/ess3/commands/Commandbreak.java +++ b/Essentials/src/net/ess3/commands/Commandbreak.java @@ -27,6 +27,8 @@ public class Commandbreak extends EssentialsCommand { throw new Exception(_("noBreakBedrock")); } + //final List<ItemStack> list = (List<ItemStack>)block.getDrops(); + //final BlockBreakEvent event = new BlockBreakEvent(block, user.getBase(), list); final BlockBreakEvent event = new BlockBreakEvent(block, user.getBase()); server.getPluginManager().callEvent(event); if (event.isCancelled()) diff --git a/Essentials/src/net/ess3/commands/Commandbroadcast.java b/Essentials/src/net/ess3/commands/Commandbroadcast.java index 8490e8605..d4fb48c4e 100644 --- a/Essentials/src/net/ess3/commands/Commandbroadcast.java +++ b/Essentials/src/net/ess3/commands/Commandbroadcast.java @@ -1,18 +1,19 @@ package net.ess3.commands; import static net.ess3.I18n._; +import net.ess3.utils.Util; +import org.bukkit.command.CommandSender; public class Commandbroadcast extends EssentialsCommand { @Override - protected void run(final CommandSender sender, final String commandLabel, final String[] args) throws Exception + public void run(final CommandSender sender, final String commandLabel, final String[] args) throws Exception { if (args.length < 1) { throw new NotEnoughArgumentsException(); } - - ess.broadcastMessage(null, _("broadcast", getFinalArg(args, 0))); + ess.broadcastMessage(null, _("broadcast", Util.replaceFormat(getFinalArg(args, 0)))); } } diff --git a/Essentials/src/net/ess3/commands/Commandenchant.java b/Essentials/src/net/ess3/commands/Commandenchant.java index 7e38d13fc..9ab4b1db9 100644 --- a/Essentials/src/net/ess3/commands/Commandenchant.java +++ b/Essentials/src/net/ess3/commands/Commandenchant.java @@ -9,6 +9,11 @@ import java.util.Locale; import java.util.Map; import java.util.Set; import java.util.TreeSet; +import static net.ess3.I18n._; +import net.ess3.api.IUser; +import net.ess3.bukkit.Enchantments; +import net.ess3.permissions.EnchantPermissions; +import net.ess3.utils.Util; import org.bukkit.enchantments.Enchantment; import org.bukkit.inventory.ItemStack; diff --git a/Essentials/src/net/ess3/commands/Commandexp.java b/Essentials/src/net/ess3/commands/Commandexp.java new file mode 100644 index 000000000..104a294e5 --- /dev/null +++ b/Essentials/src/net/ess3/commands/Commandexp.java @@ -0,0 +1,139 @@ +package net.ess3.commands; + +import static net.ess3.I18n._; +import net.ess3.api.IUser; +import net.ess3.craftbukkit.SetExpFix; +import net.ess3.permissions.Permissions; +import net.ess3.utils.Util; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + + +public class Commandexp extends EssentialsCommand +{ + @Override + public void run(final IUser user, final String commandLabel, final String[] args) throws Exception + { + + if (args.length == 0) + { + showExp(user, user); + } + else if (args[0].equalsIgnoreCase("set") && Permissions.EXP_SET.isAuthorized(user)) + { + if (args.length == 3 && Permissions.EXP_SET_OTHERS.isAuthorized(user)) + { + expMatch(user, args[1], args[2], false); + } + else + { + setExp(user, user, args[1], false); + } + } + else if (args[0].equalsIgnoreCase("give") && Permissions.EXP_GIVE.isAuthorized(user)) + { + if (args.length == 3 && Permissions.EXP_GIVE_OTHERS.isAuthorized(user)) + { + expMatch(user, args[1], args[2], true); + } + else + { + setExp(user, user, args[1], true); + } + } + else + { + String match = args[0].trim(); + if (args.length == 2) + { + match = args[1].trim(); + } + if (match.equalsIgnoreCase("show") || !Permissions.EXP_OTHERS.isAuthorized(user)) + { + showExp(user, user); + } + else + { + showMatch(user, match); + } + } + } + + + public void run(final CommandSender sender, final String commandLabel, final String[] args) throws Exception + { + if (args.length < 1) + { + throw new NotEnoughArgumentsException(); + } + else if (args.length > 2 && args[0].equalsIgnoreCase("set")) + { + expMatch(sender, args[1], args[2], false); + } + else if (args.length > 2 && args[0].equalsIgnoreCase("give")) + { + expMatch(sender, args[1], args[2], true); + } + else + { + String match = args[0].trim(); + if (args.length == 2) + { + match = args[1].trim(); + } + showMatch(sender, match); + } + } + + private void showMatch(final CommandSender sender, final String match) throws NotEnoughArgumentsException + { + boolean foundUser = false; + for (Player matchPlayer : server.matchPlayer(match)) + { + foundUser = true; + final IUser target = ess.getUser(matchPlayer); + showExp(sender, target); + } + if (!foundUser) + { + throw new NotEnoughArgumentsException(_("playerNotFound")); + } + } + + private void expMatch(final CommandSender sender, final String match, final String amount, final boolean toggle) throws NotEnoughArgumentsException + { + boolean foundUser = false; + for (Player matchPlayer : server.matchPlayer(match)) + { + final IUser target = ess.getUser(matchPlayer); + setExp(sender, target, amount, toggle); + foundUser = true; + } + if (!foundUser) + { + throw new NotEnoughArgumentsException(_("playerNotFound")); + } + } + + private void showExp(final CommandSender sender, final IUser target) + { + final int totalExp = SetExpFix.getTotalExperience(target); + final int expLeft = (int)Util.roundDouble(((((3.5 * target.getLevel()) + 6.7) - (totalExp - ((1.75 * (target.getLevel() * target.getLevel())) + (5.00 * target.getLevel())))) + 1)); + sender.sendMessage(_("exp", target.getDisplayName(), SetExpFix.getTotalExperience(target), target.getLevel(), expLeft)); + } + + private void setExp(final CommandSender sender, final IUser target, final String strAmount, final boolean give) + { + Long amount = Long.parseLong(strAmount); + if (give) + { + amount += SetExpFix.getTotalExperience(target); + } + if (amount > Integer.MAX_VALUE) + { + amount = (long)Integer.MAX_VALUE; + } + SetExpFix.setTotalExperience(target, amount.intValue()); + sender.sendMessage(_("expSet", target.getDisplayName(), amount)); + } +}
\ No newline at end of file diff --git a/Essentials/src/net/ess3/commands/Commandfly.java b/Essentials/src/net/ess3/commands/Commandfly.java new file mode 100644 index 000000000..d36923764 --- /dev/null +++ b/Essentials/src/net/ess3/commands/Commandfly.java @@ -0,0 +1,72 @@ +package net.ess3.commands; + +import static net.ess3.I18n._; +import net.ess3.api.IUser; +import net.ess3.permissions.Permissions; +import org.bukkit.Server; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + + +public class Commandfly extends EssentialsCommand +{ + @Override + protected void run(final CommandSender sender, final String commandLabel, final String[] args) throws Exception + { + if (args.length < 1) + { + throw new NotEnoughArgumentsException(); + } + + flyOtherPlayers(server, sender, args); + } + + @Override + protected void run(final IUser user, final String commandLabel, final String[] args) throws Exception + { + if (args.length > 0 && args[0].trim().length() > 2 && Permissions.FLY_OTHERS.isAuthorized(user)) + { + flyOtherPlayers(server, user, args); + return; + } + user.setAllowFlight(!user.getAllowFlight()); + if (!user.getAllowFlight()) + { + user.setFlying(false); + } + user.sendMessage(_("flyMode", _(user.getAllowFlight() ? "enabled" : "disabled"), user.getDisplayName())); + } + + private void flyOtherPlayers(final Server server, final CommandSender sender, final String[] args) + { + for (Player matchPlayer : server.matchPlayer(args[0])) + { + final IUser player = ess.getUser(matchPlayer); + if (player.isHidden()) + { + continue; + } + if (args.length > 1) + { + if (args[1].contains("on") || args[1].contains("ena") || args[1].equalsIgnoreCase("1")) + { + player.setAllowFlight(true); + } + else + { + player.setAllowFlight(false); + } + } + else + { + player.setAllowFlight(!player.getAllowFlight()); + } + + if (!player.getAllowFlight()) + { + player.setFlying(false); + } + sender.sendMessage(_("flyMode", _(player.getAllowFlight() ? "enabled" : "disabled"), player.getDisplayName())); + } + } +} diff --git a/Essentials/src/net/ess3/commands/Commandgamemode.java b/Essentials/src/net/ess3/commands/Commandgamemode.java index 3a708d0cf..30f56e1ba 100644 --- a/Essentials/src/net/ess3/commands/Commandgamemode.java +++ b/Essentials/src/net/ess3/commands/Commandgamemode.java @@ -1,9 +1,9 @@ package net.ess3.commands; +import java.util.Locale; import static net.ess3.I18n._; import net.ess3.api.IUser; import net.ess3.permissions.Permissions; -import java.util.Locale; import org.bukkit.GameMode; import org.bukkit.entity.Player; @@ -18,7 +18,7 @@ public class Commandgamemode extends EssentialsCommand throw new NotEnoughArgumentsException(); } - gamemodeOtherPlayers(sender, args[0]); + gamemodeOtherPlayers(sender, args); } @Override @@ -26,7 +26,7 @@ public class Commandgamemode extends EssentialsCommand { if (args.length > 0 && !args[0].trim().isEmpty() && Permissions.GAMEMODE_OTHERS.isAuthorized(user)) { - gamemodeOtherPlayers(user, args[0]); + gamemodeOtherPlayers(user, args); return; } @@ -34,9 +34,9 @@ public class Commandgamemode extends EssentialsCommand user.sendMessage(_("gameMode", _(user.getGameMode().toString().toLowerCase(Locale.ENGLISH)), user.getDisplayName())); } - private void gamemodeOtherPlayers(final CommandSender sender, final String name) + private void gamemodeOtherPlayers(final CommandSender sender, final String args[]) { - for (Player matchPlayer : server.matchPlayer(name)) + for (Player matchPlayer : server.matchPlayer(args[0])) { final IUser player = ess.getUser(matchPlayer); if (player.isHidden()) @@ -44,7 +44,21 @@ public class Commandgamemode extends EssentialsCommand continue; } - player.setGameMode(player.getGameMode() == GameMode.SURVIVAL ? GameMode.CREATIVE : GameMode.SURVIVAL); + if (args.length > 1) + { + if (args[1].contains("creat") || args[1].equalsIgnoreCase("1")) + { + player.setGameMode(GameMode.CREATIVE); + } + else + { + player.setGameMode(GameMode.SURVIVAL); + } + } + else + { + player.setGameMode(player.getGameMode() == GameMode.SURVIVAL ? GameMode.CREATIVE : GameMode.SURVIVAL); + } sender.sendMessage(_("gameMode", _(player.getGameMode().toString().toLowerCase(Locale.ENGLISH)), player.getDisplayName())); } } diff --git a/Essentials/src/net/ess3/commands/Commandgc.java b/Essentials/src/net/ess3/commands/Commandgc.java index a440d0474..415527af3 100644 --- a/Essentials/src/net/ess3/commands/Commandgc.java +++ b/Essentials/src/net/ess3/commands/Commandgc.java @@ -1,6 +1,10 @@ package net.ess3.commands; import static net.ess3.I18n._; +//TODO - Remove bukkit refs +import org.bukkit.ChatColor; +import org.bukkit.World; +import org.bukkit.command.CommandSender; public class Commandgc extends EssentialsCommand @@ -8,6 +12,21 @@ public class Commandgc extends EssentialsCommand @Override protected void run(final CommandSender sender, final String commandLabel, final String[] args) throws Exception { + float tps = ess.getTimer().getAverageTPS(); + ChatColor color; + if (tps >= 18) + { + color = ChatColor.GREEN; + } + else if (tps >= 15) + { + color = ChatColor.YELLOW; + } + else + { + color = ChatColor.RED; + } + sender.sendMessage(_("tps", "" + color + tps)); sender.sendMessage(_("gcmax", (Runtime.getRuntime().maxMemory() / 1024 / 1024))); sender.sendMessage(_("gctotal", (Runtime.getRuntime().totalMemory() / 1024 / 1024))); sender.sendMessage(_("gcfree", (Runtime.getRuntime().freeMemory() / 1024 / 1024))); diff --git a/Essentials/src/net/ess3/commands/Commandgetpos.java b/Essentials/src/net/ess3/commands/Commandgetpos.java index 202b7b2b4..cd02b661b 100644 --- a/Essentials/src/net/ess3/commands/Commandgetpos.java +++ b/Essentials/src/net/ess3/commands/Commandgetpos.java @@ -12,13 +12,16 @@ public class Commandgetpos extends EssentialsCommand { if (args.length > 0 && Permissions.GETPOS_OTHERS.isAuthorized(user)) { + //todo permissions final IUser otherUser = getPlayer(args, 0); - outputPosition(user, otherUser.getLocation(), user.getLocation()); - } - else - { - outputPosition(user, user.getLocation(), null); + if (!otherUser.isHidden() || Permissions.LIST_HIDDEN.isAuthorized(user)) + { + outputPosition(user, otherUser.getLocation(), user.getLocation()); + return; + } + } + outputPosition(user, user.getLocation(), null); } @Override diff --git a/Essentials/src/net/ess3/commands/Commandgive.java b/Essentials/src/net/ess3/commands/Commandgive.java index b42323d4a..abd8695b2 100644 --- a/Essentials/src/net/ess3/commands/Commandgive.java +++ b/Essentials/src/net/ess3/commands/Commandgive.java @@ -1,10 +1,10 @@ package net.ess3.commands; +import java.util.Locale; +import static net.ess3.I18n._; import net.ess3.api.IUser; import net.ess3.permissions.GivePermissions; -import static net.ess3.I18n._; - -import java.util.Locale; +import net.ess3.utils.Util; import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.enchantments.Enchantment; @@ -14,7 +14,6 @@ import org.bukkit.inventory.ItemStack; public class Commandgive extends EssentialsCommand { - //TODO: move these messages to message file @Override protected void run(final CommandSender sender, final String commandLabel, final String[] args) throws Exception { @@ -33,14 +32,19 @@ public class Commandgive extends EssentialsCommand throw new Exception(_("cantSpawnItem", itemname)); } - if (args.length > 2 && Integer.parseInt(args[2]) > 0) + if (args.length > 3 && Util.isInt(args[2]) && Util.isInt(args[3])) + { + stack.setAmount(Integer.parseInt(args[2])); + stack.setDurability(Short.parseShort(args[3])); + } + else if (args.length > 2 && Integer.parseInt(args[2]) > 0) { stack.setAmount(Integer.parseInt(args[2])); } if (args.length > 3) { - for (int i = 3; i < args.length; i++) + for (int i = Util.isInt(args[3]) ? 4 : 3; i < args.length; i++) { final String[] split = args[i].split("[:+',;.]", 2); if (split.length < 1) @@ -68,6 +72,7 @@ public class Commandgive extends EssentialsCommand giveTo.giveItems(stack, false); + //TODO: TL this. final String itemName = stack.getType().toString().toLowerCase(Locale.ENGLISH).replace('_', ' '); sender.sendMessage(ChatColor.BLUE + "Giving " + stack.getAmount() + " of " + itemName + " to " + giveTo.getDisplayName() + "."); diff --git a/Essentials/src/net/ess3/commands/Commandgod.java b/Essentials/src/net/ess3/commands/Commandgod.java index f2f3164da..c280472ef 100644 --- a/Essentials/src/net/ess3/commands/Commandgod.java +++ b/Essentials/src/net/ess3/commands/Commandgod.java @@ -16,7 +16,7 @@ public class Commandgod extends EssentialsCommand throw new NotEnoughArgumentsException(); } - godOtherPlayers(sender, args[0]); + godOtherPlayers(sender, args); } @Override @@ -24,23 +24,41 @@ public class Commandgod extends EssentialsCommand { if (args.length > 0 && !args[0].trim().isEmpty() && Permissions.GOD_OTHERS.isAuthorized(user)) { - godOtherPlayers(user, args[0]); + godOtherPlayers(user, args); return; } - user.sendMessage(_("godMode", (user.toggleGodModeEnabled() ? _("enabled") : _("disabled")))); + user.setGodModeEnabled(!user.isGodModeEnabled()); + user.sendMessage(_("godMode", (user.isGodModeEnabled() ? _("enabled") : _("disabled")))); } - private void godOtherPlayers(final CommandSender sender, final String name) + private void godOtherPlayers(final CommandSender sender, final String[] args) { - for (Player matchPlayer : server.matchPlayer(name)) + for (Player matchPlayer : server.matchPlayer(args[0])) { final IUser player = ess.getUser(matchPlayer); if (player.isHidden()) { continue; } - final boolean enabled = player.toggleGodModeEnabled(); + + if (args.length > 1) + { + if (args[1].contains("on") || args[1].contains("ena") || args[1].equalsIgnoreCase("1")) + { + player.setGodModeEnabled(true); + } + else + { + player.setGodModeEnabled(false); + } + } + else + { + player.setGodModeEnabled(!player.isGodModeEnabled()); + } + + final boolean enabled = player.isGodModeEnabled(); player.sendMessage(_("godMode", (enabled ? _("enabled") : _("disabled")))); sender.sendMessage(_("godMode", _(enabled ? "godEnabledFor" : "godDisabledFor", matchPlayer.getDisplayName()))); } diff --git a/Essentials/src/net/ess3/commands/Commandhat.java b/Essentials/src/net/ess3/commands/Commandhat.java new file mode 100644 index 000000000..18fb73cca --- /dev/null +++ b/Essentials/src/net/ess3/commands/Commandhat.java @@ -0,0 +1,57 @@ +package net.ess3.commands; + +import static net.ess3.I18n._; +import net.ess3.api.IUser; +import net.ess3.craftbukkit.InventoryWorkaround; +import org.bukkit.Material; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.PlayerInventory; + + +public class Commandhat extends EssentialsCommand +{ + @Override + protected void run(IUser user, String commandLabel, String[] args) throws Exception + { + if (args.length > 0 && (args[0].contains("rem") || args[0].contains("off") || args[0].equalsIgnoreCase("0"))) + { + final PlayerInventory inv = user.getInventory(); + final ItemStack head = inv.getHelmet(); + if (head == null || head.getType() == Material.AIR) + { + user.sendMessage(_("hatEmpty")); + } + else + { + final ItemStack air = new ItemStack(Material.AIR); + inv.setHelmet(air); + InventoryWorkaround.addItem(user.getInventory(), true, head); + user.sendMessage(_("hatRemoved")); + } + } + else + { + if (user.getItemInHand().getType() != Material.AIR) + { + final ItemStack hand = user.getItemInHand(); + if (hand.getType().getMaxDurability() == 0) + { + final PlayerInventory inv = user.getInventory(); + final ItemStack head = inv.getHelmet(); + inv.removeItem(hand); + inv.setHelmet(hand); + inv.setItemInHand(head); + user.sendMessage(_("hatPlaced")); + } + else + { + user.sendMessage(_("hatArmor")); + } + } + else + { + user.sendMessage(_("hatFail")); + } + } + } +} diff --git a/Essentials/src/net/ess3/commands/Commandheal.java b/Essentials/src/net/ess3/commands/Commandheal.java index eb5f34854..087947fd6 100644 --- a/Essentials/src/net/ess3/commands/Commandheal.java +++ b/Essentials/src/net/ess3/commands/Commandheal.java @@ -1,11 +1,11 @@ package net.ess3.commands; +import java.util.List; import static net.ess3.I18n._; import net.ess3.api.IUser; import net.ess3.api.server.CommandSender; import net.ess3.permissions.Permissions; import net.ess3.user.UserData.TimestampType; -import java.util.List; import org.bukkit.entity.Player; @@ -26,6 +26,7 @@ public class Commandheal extends EssentialsCommand user.checkCooldown(TimestampType.LASTHEAL, ess.getRanks().getHealCooldown(user), true, Permissions.HEAL_COOLDOWN_BYPASS); user.setHealth(20); + user.setFireTicks(0); user.setFoodLevel(20); user.sendMessage(_("heal")); } diff --git a/Essentials/src/net/ess3/commands/Commandhelp.java b/Essentials/src/net/ess3/commands/Commandhelp.java index 401259fa2..78c1691b0 100644 --- a/Essentials/src/net/ess3/commands/Commandhelp.java +++ b/Essentials/src/net/ess3/commands/Commandhelp.java @@ -1,13 +1,11 @@ package net.ess3.commands; -import net.ess3.utils.textreader.TextInput; -import net.ess3.utils.textreader.IText; -import net.ess3.utils.textreader.TextPager; -import net.ess3.utils.textreader.HelpInput; -import net.ess3.utils.textreader.KeywordReplacer; +import java.util.Locale; import static net.ess3.I18n._; -import net.ess3.utils.Util; import net.ess3.api.IUser; +import net.ess3.utils.Util; +import net.ess3.utils.textreader.*; + public class Commandhelp extends EssentialsCommand @@ -18,6 +16,7 @@ public class Commandhelp extends EssentialsCommand IText output; String pageStr = args.length > 0 ? args[0] : null; String chapterPageStr = args.length > 1 ? args[1] : null; + String command = commandLabel; final IText input = new TextInput(user, "help", false, ess); if (input.getLines().isEmpty()) @@ -28,7 +27,12 @@ public class Commandhelp extends EssentialsCommand } else { - output = new HelpInput(user, pageStr, ess); + if (pageStr.length() > 26) + { + pageStr = pageStr.substring(0, 25); + } + output = new HelpInput(user, pageStr.toLowerCase(Locale.ENGLISH), ess); + command = command.concat(" ").concat(pageStr); pageStr = chapterPageStr; } chapterPageStr = null; @@ -38,7 +42,7 @@ public class Commandhelp extends EssentialsCommand output = new KeywordReplacer(input, user, ess); } final TextPager pager = new TextPager(output); - pager.showPage(pageStr, chapterPageStr, commandLabel, user); + pager.showPage(pageStr, chapterPageStr, command, user); } @Override diff --git a/Essentials/src/net/ess3/commands/Commandhelpop.java b/Essentials/src/net/ess3/commands/Commandhelpop.java index e36cb1871..a4bae3b44 100644 --- a/Essentials/src/net/ess3/commands/Commandhelpop.java +++ b/Essentials/src/net/ess3/commands/Commandhelpop.java @@ -1,9 +1,5 @@ package net.ess3.commands; -import static net.ess3.I18n._; -import net.ess3.utils.Util; -import net.ess3.api.IUser; -import net.ess3.permissions.Permissions; import java.util.logging.Level; @@ -16,8 +12,8 @@ public class Commandhelpop extends EssentialsCommand { throw new NotEnoughArgumentsException(); } - - final String message = _("helpOp", user.getDisplayName(), Util.stripColor(getFinalArg(args, 0))); + user.setDisplayNick(); + final String message = _("helpOp", user.getDisplayName(), Util.stripFormat(getFinalArg(args, 0))); logger.log(Level.INFO, message); for (Player onlinePlayer : server.getOnlinePlayers()) { diff --git a/Essentials/src/net/ess3/commands/Commandhome.java b/Essentials/src/net/ess3/commands/Commandhome.java index 755676609..9d1459659 100644 --- a/Essentials/src/net/ess3/commands/Commandhome.java +++ b/Essentials/src/net/ess3/commands/Commandhome.java @@ -1,12 +1,13 @@ package net.ess3.commands; +import java.util.List; +import java.util.Locale; import static net.ess3.I18n._; -import net.ess3.economy.Trade; -import net.ess3.utils.Util; import net.ess3.api.IUser; +import net.ess3.economy.Trade; import net.ess3.permissions.Permissions; -import java.util.List; -import java.util.Locale; +import net.ess3.permissions.WorldPermissions; +import net.ess3.utils.Util; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; @@ -49,7 +50,7 @@ public class Commandhome extends EssentialsCommand throw new NoChargeException(); } } - user.getTeleport().home(player, homeName.toLowerCase(Locale.ENGLISH), charge); + goHome(user, player, homeName.toLowerCase(Locale.ENGLISH), charge); } catch (NotEnoughArgumentsException e) { @@ -75,7 +76,7 @@ public class Commandhome extends EssentialsCommand } else if (homes.size() == 1 && player.equals(user)) { - user.getTeleport().home(player, homes.get(0), charge); + goHome(user, player, homes.get(0), charge); } else { @@ -88,4 +89,19 @@ public class Commandhome extends EssentialsCommand } throw new NoChargeException(); } + + private void goHome(final IUser user, final IUser player, final String home, final Trade charge) throws Exception + { + final Location loc = player.getHome(home); + if (loc == null) + { + throw new NotEnoughArgumentsException(); + } + if (user.getWorld() != loc.getWorld() && ess.getSettings().getData().getGeneral().isWorldHomePermissions() + && !WorldPermissions.getPermission(loc.getWorld().getName()).isAuthorized(user)) + { + throw new Exception(_("noPerm", "essentials.world." + loc.getWorld().getName())); + } + user.getTeleport().home(loc, charge); + } } diff --git a/Essentials/src/net/ess3/commands/Commandignore.java b/Essentials/src/net/ess3/commands/Commandignore.java index 82bb57cae..af9f2b710 100644 --- a/Essentials/src/net/ess3/commands/Commandignore.java +++ b/Essentials/src/net/ess3/commands/Commandignore.java @@ -26,16 +26,16 @@ public class Commandignore extends EssentialsCommand { throw new Exception(_("playerNotFound")); } - final String name = player.getName(); + user.acquireWriteLock(); - if (user.isIgnoringPlayer(name)) + if (user.isIgnoringPlayer(player)) { - user.setIgnoredPlayer(name, false); + user.setIgnoredPlayer(player, false); user.sendMessage(_("unignorePlayer", player.getName())); } else { - user.setIgnoredPlayer(name, true); + user.setIgnoredPlayer(player, true); user.sendMessage(_("ignorePlayer", player.getName())); } } diff --git a/Essentials/src/net/ess3/commands/Commanditemdb.java b/Essentials/src/net/ess3/commands/Commanditemdb.java index 2c4129fd5..e298df0d7 100644 --- a/Essentials/src/net/ess3/commands/Commanditemdb.java +++ b/Essentials/src/net/ess3/commands/Commanditemdb.java @@ -1,5 +1,9 @@ package net.ess3.commands; +//TODO - replace alll the bukkit imports +import static net.ess3.I18n._; +import org.bukkit.Material; +import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; @@ -26,5 +30,16 @@ public class Commanditemdb extends EssentialsCommand itemStack = ess.getItemDb().get(args[0]); } sender.sendMessage(itemStack.getType().toString() + "- " + itemStack.getTypeId() + ":" + Integer.toString(itemStack.getData().getData())); + + + if (itemStack.getType() != Material.AIR) + { + int maxuses = itemStack.getType().getMaxDurability(); + int durability = ((maxuses + 1) - itemStack.getDurability()); + if (maxuses != 0) + { + sender.sendMessage(_("durability", Integer.toString(durability))); + } + } } } diff --git a/Essentials/src/net/ess3/commands/Commandjump.java b/Essentials/src/net/ess3/commands/Commandjump.java index 4e9eb491e..46c7b488c 100644 --- a/Essentials/src/net/ess3/commands/Commandjump.java +++ b/Essentials/src/net/ess3/commands/Commandjump.java @@ -32,5 +32,6 @@ public class Commandjump extends EssentialsCommand final Trade charge = new Trade(commandName, ess); charge.isAffordableFor(user); user.getTeleport().teleport(loc, charge, TeleportCause.COMMAND); + throw new NoChargeException(); } } diff --git a/Essentials/src/net/ess3/commands/Commandkill.java b/Essentials/src/net/ess3/commands/Commandkill.java index 401302177..0ab789af4 100644 --- a/Essentials/src/net/ess3/commands/Commandkill.java +++ b/Essentials/src/net/ess3/commands/Commandkill.java @@ -18,15 +18,14 @@ public class Commandkill extends EssentialsCommand for (Player matchPlayer : server.matchPlayer(args[0])) { - final EntityDamageEvent ede = new EntityDamageEvent(matchPlayer, sender instanceof Player && ((Player)sender).getName().equals(matchPlayer.getName()) ? EntityDamageEvent.DamageCause.SUICIDE : EntityDamageEvent.DamageCause.CUSTOM, 1000); + final EntityDamageEvent ede = new EntityDamageEvent(matchPlayer, sender instanceof Player && ((Player)sender).getName().equals(matchPlayer.getName()) ? EntityDamageEvent.DamageCause.SUICIDE : EntityDamageEvent.DamageCause.CUSTOM, Short.MAX_VALUE); server.getPluginManager().callEvent(ede); if (ede.isCancelled() && !sender.hasPermission("essentials.kill.force")) { continue; } - matchPlayer.damage(1000); - matchPlayer.setHealth(0); + matchPlayer.damage(Short.MAX_VALUE); sender.sendMessage(_("kill", matchPlayer.getDisplayName())); } } diff --git a/Essentials/src/net/ess3/commands/Commandkillall.java b/Essentials/src/net/ess3/commands/Commandkillall.java index b3b3390b4..7e6f8a2b1 100644 --- a/Essentials/src/net/ess3/commands/Commandkillall.java +++ b/Essentials/src/net/ess3/commands/Commandkillall.java @@ -5,6 +5,8 @@ import static net.ess3.I18n._; import net.ess3.bukkit.Mob; import java.util.Collections; import java.util.Locale; +import static net.ess3.I18n._; +import net.ess3.bukkit.Mob; import org.bukkit.Chunk; import org.bukkit.World; import org.bukkit.entity.*; @@ -43,7 +45,7 @@ public class Commandkillall extends EssentialsCommand } catch (NumberFormatException e) { - throw new Exception(_("numberRequired")); + throw new Exception(_("numberRequired"), e); } } } @@ -103,6 +105,13 @@ public class Commandkillall extends EssentialsCommand continue; } } + if(entity instanceof Ocelot) + { + if (((Ocelot)entity).isTamed()) + { + continue; + } + } if (animals) { if (entity instanceof Animals || entity instanceof NPC || entity instanceof Snowman || entity instanceof WaterMob) diff --git a/Essentials/src/net/ess3/commands/Commandkittycannon.java b/Essentials/src/net/ess3/commands/Commandkittycannon.java index fc625e986..72dede652 100644 --- a/Essentials/src/net/ess3/commands/Commandkittycannon.java +++ b/Essentials/src/net/ess3/commands/Commandkittycannon.java @@ -1,8 +1,9 @@ package net.ess3.commands; -import net.ess3.bukkit.Mob; -import net.ess3.api.IUser; + import java.util.Random; +import net.ess3.api.IUser; +import net.ess3.bukkit.Mob; import org.bukkit.Location; import org.bukkit.entity.Ocelot; @@ -35,4 +36,4 @@ public class Commandkittycannon extends EssentialsCommand } }, 20); } -} +}
\ No newline at end of file diff --git a/Essentials/src/net/ess3/commands/Commandlightning.java b/Essentials/src/net/ess3/commands/Commandlightning.java index 07d8ec10b..8fe876cf9 100644 --- a/Essentials/src/net/ess3/commands/Commandlightning.java +++ b/Essentials/src/net/ess3/commands/Commandlightning.java @@ -31,7 +31,7 @@ public class Commandlightning extends EssentialsCommand throw new Exception(_("playerNotFound")); } - int power = 1; + int power = 5; if (args.length > 1) { try @@ -46,18 +46,10 @@ public class Commandlightning extends EssentialsCommand for (Player matchPlayer : server.matchPlayer(args[0])) { sender.sendMessage(_("lightningUse", matchPlayer.getDisplayName())); - if (power <= 0) - { - matchPlayer.getWorld().strikeLightningEffect(matchPlayer.getLocation()); - } - else - { - LightningStrike strike = matchPlayer.getWorld().strikeLightning(matchPlayer.getLocation()); - matchPlayer.damage(power - 1, strike); - } + final LightningStrike strike = matchPlayer.getWorld().strikeLightningEffect(matchPlayer.getLocation()); if (!ess.getUser(matchPlayer).isGodModeEnabled()) { - matchPlayer.setHealth(matchPlayer.getHealth() < 5 ? 0 : matchPlayer.getHealth() - 5); + matchPlayer.damage(power, strike); } @Cleanup final ISettings settings = ess.getSettings(); diff --git a/Essentials/src/net/ess3/commands/Commandlist.java b/Essentials/src/net/ess3/commands/Commandlist.java index 1a026d970..64e352731 100644 --- a/Essentials/src/net/ess3/commands/Commandlist.java +++ b/Essentials/src/net/ess3/commands/Commandlist.java @@ -74,7 +74,7 @@ public class Commandlist extends EssentialsCommand for (String group : groups) { final StringBuilder groupString = new StringBuilder(); - groupString.append(_("listGroupTag",Util.replaceColor(group))); + groupString.append(_("listGroupTag",Util.replaceFormat(group))); final List<IUser> users = sort.get(group); Collections.sort(users); boolean first = true; @@ -104,6 +104,7 @@ public class Commandlist extends EssentialsCommand { groupString.append(_("listHiddenTag")); } + user.setDisplayNick(); groupString.append(user.getDisplayName()); groupString.append("ยงf"); } @@ -153,6 +154,7 @@ public class Commandlist extends EssentialsCommand { onlineUsers.append(_("listHiddenTag")); } + user.setDisplayNick(); onlineUsers.append(user.getDisplayName()); onlineUsers.append("ยงf"); } diff --git a/Essentials/src/net/ess3/commands/Commandmail.java b/Essentials/src/net/ess3/commands/Commandmail.java index 4f94f067c..98a9a8ad9 100644 --- a/Essentials/src/net/ess3/commands/Commandmail.java +++ b/Essentials/src/net/ess3/commands/Commandmail.java @@ -51,9 +51,9 @@ public class Commandmail extends EssentialsCommand { throw new Exception(_("playerNeverOnServer", args[1])); } - if (!u.isIgnoringPlayer(user.getName())) + if (!u.isIgnoringPlayer(user)) { - final String mail = Util.sanitizeString(Util.stripColor(getFinalArg(args, 2))); + final String mail = Util.sanitizeString(Util.stripFormat(getFinalArg(args, 2))); u.addMail(user.getName() + ": " + mail); } user.sendMessage(_("mailSent")); diff --git a/Essentials/src/net/ess3/commands/Commandme.java b/Essentials/src/net/ess3/commands/Commandme.java index 7b756a592..fb62ec234 100644 --- a/Essentials/src/net/ess3/commands/Commandme.java +++ b/Essentials/src/net/ess3/commands/Commandme.java @@ -24,13 +24,14 @@ public class Commandme extends EssentialsCommand String message = getFinalArg(args, 0); if (Permissions.CHAT_COLOR.isAuthorized(user)) { - message = Util.replaceColor(message); + message = Util.replaceFormat(message); } else { message = Util.stripColor(message); } + user.setDisplayNick(); ess.broadcastMessage(user, _("action", user.getDisplayName(), message)); } } diff --git a/Essentials/src/net/ess3/commands/Commandmotd.java b/Essentials/src/net/ess3/commands/Commandmotd.java index 91470a1af..907a41b34 100644 --- a/Essentials/src/net/ess3/commands/Commandmotd.java +++ b/Essentials/src/net/ess3/commands/Commandmotd.java @@ -4,12 +4,13 @@ import net.ess3.utils.textreader.IText; import net.ess3.utils.textreader.KeywordReplacer; import net.ess3.utils.textreader.TextInput; import net.ess3.utils.textreader.TextPager; +import org.bukkit.command.CommandSender; public class Commandmotd extends EssentialsCommand { @Override - protected void run(final CommandSender sender, final String commandLabel, final String[] args) throws Exception + public void run(final CommandSender sender, final String commandLabel, final String[] args) throws Exception { final IText input = new TextInput(sender, "motd", true, ess); final IText output = new KeywordReplacer(input, sender, ess); diff --git a/Essentials/src/net/ess3/commands/Commandmsg.java b/Essentials/src/net/ess3/commands/Commandmsg.java index 77705d36c..a1d0b614d 100644 --- a/Essentials/src/net/ess3/commands/Commandmsg.java +++ b/Essentials/src/net/ess3/commands/Commandmsg.java @@ -17,7 +17,7 @@ public class Commandmsg extends EssentialsCommand @Override protected void run(final CommandSender sender, final String commandLabel, final String[] args) throws Exception { - if (args.length < 2 || args[0].trim().isEmpty() || args[1].trim().isEmpty()) + if (args.length < 2 || args[0].trim().length() < 3 || args[1].trim().isEmpty()) { throw new NotEnoughArgumentsException(); } @@ -34,7 +34,7 @@ public class Commandmsg extends EssentialsCommand } if (Permissions.MSG_COLOR.isAuthorized(user)) { - message = Util.replaceColor(message); + message = Util.replaceFormat(message); } else { @@ -43,7 +43,7 @@ public class Commandmsg extends EssentialsCommand } else { - message = Util.replaceColor(message); + message = Util.replaceFormat(message); } final String translatedMe = _("me"); @@ -86,7 +86,7 @@ public class Commandmsg extends EssentialsCommand { sender.sendMessage(_("msgFormat", translatedMe, matchedPlayer.getDisplayName(), message)); final IUser matchedUser = ess.getUser(matchedPlayer); - if (sender instanceof Player && (matchedUser.isIgnoringPlayer(((Player)sender).getName()) || matchedUser.isHidden())) + if (sender instanceof Player && (matchedUser.isIgnoringPlayer(ess.getUser((Player)sender)) || matchedUser.isHidden())) { continue; } diff --git a/Essentials/src/net/ess3/commands/Commandmute.java b/Essentials/src/net/ess3/commands/Commandmute.java index d0e257b33..abbe78d9c 100644 --- a/Essentials/src/net/ess3/commands/Commandmute.java +++ b/Essentials/src/net/ess3/commands/Commandmute.java @@ -21,19 +21,25 @@ public class Commandmute extends EssentialsCommand @Cleanup final IUser player = getPlayer(args, 0, true); - player.acquireReadLock(); + player.acquireReadLock(); if (!player.getData().isMuted() && Permissions.MUTE_EXEMPT.isAuthorized(player)) { throw new Exception(_("muteExempt")); } long muteTimestamp = 0; + if (args.length > 1) { - String time = getFinalArg(args, 1); + final String time = getFinalArg(args, 1); muteTimestamp = DateUtil.parseDateDiff(time, true); + player.setMuted(true); + } + else + { + player.setMuted(!player.getData().isMuted()); } player.setTimestamp(TimestampType.MUTE, muteTimestamp); - final boolean muted = player.toggleMuted(); + final boolean muted = player.getData().isMuted(); sender.sendMessage( muted ? (muteTimestamp > 0 diff --git a/Essentials/src/net/ess3/commands/Commandnick.java b/Essentials/src/net/ess3/commands/Commandnick.java index 96455e85e..19c89fef8 100644 --- a/Essentials/src/net/ess3/commands/Commandnick.java +++ b/Essentials/src/net/ess3/commands/Commandnick.java @@ -1,12 +1,13 @@ package net.ess3.commands; +import java.util.Locale; +import lombok.Cleanup; import static net.ess3.I18n._; -import net.ess3.utils.Util; import net.ess3.api.ISettings; import net.ess3.api.IUser; import net.ess3.permissions.Permissions; -import java.util.Locale; -import lombok.Cleanup; +import net.ess3.utils.Util; +//TODO - Remove bukkit import org.bukkit.Server; import org.bukkit.entity.Player; @@ -69,9 +70,11 @@ public class Commandnick extends EssentialsCommand { if (user == null || Permissions.NICK_COLOR.isAuthorized(user)) { - return nick.replace('&', '\u00a7').replaceAll("\u00a7+k", ""); - } else { - return Util.stripColor(nick); + return Util.replaceFormat(nick); + } + else + { + return Util.formatString(user, "essentials.nick", nick); } } diff --git a/Essentials/src/net/ess3/commands/Commandnuke.java b/Essentials/src/net/ess3/commands/Commandnuke.java index bde21f7e1..0154e3dc2 100644 --- a/Essentials/src/net/ess3/commands/Commandnuke.java +++ b/Essentials/src/net/ess3/commands/Commandnuke.java @@ -1,10 +1,9 @@ package net.ess3.commands; -import static net.ess3.I18n._; - import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import static net.ess3.I18n._; import org.bukkit.Location; import org.bukkit.World; import org.bukkit.entity.Player; diff --git a/Essentials/src/net/ess3/commands/Commandpay.java b/Essentials/src/net/ess3/commands/Commandpay.java index f1894d337..d60f6ea18 100644 --- a/Essentials/src/net/ess3/commands/Commandpay.java +++ b/Essentials/src/net/ess3/commands/Commandpay.java @@ -16,14 +16,14 @@ public class Commandpay extends EssentialsCommand throw new NotEnoughArgumentsException(); } - if (args[0] == "") + if (args[0].trim().length() < 3) { throw new NotEnoughArgumentsException("You need to specify a player to pay."); } double amount = Double.parseDouble(args[1].replaceAll("[^0-9\\.]", "")); - Boolean foundUser = false; + boolean foundUser = false; for (Player p : server.matchPlayer(args[0])) { IUser u = ess.getUser(p); @@ -36,7 +36,7 @@ public class Commandpay extends EssentialsCommand foundUser = true; } - if (foundUser == false) + if (!foundUser) { throw new NoSuchFieldException(_("playerNotFound")); } diff --git a/Essentials/src/net/ess3/commands/Commandping.java b/Essentials/src/net/ess3/commands/Commandping.java index 77b7a82c0..1aebfa971 100644 --- a/Essentials/src/net/ess3/commands/Commandping.java +++ b/Essentials/src/net/ess3/commands/Commandping.java @@ -16,7 +16,7 @@ public class Commandping extends EssentialsCommand } else { - user.sendMessage(Util.replaceColor(getFinalArg(args, 0))); + user.sendMessage(Util.replaceFormat(getFinalArg(args, 0))); } } } diff --git a/Essentials/src/net/ess3/commands/Commandpowertool.java b/Essentials/src/net/ess3/commands/Commandpowertool.java index ad201f5c8..35ccae49a 100644 --- a/Essentials/src/net/ess3/commands/Commandpowertool.java +++ b/Essentials/src/net/ess3/commands/Commandpowertool.java @@ -1,12 +1,13 @@ package net.ess3.commands; -import static net.ess3.I18n._; -import net.ess3.utils.Util; -import net.ess3.api.IUser; -import net.ess3.permissions.Permissions; import java.util.ArrayList; import java.util.List; import java.util.Locale; +import static net.ess3.I18n._; +import net.ess3.api.IUser; +import net.ess3.permissions.Permissions; +import net.ess3.utils.Util; +//TODO remove bukkit import org.bukkit.Material; import org.bukkit.inventory.ItemStack; @@ -34,6 +35,7 @@ public class Commandpowertool extends EssentialsCommand } final String itemName = itemStack.getType().toString().toLowerCase(Locale.ENGLISH).replaceAll("_", " "); + user.acquireReadLock(); List<String> powertools = user.getData().getPowertool(itemStack.getType()); if (command != null && !command.isEmpty()) { @@ -47,26 +49,18 @@ public class Commandpowertool extends EssentialsCommand { user.sendMessage(_("powerToolList", Util.joinList(powertools), itemName)); } - return; + throw new NoChargeException(); } if (command.startsWith("r:")) { - try - { - command = command.substring(2); - if (!powertools.contains(command)) - { - throw new Exception(_("powerToolNoSuchCommandAssigned", command, itemName)); - } - - powertools.remove(command); - user.sendMessage(_("powerToolRemove", command, itemName)); - } - catch (Exception e) + command = command.substring(2); + if (!powertools.contains(command)) { - user.sendMessage(e.getMessage()); - return; + throw new Exception(_("powerToolNoSuchCommandAssigned", command, itemName)); } + + powertools.remove(command); + user.sendMessage(_("powerToolRemove", command, itemName)); } else { @@ -81,7 +75,6 @@ public class Commandpowertool extends EssentialsCommand { throw new Exception(_("powerToolAlreadySet", command, itemName)); } - } else if (powertools != null && !powertools.isEmpty()) { @@ -106,6 +99,11 @@ public class Commandpowertool extends EssentialsCommand user.sendMessage(_("powerToolRemoveAll", itemName)); } + if (!user.getData().isPowerToolsEnabled()) + { + user.getData().setPowerToolsEnabled(true); + user.sendMessage(_("powerToolsEnabled")); + } user.acquireWriteLock(); user.getData().setPowertool(itemStack.getType(), powertools); } diff --git a/Essentials/src/net/ess3/commands/Commandptime.java b/Essentials/src/net/ess3/commands/Commandptime.java index f3185c25e..1ba413407 100644 --- a/Essentials/src/net/ess3/commands/Commandptime.java +++ b/Essentials/src/net/ess3/commands/Commandptime.java @@ -1,10 +1,11 @@ package net.ess3.commands; -import net.ess3.utils.DescParseTickFormat; +import java.util.*; import static net.ess3.I18n._; import net.ess3.api.IUser; import net.ess3.permissions.Permissions; -import java.util.*; +import net.ess3.utils.DescParseTickFormat; +//TODO - Remove bukkit import org.bukkit.World; import org.bukkit.entity.Player; @@ -49,7 +50,7 @@ public class Commandptime extends EssentialsCommand Long ticks; // Parse the target time int ticks from args[0] String timeParam = args[0]; - Boolean relative = true; + boolean relative = true; if (timeParam.startsWith("@")) { relative = false; @@ -73,7 +74,7 @@ public class Commandptime extends EssentialsCommand } catch (NumberFormatException e) { - throw new NotEnoughArgumentsException(); + throw new NotEnoughArgumentsException(e); } } @@ -114,7 +115,7 @@ public class Commandptime extends EssentialsCommand /** * Used to set the time and inform of the change */ - private void setUsersTime(final CommandSender sender, final Collection<IUser> users, final Long ticks, Boolean relative) + private void setUsersTime(final CommandSender sender, final Collection<IUser> users, final Long ticks, boolean relative) { // Update the time if (ticks == null) diff --git a/Essentials/src/net/ess3/commands/Commandr.java b/Essentials/src/net/ess3/commands/Commandr.java index 0dc62ea6d..1f428432d 100644 --- a/Essentials/src/net/ess3/commands/Commandr.java +++ b/Essentials/src/net/ess3/commands/Commandr.java @@ -6,6 +6,7 @@ import net.ess3.utils.Util; import net.ess3.api.IReplyTo; import net.ess3.api.IUser; import net.ess3.permissions.Permissions; +//TODO - Remove bukkit import org.bukkit.entity.Player; @@ -28,18 +29,18 @@ public class Commandr extends EssentialsCommand IUser user = ess.getUser((Player)sender); if (Permissions.MSG_COLOR.isAuthorized(user)) { - message = Util.replaceColor(message); + message = Util.replaceFormat(message); } else { - message = Util.stripColor(message); + message = Util.replaceFormat(message); } replyTo = user; senderName = user.getDisplayName(); } else { - message = Util.replaceColor(message); + message = Util.replaceFormat(message); replyTo = Console.getConsoleReplyTo(); senderName = Console.NAME; } @@ -56,7 +57,7 @@ public class Commandr extends EssentialsCommand if (target instanceof Player) { IUser player = ess.getUser((Player)target); - if (player.isIgnoringPlayer(sender instanceof Player ? ((Player)sender).getName() : Console.NAME)) + if (sender instanceof Player && player.isIgnoringPlayer(ess.getUser((Player)sender))) { return; } diff --git a/Essentials/src/net/ess3/commands/Commandrealname.java b/Essentials/src/net/ess3/commands/Commandrealname.java index f699f2417..bcbdd6ae1 100644 --- a/Essentials/src/net/ess3/commands/Commandrealname.java +++ b/Essentials/src/net/ess3/commands/Commandrealname.java @@ -1,13 +1,12 @@ package net.ess3.commands; +import java.util.Locale; +import lombok.Cleanup; import static net.ess3.I18n._; -import net.ess3.utils.Util; import net.ess3.api.ISettings; import net.ess3.api.IUser; - -import java.util.Locale; -import lombok.Cleanup; -import org.bukkit.entity.Player; +import net.ess3.utils.Util; +//TODO - Remove bukkitimport org.bukkit.entity.Player; public class Commandrealname extends EssentialsCommand @@ -29,10 +28,11 @@ public class Commandrealname extends EssentialsCommand { continue; } - final String displayName = Util.stripColor(u.getDisplayName()).toLowerCase(Locale.ENGLISH); + u.setDisplayNick(); + final String displayName = Util.stripFormat(u.getDisplayName()).toLowerCase(Locale.ENGLISH); settings.acquireReadLock(); if (!whois.equals(displayName) - && !displayName.equals(Util.stripColor(settings.getData().getChat().getNicknamePrefix()) + whois) + && !displayName.equals(Util.stripFormat(settings.getData().getChat().getNicknamePrefix()) + whois) && !whois.equalsIgnoreCase(u.getName())) { continue; diff --git a/Essentials/src/net/ess3/commands/Commandremove.java b/Essentials/src/net/ess3/commands/Commandremove.java index 8339b13a2..897d90e37 100644 --- a/Essentials/src/net/ess3/commands/Commandremove.java +++ b/Essentials/src/net/ess3/commands/Commandremove.java @@ -1,14 +1,13 @@ package net.ess3.commands; +import java.util.Locale; import static net.ess3.I18n._; import net.ess3.api.IUser; - -import java.util.Locale; import org.bukkit.Chunk; import org.bukkit.World; import org.bukkit.entity.*; - +//Todo: Fix this up public class Commandremove extends EssentialsCommand { private enum ToRemove @@ -40,7 +39,7 @@ public class Commandremove extends EssentialsCommand } catch (NumberFormatException e) { - throw new Exception(_("numberRequired")); + throw new Exception(_("numberRequired"), e); } } @@ -50,7 +49,7 @@ public class Commandremove extends EssentialsCommand } catch (IllegalArgumentException e) { - throw new NotEnoughArgumentsException(); //TODO: translate and list types + throw new NotEnoughArgumentsException(e); //TODO: translate and list types } removeEntities(user, world, toRemove, radius); @@ -77,7 +76,7 @@ public class Commandremove extends EssentialsCommand } catch (IllegalArgumentException e) { - throw new NotEnoughArgumentsException(); //TODO: translate and list types + throw new NotEnoughArgumentsException(e); //TODO: translate and list types } removeEntities(sender, world, toRemove, 0); } @@ -124,7 +123,7 @@ public class Commandremove extends EssentialsCommand removed++; } } - else if (toRemove == ToRemove.DROPS) + else if (toRemove == ToRemove.MINECARTS) { if (e instanceof Minecart) { diff --git a/Essentials/src/net/ess3/commands/Commandrepair.java b/Essentials/src/net/ess3/commands/Commandrepair.java index e1845e76b..9762fc767 100644 --- a/Essentials/src/net/ess3/commands/Commandrepair.java +++ b/Essentials/src/net/ess3/commands/Commandrepair.java @@ -1,14 +1,14 @@ package net.ess3.commands; -import net.ess3.api.ChargeException; -import static net.ess3.I18n._; -import net.ess3.economy.Trade; -import net.ess3.utils.Util; -import net.ess3.api.IUser; -import net.ess3.permissions.Permissions; import java.util.ArrayList; import java.util.List; import java.util.Locale; +import static net.ess3.I18n._; +import net.ess3.api.ChargeException; +import net.ess3.api.IUser; +import net.ess3.economy.Trade; +import net.ess3.permissions.Permissions; +import net.ess3.utils.Util; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; @@ -50,6 +50,8 @@ public class Commandrepair extends EssentialsCommand } else if (args[0].equalsIgnoreCase("all")) { + final Trade charge = new Trade("repair-all", ess); + charge.isAffordableFor(user); final List<String> repaired = new ArrayList<String>(); repairItems(user.getInventory().getContents(), user, repaired); @@ -66,6 +68,7 @@ public class Commandrepair extends EssentialsCommand { user.sendMessage(_("repair", Util.joinList(repaired))); } + charge.charge(user); } else @@ -99,7 +102,7 @@ public class Commandrepair extends EssentialsCommand continue; } final String itemName = item.getType().toString().toLowerCase(Locale.ENGLISH); - final Trade charge = new Trade("repair-" + itemName.replace('_', '-'), ess); + final Trade charge = new Trade("repair-" + itemName.replace('_', '-'), "repair-item", ess); try { charge.isAffordableFor(user); diff --git a/Essentials/src/net/ess3/commands/Commandrules.java b/Essentials/src/net/ess3/commands/Commandrules.java index 7681b987e..1e15a6097 100644 --- a/Essentials/src/net/ess3/commands/Commandrules.java +++ b/Essentials/src/net/ess3/commands/Commandrules.java @@ -4,12 +4,13 @@ import net.ess3.utils.textreader.IText; import net.ess3.utils.textreader.KeywordReplacer; import net.ess3.utils.textreader.TextInput; import net.ess3.utils.textreader.TextPager; +import org.bukkit.command.CommandSender; public class Commandrules extends EssentialsCommand { @Override - protected void run(final CommandSender sender, final String commandLabel, final String[] args) throws Exception + public void run(final CommandSender sender, final String commandLabel, final String[] args) throws Exception { final IText input = new TextInput(sender, "rules", true, ess); final IText output = new KeywordReplacer(input, sender, ess); diff --git a/Essentials/src/net/ess3/commands/Commandsell.java b/Essentials/src/net/ess3/commands/Commandsell.java index a4e73661d..cc3671629 100644 --- a/Essentials/src/net/ess3/commands/Commandsell.java +++ b/Essentials/src/net/ess3/commands/Commandsell.java @@ -1,12 +1,12 @@ package net.ess3.commands; +import java.util.Locale; +import java.util.logging.Level; import static net.ess3.I18n._; -import net.ess3.economy.Trade; -import net.ess3.utils.Util; import net.ess3.api.IUser; import net.ess3.craftbukkit.InventoryWorkaround; -import java.util.Locale; -import java.util.logging.Level; +import net.ess3.economy.Trade; +import net.ess3.utils.Util; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; diff --git a/Essentials/src/net/ess3/commands/Commandsethome.java b/Essentials/src/net/ess3/commands/Commandsethome.java index 91b07286d..00e3a0170 100644 --- a/Essentials/src/net/ess3/commands/Commandsethome.java +++ b/Essentials/src/net/ess3/commands/Commandsethome.java @@ -1,11 +1,11 @@ package net.ess3.commands; -import static net.ess3.I18n._; -import net.ess3.api.IUser; -import net.ess3.permissions.Permissions; import java.util.HashMap; import java.util.Locale; import lombok.Cleanup; +import static net.ess3.I18n._; +import net.ess3.api.IUser; +import net.ess3.permissions.Permissions; public class Commandsethome extends EssentialsCommand @@ -26,7 +26,8 @@ public class Commandsethome extends EssentialsCommand { if (Permissions.SETHOME_MULTIPLE.isAuthorized(user)) { - if ("bed".equals(args[0].toLowerCase(Locale.ENGLISH))) { + if ("bed".equals(args[0].toLowerCase(Locale.ENGLISH))) + { throw new NotEnoughArgumentsException(); } if ((user.getHomes().size() < ess.getRanks().getHomeLimit(user)) @@ -65,7 +66,8 @@ public class Commandsethome extends EssentialsCommand { name = "home"; } - if ("bed".equals(name.toLowerCase(Locale.ENGLISH))) { + if ("bed".equals(name.toLowerCase(Locale.ENGLISH))) + { throw new NotEnoughArgumentsException(); } @@ -87,7 +89,7 @@ public class Commandsethome extends EssentialsCommand } user.getData().getHomes().put("home", new net.ess3.storage.StoredLocation(user.getLocation())); } - user.sendMessage(_("homeSet")); + user.sendMessage(_("homeSet", user.getLocation().getWorld().getName(), user.getLocation().getBlockX(), user.getLocation().getBlockY(), user.getLocation().getBlockZ())); } } diff --git a/Essentials/src/net/ess3/commands/Commandsetjail.java b/Essentials/src/net/ess3/commands/Commandsetjail.java index 344b41fc9..9938b025c 100644 --- a/Essentials/src/net/ess3/commands/Commandsetjail.java +++ b/Essentials/src/net/ess3/commands/Commandsetjail.java @@ -2,6 +2,7 @@ package net.ess3.commands; import static net.ess3.I18n._; import net.ess3.api.IUser; +import net.ess3.utils.Util; public class Commandsetjail extends EssentialsCommand @@ -14,7 +15,7 @@ public class Commandsetjail extends EssentialsCommand throw new NotEnoughArgumentsException(); } ess.getJails().setJail(args[0], user.getLocation()); - user.sendMessage(_("jailSet", args[0])); + user.sendMessage(_("jailSet", Util.sanitizeString(args[0]))); } } diff --git a/Essentials/src/net/ess3/commands/Commandsetwarp.java b/Essentials/src/net/ess3/commands/Commandsetwarp.java index 5ec5382c1..97387b80c 100644 --- a/Essentials/src/net/ess3/commands/Commandsetwarp.java +++ b/Essentials/src/net/ess3/commands/Commandsetwarp.java @@ -3,6 +3,8 @@ package net.ess3.commands; import static net.ess3.I18n._; import net.ess3.api.IUser; import net.ess3.api.IWarps; +import net.ess3.permissions.WarpPermissions; +//TODO - Remove bukkit import org.bukkit.Location; @@ -33,7 +35,8 @@ public class Commandsetwarp extends EssentialsCommand { } - if (warpLoc == null || user.hasPermission("essentials.warp.overwrite." + args[0])) + if (warpLoc == null || WarpPermissions.getPermission("overwrite." + args[0]).isAuthorized(user)) + { warps.setWarp(args[0], loc); } diff --git a/Essentials/src/net/ess3/commands/Commandsetworth.java b/Essentials/src/net/ess3/commands/Commandsetworth.java index 3ea844f69..d93c3c0cb 100644 --- a/Essentials/src/net/ess3/commands/Commandsetworth.java +++ b/Essentials/src/net/ess3/commands/Commandsetworth.java @@ -31,7 +31,7 @@ public class Commandsetworth extends EssentialsCommand ess.getWorth().setPrice(stack, Double.parseDouble(price)); user.sendMessage(_("worthSet")); - } + } @Override protected void run(final CommandSender sender, final String commandLabel, final String[] args) throws Exception diff --git a/Essentials/src/net/ess3/commands/Commandspawn.java b/Essentials/src/net/ess3/commands/Commandspawn.java index 5772cf821..f1bb51b74 100644 --- a/Essentials/src/net/ess3/commands/Commandspawn.java +++ b/Essentials/src/net/ess3/commands/Commandspawn.java @@ -1,8 +1,8 @@ package net.ess3.commands; import static net.ess3.I18n._; -import net.ess3.economy.Trade; import net.ess3.api.IUser; +import net.ess3.economy.Trade; import net.ess3.permissions.Permissions; import net.ess3.settings.SpawnsHolder; import org.bukkit.Location; diff --git a/Essentials/src/net/ess3/commands/Commandspawnmob.java b/Essentials/src/net/ess3/commands/Commandspawnmob.java index c836589da..8c2a9bee0 100644 --- a/Essentials/src/net/ess3/commands/Commandspawnmob.java +++ b/Essentials/src/net/ess3/commands/Commandspawnmob.java @@ -1,22 +1,24 @@ package net.ess3.commands; +import java.util.HashSet; +import java.util.Locale; +import java.util.Random; +import java.util.Set; import static net.ess3.I18n._; -import net.ess3.bukkit.Mob; -import net.ess3.bukkit.Mob.MobException; import net.ess3.api.ISettings; import net.ess3.api.IUser; +import net.ess3.bukkit.Mob; +import net.ess3.bukkit.Mob.MobException; import net.ess3.permissions.SpawnmobPermissions; import net.ess3.utils.LocationUtil; import net.ess3.utils.Util; -import java.util.HashSet; -import java.util.Locale; -import java.util.Random; -import java.util.Set; import org.bukkit.DyeColor; import org.bukkit.Location; import org.bukkit.block.Block; +import org.bukkit.entity.Villager.Profession; import org.bukkit.entity.*; - +import org.bukkit.material.Colorable; +//TODO - Bukkit cleanup public class Commandspawnmob extends EssentialsCommand { @@ -97,7 +99,7 @@ public class Commandspawnmob extends EssentialsCommand } catch (MobException e) { - throw new Exception(_("unableToSpawnMob")); + throw new Exception(_("unableToSpawnMob"), e); } if (mountType != null) @@ -119,7 +121,7 @@ public class Commandspawnmob extends EssentialsCommand } catch (MobException e) { - throw new Exception(_("unableToSpawnMob")); + throw new Exception(_("unableToSpawnMob"), e); } spawnedMob.setPassenger(spawnedMount); } @@ -164,7 +166,7 @@ public class Commandspawnmob extends EssentialsCommand } catch (MobException e) { - throw new Exception(_("unableToSpawnMob")); + throw new Exception(_("unableToSpawnMob"), e); } spawnedMob.setPassenger(spawnedMount); } @@ -201,7 +203,8 @@ public class Commandspawnmob extends EssentialsCommand private void changeMobData(final EntityType type, final Entity spawned, String data, final IUser user) throws Exception { data = data.toLowerCase(Locale.ENGLISH); - if (type == EntityType.SLIME || type == EntityType.MAGMA_CUBE) + + if (spawned instanceof Slime) { try { @@ -212,32 +215,24 @@ public class Commandspawnmob extends EssentialsCommand throw new Exception(_("slimeMalformedSize"), e); } } - if ((type == EntityType.SHEEP - || type == EntityType.COW - || type == EntityType.MUSHROOM_COW - || type == EntityType.CHICKEN - || type == EntityType.PIG - || type == EntityType.VILLAGER - || type == EntityType.OCELOT - || type == EntityType.WOLF) - && data.contains("baby")) + if (spawned instanceof Ageable && data.contains("baby")) { - ((Animals)spawned).setBaby(); + ((Ageable)spawned).setBaby(); return; } - if (type == EntityType.SHEEP) + if (spawned instanceof Colorable) { final String color = data.toUpperCase(Locale.ENGLISH).replace("BABY", ""); try { if (color.equals("RANDOM")) { - Random rand = new Random(); - ((Sheep)spawned).setColor(DyeColor.values()[rand.nextInt(DyeColor.values().length)]); + final Random rand = new Random(); + ((Colorable)spawned).setColor(DyeColor.values()[rand.nextInt(DyeColor.values().length)]); } else { - ((Sheep)spawned).setColor(DyeColor.valueOf(color)); + ((Colorable)spawned).setColor(DyeColor.valueOf(color)); } } catch (Exception e) @@ -245,9 +240,7 @@ public class Commandspawnmob extends EssentialsCommand throw new Exception(_("sheepMalformedColor"), e); } } - if ((type == EntityType.WOLF - || type == EntityType.OCELOT) - && data.contains("tamed")) + if (spawned instanceof Tameable && data.contains("tamed")) { final Tameable tameable = ((Tameable)spawned); tameable.setTamed(true); @@ -268,6 +261,31 @@ public class Commandspawnmob extends EssentialsCommand { ((Ocelot)spawned).setCatType(Ocelot.Type.SIAMESE_CAT); } + else if (data.contains("red")) + { + ((Ocelot)spawned).setCatType(Ocelot.Type.RED_CAT); + } + else if (data.contains("black")) + { + ((Ocelot)spawned).setCatType(Ocelot.Type.BLACK_CAT); + } + } + if (type == EntityType.VILLAGER) + { + for (Profession prof : Villager.Profession.values()) + { + if (data.contains(prof.toString().toLowerCase(Locale.ENGLISH))) + { + ((Villager)spawned).setProfession(prof); + } + } + } + if (type == EntityType.OCELOT) + { + if (data.contains("siamese")) + { + ((Ocelot)spawned).setCatType(Ocelot.Type.SIAMESE_CAT); + } if (data.contains("red")) { ((Ocelot)spawned).setCatType(Ocelot.Type.RED_CAT); diff --git a/Essentials/src/net/ess3/commands/Commandsuicide.java b/Essentials/src/net/ess3/commands/Commandsuicide.java index d1d666d7c..c9598ee3e 100644 --- a/Essentials/src/net/ess3/commands/Commandsuicide.java +++ b/Essentials/src/net/ess3/commands/Commandsuicide.java @@ -10,9 +10,9 @@ public class Commandsuicide extends EssentialsCommand public void run(final IUser user, final String commandLabel, final String[] args) throws Exception { ess.getPlugin().callSuicideEvent(user.getBase()); - user.damage(1000); - user.setHealth(0); + user.damage(Short.MAX_VALUE); user.sendMessage(_("suicideMessage")); + user.setDisplayNick(); ess.broadcastMessage(user,_("suicideSuccess", user.getDisplayName())); } } diff --git a/Essentials/src/net/ess3/commands/Commandtime.java b/Essentials/src/net/ess3/commands/Commandtime.java index 8ba2ff13f..5a1a5b410 100644 --- a/Essentials/src/net/ess3/commands/Commandtime.java +++ b/Essentials/src/net/ess3/commands/Commandtime.java @@ -1,10 +1,11 @@ package net.ess3.commands; -import net.ess3.utils.DescParseTickFormat; +import java.util.*; import static net.ess3.I18n._; import net.ess3.api.IUser; import net.ess3.permissions.Permissions; -import java.util.*; +import net.ess3.utils.DescParseTickFormat; +import net.ess3.utils.Util; import org.bukkit.World; import org.bukkit.entity.Player; @@ -14,16 +15,29 @@ public class Commandtime extends EssentialsCommand @Override protected void run(final CommandSender sender, final String commandLabel, final String[] args) throws Exception { + boolean add = false; + final List<String> argList = new ArrayList<String>(Arrays.asList(args)); + if (argList.remove("set") && !argList.isEmpty() && Util.isInt(argList.get(0))) + { + argList.set(0, argList.get(0) + "t"); + } + if (argList.remove("add") && !argList.isEmpty() && Util.isInt(argList.get(0))) + { + add = true; + argList.set(0, argList.get(0) + "t"); + } + final String[] validArgs = argList.toArray(new String[0]); + // Which World(s) are we interested in? String worldSelector = null; - if (args.length == 2) + if (validArgs.length == 2) { - worldSelector = args[1]; + worldSelector = validArgs[1]; } final Set<World> worlds = getWorlds(sender, worldSelector); // If no arguments we are reading the time - if (args.length == 0) + if (validArgs.length == 0) { getWorldsTime(sender, worlds); return; @@ -39,14 +53,14 @@ public class Commandtime extends EssentialsCommand long ticks; try { - ticks = DescParseTickFormat.parse(args[0]); + ticks = DescParseTickFormat.parse(validArgs[0]); } catch (NumberFormatException e) { - throw new NotEnoughArgumentsException(); + throw new NotEnoughArgumentsException(e); } - setWorldsTime(sender, worlds, ticks); + setWorldsTime(sender, worlds, ticks, add); } /** @@ -70,14 +84,17 @@ public class Commandtime extends EssentialsCommand /** * Used to set the time and inform of the change */ - private void setWorldsTime(final CommandSender sender, final Collection<World> worlds, final long ticks) + private void setWorldsTime(final CommandSender sender, final Collection<World> worlds, final long ticks, final boolean add) { // Update the time for (World world : worlds) { long time = world.getTime(); - time -= time % 24000; - world.setTime(time + 24000 + ticks); + if (!add) + { + time -= time % 24000; + } + world.setTime(time + (add ? 0 : 24000) + ticks); } final StringBuilder output = new StringBuilder(); diff --git a/Essentials/src/net/ess3/commands/Commandtop.java b/Essentials/src/net/ess3/commands/Commandtop.java index 3298f8acd..66c142120 100644 --- a/Essentials/src/net/ess3/commands/Commandtop.java +++ b/Essentials/src/net/ess3/commands/Commandtop.java @@ -15,7 +15,7 @@ public class Commandtop extends EssentialsCommand final int topX = user.getLocation().getBlockX(); final int topZ = user.getLocation().getBlockZ(); final int topY = user.getWorld().getHighestBlockYAt(topX, topZ); - user.getTeleport().teleport(new Location(user.getWorld(), user.getLocation().getX(), topY + 1, user.getLocation().getZ()), new Trade(commandName, ess), TeleportCause.COMMAND); + user.getTeleport().teleport(new Location(user.getWorld(), user.getLocation().getX(), topY + 1, user.getLocation().getZ(), user.getLocation().getYaw(), user.getLocation().getPitch()), new Trade(commandName, ess), TeleportCause.COMMAND); user.sendMessage(_("teleportTop")); } } diff --git a/Essentials/src/net/ess3/commands/Commandtp.java b/Essentials/src/net/ess3/commands/Commandtp.java index 93bd2a798..27744d571 100644 --- a/Essentials/src/net/ess3/commands/Commandtp.java +++ b/Essentials/src/net/ess3/commands/Commandtp.java @@ -1,11 +1,13 @@ package net.ess3.commands; +import lombok.Cleanup; import net.ess3.Console; import static net.ess3.I18n._; -import net.ess3.economy.Trade; +import net.ess3.api.ISettings; import net.ess3.api.IUser; +import net.ess3.economy.Trade; import net.ess3.permissions.Permissions; -import lombok.Cleanup; +import net.ess3.permissions.WorldPermissions; import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; @@ -14,6 +16,9 @@ public class Commandtp extends EssentialsCommand @Override public void run(final IUser user, final String commandLabel, final String[] args) throws Exception { + @Cleanup + ISettings settings = ess.getSettings(); + settings.acquireReadLock(); switch (args.length) { case 0: @@ -27,6 +32,11 @@ public class Commandtp extends EssentialsCommand { throw new Exception(_("teleportDisabled", player.getDisplayName())); } + if (user.getWorld() != player.getWorld() && settings.getData().getGeneral().isWorldTeleportPermissions() + && !WorldPermissions.getPermission(player.getWorld().getName()).isAuthorized(user)) + { + throw new Exception(_("noPerm", "essentials.world." + player.getWorld().getName())); + } user.sendMessage(_("teleporting")); final Trade charge = new Trade(commandName, ess); charge.isAffordableFor(user); @@ -39,8 +49,26 @@ public class Commandtp extends EssentialsCommand throw new Exception(_("needTpohere")); } user.sendMessage(_("teleporting")); + @Cleanup final IUser target = getPlayer(args, 0); + @Cleanup final IUser toPlayer = getPlayer(args, 1); + target.acquireReadLock(); + toPlayer.acquireReadLock(); + + if (!target.getData().isTeleportEnabled()) + { + throw new Exception(_("teleportDisabled", target.getDisplayName())); + } + if (!toPlayer.getData().isTeleportEnabled()) + { + throw new Exception(_("teleportDisabled", toPlayer.getDisplayName())); + } + if (target.getWorld() != toPlayer.getWorld() && settings.getData().getGeneral().isWorldTeleportPermissions() + && !WorldPermissions.getPermission(toPlayer.getWorld().getName()).isAuthorized(user)) + { + throw new Exception(_("noPerm", "essentials.world." + toPlayer.getWorld().getName())); + } target.getTeleport().now(toPlayer, false, TeleportCause.COMMAND); target.sendMessage(_("teleportAtoB", user.getDisplayName(), toPlayer.getDisplayName())); break; diff --git a/Essentials/src/net/ess3/commands/Commandtpa.java b/Essentials/src/net/ess3/commands/Commandtpa.java index 84f674538..999b57ec3 100644 --- a/Essentials/src/net/ess3/commands/Commandtpa.java +++ b/Essentials/src/net/ess3/commands/Commandtpa.java @@ -1,9 +1,10 @@ package net.ess3.commands; +import lombok.Cleanup; import static net.ess3.I18n._; import net.ess3.api.ISettings; import net.ess3.api.IUser; -import lombok.Cleanup; +import net.ess3.permissions.WorldPermissions; public class Commandtpa extends EssentialsCommand @@ -23,20 +24,22 @@ public class Commandtpa extends EssentialsCommand { throw new Exception(_("teleportDisabled", player.getDisplayName())); } - if (!player.isIgnoringPlayer(user.getName())) + @Cleanup + ISettings settings = ess.getSettings(); + settings.acquireReadLock(); + if (user.getWorld() != player.getWorld() && ess.getSettings().getData().getGeneral().isWorldTeleportPermissions() + && !WorldPermissions.getPermission(user.getWorld().getName()).isAuthorized(user)) + { + throw new Exception(_("noPerm", "essentials.world." + player.getWorld().getName())); + } + if (!player.isIgnoringPlayer(user)) { player.requestTeleport(user, false); player.sendMessage(_("teleportRequest", user.getDisplayName())); player.sendMessage(_("typeTpaccept")); player.sendMessage(_("typeTpdeny")); int tpaAcceptCancellation = 0; - ISettings settings = ess.getSettings(); - settings.acquireReadLock(); - try { - tpaAcceptCancellation = settings.getData().getCommands().getTpa().getTimeout(); - } finally { - settings.unlock(); - } + tpaAcceptCancellation = settings.getData().getCommands().getTpa().getTimeout(); if (tpaAcceptCancellation != 0) { player.sendMessage(_("teleportRequestTimeoutInfo", tpaAcceptCancellation)); diff --git a/Essentials/src/net/ess3/commands/Commandtpaall.java b/Essentials/src/net/ess3/commands/Commandtpaall.java index 0dbbdd59a..5517fad6d 100644 --- a/Essentials/src/net/ess3/commands/Commandtpaall.java +++ b/Essentials/src/net/ess3/commands/Commandtpaall.java @@ -1,9 +1,10 @@ package net.ess3.commands; +import lombok.Cleanup; import static net.ess3.I18n._; import net.ess3.api.ISettings; import net.ess3.api.IUser; -import lombok.Cleanup; +import net.ess3.permissions.WorldPermissions; import org.bukkit.entity.Player; @@ -42,22 +43,21 @@ public class Commandtpaall extends EssentialsCommand { continue; } + @Cleanup + ISettings settings = ess.getSettings(); + settings.acquireReadLock(); + if (user.getWorld() != player.getWorld() && settings.getData().getGeneral().isWorldTeleportPermissions() + && !WorldPermissions.getPermission(user.getWorld().getName()).isAuthorized(user)) + { + continue; + } try { player.requestTeleport(user, true); player.sendMessage(_("teleportHereRequest", user.getDisplayName())); player.sendMessage(_("typeTpaccept")); int tpaAcceptCancellation = 0; - ISettings settings = ess.getSettings(); - settings.acquireReadLock(); - try - { - tpaAcceptCancellation = settings.getData().getCommands().getTpa().getTimeout(); - } - finally - { - settings.unlock(); - } + tpaAcceptCancellation = settings.getData().getCommands().getTpa().getTimeout(); if (tpaAcceptCancellation != 0) { player.sendMessage(_("teleportRequestTimeoutInfo", tpaAcceptCancellation)); diff --git a/Essentials/src/net/ess3/commands/Commandtpahere.java b/Essentials/src/net/ess3/commands/Commandtpahere.java index fc4a30083..01e3dd29b 100644 --- a/Essentials/src/net/ess3/commands/Commandtpahere.java +++ b/Essentials/src/net/ess3/commands/Commandtpahere.java @@ -1,9 +1,10 @@ package net.ess3.commands; +import lombok.Cleanup; import static net.ess3.I18n._; import net.ess3.api.ISettings; import net.ess3.api.IUser; -import lombok.Cleanup; +import net.ess3.permissions.WorldPermissions; public class Commandtpahere extends EssentialsCommand @@ -23,20 +24,21 @@ public class Commandtpahere extends EssentialsCommand { throw new Exception(_("teleportDisabled", player.getDisplayName())); } + @Cleanup + ISettings settings = ess.getSettings(); + settings.acquireReadLock(); + if (user.getWorld() != player.getWorld() && settings.getData().getGeneral().isWorldTeleportPermissions() + && !WorldPermissions.getPermission(user.getWorld().getName()).isAuthorized(user)) + { + throw new Exception(_("noPerm", "essentials.world." + user.getWorld().getName())); + } player.requestTeleport(user, true); player.sendMessage(_("teleportHereRequest", user.getDisplayName())); player.sendMessage(_("typeTpaccept")); int tpaAcceptCancellation = 0; - ISettings settings = ess.getSettings(); - settings.acquireReadLock(); - try { tpaAcceptCancellation = settings.getData().getCommands().getTpa().getTimeout(); } - finally - { - settings.unlock(); - } if (tpaAcceptCancellation != 0) { player.sendMessage(_("teleportRequestTimeoutInfo", tpaAcceptCancellation)); diff --git a/Essentials/src/net/ess3/commands/Commandtpall.java b/Essentials/src/net/ess3/commands/Commandtpall.java index db0c676be..2926b4a8c 100644 --- a/Essentials/src/net/ess3/commands/Commandtpall.java +++ b/Essentials/src/net/ess3/commands/Commandtpall.java @@ -1,7 +1,11 @@ package net.ess3.commands; +import lombok.Cleanup; import static net.ess3.I18n._; +import net.ess3.api.ISettings; import net.ess3.api.IUser; +import net.ess3.permissions.WorldPermissions; +import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; @@ -35,6 +39,15 @@ public class Commandtpall extends EssentialsCommand { continue; } + @Cleanup + ISettings settings = ess.getSettings(); + settings.acquireReadLock(); + + if (user.getWorld() != player.getWorld() && settings.getData().getGeneral().isWorldTeleportPermissions() + && !WorldPermissions.getPermission(user.getWorld().getName()).isAuthorized(user)) + { + continue; + } try { player.getTeleport().now(user, false, TeleportCause.COMMAND); @@ -43,6 +56,7 @@ public class Commandtpall extends EssentialsCommand { ess.getCommandHandler().showCommandError(sender, commandName, ex); } + } } -} +}
\ No newline at end of file diff --git a/Essentials/src/net/ess3/commands/Commandtpohere.java b/Essentials/src/net/ess3/commands/Commandtpohere.java index a3f9fcb74..48923e223 100644 --- a/Essentials/src/net/ess3/commands/Commandtpohere.java +++ b/Essentials/src/net/ess3/commands/Commandtpohere.java @@ -1,8 +1,11 @@ package net.ess3.commands; +import lombok.Cleanup; import static net.ess3.I18n._; +import net.ess3.api.ISettings; import net.ess3.api.IUser; import net.ess3.permissions.Permissions; +import net.ess3.permissions.WorldPermissions; import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; @@ -24,6 +27,16 @@ public class Commandtpohere extends EssentialsCommand { throw new NoSuchFieldException(_("playerNotFound")); } + @Cleanup + ISettings settings = ess.getSettings(); + settings.acquireReadLock(); + //todo - common method + if (user.getWorld() != player.getWorld() && settings.getData().getGeneral().isWorldTeleportPermissions() + && !WorldPermissions.getPermission(user.getWorld().getName()).isAuthorized(player)) + { + throw new Exception(_("noPerm", "essentials.world." + user.getWorld().getName())); + } + // Verify permission if (!player.isHidden() || Permissions.TELEPORT_HIDDEN.isAuthorized(user)) diff --git a/Essentials/src/net/ess3/commands/Commandtppos.java b/Essentials/src/net/ess3/commands/Commandtppos.java index abbdeaae9..907292b8e 100644 --- a/Essentials/src/net/ess3/commands/Commandtppos.java +++ b/Essentials/src/net/ess3/commands/Commandtppos.java @@ -1,8 +1,8 @@ package net.ess3.commands; import static net.ess3.I18n._; -import net.ess3.economy.Trade; import net.ess3.api.IUser; +import net.ess3.economy.Trade; import org.bukkit.Location; import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; @@ -35,4 +35,30 @@ public class Commandtppos extends EssentialsCommand user.getTeleport().teleport(location, charge, TeleportCause.COMMAND); throw new NoChargeException(); } + + @Override + public void run(final CommandSender sender, final String commandLabel, final String[] args) throws Exception + { + if (args.length < 4) + { + throw new NotEnoughArgumentsException(); + } + + IUser user = ess.getUser(server.getPlayer(args[0])); + final int x = Integer.parseInt(args[1]); + final int y = Integer.parseInt(args[2]); + final int z = Integer.parseInt(args[3]); + final Location location = new Location(user.getWorld(), x, y, z); + if (args.length > 4) + { + location.setYaw((Float.parseFloat(args[4]) + 180 + 360) % 360); + } + if (args.length > 5) + { + location.setPitch(Float.parseFloat(args[5])); + } + sender.sendMessage(_("teleporting")); + user.sendMessage(_("teleporting")); + user.getTeleport().teleport(location, null, TeleportCause.COMMAND); + } }
\ No newline at end of file diff --git a/Essentials/src/net/ess3/commands/Commandtree.java b/Essentials/src/net/ess3/commands/Commandtree.java index dd498d66a..991e86380 100644 --- a/Essentials/src/net/ess3/commands/Commandtree.java +++ b/Essentials/src/net/ess3/commands/Commandtree.java @@ -37,6 +37,18 @@ public class Commandtree extends EssentialsCommand { tree = TreeType.BROWN_MUSHROOM; } + else if (args[0].equalsIgnoreCase("jungle")) + { + tree = TreeType.SMALL_JUNGLE; + } + else if (args[0].equalsIgnoreCase("junglebush")) + { + tree = TreeType.JUNGLE_BUSH; + } + else if (args[0].equalsIgnoreCase("swamp")) + { + tree = TreeType.SWAMP; + } else { throw new NotEnoughArgumentsException(); diff --git a/Essentials/src/net/ess3/commands/Commandunban.java b/Essentials/src/net/ess3/commands/Commandunban.java index b8e43e93b..4f2fe8fb6 100644 --- a/Essentials/src/net/ess3/commands/Commandunban.java +++ b/Essentials/src/net/ess3/commands/Commandunban.java @@ -1,8 +1,8 @@ package net.ess3.commands; +import lombok.Cleanup; import static net.ess3.I18n._; import net.ess3.api.IUser; -import lombok.Cleanup; public class Commandunban extends EssentialsCommand @@ -26,7 +26,7 @@ public class Commandunban extends EssentialsCommand } catch (NoSuchFieldException e) { - throw new Exception(_("playerNotFound")); + throw new Exception(_("playerNotFound"), e); } } } diff --git a/Essentials/src/net/ess3/commands/Commandunbanip.java b/Essentials/src/net/ess3/commands/Commandunbanip.java index 77017c244..4c5975eb5 100644 --- a/Essentials/src/net/ess3/commands/Commandunbanip.java +++ b/Essentials/src/net/ess3/commands/Commandunbanip.java @@ -1,8 +1,8 @@ package net.ess3.commands; +import lombok.Cleanup; import static net.ess3.I18n._; import net.ess3.api.IUser; -import lombok.Cleanup; public class Commandunbanip extends EssentialsCommand diff --git a/Essentials/src/net/ess3/commands/Commandunlimited.java b/Essentials/src/net/ess3/commands/Commandunlimited.java index d3a53d1cb..88115ab64 100644 --- a/Essentials/src/net/ess3/commands/Commandunlimited.java +++ b/Essentials/src/net/ess3/commands/Commandunlimited.java @@ -75,7 +75,7 @@ public class Commandunlimited extends EssentialsCommand return output.toString(); } - private Boolean toggleUnlimited(final IUser user, final IUser target, final String item) throws Exception + private boolean toggleUnlimited(final IUser user, final IUser target, final String item) throws Exception { final ItemStack stack = ess.getItemDb().get(item, 1); stack.setAmount(Math.min(stack.getType().getMaxStackSize(), 2)); @@ -87,7 +87,7 @@ public class Commandunlimited extends EssentialsCommand } String message = "disableUnlimited"; - Boolean enableUnlimited = false; + boolean enableUnlimited = false; if (!target.getData().hasUnlimited(stack.getType())) { message = "enableUnlimited"; diff --git a/Essentials/src/net/ess3/commands/Commandvanish.java b/Essentials/src/net/ess3/commands/Commandvanish.java new file mode 100644 index 000000000..16cab5a51 --- /dev/null +++ b/Essentials/src/net/ess3/commands/Commandvanish.java @@ -0,0 +1,37 @@ +package net.ess3.commands; + +import static net.ess3.I18n._; +import net.ess3.api.IUser; + + +public class Commandvanish extends EssentialsCommand +{ + @Override + protected void run(IUser user, String commandLabel, String[] args) throws Exception + { + if (args.length < 1) + { + user.toggleVanished(); + if (user.isVanished()) + { + user.sendMessage(_("vanished")); + } + else + { + user.sendMessage(_("unvanished")); + } + } + else + { + if (args[0].contains("on") || args[0].contains("ena") || args[0].equalsIgnoreCase("1")) + { + user.setVanished(true); + } + else + { + user.setVanished(false); + } + user.sendMessage(user.isVanished() ? _("vanished") : _("unvanished")); + } + } +} diff --git a/Essentials/src/net/ess3/commands/Commandwarp.java b/Essentials/src/net/ess3/commands/Commandwarp.java index 93fa4a003..c01bc8354 100644 --- a/Essentials/src/net/ess3/commands/Commandwarp.java +++ b/Essentials/src/net/ess3/commands/Commandwarp.java @@ -111,7 +111,10 @@ public class Commandwarp extends EssentialsCommand private void warpUser(final IUser user, final String name) throws Exception { - final Trade charge = new Trade("warp-" + name.toLowerCase(Locale.ENGLISH).replace('_', '-'), ess); + final Trade chargeWarp = new Trade("warp-" + name.toLowerCase(Locale.ENGLISH).replace('_', '-'), ess); + final Trade chargeCmd = new Trade(this.commandName, ess); + final double fullCharge = chargeWarp.getCommandCost(user) + chargeCmd.getCommandCost(user); + final Trade charge = new Trade(fullCharge, ess); charge.isAffordableFor(user); if (WarpPermissions.getPermission(name).isAuthorized(user)) { diff --git a/Essentials/src/net/ess3/commands/Commandwhois.java b/Essentials/src/net/ess3/commands/Commandwhois.java index 4344d5f11..dee99fdc7 100644 --- a/Essentials/src/net/ess3/commands/Commandwhois.java +++ b/Essentials/src/net/ess3/commands/Commandwhois.java @@ -1,16 +1,17 @@ package net.ess3.commands; +import net.ess3.api.server.CommandSender; +import net.ess3.api.server.Player; +import java.util.Locale; +import lombok.Cleanup; import static net.ess3.I18n._; -import net.ess3.utils.Util; import net.ess3.api.ISettings; import net.ess3.api.IUser; -import net.ess3.api.server.CommandSender; -import net.ess3.api.server.Player; +import net.ess3.craftbukkit.SetExpFix; import net.ess3.permissions.Permissions; import net.ess3.user.UserData; import net.ess3.utils.DateUtil; -import java.util.Locale; -import lombok.Cleanup; +import net.ess3.utils.Util; @@ -40,6 +41,7 @@ public class Commandwhois extends EssentialsCommand ISettings settings = ess.getSettings(); settings.acquireReadLock(); final int prefixLength = Util.stripColor(settings.getData().getChat().getNicknamePrefix()).length(); + boolean foundPlayer = false; for (Player onlinePlayer : server.getOnlinePlayers()) { @Cleanup @@ -50,29 +52,21 @@ public class Commandwhois extends EssentialsCommand continue; } user.acquireReadLock(); - final String nickName = Util.stripColor(user.getData().getNickname()); + final String nickName = Util.stripFormat(user.getData().getNickname()); if (!whois.equalsIgnoreCase(nickName) && !whois.substring(prefixLength).equalsIgnoreCase(nickName) && !whois.equalsIgnoreCase(user.getName())) { continue; } - sender.sendMessage(""); + foundPlayer = true; + sender.sendMessage(_("whoisTop", user.getName())); + user.setDisplayNick(); sender.sendMessage(_("whoisIs", user.getDisplayName(), user.getName())); sender.sendMessage(_("whoisHealth", user.getHealth())); - sender.sendMessage(_("whoisOP", (user.isOp() ? _("true") : _("false")))); - sender.sendMessage(_("whoisGod", (user.isGodModeEnabled() ? _("true") : _("false")))); - sender.sendMessage(_("whoisGamemode", _(user.getGameMode().toString().toLowerCase(Locale.ENGLISH)))); + sender.sendMessage(_("whoisExp", SetExpFix.getTotalExperience(user), user.getLevel())); sender.sendMessage(_("whoisLocation", user.getLocation().getWorld().getName(), user.getLocation().getBlockX(), user.getLocation().getBlockY(), user.getLocation().getBlockZ())); sender.sendMessage(_("whoisMoney", Util.displayCurrency(user.getMoney(), ess))); - sender.sendMessage(_("whoisJail", (user.getData().isJailed() - ? user.getTimestamp(UserData.TimestampType.JAIL) > 0 - ? DateUtil.formatDateDiff(user.getTimestamp(UserData.TimestampType.JAIL)) - : _("true") - : _("false")))); - sender.sendMessage(user.getData().isAfk() - ? _("whoisStatusAway") - : _("whoisStatusAvailable")); sender.sendMessage(_("whoisIPAddress", user.getAddress().getAddress().toString())); final String location = user.getData().getGeolocation(); if (location != null @@ -80,6 +74,26 @@ public class Commandwhois extends EssentialsCommand { sender.sendMessage(_("whoisGeoLocation", location)); } + sender.sendMessage(_("whoisGamemode", _(user.getGameMode().toString().toLowerCase(Locale.ENGLISH)))); + sender.sendMessage(_("whoisGod", (user.isGodModeEnabled() ? _("true") : _("false")))); + sender.sendMessage(_("whoisOP", (user.isOp() ? _("true") : _("false")))); + sender.sendMessage(_("whoisFly", user.getAllowFlight() ? _("true") : _("false"), user.isFlying() ? _("flying") : _("notFlying"))); + sender.sendMessage(_("whoisAFK", (user.getData().isAfk() ? _("true") : _("false")))); + sender.sendMessage(_("whoisJail", (user.getData().isJailed() + ? user.getTimestamp(UserData.TimestampType.JAIL) > 0 + ? DateUtil.formatDateDiff(user.getTimestamp(UserData.TimestampType.JAIL)) + : _("true") + : _("false")))); + sender.sendMessage(_("whoisMute", (user.getData().isMuted() + ? user.getTimestamp(UserData.TimestampType.MUTE) > 0 + ? DateUtil.formatDateDiff(user.getTimestamp(UserData.TimestampType.MUTE)) + : _("true") + : _("false")))); + + if (!foundPlayer) + { + throw new NoSuchFieldException(_("playerNotFound")); + } } } } diff --git a/Essentials/src/net/ess3/commands/EssentialsCommandHandler.java b/Essentials/src/net/ess3/commands/EssentialsCommandHandler.java index c4ef7bd78..db2b63c3e 100644 --- a/Essentials/src/net/ess3/commands/EssentialsCommandHandler.java +++ b/Essentials/src/net/ess3/commands/EssentialsCommandHandler.java @@ -1,11 +1,10 @@ package net.ess3.commands; -import static net.ess3.I18n._; -import net.ess3.api.*; - import java.util.*; import java.util.logging.Level; import java.util.logging.Logger; +import static net.ess3.I18n._; +import net.ess3.api.*; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.command.Command; diff --git a/Essentials/src/net/ess3/commands/WarpNotFoundException.java b/Essentials/src/net/ess3/commands/WarpNotFoundException.java index 4c948560d..eef5db914 100644 --- a/Essentials/src/net/ess3/commands/WarpNotFoundException.java +++ b/Essentials/src/net/ess3/commands/WarpNotFoundException.java @@ -1,11 +1,12 @@ package net.ess3.commands; +import static net.ess3.I18n._; public class WarpNotFoundException extends Exception { public WarpNotFoundException() { - super(""); + super(_("warpNotExist")); } public WarpNotFoundException(String message) diff --git a/Essentials/src/net/ess3/craftbukkit/FakeExplosion.java b/Essentials/src/net/ess3/craftbukkit/FakeExplosion.java deleted file mode 100644 index 01f117cfa..000000000 --- a/Essentials/src/net/ess3/craftbukkit/FakeExplosion.java +++ /dev/null @@ -1,51 +0,0 @@ -package net.ess3.craftbukkit; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.logging.Level; -import java.util.logging.Logger; -import net.minecraft.server.ChunkPosition; -import net.minecraft.server.Packet60Explosion; -import org.bukkit.Location; -import org.bukkit.Server; -import org.bukkit.block.Block; -import org.bukkit.craftbukkit.CraftServer; -import org.bukkit.craftbukkit.CraftWorld; -import org.bukkit.entity.Player; -import org.bukkit.event.entity.EntityExplodeEvent; - - -public class FakeExplosion -{ - public static void createExplosion(final EntityExplodeEvent event, final Server server, final Player[] players) - { - try - { - final Set<ChunkPosition> set = new HashSet<ChunkPosition>(event.blockList().size()); - final List<ChunkPosition> blocksUnderPlayers = new ArrayList<ChunkPosition>(players.length); - final Location loc = event.getLocation(); - for (Player player : players) - { - if (player.getWorld().equals(loc.getWorld())) - { - blocksUnderPlayers.add(new ChunkPosition(player.getLocation().getBlockX(), player.getLocation().getBlockY() - 1, player.getLocation().getBlockZ())); - } - } - for (Block block : event.blockList()) - { - final ChunkPosition cp = new ChunkPosition(block.getX(), block.getY(), block.getZ()); - if (!blocksUnderPlayers.contains(cp)) - { - set.add(cp); - } - } - ((CraftServer)server).getHandle().sendPacketNearby(loc.getX(), loc.getY(), loc.getZ(), 64.0, ((CraftWorld)loc.getWorld()).getHandle().worldProvider.dimension, new Packet60Explosion(loc.getX(), loc.getY(), loc.getZ(), 3.0F, set)); - } - catch (Throwable ex) - { - Logger.getLogger("Minecraft").log(Level.SEVERE, null, ex); - } - } -} diff --git a/Essentials/src/net/ess3/craftbukkit/FakeInventory.java b/Essentials/src/net/ess3/craftbukkit/FakeInventory.java index 9d07c9dbd..7db0a1a7b 100644 --- a/Essentials/src/net/ess3/craftbukkit/FakeInventory.java +++ b/Essentials/src/net/ess3/craftbukkit/FakeInventory.java @@ -222,4 +222,22 @@ public class FakeInventory implements Inventory { throw new UnsupportedOperationException("Not supported yet."); } + + @Override + public int getMaxStackSize() + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setMaxStackSize(int size) + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public ListIterator<ItemStack> iterator(int index) + { + throw new UnsupportedOperationException("Not supported yet."); + } } diff --git a/Essentials/src/net/ess3/craftbukkit/InventoryWorkaround.java b/Essentials/src/net/ess3/craftbukkit/InventoryWorkaround.java index c8f070bab..f816026b9 100644 --- a/Essentials/src/net/ess3/craftbukkit/InventoryWorkaround.java +++ b/Essentials/src/net/ess3/craftbukkit/InventoryWorkaround.java @@ -15,12 +15,12 @@ public final class InventoryWorkaround { } - public static int first(final Inventory inventory, final ItemStack item, final boolean forceDurability, final boolean forceAmount, final boolean forceEnchantments) + public static int first(final Inventory inventory, final ItemStack item, final boolean enforceDurability, final boolean enforceAmount, final boolean enforceEnchantments) { - return next(inventory, item, 0, forceDurability, forceAmount, forceEnchantments); + return next(inventory, item, 0, enforceDurability, enforceAmount, enforceEnchantments); } - public static int next(final Inventory cinventory, final ItemStack item, final int start, final boolean forceDurability, final boolean forceAmount, final boolean forceEnchantments) + public static int next(final Inventory cinventory, final ItemStack item, final int start, final boolean enforceDurability, final boolean enforceAmount, final boolean enforceEnchantments) { final ItemStack[] inventory = cinventory.getContents(); for (int i = start; i < inventory.length; i++) @@ -30,7 +30,7 @@ public final class InventoryWorkaround { continue; } - if (item.getTypeId() == cItem.getTypeId() && (!forceAmount || item.getAmount() == cItem.getAmount()) && (!forceDurability || cItem.getDurability() == item.getDurability()) && (!forceEnchantments || cItem.getEnchantments().equals(item.getEnchantments()))) + if (item.getTypeId() == cItem.getTypeId() && (!enforceAmount || item.getAmount() == cItem.getAmount()) && (!enforceDurability || cItem.getDurability() == item.getDurability()) && (!enforceEnchantments || cItem.getEnchantments().equals(item.getEnchantments()))) { return i; } @@ -38,12 +38,12 @@ public final class InventoryWorkaround return -1; } - public static int firstPartial(final Inventory cinventory, final ItemStack item, final boolean forceDurability) + public static int firstPartial(final Inventory cinventory, final ItemStack item, final boolean enforceDurability) { - return firstPartial(cinventory, item, forceDurability, item.getType().getMaxStackSize()); + return firstPartial(cinventory, item, enforceDurability, item.getType().getMaxStackSize()); } - public static int firstPartial(final Inventory cinventory, final ItemStack item, final boolean forceDurability, final int maxAmount) + public static int firstPartial(final Inventory cinventory, final ItemStack item, final boolean enforceDurability, final int maxAmount) { if (item == null) { @@ -57,7 +57,7 @@ public final class InventoryWorkaround { continue; } - if (item.getTypeId() == cItem.getTypeId() && cItem.getAmount() < maxAmount && (!forceDurability || cItem.getDurability() == item.getDurability()) && cItem.getEnchantments().equals(item.getEnchantments())) + if (item.getTypeId() == cItem.getTypeId() && cItem.getAmount() < maxAmount && (!enforceDurability || cItem.getDurability() == item.getDurability()) && cItem.getEnchantments().equals(item.getEnchantments())) { return i; } @@ -65,12 +65,12 @@ public final class InventoryWorkaround return -1; } - public static boolean addAllItems(final Inventory cinventory, final boolean forceDurability, final ItemStack... items) + public static boolean addAllItems(final Inventory cinventory, final boolean enforceDurability, final ItemStack... items) { final Inventory fake = new FakeInventory(cinventory.getContents()); - if (addItem(fake, forceDurability, items).isEmpty()) + if (addItem(fake, enforceDurability, items).isEmpty()) { - addItem(cinventory, forceDurability, items); + addItem(cinventory, enforceDurability, items); return true; } else @@ -84,7 +84,7 @@ public final class InventoryWorkaround return addItem(cinventory, forceDurability, 0, items); } - public static Map<Integer, ItemStack> addItem(final Inventory cinventory, final boolean forceDurability, final int oversizedStacks, final ItemStack... items) + public static Map<Integer, ItemStack> addItem(final Inventory cinventory, final boolean enforceDurability, final int oversizedStacks, final ItemStack... items) { final Map<Integer, ItemStack> leftover = new HashMap<Integer, ItemStack>(); @@ -109,7 +109,7 @@ public final class InventoryWorkaround combined[j] = items[i].clone(); break; } - if (combined[j].getTypeId() == items[i].getTypeId() && (!forceDurability || combined[j].getDurability() == items[i].getDurability()) && combined[j].getEnchantments().equals(items[i].getEnchantments())) + if (combined[j].getTypeId() == items[i].getTypeId() && (!enforceDurability || combined[j].getDurability() == items[i].getDurability()) && combined[j].getEnchantments().equals(items[i].getEnchantments())) { combined[j].setAmount(combined[j].getAmount() + items[i].getAmount()); break; @@ -130,7 +130,7 @@ public final class InventoryWorkaround { // Do we already have a stack of it? final int maxAmount = oversizedStacks > item.getType().getMaxStackSize() ? oversizedStacks : item.getType().getMaxStackSize(); - final int firstPartial = firstPartial(cinventory, item, forceDurability, maxAmount); + final int firstPartial = firstPartial(cinventory, item, enforceDurability, maxAmount); // Drat! no partial stack if (firstPartial == -1) @@ -186,7 +186,7 @@ public final class InventoryWorkaround return leftover; } - public static Map<Integer, ItemStack> removeItem(final Inventory cinventory, final boolean forceDurability, final boolean forceEnchantments, final ItemStack... items) + public static Map<Integer, ItemStack> removeItem(final Inventory cinventory, final boolean enforceDurability, final boolean enforceEnchantments, final ItemStack... items) { final Map<Integer, ItemStack> leftover = new HashMap<Integer, ItemStack>(); @@ -211,7 +211,7 @@ public final class InventoryWorkaround } // get first Item, ignore the amount - final int first = first(cinventory, item, forceDurability, false, forceEnchantments); + final int first = first(cinventory, item, enforceDurability, false, enforceEnchantments); // Drat! we don't have this type in the inventory if (first == -1) @@ -244,7 +244,7 @@ public final class InventoryWorkaround return leftover; } - public static boolean containsItem(final Inventory cinventory, final boolean forceDurability, final boolean forceEnchantments, final ItemStack... items) + public static boolean containsItem(final Inventory cinventory, final boolean enforceDurability, final boolean enforceEnchantments, final ItemStack... items) { final Map<Integer, ItemStack> leftover = new HashMap<Integer, ItemStack>(); @@ -266,7 +266,7 @@ public final class InventoryWorkaround combined[j] = items[i].clone(); break; } - if (combined[j].getTypeId() == items[i].getTypeId() && (!forceDurability || combined[j].getDurability() == items[i].getDurability()) && (!forceEnchantments || combined[j].getEnchantments().equals(items[i].getEnchantments()))) + if (combined[j].getTypeId() == items[i].getTypeId() && (!enforceDurability || combined[j].getDurability() == items[i].getDurability()) && (!enforceEnchantments || combined[j].getEnchantments().equals(items[i].getEnchantments()))) { combined[j].setAmount(combined[j].getAmount() + items[i].getAmount()); break; @@ -292,7 +292,7 @@ public final class InventoryWorkaround break; } - final int slot = next(cinventory, item, position, forceDurability, false, forceEnchantments); + final int slot = next(cinventory, item, position, enforceDurability, false, enforceEnchantments); // Drat! we don't have this type in the inventory if (slot == -1) diff --git a/Essentials/src/net/ess3/craftbukkit/SetExpFix.java b/Essentials/src/net/ess3/craftbukkit/SetExpFix.java index 2bf6ec32e..90962bfcb 100644 --- a/Essentials/src/net/ess3/craftbukkit/SetExpFix.java +++ b/Essentials/src/net/ess3/craftbukkit/SetExpFix.java @@ -3,6 +3,8 @@ package net.ess3.craftbukkit; public class SetExpFix { + //This method is used to update both the recorded total experience and displayed total experience. + //We reset both types to prevent issues. public static void setTotalExperience(final IPlayer player, final int exp) { if (exp < 0) @@ -12,6 +14,9 @@ public class SetExpFix player.setExp(0); player.setLevel(0); player.setTotalExperience(0); + + //This following code is technically redundant now, as bukkit now calulcates levels more or less correctly + //At larger numbers however... player.getExp(3000), only seems to give 2999, putting the below calculations off. int amount = exp; while (amount > 0) { @@ -42,9 +47,11 @@ public class SetExpFix return 7 + (level * 7 >> 1); } + //This method is required because the bukkit player.getTotalExperience() method, shows exp that has been 'spent'. + //Without this people would be able to use exp and then still sell it. public static int getTotalExperience(final IPlayer player) { - int exp = (int) (getExpToLevel(player) * player.getExp()); + int exp = (int)Math.round(getExpToLevel(player) * player.getExp()); int currentLevel = player.getLevel(); while (currentLevel > 0) { diff --git a/Essentials/src/net/ess3/economy/Economy.java b/Essentials/src/net/ess3/economy/Economy.java index 4ba48a3d9..c818dbf75 100644 --- a/Essentials/src/net/ess3/economy/Economy.java +++ b/Essentials/src/net/ess3/economy/Economy.java @@ -1,11 +1,11 @@ package net.ess3.economy; -import net.ess3.utils.Util; -import net.ess3.api.*; -import net.ess3.permissions.Permissions; import java.util.HashMap; import java.util.Locale; import java.util.Map; +import net.ess3.api.*; +import net.ess3.permissions.Permissions; +import net.ess3.utils.Util; public class Economy implements IEconomy diff --git a/Essentials/src/net/ess3/economy/Money.java b/Essentials/src/net/ess3/economy/Money.java index 20eea3544..01da6d5ce 100644 --- a/Essentials/src/net/ess3/economy/Money.java +++ b/Essentials/src/net/ess3/economy/Money.java @@ -1,11 +1,11 @@ package net.ess3.economy; -import net.ess3.storage.MapValueType; -import net.ess3.storage.StorageObject; import java.util.HashMap; import java.util.Map; import lombok.Data; import lombok.EqualsAndHashCode; +import net.ess3.storage.MapValueType; +import net.ess3.storage.StorageObject; @Data diff --git a/Essentials/src/net/ess3/economy/MoneyHolder.java b/Essentials/src/net/ess3/economy/MoneyHolder.java index b4355edd8..386dae7af 100644 --- a/Essentials/src/net/ess3/economy/MoneyHolder.java +++ b/Essentials/src/net/ess3/economy/MoneyHolder.java @@ -1,13 +1,27 @@ package net.ess3.economy; -import net.ess3.api.IEssentials; -import net.ess3.storage.AsyncStorageObjectHolder; import java.io.File; import java.io.IOException; +import net.ess3.api.IEssentials; +import net.ess3.storage.AsyncStorageObjectHolder; public class MoneyHolder extends AsyncStorageObjectHolder<Money> { + + @Override + public void finishRead() + { + + } + + @Override + public void finishWrite() + { + + } + + public MoneyHolder(IEssentials ess) { super(ess, Money.class); diff --git a/Essentials/src/net/ess3/economy/Trade.java b/Essentials/src/net/ess3/economy/Trade.java index a760d5730..85d8e53f3 100644 --- a/Essentials/src/net/ess3/economy/Trade.java +++ b/Essentials/src/net/ess3/economy/Trade.java @@ -25,6 +25,7 @@ import lombok.Cleanup; public class Trade { private final transient String command; + private final transient String fallbackCommand; private final transient Double money; private final transient ItemStack itemStack; private final transient Integer exp; @@ -32,27 +33,33 @@ public class Trade public Trade(final String command, final IEssentials ess) { - this(command, null, null, null, ess); + this(command, null, null, null, null, ess); + } + + public Trade(final String command, final String fallback, final IEssentials ess) + { + this(command, fallback, null, null, null, ess); } public Trade(final double money, final IEssentials ess) { - this(null, money, null, null, ess); + this(null, null, money, null, null, ess); } public Trade(final ItemStack items, final IEssentials ess) { - this(null, null, items, null, ess); + this(null, null, null, items, null, ess); } public Trade(final int exp, final IEssentials ess) { - this(null, null, null, exp, ess); + this(null, null, null, null, exp, ess); } - private Trade(final String command, final Double money, final ItemStack item, final Integer exp, final IEssentials ess) + private Trade(final String command, final String fallback, final Double money, final ItemStack item, final Integer exp, final IEssentials ess) { this.command = command; + this.fallbackCommand = fallback; this.money = money; this.itemStack = item; this.exp = exp; @@ -61,11 +68,10 @@ public class Trade public void isAffordableFor(final IUser user) throws ChargeException { - final double mon = user.getMoney(); if (getMoney() != null - && mon < getMoney() && getMoney() > 0 - && !Permissions.ECO_LOAN.isAuthorized(user)) + && !Permissions.ECO_LOAN.isAuthorized(user) + && !user.canAfford(getMoney())) { throw new ChargeException(_("notEnoughMoney")); } @@ -80,10 +86,9 @@ public class Trade final ISettings settings = ess.getSettings(); settings.acquireReadLock(); + double money; if (command != null && !command.isEmpty() - && !NoCommandCostPermissions.getPermission(command).isAuthorized(user) - && mon < settings.getData().getEconomy().getCommandCost(command.charAt(0) == '/' ? command.substring(1) : command) - && 0 < settings.getData().getEconomy().getCommandCost(command.charAt(0) == '/' ? command.substring(1) : command) + && 0 < (money = getCommandCost(user)) && !Permissions.ECO_LOAN.isAuthorized(user)) { throw new ChargeException(_("notEnoughMoney")); @@ -204,6 +209,22 @@ public class Trade { return exp; } + + public Double getCommandCost(final IUser user) + { + double cost = 0d; + if (command != null && !command.isEmpty() + && !NoCommandCostPermissions.getPermission("all").isAuthorized(user) + && !NoCommandCostPermissions.getPermission(command).isAuthorized(user)) + { + cost = ess.getSettings().getData().getEconomy().getCommandCost(command.charAt(0) == '/' ? command.substring(1) : command); + if (cost == 0.0 && fallbackCommand != null && !fallbackCommand.isEmpty()) + { + cost = ess.getSettings().getData().getEconomy().getCommandCost(fallbackCommand.charAt(0) == '/' ? fallbackCommand.substring(1) : fallbackCommand); + } + } + return cost; + } private static FileWriter fw = null; public static void log(String type, String subtype, String event, String sender, Trade charge, String receiver, Trade pay, Location loc, IEssentials ess) diff --git a/Essentials/src/net/ess3/economy/Worth.java b/Essentials/src/net/ess3/economy/Worth.java index 91fa254b7..c14873b22 100644 --- a/Essentials/src/net/ess3/economy/Worth.java +++ b/Essentials/src/net/ess3/economy/Worth.java @@ -1,13 +1,13 @@ package net.ess3.economy; -import net.ess3.storage.EnchantmentLevel; -import net.ess3.storage.MapKeyType; -import net.ess3.storage.MapValueType; -import net.ess3.storage.StorageObject; import java.util.HashMap; import java.util.Map; import lombok.Data; import lombok.EqualsAndHashCode; +import net.ess3.storage.EnchantmentLevel; +import net.ess3.storage.MapKeyType; +import net.ess3.storage.MapValueType; +import net.ess3.storage.StorageObject; import org.bukkit.Material; import org.bukkit.material.MaterialData; diff --git a/Essentials/src/net/ess3/economy/WorthHolder.java b/Essentials/src/net/ess3/economy/WorthHolder.java index f43441f0d..fbd20360c 100644 --- a/Essentials/src/net/ess3/economy/WorthHolder.java +++ b/Essentials/src/net/ess3/economy/WorthHolder.java @@ -1,20 +1,34 @@ package net.ess3.economy; -import net.ess3.api.IEssentials; -import net.ess3.api.IWorth; import net.ess3.api.server.ItemStack; -import net.ess3.storage.AsyncStorageObjectHolder; -import net.ess3.storage.EnchantmentLevel; import java.io.File; import java.io.IOException; import java.util.HashMap; import java.util.Map; +import net.ess3.api.IEssentials; +import net.ess3.api.IWorth; +import net.ess3.storage.AsyncStorageObjectHolder; +import net.ess3.storage.EnchantmentLevel; import org.bukkit.enchantments.Enchantment; import org.bukkit.material.MaterialData; public class WorthHolder extends AsyncStorageObjectHolder<net.ess3.economy.Worth> implements IWorth { + + @Override + public void finishRead() + { + + } + + @Override + public void finishWrite() + { + + } + + public WorthHolder(final IEssentials ess) { super(ess, net.ess3.economy.Worth.class); diff --git a/Essentials/src/net/ess3/economy/register/Method.java b/Essentials/src/net/ess3/economy/register/Method.java index 228e92569..c01e46476 100644 --- a/Essentials/src/net/ess3/economy/register/Method.java +++ b/Essentials/src/net/ess3/economy/register/Method.java @@ -33,6 +33,13 @@ public interface Method * @return <code>String</code> Plugin name. */ public String getName(); + + /** + * Returns the reported name of this method. + * + * @return <code>String</code> Plugin name. + */ + public String getLongName(); /** * Returns the actual version of this method. diff --git a/Essentials/src/net/ess3/economy/register/methods/BOSE6.java b/Essentials/src/net/ess3/economy/register/methods/BOSE6.java index 051ac92a3..2d8fd4715 100644 --- a/Essentials/src/net/ess3/economy/register/methods/BOSE6.java +++ b/Essentials/src/net/ess3/economy/register/methods/BOSE6.java @@ -1,16 +1,15 @@ package net.ess3.economy.register.methods; -import net.ess3.economy.register.Method; import cosine.boseconomy.BOSEconomy; +import net.ess3.economy.register.Method; import org.bukkit.plugin.Plugin; /** * BOSEconomy 6 Implementation of Method * - * @author Nijikokun <nijikokun@shortmail.com> (@nijikokun) - * @copyright (c) 2011 - * @license AOL license <http://aol.nexua.org> + * @author Nijikokun <nijikokun@shortmail.com> (@nijikokun) @copyright (c) 2011 @license AOL license + * <http://aol.nexua.org> */ @SuppressWarnings("deprecation") public class BOSE6 implements Method @@ -30,6 +29,12 @@ public class BOSE6 implements Method } @Override + public String getLongName() + { + return getName(); + } + + @Override public String getVersion() { return "0.6.2"; diff --git a/Essentials/src/net/ess3/economy/register/methods/BOSE7.java b/Essentials/src/net/ess3/economy/register/methods/BOSE7.java index 59e2f5bb5..46234bc52 100644 --- a/Essentials/src/net/ess3/economy/register/methods/BOSE7.java +++ b/Essentials/src/net/ess3/economy/register/methods/BOSE7.java @@ -1,7 +1,7 @@ package net.ess3.economy.register.methods; -import net.ess3.economy.register.Method; import cosine.boseconomy.BOSEconomy; +import net.ess3.economy.register.Method; import org.bukkit.plugin.Plugin; @@ -9,9 +9,8 @@ import org.bukkit.plugin.Plugin; * BOSEconomy 7 Implementation of Method * * @author Acrobot - * @author Nijikokun <nijikokun@shortmail.com> (@nijikokun) - * @copyright (c) 2011 - * @license AOL license <http://aol.nexua.org> + * @author Nijikokun <nijikokun@shortmail.com> (@nijikokun) @copyright (c) 2011 @license AOL license + * <http://aol.nexua.org> */ public class BOSE7 implements Method { @@ -30,6 +29,12 @@ public class BOSE7 implements Method } @Override + public String getLongName() + { + return getName(); + } + + @Override public String getVersion() { return "0.7.0"; diff --git a/Essentials/src/net/ess3/economy/register/methods/MCUR.java b/Essentials/src/net/ess3/economy/register/methods/MCUR.java index e7c1287eb..3c6d39fba 100644 --- a/Essentials/src/net/ess3/economy/register/methods/MCUR.java +++ b/Essentials/src/net/ess3/economy/register/methods/MCUR.java @@ -1,17 +1,15 @@ package net.ess3.economy.register.methods; -import net.ess3.economy.register.Method; import me.ashtheking.currency.Currency; import me.ashtheking.currency.CurrencyList; +import net.ess3.economy.register.Method; import org.bukkit.plugin.Plugin; /** * MultiCurrency Method implementation. * - * @author Acrobot - * @copyright (c) 2011 - * @license AOL license <http://aol.nexua.org> + * @author Acrobot @copyright (c) 2011 @license AOL license <http://aol.nexua.org> */ public class MCUR implements Method { @@ -30,6 +28,12 @@ public class MCUR implements Method } @Override + public String getLongName() + { + return getName(); + } + + @Override public String getVersion() { return "0.09"; diff --git a/Essentials/src/net/ess3/economy/register/methods/VaultEco.java b/Essentials/src/net/ess3/economy/register/methods/VaultEco.java index 804770773..5281c5b2f 100644 --- a/Essentials/src/net/ess3/economy/register/methods/VaultEco.java +++ b/Essentials/src/net/ess3/economy/register/methods/VaultEco.java @@ -32,8 +32,18 @@ public class VaultEco implements Method @Override public String getName() { - - return this.vault.getDescription().getName().concat(" - Economy: ").concat(economy == null ? "NoEco" : economy.getName()); + return this.vault.getDescription().getName(); + } + + public String getEconomy() + { + return economy == null ? "NoEco" : economy.getName(); + } + + @Override + public String getLongName() + { + return getName().concat(" - Economy: ").concat(getEconomy()); } @Override diff --git a/Essentials/src/net/ess3/economy/register/methods/iCo4.java b/Essentials/src/net/ess3/economy/register/methods/iCo4.java index adb1c5eb1..cf365d322 100644 --- a/Essentials/src/net/ess3/economy/register/methods/iCo4.java +++ b/Essentials/src/net/ess3/economy/register/methods/iCo4.java @@ -1,17 +1,16 @@ package net.ess3.economy.register.methods; -import net.ess3.economy.register.Method; import com.nijiko.coelho.iConomy.iConomy; import com.nijiko.coelho.iConomy.system.Account; +import net.ess3.economy.register.Method; import org.bukkit.plugin.Plugin; /** * iConomy 4 Implementation of Method * - * @author Nijikokun <nijikokun@shortmail.com> (@nijikokun) - * @copyright (c) 2011 - * @license AOL license <http://aol.nexua.org> + * @author Nijikokun <nijikokun@shortmail.com> (@nijikokun) @copyright (c) 2011 @license AOL license + * <http://aol.nexua.org> */ public class iCo4 implements Method { @@ -30,6 +29,12 @@ public class iCo4 implements Method } @Override + public String getLongName() + { + return getName(); + } + + @Override public String getVersion() { return "4"; diff --git a/Essentials/src/net/ess3/economy/register/methods/iCo5.java b/Essentials/src/net/ess3/economy/register/methods/iCo5.java index 7867446de..a25513f36 100644 --- a/Essentials/src/net/ess3/economy/register/methods/iCo5.java +++ b/Essentials/src/net/ess3/economy/register/methods/iCo5.java @@ -1,20 +1,19 @@ package net.ess3.economy.register.methods; -import net.ess3.economy.register.Method; import com.iConomy.iConomy; import com.iConomy.system.Account; import com.iConomy.system.BankAccount; import com.iConomy.system.Holdings; import com.iConomy.util.Constants; +import net.ess3.economy.register.Method; import org.bukkit.plugin.Plugin; /** * iConomy 5 Implementation of Method * - * @author Nijikokun <nijikokun@shortmail.com> (@nijikokun) - * @copyright (c) 2011 - * @license AOL license <http://aol.nexua.org> + * @author Nijikokun <nijikokun@shortmail.com> (@nijikokun) @copyright (c) 2011 @license AOL license + * <http://aol.nexua.org> */ public class iCo5 implements Method { @@ -33,6 +32,12 @@ public class iCo5 implements Method } @Override + public String getLongName() + { + return getName(); + } + + @Override public String getVersion() { return "5"; diff --git a/Essentials/src/net/ess3/economy/register/methods/iCo6.java b/Essentials/src/net/ess3/economy/register/methods/iCo6.java index 961aadef4..c68882aa3 100644 --- a/Essentials/src/net/ess3/economy/register/methods/iCo6.java +++ b/Essentials/src/net/ess3/economy/register/methods/iCo6.java @@ -1,19 +1,18 @@ package net.ess3.economy.register.methods; -import net.ess3.economy.register.Method; import com.iCo6.iConomy; import com.iCo6.system.Account; import com.iCo6.system.Accounts; import com.iCo6.system.Holdings; +import net.ess3.economy.register.Method; import org.bukkit.plugin.Plugin; /** * iConomy 6 Implementation of Method * - * @author Nijikokun <nijikokun@shortmail.com> (@nijikokun) - * @copyright (c) 2011 - * @license AOL license <http://aol.nexua.org> + * @author Nijikokun <nijikokun@shortmail.com> (@nijikokun) @copyright (c) 2011 @license AOL license + * <http://aol.nexua.org> */ public class iCo6 implements Method { @@ -32,6 +31,12 @@ public class iCo6 implements Method } @Override + public String getLongName() + { + return getName(); + } + + @Override public String getVersion() { return "6"; diff --git a/Essentials/src/net/ess3/listener/EssentialsBlockListener.java b/Essentials/src/net/ess3/listener/EssentialsBlockListener.java index 9393d8dbe..5faaeeb3b 100644 --- a/Essentials/src/net/ess3/listener/EssentialsBlockListener.java +++ b/Essentials/src/net/ess3/listener/EssentialsBlockListener.java @@ -1,8 +1,8 @@ package net.ess3.listener; -import net.ess3.utils.Util; import net.ess3.api.IEssentials; import net.ess3.api.IUser; +import net.ess3.utils.Util; import org.bukkit.GameMode; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; @@ -21,11 +21,11 @@ public class EssentialsBlockListener implements Listener this.ess = ess; } - @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) + @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) public void onBlockPlace(final BlockPlaceEvent event) { // Do not rely on getItemInHand(); - // http://leaky.bukkit.org/issues/663 + // http://leaky.bukkit.org/issues/663 final ItemStack itemstack = Util.convertBlockToItem(event.getBlockPlaced()); if (itemstack == null) { diff --git a/Essentials/src/net/ess3/listener/EssentialsEntityListener.java b/Essentials/src/net/ess3/listener/EssentialsEntityListener.java index 14fcd74ff..6677005bd 100644 --- a/Essentials/src/net/ess3/listener/EssentialsEntityListener.java +++ b/Essentials/src/net/ess3/listener/EssentialsEntityListener.java @@ -7,9 +7,16 @@ import net.ess3.api.IUser; import net.ess3.permissions.Permissions; import java.util.List; import lombok.Cleanup; +import static net.ess3.I18n._; +import net.ess3.api.IEssentials; +import net.ess3.api.ISettings; +import net.ess3.api.IUser; +import net.ess3.permissions.Permissions; +import net.ess3.user.UserData.TimestampType; import org.bukkit.Material; -import org.bukkit.entity.Animals; +import org.bukkit.entity.Ageable; import org.bukkit.entity.Entity; +import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; @@ -28,39 +35,64 @@ public class EssentialsEntityListener implements Listener this.ess = ess; } - @EventHandler(priority = EventPriority.LOWEST) + @EventHandler(priority = EventPriority.LOW) public void onEntityDamage(final EntityDamageByEntityEvent event) { final Entity eAttack = event.getDamager(); final Entity eDefend = event.getEntity(); + if (eDefend instanceof Player && eAttack instanceof Player) { @Cleanup final IUser attacker = ess.getUser((Player)eAttack); + @Cleanup + final IUser defender = ess.getUser((Player)eDefend); + @Cleanup + ISettings settings = ess.getSettings(); + settings.acquireReadLock(); attacker.acquireReadLock(); + defender.acquireReadLock(); + attacker.updateActivity(true); + if (settings.getData().getGeneral().getLoginAttackDelay() > 0 && !Permissions.PVPDELAY_EXEMPT.isAuthorized(attacker) + && (System.currentTimeMillis() < (attacker.getTimestamp(TimestampType.LOGIN) + settings.getData().getGeneral().getLoginAttackDelay()))) + { + event.setCancelled(true); + } + if (attacker.hasInvulnerabilityAfterTeleport() || defender.hasInvulnerabilityAfterTeleport()) + { + event.setCancelled(true); + } final ItemStack itemstack = attacker.getItemInHand(); final List<String> commandList = attacker.getData().getPowertool(itemstack.getType()); if (commandList != null && !commandList.isEmpty()) { - for (String command : commandList) + for (final String command : commandList) { if (command != null && !command.isEmpty()) { - attacker.getServer().dispatchCommand(attacker, command.replaceAll("\\{player\\}", ((Player)eDefend).getName())); + ess.scheduleSyncDelayedTask( + new Runnable() + { + @Override + public void run() + { + attacker.getServer().dispatchCommand(attacker.getBase(), command.replaceAll("\\{player\\}", defender.getName())); + } + }); event.setCancelled(true); return; } } } } - else if (eDefend instanceof Animals && eAttack instanceof Player) + else if (eDefend instanceof Ageable && eAttack instanceof Player) { final Player player = (Player)eAttack; final ItemStack hand = player.getItemInHand(); if (hand != null && hand.getType() == Material.MILK_BUCKET) { - ((Animals)eDefend).setBaby(); + ((Ageable)eDefend).setBaby(); hand.setType(Material.BUCKET); player.setItemInHand(hand); player.updateInventory(); @@ -69,7 +101,7 @@ public class EssentialsEntityListener implements Listener } } - @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) + @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) public void onEntityDamage(final EntityDamageEvent event) { if (event.getEntity() instanceof Player && ess.getUser((Player)event.getEntity()).isGodModeEnabled()) @@ -81,7 +113,7 @@ public class EssentialsEntityListener implements Listener } } - @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) + @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) public void onEntityCombust(final EntityCombustEvent event) { if (event.getEntity() instanceof Player && ess.getUser((Player)event.getEntity()).isGodModeEnabled()) @@ -108,7 +140,18 @@ public class EssentialsEntityListener implements Listener } } - @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) + @EventHandler(priority = EventPriority.LOW) + public void onPlayerDeathExpEvent(final PlayerDeathEvent event) + { + final IUser user = ess.getUser(event.getEntity()); + if (Permissions.KEEPXP.isAuthorized(user)) + { + event.setKeepLevel(true); + event.setDroppedExp(0); + } + } + + @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) public void onFoodLevelChange(final FoodLevelChangeEvent event) { if (event.getEntity() instanceof Player && ess.getUser((Player)event.getEntity()).isGodModeEnabled()) @@ -117,7 +160,7 @@ public class EssentialsEntityListener implements Listener } } - @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) + @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) public void onEntityRegainHealth(final EntityRegainHealthEvent event) { @@ -135,4 +178,32 @@ public class EssentialsEntityListener implements Listener } } } + + @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) + public void onCreatureSpawn(final CreatureSpawnEvent event) + { + if (event.getEntity().getType() == EntityType.PLAYER) + { + return; + } + final EntityType creature = event.getEntityType(); + if (creature == null) + { + return; + } + final ISettings settings = ess.getSettings(); + settings.acquireReadLock(); + try + { + final Boolean prevent = settings.getData().getWorldOptions(event.getLocation().getWorld().getName()).getPreventSpawn(creature); + if (prevent != null && prevent) + { + event.setCancelled(true); + } + } + finally + { + settings.unlock(); + } + } } diff --git a/Essentials/src/net/ess3/listener/EssentialsPlayerListener.java b/Essentials/src/net/ess3/listener/EssentialsPlayerListener.java index 129178b84..564a75f34 100644 --- a/Essentials/src/net/ess3/listener/EssentialsPlayerListener.java +++ b/Essentials/src/net/ess3/listener/EssentialsPlayerListener.java @@ -1,24 +1,24 @@ package net.ess3.listener; +import java.io.IOException; +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; +import java.util.Locale; +import java.util.logging.Level; +import java.util.logging.Logger; +import lombok.Cleanup; import static net.ess3.I18n._; import net.ess3.api.IEssentials; import net.ess3.api.ISettings; import net.ess3.api.IUser; import net.ess3.permissions.Permissions; +import net.ess3.user.UserData.TimestampType; +import net.ess3.utils.LocationUtil; import net.ess3.utils.textreader.IText; import net.ess3.utils.textreader.KeywordReplacer; import net.ess3.utils.textreader.TextInput; import net.ess3.utils.textreader.TextPager; -import net.ess3.user.UserData.TimestampType; -import net.ess3.utils.LocationUtil; -import java.io.IOException; -import java.util.Arrays; -import java.util.Iterator; -import java.util.List; -import java.util.Locale; -import java.util.logging.Level; -import java.util.logging.Logger; -import lombok.Cleanup; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Server; @@ -26,9 +26,13 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.event.inventory.InventoryCloseEvent; +import org.bukkit.event.inventory.InventoryType; import org.bukkit.event.player.PlayerLoginEvent.Result; import org.bukkit.event.player.*; import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; +import org.bukkit.inventory.InventoryHolder; import org.bukkit.inventory.ItemStack; @@ -69,7 +73,7 @@ public class EssentialsPlayerListener implements Listener while (it.hasNext()) { final IUser player = ess.getUser(it.next()); - if (player.isIgnoringPlayer(user.getName())) + if (player.isIgnoringPlayer(user)) { it.remove(); } @@ -124,7 +128,11 @@ public class EssentialsPlayerListener implements Listener settings.acquireReadLock(); if (settings.getData().getCommands().getGod().isRemoveOnDisconnect() && user.isGodModeEnabled()) { - user.toggleGodModeEnabled(); + user.setGodModeEnabled(false); + } + if (user.isVanished()) + { + user.toggleVanished(); } if (user.getData().getInventory() != null) { @@ -138,6 +146,10 @@ public class EssentialsPlayerListener implements Listener @EventHandler(priority = EventPriority.MONITOR) public void onPlayerJoin(final PlayerJoinEvent event) { + if (!event.getPlayer().isOnline()) + { + return; + } ess.getBackup().startTask(); @Cleanup final IUser user = ess.getUser(event.getPlayer()); @@ -146,6 +158,15 @@ public class EssentialsPlayerListener implements Listener user.updateDisplayName(); user.getData().setIpAddress(user.getAddress().getAddress().getHostAddress()); user.updateActivity(false); + + for (String p : ess.getVanishedPlayers()) + { + if (!Permissions.VANISH_SEE_OTHERS.isAuthorized(user)) + { + user.hidePlayer(ess.getUser(p).getBase()); + } + } + if (Permissions.SLEEPINGIGNORED.isAuthorized(user)) { user.setSleepingIgnored(true); @@ -380,7 +401,7 @@ public class EssentialsPlayerListener implements Listener { return false; } - + final List<String> commandList = user.getData().getPowertool(is.getType()); if (commandList == null || commandList.isEmpty()) { @@ -435,4 +456,34 @@ public class EssentialsPlayerListener implements Listener event.setCancelled(true); } } + + @EventHandler(priority = EventPriority.LOWEST) + public void onInventoryClickEvent(final InventoryClickEvent event) + { + if (event.getView().getTopInventory().getType() == InventoryType.PLAYER) + { + final IUser user = ess.getUser((Player)event.getWhoClicked()); + final InventoryHolder invHolder = event.getView().getTopInventory().getHolder(); + if (invHolder != null && invHolder instanceof Player) + { + final IUser invOwner = ess.getUser((Player)invHolder); + if (user.isInvSee() && (!Permissions.INVSEE_MODIFY.isAuthorized(user) + || Permissions.INVSEE_PREVENT_MODIFY.isAuthorized(invOwner) + || !invOwner.isOnline())) + { + event.setCancelled(true); + } + } + } + } + + @EventHandler(priority = EventPriority.MONITOR) + public void onInventoryCloseEvent(final InventoryCloseEvent event) + { + if (event.getView().getTopInventory().getType() == InventoryType.PLAYER) + { + final IUser user = ess.getUser((Player)event.getPlayer()); + user.setInvSee(false); + } + } } diff --git a/Essentials/src/net/ess3/listener/EssentialsPluginListener.java b/Essentials/src/net/ess3/listener/EssentialsPluginListener.java index 2d5e7a9d4..46b87a28c 100644 --- a/Essentials/src/net/ess3/listener/EssentialsPluginListener.java +++ b/Essentials/src/net/ess3/listener/EssentialsPluginListener.java @@ -1,14 +1,14 @@ package net.ess3.listener; +import java.util.logging.Level; import net.ess3.api.IEssentials; import net.ess3.api.IReload; import net.ess3.api.ISettings; +import net.ess3.economy.register.Methods; import net.ess3.ranks.GMGroups; +import net.ess3.ranks.RanksStorage; import net.ess3.ranks.VaultGroups; -import net.ess3.economy.register.Methods; import net.ess3.settings.General; -import net.ess3.ranks.RanksStorage; -import java.util.logging.Level; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; diff --git a/Essentials/src/net/ess3/listener/TntExplodeListener.java b/Essentials/src/net/ess3/listener/TntExplodeListener.java index 5a423a027..66ef5c284 100644 --- a/Essentials/src/net/ess3/listener/TntExplodeListener.java +++ b/Essentials/src/net/ess3/listener/TntExplodeListener.java @@ -1,8 +1,7 @@ package net.ess3.listener; -import net.ess3.api.IEssentials; -import net.ess3.craftbukkit.FakeExplosion; import java.util.concurrent.atomic.AtomicBoolean; +import net.ess3.api.IEssentials; import org.bukkit.entity.LivingEntity; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; @@ -47,8 +46,12 @@ public class TntExplodeListener implements Listener, Runnable { return; } - FakeExplosion.createExplosion(event, ess.getServer(), ess.getServer().getOnlinePlayers()); + if (event.blockList().size() < 1) + { + return; + } event.setCancelled(true); + event.getLocation().getWorld().createExplosion(event.getLocation(), 0F); } @Override diff --git a/Essentials/src/net/ess3/metrics/Metrics.java b/Essentials/src/net/ess3/metrics/Metrics.java new file mode 100644 index 000000000..415938dea --- /dev/null +++ b/Essentials/src/net/ess3/metrics/Metrics.java @@ -0,0 +1,625 @@ +package net.ess3.metrics; + +/* + * Copyright 2011 Tyler Blair. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the + * following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following + * disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the + * following disclaimer in the documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the authors and contributors and + * should not be interpreted as representing official policies, either expressed or implied, of anybody else. + */ +import java.io.*; +import java.net.Proxy; +import java.net.URL; +import java.net.URLConnection; +import java.net.URLEncoder; +import java.util.*; +import java.util.logging.Level; +import org.bukkit.Bukkit; +import org.bukkit.configuration.InvalidConfigurationException; +import org.bukkit.configuration.file.YamlConfiguration; +import org.bukkit.plugin.Plugin; +import org.bukkit.plugin.PluginDescriptionFile; + + +/** + * <p> The metrics class obtains data about a plugin and submits statistics about it to the metrics backend. </p> <p> + * Public methods provided by this class: </p> + * <code> + * Graph createGraph(String name); <br/> + * void addCustomData(Metrics.Plotter plotter); <br/> + * void start(); <br/> + * </code> + */ +public class Metrics +{ + /** + * The current revision number + */ + private final static int REVISION = 5; + /** + * The base url of the metrics domain + */ + private static final String BASE_URL = "http://metrics.essentials3.net"; + /** + * The url used to report a server's status + */ + private static final String REPORT_URL = "/report/%s"; + /** + * The file where guid and opt out is stored in + */ + private static final String CONFIG_FILE = "plugins/PluginMetrics/config.yml"; + /** + * The separator to use for custom data. This MUST NOT change unless you are hosting your own version of metrics and + * want to change it. + */ + private static final String CUSTOM_DATA_SEPARATOR = "~~"; + /** + * Interval of time to ping (in minutes) + */ + private static final int PING_INTERVAL = 10; + /** + * The plugin this metrics submits for + */ + private final Plugin plugin; + /** + * All of the custom graphs to submit to metrics + */ + private final Set<Graph> graphs = Collections.synchronizedSet(new HashSet<Graph>()); + /** + * The default graph, used for addCustomData when you don't want a specific graph + */ + private final Graph defaultGraph = new Graph("Default"); + /** + * The plugin configuration file + */ + private final YamlConfiguration configuration; + /** + * The plugin configuration file + */ + private final File configurationFile; + /** + * Unique server id + */ + private final String guid; + /** + * Lock for synchronization + */ + private final Object optOutLock = new Object(); + /** + * Id of the scheduled task + */ + private volatile int taskId = -1; + + public Metrics(final Plugin plugin) throws IOException + { + if (plugin == null) + { + throw new IllegalArgumentException("Plugin cannot be null"); + } + + this.plugin = plugin; + + // load the config + configurationFile = new File(CONFIG_FILE); + configuration = YamlConfiguration.loadConfiguration(configurationFile); + + // add some defaults + configuration.addDefault("opt-out", false); + configuration.addDefault("guid", UUID.randomUUID().toString()); + + // Do we need to create the file? + if (configuration.get("guid", null) == null) + { + configuration.options().header("http://metrics.griefcraft.com").copyDefaults(true); + configuration.save(configurationFile); + } + + // Load the guid then + guid = configuration.getString("guid"); + } + + /** + * Construct and create a Graph that can be used to separate specific plotters to their own graphs on the metrics + * website. Plotters can be added to the graph object returned. + * + * @param name + * @return Graph object created. Will never return NULL under normal circumstances unless bad parameters are given + */ + public Graph createGraph(final String name) + { + if (name == null) + { + throw new IllegalArgumentException("Graph name cannot be null"); + } + + // Construct the graph object + final Graph graph = new Graph(name); + + // Now we can add our graph + graphs.add(graph); + + // and return back + return graph; + } + + /** + * Adds a custom data plotter to the default graph + * + * @param plotter + */ + public void addCustomData(final Plotter plotter) + { + if (plotter == null) + { + throw new IllegalArgumentException("Plotter cannot be null"); + } + + // Add the plotter to the graph o/ + defaultGraph.addPlotter(plotter); + + // Ensure the default graph is included in the submitted graphs + graphs.add(defaultGraph); + } + + /** + * Start measuring statistics. This will immediately create an async repeating task as the plugin and send the + * initial data to the metrics backend, and then after that it will post in increments of PING_INTERVAL * 1200 + * ticks. + */ + public void start() + { + synchronized (optOutLock) + { + // Did we opt out? + if (isOptOut()) + { + return; + } + + // Begin hitting the server with glorious data + taskId = plugin.getServer().getScheduler().scheduleAsyncRepeatingTask(plugin, new Runnable() + { + private boolean firstPost = true; + + public void run() + { + try + { + // This has to be synchronized or it can collide with the disable method. + synchronized (optOutLock) + { + // Disable Task, if it is running and the server owner decided to opt-out + if (isOptOut() && taskId > 0) + { + plugin.getServer().getScheduler().cancelTask(taskId); + taskId = -1; + } + } + + // We use the inverse of firstPost because if it is the first time we are posting, + // it is not a interval ping, so it evaluates to FALSE + // Each time thereafter it will evaluate to TRUE, i.e PING! + postPlugin(!firstPost); + + // After the first post we set firstPost to false + // Each post thereafter will be a ping + firstPost = false; + } + catch (IOException e) + { + Bukkit.getLogger().log(Level.INFO, "[Metrics] " + e.getMessage()); + } + } + }, 0, PING_INTERVAL * 1200); + } + } + + /** + * Has the server owner denied plugin metrics? + * + * @return + */ + public boolean isOptOut() + { + synchronized (optOutLock) + { + try + { + // Reload the metrics file + configuration.load(CONFIG_FILE); + } + catch (IOException ex) + { + Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.getMessage()); + return true; + } + catch (InvalidConfigurationException ex) + { + Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.getMessage()); + return true; + } + return configuration.getBoolean("opt-out", false); + } + } + + /** + * Enables metrics for the server by setting "opt-out" to false in the config file and starting the metrics task. + * + * @throws IOException + */ + public void enable() throws IOException + { + // This has to be synchronized or it can collide with the check in the task. + synchronized (optOutLock) + { + // Check if the server owner has already set opt-out, if not, set it. + if (isOptOut()) + { + configuration.set("opt-out", false); + configuration.save(configurationFile); + } + + // Enable Task, if it is not running + if (taskId < 0) + { + start(); + } + } + } + + /** + * Disables metrics for the server by setting "opt-out" to true in the config file and canceling the metrics task. + * + * @throws IOException + */ + public void disable() throws IOException + { + // This has to be synchronized or it can collide with the check in the task. + synchronized (optOutLock) + { + // Check if the server owner has already set opt-out, if not, set it. + if (!isOptOut()) + { + configuration.set("opt-out", true); + final File file = new File(CONFIG_FILE); + configuration.save(file); + } + + // Disable Task, if it is running + if (taskId >= 0) + { + this.plugin.getServer().getScheduler().cancelTask(taskId); + taskId = -1; + } + } + } + + /** + * Generic method that posts a plugin to the metrics website + */ + private void postPlugin(final boolean isPing) throws IOException + { + // The plugin's description file containg all of the plugin data such as name, version, author, etc + final PluginDescriptionFile description = plugin.getDescription(); + + // Construct the post data + final StringBuilder data = new StringBuilder(); + data.append(encode("guid")).append('=').append(encode(guid)); + encodeDataPair(data, "version", description.getVersion()); + encodeDataPair(data, "server", Bukkit.getVersion()); + encodeDataPair(data, "players", Integer.toString(Bukkit.getServer().getOnlinePlayers().length)); + encodeDataPair(data, "revision", String.valueOf(REVISION)); + + // If we're pinging, append it + if (isPing) + { + encodeDataPair(data, "ping", "true"); + } + + // Acquire a lock on the graphs, which lets us make the assumption we also lock everything + // inside of the graph (e.g plotters) + synchronized (graphs) + { + final Iterator<Graph> iter = graphs.iterator(); + + while (iter.hasNext()) + { + final Graph graph = iter.next(); + + // Because we have a lock on the graphs set already, it is reasonable to assume + // that our lock transcends down to the individual plotters in the graphs also. + // Because our methods are private, no one but us can reasonably access this list + // without reflection so this is a safe assumption without adding more code. + for (Plotter plotter : graph.getPlotters()) + { + // The key name to send to the metrics server + // The format is C-GRAPHNAME-PLOTTERNAME where separator - is defined at the top + // Legacy (R4) submitters use the format Custom%s, or CustomPLOTTERNAME + final String key = String.format("C%s%s%s%s", CUSTOM_DATA_SEPARATOR, graph.getName(), CUSTOM_DATA_SEPARATOR, plotter.getColumnName()); + + // The value to send, which for the foreseeable future is just the string + // value of plotter.getValue() + final String value = Integer.toString(plotter.getValue()); + + // Add it to the http post data :) + encodeDataPair(data, key, value); + } + } + } + + // Create the url + final URL url = new URL(BASE_URL + String.format(REPORT_URL, description.getName())); + + // Connect to the website + URLConnection connection; + + // Mineshafter creates a socks proxy, so we can safely bypass it + // It does not reroute POST requests so we need to go around it + if (isMineshafterPresent()) + { + connection = url.openConnection(Proxy.NO_PROXY); + } + else + { + connection = url.openConnection(); + } + + connection.setDoOutput(true); + + // Write the data + final OutputStreamWriter writer = new OutputStreamWriter(connection.getOutputStream()); + writer.write(data.toString()); + writer.flush(); + + // Now read the response + final BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream())); + final String response = reader.readLine(); + + // close resources + writer.close(); + reader.close(); + + if (response == null || response.startsWith("ERR")) + { + throw new IOException(response); //Throw the exception + } + else + { + // Is this the first update this hour? + if (response.contains("OK This is your first update this hour")) + { + synchronized (graphs) + { + final Iterator<Graph> iter = graphs.iterator(); + + while (iter.hasNext()) + { + final Graph graph = iter.next(); + + for (Plotter plotter : graph.getPlotters()) + { + plotter.reset(); + } + } + } + } + } + //if (response.startsWith("OK")) - We should get "OK" followed by an optional description if everything goes right + } + + /** + * Check if mineshafter is present. If it is, we need to bypass it to send POST requests + * + * @return + */ + private boolean isMineshafterPresent() + { + try + { + Class.forName("mineshafter.MineServer"); + return true; + } + catch (Exception e) + { + return false; + } + } + + /** + * <p>Encode a key/value data pair to be used in a HTTP post request. This INCLUDES a & so the first key/value pair + * MUST be included manually, e.g:</p> + * <code> + * StringBuffer data = new StringBuffer(); + * data.append(encode("guid")).append('=').append(encode(guid)); + * encodeDataPair(data, "version", description.getVersion()); + * </code> + * + * @param buffer + * @param key + * @param value + * @return + */ + private static void encodeDataPair(final StringBuilder buffer, final String key, final String value) throws UnsupportedEncodingException + { + buffer.append('&').append(encode(key)).append('=').append(encode(value)); + } + + /** + * Encode text as UTF-8 + * + * @param text + * @return + */ + private static String encode(final String text) throws UnsupportedEncodingException + { + return URLEncoder.encode(text, "UTF-8"); + } + + + /** + * Represents a custom graph on the website + */ + public static class Graph + { + /** + * The graph's name, alphanumeric and spaces only :) If it does not comply to the above when submitted, it is + * rejected + */ + private final String name; + /** + * The set of plotters that are contained within this graph + */ + private final Set<Plotter> plotters = new LinkedHashSet<Plotter>(); + + private Graph(final String name) + { + this.name = name; + } + + /** + * Gets the graph's name + * + * @return + */ + public String getName() + { + return name; + } + + /** + * Add a plotter to the graph, which will be used to plot entries + * + * @param plotter + */ + public void addPlotter(final Plotter plotter) + { + plotters.add(plotter); + } + + /** + * Remove a plotter from the graph + * + * @param plotter + */ + public void removePlotter(final Plotter plotter) + { + plotters.remove(plotter); + } + + /** + * Gets an <b>unmodifiable</b> set of the plotter objects in the graph + * + * @return + */ + public Set<Plotter> getPlotters() + { + return Collections.unmodifiableSet(plotters); + } + + @Override + public int hashCode() + { + return name.hashCode(); + } + + @Override + public boolean equals(final Object object) + { + if (!(object instanceof Graph)) + { + return false; + } + + final Graph graph = (Graph)object; + return graph.name.equals(name); + } + } + + + /** + * Interface used to collect custom data for a plugin + */ + public static abstract class Plotter + { + /** + * The plot's name + */ + private final String name; + + /** + * Construct a plotter with the default plot name + */ + public Plotter() + { + this("Default"); + } + + /** + * Construct a plotter with a specific plot name + * + * @param name + */ + public Plotter(final String name) + { + this.name = name; + } + + /** + * Get the current value for the plotted point + * + * @return + */ + public abstract int getValue(); + + /** + * Get the column name for the plotted point + * + * @return the plotted point's column name + */ + public String getColumnName() + { + return name; + } + + /** + * Called after the website graphs have been updated + */ + public void reset() + { + } + + @Override + public int hashCode() + { + return getColumnName().hashCode() + getValue(); + } + + @Override + public boolean equals(final Object object) + { + if (!(object instanceof Plotter)) + { + return false; + } + + final Plotter plotter = (Plotter)object; + return plotter.name.equals(name) && plotter.getValue() == getValue(); + } + } +}
\ No newline at end of file diff --git a/Essentials/src/net/ess3/metrics/MetricsListener.java b/Essentials/src/net/ess3/metrics/MetricsListener.java new file mode 100644 index 000000000..1db463a46 --- /dev/null +++ b/Essentials/src/net/ess3/metrics/MetricsListener.java @@ -0,0 +1,37 @@ +package net.ess3.metrics; + +import net.ess3.api.IEssentials; +import org.bukkit.Server; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerJoinEvent; + + +public class MetricsListener implements Listener +{ + private final transient Server server; + private final transient IEssentials ess; + private final transient MetricsStarter starter; + + public MetricsListener(final IEssentials parent, final MetricsStarter starter) + { + this.ess = parent; + this.server = parent.getServer(); + this.starter = starter; + } + + @EventHandler(priority = EventPriority.MONITOR) + public void onPlayerJoin(final PlayerJoinEvent event) + { + /*final IUser player = ess.getUser(event.getPlayer()); + if (ess.getSettings().isMetricsEnabled() == false && (player.isAuthorized("essentials.essentials") || player.isAuthorized("bukkit.broadcast.admin"))) + { + player.sendMessage("PluginMetrics collects minimal statistic data, starting in about 5 minutes."); + player.sendMessage("To opt out, run /essentials opt-out"); + ess.getLogger().log(Level.INFO, "[Metrics] Admin join - Starting 5 minute opt-out period."); + ess.getSettings().setMetricsEnabled(true); + ess.getScheduler().scheduleAsyncDelayedTask(ess, starter, 5 * 1200); + }*/ + } +} diff --git a/Essentials/src/net/ess3/metrics/MetricsStarter.java b/Essentials/src/net/ess3/metrics/MetricsStarter.java new file mode 100644 index 000000000..ed55f9d40 --- /dev/null +++ b/Essentials/src/net/ess3/metrics/MetricsStarter.java @@ -0,0 +1,234 @@ +package net.ess3.metrics; + +import com.nijikokun.bukkit.Permissions.Permissions; +import java.util.Locale; +import java.util.logging.Level; +import lombok.Cleanup; +import net.ess3.api.IEssentials; +import net.ess3.api.ISettings; +import net.ess3.economy.register.Method; +import net.ess3.economy.register.methods.VaultEco; +import net.ess3.metrics.Metrics.Graph; +import net.ess3.metrics.Metrics.Plotter; + + +public class MetricsStarter implements Runnable +{ + private final IEssentials ess; + private transient Boolean start; + + + private enum Modules + { + Essentials, + EssentialsAntiCheat, + EssentialsChat, + EssentialsSpawn, + EssentialsProtect, + EssentialsGeoIP, + EssentialsXMPP + }; + + public MetricsStarter(final IEssentials plugin) + { + ess = plugin; + /* + try + { + + final Metrics metrics = new Metrics(ess); + ess.setMetrics(metrics); + + @Cleanup + ISettings settings = ess.getSettings(); + settings.acquireReadLock(); + if (!metrics.isOptOut()) + { + if (settings.getData().getGeneral().isMetricsEnabled()) + { + start = true; + } + else + { + ess.getLogger().info("This plugin collects minimal statistic data and sends it to http://metrics.essentials3.net."); + ess.getLogger().info("You can opt out by running /essentials opt-out"); + ess.getLogger().info("This will start 5 minutes after the first admin/op joins."); + start = false; + } + return; + } + } + catch (Exception ex) + { + metricsError(ex); + }*/ + } + + @Override + public void run() + { + try + { + final Metrics metrics = ess.getMetrics(); + + final Graph moduleGraph = metrics.createGraph("Modules Used"); + for (Modules module : Modules.values()) + { + final String moduleName = module.toString(); + if (ess.getServer().getPluginManager().isPluginEnabled(moduleName)) + { + moduleGraph.addPlotter(new SimplePlotter(moduleName)); + } + } + + final Graph localeGraph = metrics.createGraph("Locale"); + localeGraph.addPlotter(new SimplePlotter(ess.getI18n().getCurrentLocale().getDisplayLanguage(Locale.ENGLISH))); + + final Graph featureGraph = metrics.createGraph("Features"); + featureGraph.addPlotter(new Plotter("Unique Accounts") + { + @Override + public int getValue() + { + return ess.getUserMap().getUniqueUsers(); + } + }); + featureGraph.addPlotter(new Plotter("Jails") + { + @Override + public int getValue() + { + return ess.getJails().getCount(); + } + }); + featureGraph.addPlotter(new Plotter("Kits") + { + @Override + public int getValue() + { + int size = 0; + try + { + size = ess.getKits().getList().size(); + } + catch (Exception ex) + { + } + return size; + + } + }); + featureGraph.addPlotter(new Plotter("Warps") + { + @Override + public int getValue() + { + return ess.getWarps().getList().size(); + } + }); + + final Graph enabledGraph = metrics.createGraph("EnabledFeatures"); + enabledGraph.addPlotter(new SimplePlotter("Total")); + @Cleanup + ISettings settings = ess.getSettings(); + settings.acquireReadLock(); + final String BKcommand = settings.getData().getGeneral().getBackup().getCommand();; + if (BKcommand != null && !"".equals(BKcommand)) + { + enabledGraph.addPlotter(new SimplePlotter("Backup")); + } + if (ess.getJails().getCount() > 0) + { + enabledGraph.addPlotter(new SimplePlotter("Jails")); + } + if (ess.getKits().getList().size() > 0) + { + enabledGraph.addPlotter(new SimplePlotter("Kits")); + } + if (ess.getWarps().getList().size() > 0) + { + enabledGraph.addPlotter(new SimplePlotter("Warps")); + } + //todo - enable once settings are in + /* + if (!ess.getSettings().areSignsDisabled()) + { + enabledGraph.addPlotter(new SimplePlotter("Signs")); + } + if (ess.getSettings().getAutoAfk() > 0) + { + enabledGraph.addPlotter(new SimplePlotter("AutoAFK")); + } + if (ess.getSettings().changeDisplayName()) + { + enabledGraph.addPlotter(new SimplePlotter("DisplayName")); + } + if (ess.getSettings().getChatRadius() >= 1) + { + enabledGraph.addPlotter(new SimplePlotter("LocalChat")); + } + */ + final Graph depGraph = metrics.createGraph("Dependencies"); + final Method method = ess.getPaymentMethod().getMethod(); + if (method != null) + { + String version; + if (method instanceof VaultEco) + { + version = ((VaultEco)method).getEconomy(); + } + else + { + version = method.getVersion(); + final int dashPosition = version.indexOf('-'); + if (dashPosition > 0) + { + version = version.substring(0, dashPosition); + } + } + depGraph.addPlotter(new SimplePlotter(method.getName() + " " + version)); + } + //todo - verify + depGraph.addPlotter(new SimplePlotter(Permissions.getInstance().getName())); + + metrics.start(); + + } + catch (Exception ex) + { + metricsError(ex); + } + } + + public void metricsError(final Exception ex) + { + if (ess.getSettings().isDebug()) + { + ess.getLogger().log(Level.INFO, "[Metrics] " + ex.getMessage(), ex); + } + else + { + ess.getLogger().log(Level.INFO, "[Metrics] " + ex.getMessage()); + } + } + + public Boolean getStart() + { + return start; + } + + + private class SimplePlotter extends Plotter + { + public SimplePlotter(final String name) + { + super(name); + } + + @Override + public int getValue() + { + return 1; + } + } +}
\ No newline at end of file diff --git a/Essentials/src/net/ess3/permissions/AbstractSuperpermsPermission.java b/Essentials/src/net/ess3/permissions/AbstractSuperpermsPermission.java index 291284f87..211ce53aa 100644 --- a/Essentials/src/net/ess3/permissions/AbstractSuperpermsPermission.java +++ b/Essentials/src/net/ess3/permissions/AbstractSuperpermsPermission.java @@ -1,8 +1,10 @@ package net.ess3.permissions; import net.ess3.api.IPermission; -import net.ess3.api.server.CommandSender; -import net.ess3.api.server.Permission; +import net.ess3.utils.Util; +import org.bukkit.command.CommandSender; +import org.bukkit.permissions.Permission; +import org.bukkit.permissions.PermissionDefault; public abstract class AbstractSuperpermsPermission implements IPermission @@ -10,7 +12,7 @@ public abstract class AbstractSuperpermsPermission implements IPermission protected Permission bukkitPerm; @Override - public Permission getPermission() + public Permission getBukkitPermission() { if (bukkitPerm != null) { @@ -18,7 +20,7 @@ public abstract class AbstractSuperpermsPermission implements IPermission } else { - return Permission.create(getPermissionName(), getPermissionDefault()); + return Util.registerPermission(getPermission(), getPermissionDefault()); } } @@ -27,14 +29,14 @@ public abstract class AbstractSuperpermsPermission implements IPermission * @return */ @Override - public Permission.Default getPermissionDefault() + public PermissionDefault getPermissionDefault() { - return Permission.Default.OP; + return PermissionDefault.OP; } @Override public boolean isAuthorized(final CommandSender sender) { - return sender.hasPermission(getPermission()); + return sender.hasPermission(getBukkitPermission()); } } diff --git a/Essentials/src/net/ess3/permissions/EnchantPermissions.java b/Essentials/src/net/ess3/permissions/EnchantPermissions.java index 996477338..cc2095c8e 100644 --- a/Essentials/src/net/ess3/permissions/EnchantPermissions.java +++ b/Essentials/src/net/ess3/permissions/EnchantPermissions.java @@ -1,9 +1,9 @@ package net.ess3.permissions; -import net.ess3.api.IPermission; import java.util.HashMap; import java.util.Locale; import java.util.Map; +import net.ess3.api.IPermission; public class EnchantPermissions diff --git a/Essentials/src/net/ess3/permissions/GroupsPermissions.java b/Essentials/src/net/ess3/permissions/GroupsPermissions.java index 330cb7fb8..ed3095e38 100644 --- a/Essentials/src/net/ess3/permissions/GroupsPermissions.java +++ b/Essentials/src/net/ess3/permissions/GroupsPermissions.java @@ -1,9 +1,9 @@ package net.ess3.permissions; -import net.ess3.api.IPermission; import java.util.HashMap; import java.util.Locale; import java.util.Map; +import net.ess3.api.IPermission; public class GroupsPermissions diff --git a/Essentials/src/net/ess3/permissions/HelpPermissions.java b/Essentials/src/net/ess3/permissions/HelpPermissions.java index 3e7b251bd..3087cd4e9 100644 --- a/Essentials/src/net/ess3/permissions/HelpPermissions.java +++ b/Essentials/src/net/ess3/permissions/HelpPermissions.java @@ -1,9 +1,9 @@ package net.ess3.permissions; -import net.ess3.api.IPermission; import java.util.HashMap; import java.util.Locale; import java.util.Map; +import net.ess3.api.IPermission; public class HelpPermissions diff --git a/Essentials/src/net/ess3/permissions/NoCommandCostPermissions.java b/Essentials/src/net/ess3/permissions/NoCommandCostPermissions.java index 54cd18624..ab099e45f 100644 --- a/Essentials/src/net/ess3/permissions/NoCommandCostPermissions.java +++ b/Essentials/src/net/ess3/permissions/NoCommandCostPermissions.java @@ -1,9 +1,9 @@ package net.ess3.permissions; -import net.ess3.api.IPermission; import java.util.HashMap; import java.util.Locale; import java.util.Map; +import net.ess3.api.IPermission; public class NoCommandCostPermissions diff --git a/Essentials/src/net/ess3/permissions/Permissions.java b/Essentials/src/net/ess3/permissions/Permissions.java index 2f1c83dfe..34fe88be4 100644 --- a/Essentials/src/net/ess3/permissions/Permissions.java +++ b/Essentials/src/net/ess3/permissions/Permissions.java @@ -1,8 +1,5 @@ package net.ess3.permissions; -import net.ess3.api.IPermission; -import net.ess3.api.server.CommandSender; -import net.ess3.api.server.Permission; import java.util.Locale; @@ -18,11 +15,18 @@ public enum Permissions implements IPermission BAN_OFFLINE, BREAK_BEDROCK, CHAT_COLOR, + CHAT_IGNORE_EXEMPT, CHAT_SPY, CLEARINVENTORY_OTHERS, DELHOME_OTHERS, ECO_LOAN(Permission.Default.FALSE), + EXP_GIVE, + EXP_GIVE_OTHERS, + EXP_SET, + EXP_SET_OTHERS, + EXP_OTHERS, FEED_OTHERS, + FLY_OTHERS, GAMEMODE_OTHERS, GEOIP_HIDE(Permission.Default.FALSE), GEOIP_SHOW(Permission.Default.TRUE), @@ -34,6 +38,9 @@ public enum Permissions implements IPermission HOME_OTHERS, JAIL_EXEMPT, JOINFULLSERVER, + INVSEE_MODIFY, + INVSEE_PREVENT_MODIFY, + KEEPXP, KICK_EXEMPT, KICK_NOTIFY, LIST_HIDDEN, @@ -51,9 +58,11 @@ public enum Permissions implements IPermission OVERSIZEDSTACKS(Permission.Default.FALSE), POWERTOOL_APPEND, PTIME_OTHERS, + PVPDELAY_EXEMPT, REPAIR_ARMOR, REPAIR_ENCHANTED, SEEN_BANREASON, + SEEN_EXTRA, SETHOME_MULTIPLE, SETHOME_OTHERS, SLEEPINGIGNORED, @@ -61,6 +70,7 @@ public enum Permissions implements IPermission SUDO_EXEMPT, TELEPORT_COOLDOWN_BYPASS, TELEPORT_HIDDEN, + TELEPORT_OTHERS, TELEPORT_TIMER_BYPASS, TEMPBAN_EXEMPT, TEMPBAN_OFFLINE, @@ -72,7 +82,8 @@ public enum Permissions implements IPermission TPOHERE, UNLIMITED_OTHERS, WARP_LIST(Permission.Default.TRUE), - WARP_OTHERS; + WARP_OTHERS, + VANISH_SEE_OTHERS; private static final String base = "essentials."; private final String permission; private final Permission.Default defaultPerm; diff --git a/Essentials/src/net/ess3/permissions/SpawnerPermissions.java b/Essentials/src/net/ess3/permissions/SpawnerPermissions.java index 67674370a..8e8a4bb1e 100644 --- a/Essentials/src/net/ess3/permissions/SpawnerPermissions.java +++ b/Essentials/src/net/ess3/permissions/SpawnerPermissions.java @@ -1,9 +1,9 @@ package net.ess3.permissions; -import net.ess3.api.IPermission; import java.util.HashMap; import java.util.Locale; import java.util.Map; +import net.ess3.api.IPermission; public class SpawnerPermissions diff --git a/Essentials/src/net/ess3/permissions/SpawnmobPermissions.java b/Essentials/src/net/ess3/permissions/SpawnmobPermissions.java index ce8441706..21bb0b286 100644 --- a/Essentials/src/net/ess3/permissions/SpawnmobPermissions.java +++ b/Essentials/src/net/ess3/permissions/SpawnmobPermissions.java @@ -1,9 +1,9 @@ package net.ess3.permissions; -import net.ess3.api.IPermission; import java.util.HashMap; import java.util.Locale; import java.util.Map; +import net.ess3.api.IPermission; public class SpawnmobPermissions { private static Map<String, IPermission> permissions = new HashMap<String, IPermission>(); diff --git a/Essentials/src/net/ess3/permissions/WorldPermissions.java b/Essentials/src/net/ess3/permissions/WorldPermissions.java index d86e22546..a4d14a174 100644 --- a/Essentials/src/net/ess3/permissions/WorldPermissions.java +++ b/Essentials/src/net/ess3/permissions/WorldPermissions.java @@ -1,9 +1,9 @@ package net.ess3.permissions; -import net.ess3.api.IPermission; import java.util.HashMap; import java.util.Locale; import java.util.Map; +import net.ess3.api.IPermission; public class WorldPermissions { diff --git a/Essentials/src/net/ess3/ranks/GMGroups.java b/Essentials/src/net/ess3/ranks/GMGroups.java index 976cd89ea..650ebac11 100644 --- a/Essentials/src/net/ess3/ranks/GMGroups.java +++ b/Essentials/src/net/ess3/ranks/GMGroups.java @@ -1,12 +1,12 @@ package net.ess3.ranks; -import net.ess3.utils.Util; +import java.text.MessageFormat; +import lombok.Cleanup; import net.ess3.api.IEssentials; import net.ess3.api.IRanks; import net.ess3.api.ISettings; import net.ess3.api.IUser; -import java.text.MessageFormat; -import lombok.Cleanup; +import net.ess3.utils.Util; import org.anjocaido.groupmanager.GroupManager; import org.anjocaido.groupmanager.permissions.AnjoPermissionsHandler; import org.bukkit.plugin.Plugin; @@ -91,7 +91,7 @@ public class GMGroups implements IRanks { public MessageFormat getChatFormat(final IUser player) { String format = getRawChatFormat(player); - format = Util.replaceColor(format); + format = Util.replaceFormat(format); format = format.replace("{DISPLAYNAME}", "%1$s"); format = format.replace("{GROUP}", "{0}"); format = format.replace("{MESSAGE}", "%2$s"); diff --git a/Essentials/src/net/ess3/ranks/RankOptions.java b/Essentials/src/net/ess3/ranks/RankOptions.java index a8a8c3298..c22e493f5 100644 --- a/Essentials/src/net/ess3/ranks/RankOptions.java +++ b/Essentials/src/net/ess3/ranks/RankOptions.java @@ -1,9 +1,9 @@ package net.ess3.ranks; -import net.ess3.storage.Comment; -import net.ess3.storage.StorageObject; import lombok.Data; import lombok.EqualsAndHashCode; +import net.ess3.storage.Comment; +import net.ess3.storage.StorageObject; @Data diff --git a/Essentials/src/net/ess3/ranks/Ranks.java b/Essentials/src/net/ess3/ranks/Ranks.java index a77f09846..fffe8fd4a 100644 --- a/Essentials/src/net/ess3/ranks/Ranks.java +++ b/Essentials/src/net/ess3/ranks/Ranks.java @@ -1,11 +1,11 @@ package net.ess3.ranks; -import net.ess3.storage.Comment; -import net.ess3.storage.MapValueType; -import net.ess3.storage.StorageObject; import java.util.LinkedHashMap; import lombok.Data; import lombok.EqualsAndHashCode; +import net.ess3.storage.Comment; +import net.ess3.storage.MapValueType; +import net.ess3.storage.StorageObject; @Data diff --git a/Essentials/src/net/ess3/ranks/RanksStorage.java b/Essentials/src/net/ess3/ranks/RanksStorage.java index 2e6096837..c99deb535 100644 --- a/Essentials/src/net/ess3/ranks/RanksStorage.java +++ b/Essentials/src/net/ess3/ranks/RanksStorage.java @@ -1,12 +1,5 @@ package net.ess3.ranks; -import net.ess3.utils.Util; -import net.ess3.api.IEssentials; -import net.ess3.api.IRanks; -import net.ess3.api.ISettings; -import net.ess3.api.IUser; -import net.ess3.permissions.GroupsPermissions; -import net.ess3.storage.AsyncStorageObjectHolder; import java.io.File; import java.text.MessageFormat; import java.util.ArrayList; @@ -15,10 +8,29 @@ import java.util.Collections; import java.util.Map; import java.util.Map.Entry; import lombok.Cleanup; +import net.ess3.api.IEssentials; +import net.ess3.api.IRanks; +import net.ess3.api.ISettings; +import net.ess3.api.IUser; +import net.ess3.permissions.GroupsPermissions; +import net.ess3.storage.AsyncStorageObjectHolder; +import net.ess3.utils.Util; public class RanksStorage extends AsyncStorageObjectHolder<Ranks> implements IRanks { + + @Override + public void finishRead() + { + + } + + @Override + public void finishWrite() + { + + } public RanksStorage(final IEssentials ess) { super(ess, Ranks.class); @@ -143,7 +155,7 @@ public class RanksStorage extends AsyncStorageObjectHolder<Ranks> implements IRa public MessageFormat getChatFormat(final IUser player) { String format = getRawChatFormat(player); - format = Util.replaceColor(format); + format = Util.replaceFormat(format); format = format.replace("{DISPLAYNAME}", "%1$s"); format = format.replace("{GROUP}", "{0}"); format = format.replace("{MESSAGE}", "%2$s"); diff --git a/Essentials/src/net/ess3/ranks/VaultGroups.java b/Essentials/src/net/ess3/ranks/VaultGroups.java index eddc367f8..d9558d62f 100644 --- a/Essentials/src/net/ess3/ranks/VaultGroups.java +++ b/Essentials/src/net/ess3/ranks/VaultGroups.java @@ -1,12 +1,12 @@ package net.ess3.ranks; -import net.ess3.utils.Util; +import java.text.MessageFormat; +import lombok.Cleanup; import net.ess3.api.IEssentials; import net.ess3.api.IRanks; import net.ess3.api.ISettings; import net.ess3.api.IUser; -import java.text.MessageFormat; -import lombok.Cleanup; +import net.ess3.utils.Util; import net.milkbowl.vault.chat.Chat; @@ -65,7 +65,7 @@ public class VaultGroups implements IRanks public MessageFormat getChatFormat(final IUser player) { String format = getRawChatFormat(player); - format = Util.replaceColor(format); + format = Util.replaceFormat(format); format = format.replace("{DISPLAYNAME}", "%1$s"); format = format.replace("{GROUP}", "{0}"); format = format.replace("{MESSAGE}", "%2$s"); diff --git a/Essentials/src/net/ess3/settings/Backup.java b/Essentials/src/net/ess3/settings/Backup.java index 9b2ce28cf..a3e147c22 100644 --- a/Essentials/src/net/ess3/settings/Backup.java +++ b/Essentials/src/net/ess3/settings/Backup.java @@ -1,9 +1,9 @@ package net.ess3.settings; -import net.ess3.storage.Comment; -import net.ess3.storage.StorageObject; import lombok.Data; import lombok.EqualsAndHashCode; +import net.ess3.storage.Comment; +import net.ess3.storage.StorageObject; @Data diff --git a/Essentials/src/net/ess3/settings/Chat.java b/Essentials/src/net/ess3/settings/Chat.java index 44bafc395..78b970582 100644 --- a/Essentials/src/net/ess3/settings/Chat.java +++ b/Essentials/src/net/ess3/settings/Chat.java @@ -1,9 +1,9 @@ package net.ess3.settings; -import net.ess3.storage.Comment; -import net.ess3.storage.StorageObject; import lombok.Data; import lombok.EqualsAndHashCode; +import net.ess3.storage.Comment; +import net.ess3.storage.StorageObject; @Data diff --git a/Essentials/src/net/ess3/settings/Commands.java b/Essentials/src/net/ess3/settings/Commands.java index 899ba6b1d..c67ca2da3 100644 --- a/Essentials/src/net/ess3/settings/Commands.java +++ b/Essentials/src/net/ess3/settings/Commands.java @@ -1,13 +1,13 @@ package net.ess3.settings; -import net.ess3.settings.commands.*; -import net.ess3.storage.Comment; -import net.ess3.storage.ListType; -import net.ess3.storage.StorageObject; import java.util.ArrayList; import java.util.List; import lombok.Data; import lombok.EqualsAndHashCode; +import net.ess3.settings.commands.*; +import net.ess3.storage.Comment; +import net.ess3.storage.ListType; +import net.ess3.storage.StorageObject; @Data diff --git a/Essentials/src/net/ess3/settings/Economy.java b/Essentials/src/net/ess3/settings/Economy.java index d1eced963..ffbd57045 100644 --- a/Essentials/src/net/ess3/settings/Economy.java +++ b/Essentials/src/net/ess3/settings/Economy.java @@ -1,13 +1,13 @@ package net.ess3.settings; -import net.ess3.economy.Worth; -import net.ess3.storage.Comment; -import net.ess3.storage.MapValueType; -import net.ess3.storage.StorageObject; import java.util.HashMap; import java.util.Map; import lombok.Data; import lombok.EqualsAndHashCode; +import net.ess3.economy.Worth; +import net.ess3.storage.Comment; +import net.ess3.storage.MapValueType; +import net.ess3.storage.StorageObject; @Data diff --git a/Essentials/src/net/ess3/settings/General.java b/Essentials/src/net/ess3/settings/General.java index eb20ba4f4..caf8a15c2 100644 --- a/Essentials/src/net/ess3/settings/General.java +++ b/Essentials/src/net/ess3/settings/General.java @@ -1,15 +1,29 @@ package net.ess3.settings; -import net.ess3.storage.Comment; -import net.ess3.storage.StorageObject; +import java.util.HashMap; +import java.util.Map; import lombok.Data; import lombok.EqualsAndHashCode; +import net.ess3.storage.Comment; +import net.ess3.storage.StorageObject; +import org.bukkit.entity.EntityType; @Data @EqualsAndHashCode(callSuper = false) public class General implements StorageObject { + public General() + { + //Populate creature spawn values + for (EntityType t : EntityType.values()) + { + if (t.isAlive()) + { + creatureSpawn.put(t, false); + } + } + } @Comment("Backup runs a command while saving is disabled") private Backup backup = new Backup(); @Comment("You can disable the death messages of minecraft.") @@ -51,4 +65,48 @@ public class General implements StorageObject " VAULT: Options are stored using a permissions plugin supported by Vault" }) private GroupStorage groupStorage = GroupStorage.FILE; + @Comment( + { + "The delay, in seconds, a player can't be attacked by other players after he has been teleported by a command", + "This will also prevent that the player can attack other players" + }) + private long teleportInvulnerability = 0; + + public long getTeleportInvulnerability() + { + return teleportInvulnerability * 1000; + } + @Comment( + { + "Set to true to enable per-world permissions for teleporting between worlds with essentials commands", + "This applies to /world, /back, /tp[a|o][here|all], but not warps.", + "Give someone permission to teleport to a world with essentials.world.<worldname>" + }) + private boolean worldTeleportPermissions = false; + private boolean worldHomePermissions = false; + @Comment("Delay to wait before people can cause attack damage after logging in ") + private long loginAttackDelay = 0; + + public long getLoginAttackDelay() + { + return loginAttackDelay * 1000; + } + public boolean metricsEnabled = true; +//todo remove this + @Comment("Prevent creatures spawning") + private Map<EntityType, Boolean> creatureSpawn = new HashMap<EntityType, Boolean>(); + + public boolean getPreventSpawn(String creatureName) + { + return getPreventSpawn(EntityType.fromName(creatureName)); + } + + public boolean getPreventSpawn(EntityType creature) + { + if (creatureSpawn == null) + { + return false; + } + return creatureSpawn.get(creature); + } } diff --git a/Essentials/src/net/ess3/settings/Jails.java b/Essentials/src/net/ess3/settings/Jails.java index 69bf76643..6bcad4d4a 100644 --- a/Essentials/src/net/ess3/settings/Jails.java +++ b/Essentials/src/net/ess3/settings/Jails.java @@ -1,18 +1,18 @@ package net.ess3.settings; -import net.ess3.storage.StoredLocation; -import net.ess3.storage.MapValueType; -import net.ess3.storage.StorageObject; import java.util.HashMap; import java.util.Map; import lombok.Data; import lombok.EqualsAndHashCode; +import net.ess3.storage.Location; +import net.ess3.storage.MapValueType; +import net.ess3.storage.StorageObject; @Data @EqualsAndHashCode(callSuper = false) public class Jails implements StorageObject { - @MapValueType(StoredLocation.class) - private Map<String, StoredLocation> jails = new HashMap<String, StoredLocation>(); + @MapValueType(Location.class) + private Map<String, Location> jails = new HashMap<String, Location>(); } diff --git a/Essentials/src/net/ess3/settings/Kit.java b/Essentials/src/net/ess3/settings/Kit.java index 6d7800e00..822209eda 100644 --- a/Essentials/src/net/ess3/settings/Kit.java +++ b/Essentials/src/net/ess3/settings/Kit.java @@ -1,11 +1,11 @@ package net.ess3.settings; -import net.ess3.storage.ListType; -import net.ess3.storage.StorageObject; import java.util.ArrayList; import java.util.List; import lombok.Data; import lombok.EqualsAndHashCode; +import net.ess3.storage.ListType; +import net.ess3.storage.StorageObject; import org.bukkit.inventory.ItemStack; @@ -16,4 +16,5 @@ public class Kit implements StorageObject @ListType(ItemStack.class) private List<ItemStack> items = new ArrayList<ItemStack>(); private Double delay; + } diff --git a/Essentials/src/net/ess3/settings/Kits.java b/Essentials/src/net/ess3/settings/Kits.java index 7992b9867..79abaea59 100644 --- a/Essentials/src/net/ess3/settings/Kits.java +++ b/Essentials/src/net/ess3/settings/Kits.java @@ -1,11 +1,11 @@ package net.ess3.settings; -import net.ess3.storage.MapValueType; -import net.ess3.storage.StorageObject; import java.util.HashMap; import java.util.Map; import lombok.Data; import lombok.EqualsAndHashCode; +import net.ess3.storage.MapValueType; +import net.ess3.storage.StorageObject; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; diff --git a/Essentials/src/net/ess3/settings/Settings.java b/Essentials/src/net/ess3/settings/Settings.java index 11705f493..f5d87ba20 100644 --- a/Essentials/src/net/ess3/settings/Settings.java +++ b/Essentials/src/net/ess3/settings/Settings.java @@ -1,12 +1,12 @@ package net.ess3.settings; -import net.ess3.storage.Comment; -import net.ess3.storage.MapValueType; -import net.ess3.storage.StorageObject; import java.util.HashMap; import java.util.Map; import lombok.Data; import lombok.EqualsAndHashCode; +import net.ess3.storage.Comment; +import net.ess3.storage.MapValueType; +import net.ess3.storage.StorageObject; @Data diff --git a/Essentials/src/net/ess3/settings/SettingsHolder.java b/Essentials/src/net/ess3/settings/SettingsHolder.java index 22238ffa9..f161c2580 100644 --- a/Essentials/src/net/ess3/settings/SettingsHolder.java +++ b/Essentials/src/net/ess3/settings/SettingsHolder.java @@ -1,14 +1,26 @@ package net.ess3.settings; +import java.io.File; +import java.util.concurrent.atomic.AtomicBoolean; import net.ess3.api.IEssentials; import net.ess3.api.ISettings; import net.ess3.storage.AsyncStorageObjectHolder; -import java.io.File; -import java.util.concurrent.atomic.AtomicBoolean; public class SettingsHolder extends AsyncStorageObjectHolder<Settings> implements ISettings { + + @Override + public void finishRead() + { + + } + + @Override + public void finishWrite() + { + + } private final transient AtomicBoolean debug = new AtomicBoolean(false); public SettingsHolder(final IEssentials ess) { @@ -51,6 +63,7 @@ public class SettingsHolder extends AsyncStorageObjectHolder<Settings> implement return debug.get(); } + @Override public void setDebug(final boolean set) { debug.set(set); diff --git a/Essentials/src/net/ess3/settings/Spawns.java b/Essentials/src/net/ess3/settings/Spawns.java index ec3b6fe5d..91dab36f9 100644 --- a/Essentials/src/net/ess3/settings/Spawns.java +++ b/Essentials/src/net/ess3/settings/Spawns.java @@ -1,13 +1,13 @@ package net.ess3.settings; -import net.ess3.storage.Comment; -import net.ess3.storage.StoredLocation; -import net.ess3.storage.MapValueType; -import net.ess3.storage.StorageObject; import java.util.HashMap; import java.util.Map; import lombok.Data; import lombok.EqualsAndHashCode; +import net.ess3.storage.Comment; +import net.ess3.storage.Location; +import net.ess3.storage.MapValueType; +import net.ess3.storage.StorageObject; @Data diff --git a/Essentials/src/net/ess3/settings/SpawnsHolder.java b/Essentials/src/net/ess3/settings/SpawnsHolder.java index 652ff8f49..4f43e5ab9 100644 --- a/Essentials/src/net/ess3/settings/SpawnsHolder.java +++ b/Essentials/src/net/ess3/settings/SpawnsHolder.java @@ -1,21 +1,21 @@ package net.ess3.settings; +import java.io.File; +import java.util.HashMap; +import java.util.Locale; +import java.util.Map; +import java.util.logging.Level; import static net.ess3.I18n._; import net.ess3.api.IEssentials; import net.ess3.api.IEssentialsModule; import net.ess3.api.ISettings; import net.ess3.api.IUser; import net.ess3.storage.AsyncStorageObjectHolder; -import net.ess3.storage.StoredLocation.WorldNotLoadedException; +import net.ess3.storage.Location.WorldNotLoadedException; import net.ess3.utils.textreader.IText; import net.ess3.utils.textreader.KeywordReplacer; import net.ess3.utils.textreader.SimpleTextInput; import net.ess3.utils.textreader.SimpleTextPager; -import java.io.File; -import java.util.HashMap; -import java.util.Locale; -import java.util.Map; -import java.util.logging.Level; import org.bukkit.*; import org.bukkit.event.Event; import org.bukkit.event.EventException; @@ -29,6 +29,19 @@ import org.bukkit.plugin.EventExecutor; public class SpawnsHolder extends AsyncStorageObjectHolder<Spawns> implements IEssentialsModule { + + @Override + public void finishRead() + { + + } + + @Override + public void finishWrite() + { + + } + public SpawnsHolder(final IEssentials ess) { super(ess, Spawns.class); @@ -167,7 +180,7 @@ public class SpawnsHolder extends AsyncStorageObjectHolder<Spawns> implements IE acquireReadLock(); try { - return getData().getNewPlayerAnnouncement().replace('&', '๏ฟฝ').replace("๏ฟฝ๏ฟฝ", "&").replace("{PLAYER}", user.getDisplayName()).replace("{DISPLAYNAME}", user.getDisplayName()).replace("{GROUP}", ess.getRanks().getMainGroup(user)).replace("{USERNAME}", user.getName()).replace("{ADDRESS}", user.getAddress().toString()); + return getData().getNewPlayerAnnouncement().replace('&', 'ยง').replace("ยงยง", "&").replace("{PLAYER}", user.getDisplayName()).replace("{DISPLAYNAME}", user.getDisplayName()).replace("{GROUP}", ess.getRanks().getMainGroup(user)).replace("{USERNAME}", user.getName()).replace("{ADDRESS}", user.getAddress().toString()); } finally { diff --git a/Essentials/src/net/ess3/settings/Warp.java b/Essentials/src/net/ess3/settings/Warp.java index 30384a83e..963a5420a 100644 --- a/Essentials/src/net/ess3/settings/Warp.java +++ b/Essentials/src/net/ess3/settings/Warp.java @@ -1,14 +1,14 @@ package net.ess3.settings; -import net.ess3.storage.StoredLocation; -import net.ess3.storage.StorageObject; import lombok.Data; import lombok.EqualsAndHashCode; +import net.ess3.storage.Location; +import net.ess3.storage.StorageObject; @Data @EqualsAndHashCode(callSuper = false) public class Warp implements StorageObject { private String name; - private StoredLocation location; + private Location location; } diff --git a/Essentials/src/net/ess3/settings/WarpHolder.java b/Essentials/src/net/ess3/settings/WarpHolder.java index a02d77e41..06bf47121 100644 --- a/Essentials/src/net/ess3/settings/WarpHolder.java +++ b/Essentials/src/net/ess3/settings/WarpHolder.java @@ -1,15 +1,28 @@ package net.ess3.settings; +import java.io.File; +import java.io.IOException; import net.ess3.api.IEssentials; import net.ess3.api.IWarp; import net.ess3.api.InvalidNameException; import net.ess3.storage.AsyncStorageObjectHolder; -import java.io.File; -import java.io.IOException; public class WarpHolder extends AsyncStorageObjectHolder<Warp> implements IWarp { + + @Override + public void finishRead() + { + + } + + @Override + public void finishWrite() + { + + } + private final String name; public WarpHolder(String name, IEssentials ess) diff --git a/Essentials/src/net/ess3/settings/Worlds.java b/Essentials/src/net/ess3/settings/Worlds.java index 0d9fdb754..4e624c961 100644 --- a/Essentials/src/net/ess3/settings/Worlds.java +++ b/Essentials/src/net/ess3/settings/Worlds.java @@ -1,8 +1,8 @@ package net.ess3.settings; -import net.ess3.storage.StorageObject; import lombok.Data; import lombok.EqualsAndHashCode; +import net.ess3.storage.StorageObject; @Data @EqualsAndHashCode(callSuper = false) diff --git a/Essentials/src/net/ess3/settings/commands/Afk.java b/Essentials/src/net/ess3/settings/commands/Afk.java index 0b337e049..171926218 100644 --- a/Essentials/src/net/ess3/settings/commands/Afk.java +++ b/Essentials/src/net/ess3/settings/commands/Afk.java @@ -1,9 +1,9 @@ package net.ess3.settings.commands; -import net.ess3.storage.Comment; -import net.ess3.storage.StorageObject; import lombok.Data; import lombok.EqualsAndHashCode; +import net.ess3.storage.Comment; +import net.ess3.storage.StorageObject; @Data diff --git a/Essentials/src/net/ess3/settings/commands/Back.java b/Essentials/src/net/ess3/settings/commands/Back.java index 54a4aa246..e83c53860 100644 --- a/Essentials/src/net/ess3/settings/commands/Back.java +++ b/Essentials/src/net/ess3/settings/commands/Back.java @@ -1,9 +1,9 @@ package net.ess3.settings.commands; -import net.ess3.storage.Comment; -import net.ess3.storage.StorageObject; import lombok.Data; import lombok.EqualsAndHashCode; +import net.ess3.storage.Comment; +import net.ess3.storage.StorageObject; @Data diff --git a/Essentials/src/net/ess3/settings/commands/God.java b/Essentials/src/net/ess3/settings/commands/God.java index 32ab65c97..89b8505ae 100644 --- a/Essentials/src/net/ess3/settings/commands/God.java +++ b/Essentials/src/net/ess3/settings/commands/God.java @@ -1,9 +1,9 @@ package net.ess3.settings.commands; -import net.ess3.storage.Comment; -import net.ess3.storage.StorageObject; import lombok.Data; import lombok.EqualsAndHashCode; +import net.ess3.storage.Comment; +import net.ess3.storage.StorageObject; @Data diff --git a/Essentials/src/net/ess3/settings/commands/Help.java b/Essentials/src/net/ess3/settings/commands/Help.java index 92d5774c7..585426dce 100644 --- a/Essentials/src/net/ess3/settings/commands/Help.java +++ b/Essentials/src/net/ess3/settings/commands/Help.java @@ -1,9 +1,9 @@ package net.ess3.settings.commands; -import net.ess3.storage.Comment; -import net.ess3.storage.StorageObject; import lombok.Data; import lombok.EqualsAndHashCode; +import net.ess3.storage.Comment; +import net.ess3.storage.StorageObject; @Data diff --git a/Essentials/src/net/ess3/settings/commands/Home.java b/Essentials/src/net/ess3/settings/commands/Home.java index f23af4646..8b4c7356b 100644 --- a/Essentials/src/net/ess3/settings/commands/Home.java +++ b/Essentials/src/net/ess3/settings/commands/Home.java @@ -1,9 +1,9 @@ package net.ess3.settings.commands; -import net.ess3.storage.Comment; -import net.ess3.storage.StorageObject; import lombok.Data; import lombok.EqualsAndHashCode; +import net.ess3.storage.Comment; +import net.ess3.storage.StorageObject; @Data diff --git a/Essentials/src/net/ess3/settings/commands/Lightning.java b/Essentials/src/net/ess3/settings/commands/Lightning.java index ee0d2ba3e..5b9e2adf6 100644 --- a/Essentials/src/net/ess3/settings/commands/Lightning.java +++ b/Essentials/src/net/ess3/settings/commands/Lightning.java @@ -1,9 +1,9 @@ package net.ess3.settings.commands; -import net.ess3.storage.Comment; -import net.ess3.storage.StorageObject; import lombok.Data; import lombok.EqualsAndHashCode; +import net.ess3.storage.Comment; +import net.ess3.storage.StorageObject; @Data diff --git a/Essentials/src/net/ess3/settings/commands/List.java b/Essentials/src/net/ess3/settings/commands/List.java index 6258123f8..e2b869aaf 100644 --- a/Essentials/src/net/ess3/settings/commands/List.java +++ b/Essentials/src/net/ess3/settings/commands/List.java @@ -1,10 +1,10 @@ package net.ess3.settings.commands; -import net.ess3.storage.Comment; -import net.ess3.storage.StorageObject; import lombok.Data; import lombok.EqualsAndHashCode; +import net.ess3.storage.Comment; +import net.ess3.storage.StorageObject; @Data diff --git a/Essentials/src/net/ess3/settings/commands/Spawnmob.java b/Essentials/src/net/ess3/settings/commands/Spawnmob.java index 4f9a524f2..a1a870e49 100644 --- a/Essentials/src/net/ess3/settings/commands/Spawnmob.java +++ b/Essentials/src/net/ess3/settings/commands/Spawnmob.java @@ -1,9 +1,9 @@ package net.ess3.settings.commands; -import net.ess3.storage.Comment; -import net.ess3.storage.StorageObject; import lombok.Data; import lombok.EqualsAndHashCode; +import net.ess3.storage.Comment; +import net.ess3.storage.StorageObject; @Data diff --git a/Essentials/src/net/ess3/settings/commands/Tpa.java b/Essentials/src/net/ess3/settings/commands/Tpa.java index b11e71035..5b8795266 100644 --- a/Essentials/src/net/ess3/settings/commands/Tpa.java +++ b/Essentials/src/net/ess3/settings/commands/Tpa.java @@ -1,9 +1,9 @@ package net.ess3.settings.commands; -import net.ess3.storage.Comment; -import net.ess3.storage.StorageObject; import lombok.Data; import lombok.EqualsAndHashCode; +import net.ess3.storage.Comment; +import net.ess3.storage.StorageObject; @Data diff --git a/Essentials/src/net/ess3/settings/geoip/GeoIP.java b/Essentials/src/net/ess3/settings/geoip/GeoIP.java index c245dcd7a..04f6f5a77 100644 --- a/Essentials/src/net/ess3/settings/geoip/GeoIP.java +++ b/Essentials/src/net/ess3/settings/geoip/GeoIP.java @@ -1,8 +1,8 @@ package net.ess3.settings.geoip; -import net.ess3.storage.StorageObject; import lombok.Data; import lombok.EqualsAndHashCode; +import net.ess3.storage.StorageObject; @Data @@ -10,6 +10,6 @@ import lombok.EqualsAndHashCode; public class GeoIP implements StorageObject { private Database database = new Database(); - boolean showOnWhois = true; - boolean showOnLogin = true; + private boolean showOnWhois = true; + private boolean showOnLogin = true; } diff --git a/Essentials/src/net/ess3/settings/protect/Prevent.java b/Essentials/src/net/ess3/settings/protect/Prevent.java index e52be9f54..7b50be568 100644 --- a/Essentials/src/net/ess3/settings/protect/Prevent.java +++ b/Essentials/src/net/ess3/settings/protect/Prevent.java @@ -3,12 +3,10 @@ package net.ess3.settings.protect; import net.ess3.storage.*; import java.util.HashMap; import java.util.HashSet; -import java.util.Map; import java.util.Set; import lombok.Data; import lombok.EqualsAndHashCode; import org.bukkit.Material; -import org.bukkit.entity.CreatureType; @Data @@ -39,7 +37,9 @@ public class Prevent implements StorageObject "permission essentials.protect.entitytarget.bypass disables this" }) private boolean entitytarget = false; - @MapKeyType(CreatureType.class) - @MapValueType(Boolean.class) - private Map<CreatureType, Boolean> spawn = new HashMap<CreatureType, Boolean>(); + + public Prevent() + { + pistonPush.add(Material.GLASS); + } }
\ No newline at end of file diff --git a/Essentials/src/net/ess3/settings/protect/Protect.java b/Essentials/src/net/ess3/settings/protect/Protect.java index 1f7b3b9c6..3447979be 100644 --- a/Essentials/src/net/ess3/settings/protect/Protect.java +++ b/Essentials/src/net/ess3/settings/protect/Protect.java @@ -1,12 +1,12 @@ package net.ess3.settings.protect; -import net.ess3.storage.Comment; -import net.ess3.storage.ListType; -import net.ess3.storage.StorageObject; import java.util.HashSet; import java.util.Set; import lombok.Data; import lombok.EqualsAndHashCode; +import net.ess3.storage.Comment; +import net.ess3.storage.ListType; +import net.ess3.storage.StorageObject; import org.bukkit.Material; @@ -42,4 +42,11 @@ public class Protect implements StorageObject private boolean disableThunder = false; private boolean disableLighting = false; private SignsAndRails signsAndRails = new SignsAndRails(); + + public Protect() + { + alertOnPlacement.add(Material.LAVA); + alertOnUse.add(Material.LAVA_BUCKET); + alertOnBreak.add(Material.GLASS); + } } diff --git a/Essentials/src/net/ess3/settings/protect/SignsAndRails.java b/Essentials/src/net/ess3/settings/protect/SignsAndRails.java index aba39305d..148da7bc9 100644 --- a/Essentials/src/net/ess3/settings/protect/SignsAndRails.java +++ b/Essentials/src/net/ess3/settings/protect/SignsAndRails.java @@ -1,9 +1,9 @@ package net.ess3.settings.protect; -import net.ess3.storage.Comment; -import net.ess3.storage.StorageObject; import lombok.Data; import lombok.EqualsAndHashCode; +import net.ess3.storage.Comment; +import net.ess3.storage.StorageObject; @Data diff --git a/Essentials/src/net/ess3/storage/AbstractDelayedYamlFileReader.java b/Essentials/src/net/ess3/storage/AbstractDelayedYamlFileReader.java index a8d0ff158..47d6bf85a 100644 --- a/Essentials/src/net/ess3/storage/AbstractDelayedYamlFileReader.java +++ b/Essentials/src/net/ess3/storage/AbstractDelayedYamlFileReader.java @@ -1,17 +1,19 @@ package net.ess3.storage; -import net.ess3.api.IEssentials; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.util.concurrent.locks.ReentrantLock; import java.util.logging.Level; +import net.ess3.Essentials; +import net.ess3.api.IEssentials; import org.bukkit.Bukkit; public abstract class AbstractDelayedYamlFileReader<T extends StorageObject> implements Runnable { + private final transient Class<T> clazz; private final transient IEssentials ess; private final transient ReentrantLock lock = new ReentrantLock(); @@ -39,10 +41,11 @@ public abstract class AbstractDelayedYamlFileReader<T extends StorageObject> imp @Override public void run() { + File file = null; lock.lock(); try { - final File file = onStart(); + file = onStart(); try { final FileReader reader = new FileReader(file); @@ -79,7 +82,11 @@ public abstract class AbstractDelayedYamlFileReader<T extends StorageObject> imp } catch (IOException ex) { - Bukkit.getLogger().log(Level.SEVERE, "File could not be opened: " + ex.getMessage(), ex); + onException(ex); + if (plugin.getSettings() == null || plugin.getSettings().isDebug()) + { + Bukkit.getLogger().log(Level.INFO, "File not found: " + file.toString()); + } } finally { diff --git a/Essentials/src/net/ess3/storage/AbstractDelayedYamlFileWriter.java b/Essentials/src/net/ess3/storage/AbstractDelayedYamlFileWriter.java index baeee2ce8..f728ff7a0 100644 --- a/Essentials/src/net/ess3/storage/AbstractDelayedYamlFileWriter.java +++ b/Essentials/src/net/ess3/storage/AbstractDelayedYamlFileWriter.java @@ -1,12 +1,13 @@ package net.ess3.storage; -import net.ess3.api.IEssentials; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.io.PrintWriter; import java.util.concurrent.locks.ReentrantLock; import java.util.logging.Level; +import net.ess3.Essentials; +import net.ess3.api.IEssentials; import org.bukkit.Bukkit; diff --git a/Essentials/src/net/ess3/storage/AsyncStorageObjectHolder.java b/Essentials/src/net/ess3/storage/AsyncStorageObjectHolder.java index 8e904dea9..c6c32f134 100644 --- a/Essentials/src/net/ess3/storage/AsyncStorageObjectHolder.java +++ b/Essentials/src/net/ess3/storage/AsyncStorageObjectHolder.java @@ -1,12 +1,12 @@ package net.ess3.storage; -import net.ess3.api.IEssentials; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.locks.ReentrantReadWriteLock; import java.util.logging.Level; +import net.ess3.api.IEssentials; import org.bukkit.Bukkit; @@ -99,7 +99,11 @@ public abstract class AsyncStorageObjectHolder<T extends StorageObject> implemen { reader.schedule(instant); } - + + public abstract void finishRead(); + + public abstract void finishWrite(); + public abstract File getStorageFile() throws IOException; @@ -127,6 +131,7 @@ public abstract class AsyncStorageObjectHolder<T extends StorageObject> implemen public void onFinish() { unlock(); + finishWrite(); } } diff --git a/Essentials/src/net/ess3/storage/BukkitConstructor.java b/Essentials/src/net/ess3/storage/BukkitConstructor.java index 068d31608..81fe3daa2 100644 --- a/Essentials/src/net/ess3/storage/BukkitConstructor.java +++ b/Essentials/src/net/ess3/storage/BukkitConstructor.java @@ -1,8 +1,5 @@ package net.ess3.storage; -import net.ess3.Essentials; -import net.ess3.api.server.IPlugin; -import net.ess3.api.server.Material; import java.lang.reflect.Field; import java.util.List; import java.util.Locale; diff --git a/Essentials/src/net/ess3/storage/IStorageObjectMap.java b/Essentials/src/net/ess3/storage/IStorageObjectMap.java index 5facaf200..c47ece28f 100644 --- a/Essentials/src/net/ess3/storage/IStorageObjectMap.java +++ b/Essentials/src/net/ess3/storage/IStorageObjectMap.java @@ -1,9 +1,9 @@ package net.ess3.storage; -import net.ess3.api.IReload; -import net.ess3.api.InvalidNameException; import java.io.File; import java.util.Set; +import net.ess3.api.IReload; +import net.ess3.api.InvalidNameException; interface IStorageObjectMap<I> extends IReload diff --git a/Essentials/src/net/ess3/storage/Location.java b/Essentials/src/net/ess3/storage/Location.java new file mode 100644 index 000000000..06210504b --- /dev/null +++ b/Essentials/src/net/ess3/storage/Location.java @@ -0,0 +1,115 @@ +package net.ess3.storage; + +import java.lang.ref.WeakReference; +import java.util.UUID; +import org.bukkit.Bukkit; +import org.bukkit.World; + + +public class Location +{ + private WeakReference<org.bukkit.Location> location; + private final String worldname; + private UUID worldUID = null; + private final double x; + private final double y; + private final double z; + private final float yaw; + private final float pitch; + + public Location(org.bukkit.Location loc) + { + location = new WeakReference<org.bukkit.Location>(loc); + worldname = loc.getWorld().getName(); + worldUID = loc.getWorld().getUID(); + x = loc.getX(); + y = loc.getY(); + z = loc.getZ(); + yaw = loc.getYaw(); + pitch = loc.getPitch(); + } + + public Location(String worldname, double x, double y, double z, float yaw, float pitch) + { + this.worldname = worldname; + this.x = x; + this.y = y; + this.z = z; + this.yaw = yaw; + this.pitch = pitch; + } + + public Location(String worldname, double x, double y, double z) + { + this.worldname = worldname; + this.x = x; + this.y = y; + this.z = z; + this.yaw = 0f; + this.pitch = 0f; + } + + public org.bukkit.Location getBukkitLocation() throws WorldNotLoadedException + { + + org.bukkit.Location loc = location == null ? null : location.get(); + if (loc == null) + { + World world = null; + if (worldUID != null) + { + world = Bukkit.getWorld(worldUID); + } + if (world == null) + { + world = Bukkit.getWorld(worldname); + } + if (world == null) + { + throw new WorldNotLoadedException(worldname); + } + loc = new org.bukkit.Location(world, getX(), getY(), getZ(), getYaw(), getPitch()); + location = new WeakReference<org.bukkit.Location>(loc); + } + return loc; + } + + public String getWorldName() + { + return worldname; + } + + public double getX() + { + return x; + } + + public double getY() + { + return y; + } + + public double getZ() + { + return z; + } + + public float getYaw() + { + return yaw; + } + + public float getPitch() + { + return pitch; + } + + + public static class WorldNotLoadedException extends Exception + { + public WorldNotLoadedException(String worldname) + { + super("World " + worldname + " is not loaded."); + } + } +} diff --git a/Essentials/src/net/ess3/storage/ManagedFile.java b/Essentials/src/net/ess3/storage/ManagedFile.java index bbe9bd212..c6e23e6b8 100644 --- a/Essentials/src/net/ess3/storage/ManagedFile.java +++ b/Essentials/src/net/ess3/storage/ManagedFile.java @@ -1,7 +1,5 @@ package net.ess3.storage; -import static net.ess3.I18n._; -import net.ess3.api.IEssentials; import java.io.*; import java.math.BigInteger; import java.security.DigestInputStream; @@ -12,6 +10,8 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.logging.Level; +import static net.ess3.I18n._; +import net.ess3.api.IEssentials; import org.bukkit.Bukkit; diff --git a/Essentials/src/net/ess3/storage/StorageObjectMap.java b/Essentials/src/net/ess3/storage/StorageObjectMap.java index 6c246e62f..1e88a8fd3 100644 --- a/Essentials/src/net/ess3/storage/StorageObjectMap.java +++ b/Essentials/src/net/ess3/storage/StorageObjectMap.java @@ -1,8 +1,5 @@ package net.ess3.storage; -import net.ess3.api.IEssentials; -import net.ess3.api.InvalidNameException; -import net.ess3.utils.Util; import com.google.common.cache.Cache; import com.google.common.cache.CacheBuilder; import com.google.common.cache.CacheLoader; @@ -15,6 +12,9 @@ import java.util.Set; import java.util.concurrent.ConcurrentSkipListSet; import java.util.concurrent.ExecutionException; import java.util.logging.Level; +import net.ess3.api.IEssentials; +import net.ess3.api.InvalidNameException; +import net.ess3.utils.Util; public abstract class StorageObjectMap<I> extends CacheLoader<String, I> implements IStorageObjectMap<I> diff --git a/Essentials/src/net/ess3/storage/YamlStorageWriter.java b/Essentials/src/net/ess3/storage/YamlStorageWriter.java index 793ac67fd..40ac71464 100644 --- a/Essentials/src/net/ess3/storage/YamlStorageWriter.java +++ b/Essentials/src/net/ess3/storage/YamlStorageWriter.java @@ -80,10 +80,10 @@ public class YamlStorageWriter implements IStorageWriter else { writeScalar(data); - writer.println(); } } } + writer.println(); } private boolean writeKey(final Field field, final int depth, final Object data) @@ -194,10 +194,10 @@ public class YamlStorageWriter implements IStorageWriter else { writeScalar(value); - writer.println(); } } } + writer.println(); } private void writeIndention(final int depth) diff --git a/Essentials/src/net/ess3/user/Ban.java b/Essentials/src/net/ess3/user/Ban.java index 3fd5d1192..2938d0b62 100644 --- a/Essentials/src/net/ess3/user/Ban.java +++ b/Essentials/src/net/ess3/user/Ban.java @@ -1,8 +1,8 @@ package net.ess3.user; -import net.ess3.storage.StorageObject; import lombok.Data; import lombok.EqualsAndHashCode; +import net.ess3.storage.StorageObject; @Data diff --git a/Essentials/src/net/ess3/user/IOfflinePlayer.java b/Essentials/src/net/ess3/user/IOfflinePlayer.java index f594ad669..94b626ab7 100644 --- a/Essentials/src/net/ess3/user/IOfflinePlayer.java +++ b/Essentials/src/net/ess3/user/IOfflinePlayer.java @@ -14,4 +14,6 @@ public interface IOfflinePlayer void setBanned(boolean bln); boolean hasPermission(Permission perm); + + void setName(final String name); }
\ No newline at end of file diff --git a/Essentials/src/net/ess3/user/Inventory.java b/Essentials/src/net/ess3/user/Inventory.java index 621163e33..b50b8c535 100644 --- a/Essentials/src/net/ess3/user/Inventory.java +++ b/Essentials/src/net/ess3/user/Inventory.java @@ -1,12 +1,12 @@ package net.ess3.user; -import net.ess3.storage.MapKeyType; -import net.ess3.storage.MapValueType; -import net.ess3.storage.StorageObject; import java.util.HashMap; import java.util.Map; import lombok.Data; import lombok.EqualsAndHashCode; +import net.ess3.storage.MapKeyType; +import net.ess3.storage.MapValueType; +import net.ess3.storage.StorageObject; import org.bukkit.inventory.ItemStack; diff --git a/Essentials/src/net/ess3/user/User.java b/Essentials/src/net/ess3/user/User.java index 60bd802f0..061f006db 100644 --- a/Essentials/src/net/ess3/user/User.java +++ b/Essentials/src/net/ess3/user/User.java @@ -25,7 +25,7 @@ public class User extends UserBase implements IUser @Getter private transient IUser teleportRequester; @Getter - private transient boolean teleportRequestHere; + private transient boolean tpRequestHere; @Getter private transient final ITeleport teleport; @Getter @@ -37,6 +37,11 @@ public class User extends UserBase implements IUser @Getter @Setter private boolean hidden = false; + @Getter + private transient boolean vanished; + @Getter + @Setter + private boolean invSee = false; private transient Location afkPosition; private AtomicBoolean gotMailInfo = new AtomicBoolean(false); @@ -62,6 +67,22 @@ public class User extends UserBase implements IUser } @Override + public void finishRead() + { + } + + @Override + public void finishWrite() + { + } + + @Override + public void update(final Player base) + { + super.update(base); + } + + @Override public void checkCooldown(final UserData.TimestampType cooldownType, final double cooldown, final boolean set, final IPermission bypassPermission) throws CooldownException { final Calendar now = new GregorianCalendar(); @@ -176,14 +197,6 @@ public class User extends UserBase implements IUser unlock(); } } - - public void requestTeleport(final User player, final boolean here) - { - teleportRequestTime = System.currentTimeMillis(); - teleportRequester = player; - teleportRequestHere = here; - } - public String getNick(boolean addprefixsuffix) { acquireReadLock(); @@ -227,6 +240,7 @@ public class User extends UserBase implements IUser } } + @Override public void setDisplayNick() { String name = getNick(true); @@ -338,6 +352,7 @@ public class User extends UserBase implements IUser } //Returns true if status expired during this check + @Override public boolean checkJailTimeout(final long currentTime) { acquireReadLock(); @@ -370,6 +385,7 @@ public class User extends UserBase implements IUser } //Returns true if status expired during this check + @Override public boolean checkMuteTimeout(final long currentTime) { acquireReadLock(); @@ -392,6 +408,7 @@ public class User extends UserBase implements IUser } //Returns true if status expired during this check + @Override public boolean checkBanTimeout(final long currentTime) { acquireReadLock(); @@ -412,6 +429,7 @@ public class User extends UserBase implements IUser } } + @Override public void updateActivity(final boolean broadcast) { acquireReadLock(); @@ -434,6 +452,7 @@ public class User extends UserBase implements IUser } } + @Override public void checkActivity() { @Cleanup @@ -478,20 +497,13 @@ public class User extends UserBase implements IUser } } + @Override public Location getAfkPosition() { return afkPosition; } - public boolean toggleGodModeEnabled() - { - if (!isGodModeEnabled()) - { - setFoodLevel(20); - } - return super.toggleGodmode(); - } - + @Override public boolean isGodModeEnabled() { acquireReadLock(); @@ -509,13 +521,7 @@ public class User extends UserBase implements IUser unlock(); } } - - @Override - public Location getHome(String name) throws Exception - { - throw new UnsupportedOperationException("Not supported yet."); - } - + @Override public void updateCompass() { @@ -535,13 +541,7 @@ public class User extends UserBase implements IUser { // Ignore } - } - - @Override - public List<String> getHomes() - { - throw new UnsupportedOperationException("Not supported yet."); - } + } @Override public int compareTo(final IUser t) @@ -550,9 +550,11 @@ public class User extends UserBase implements IUser } @Override - public void requestTeleport(IUser user, boolean b) + public void requestTeleport(IUser player, boolean here) { - throw new UnsupportedOperationException("Not supported yet."); + teleportRequestTime = System.currentTimeMillis(); + teleportRequester = player; + tpRequestHere = here; } @Override @@ -639,8 +641,10 @@ public class User extends UserBase implements IUser spew = true; } } - else { - if (!overfilled.isEmpty()) { + else + { + if (!overfilled.isEmpty()) + { throw new ChargeException("Inventory full"); } } @@ -660,14 +664,92 @@ public class User extends UserBase implements IUser } return cost <= mon; } - - public void updateMoneyCache(double userMoney) { - if (super.getMoney() != userMoney) { + + @Override + public void updateMoneyCache(double userMoney) + { + if (super.getMoney() != userMoney) + { super.setMoney(userMoney); } } - public boolean canAfford(double amount, boolean b) { + @Override + public boolean canAfford(double amount, boolean b) + { return true; } + private transient long teleportInvulnerabilityTimestamp = 0; + + public void enableInvulnerabilityAfterTeleport() + { + @Cleanup + final ISettings settings = ess.getSettings(); + settings.acquireReadLock(); + + final long time = settings.getData().getGeneral().getTeleportInvulnerability(); + if (time > 0) + { + teleportInvulnerabilityTimestamp = System.currentTimeMillis() + time; + } + } + + @Override + public void resetInvulnerabilityAfterTeleport() + { + if (teleportInvulnerabilityTimestamp != 0 + && teleportInvulnerabilityTimestamp < System.currentTimeMillis()) + { + teleportInvulnerabilityTimestamp = 0; + } + } + + @Override + public boolean hasInvulnerabilityAfterTeleport() + { + return teleportInvulnerabilityTimestamp != 0 && teleportInvulnerabilityTimestamp >= System.currentTimeMillis(); + } + + @Override + public void setVanished(boolean set) + { + vanished = set; + if (set) + { + for (Player p : ess.getServer().getOnlinePlayers()) + { + if (!Permissions.VANISH_SEE_OTHERS.isAuthorized(ess.getUser(p))) + { + p.hidePlayer(getBase()); + } + } + setHidden(true); + ess.getVanishedPlayers().add(getName()); + } + else + { + for (Player p : ess.getServer().getOnlinePlayers()) + { + p.showPlayer(getBase()); + } + setHidden(false); + ess.getVanishedPlayers().remove(getName()); + } + } + + @Override + public void setName(String name) + { + //todo + //throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void toggleVanished() + { + final boolean set = !vanished; + this.setVanished(set); + } + + } diff --git a/Essentials/src/net/ess3/user/UserBase.java b/Essentials/src/net/ess3/user/UserBase.java index ebd0dc361..9d0598fd1 100644 --- a/Essentials/src/net/ess3/user/UserBase.java +++ b/Essentials/src/net/ess3/user/UserBase.java @@ -180,14 +180,12 @@ public abstract class UserBase extends AsyncStorageObjectHolder<UserData> implem } } - public boolean toggleGodmode() + public void setGodModeEnabled(boolean set) { acquireWriteLock(); try { - boolean ret = !getData().isGodmode(); - getData().setGodmode(ret); - return ret; + getData().setGodmode(set); } finally { @@ -195,14 +193,12 @@ public abstract class UserBase extends AsyncStorageObjectHolder<UserData> implem } } - public boolean toggleMuted() + public void setMuted(boolean mute) { acquireWriteLock(); try { - boolean ret = !getData().isMuted(); - getData().setMuted(ret); - return ret; + getData().setMuted(mute); } finally { @@ -240,12 +236,12 @@ public abstract class UserBase extends AsyncStorageObjectHolder<UserData> implem } } - public boolean isIgnoringPlayer(final String name) + public boolean isIgnoringPlayer(final IUser user) { acquireReadLock(); try { - return getData().getIgnore() == null ? false : getData().getIgnore().contains(name.toLowerCase(Locale.ENGLISH)); + return getData().getIgnore() == null ? false : getData().getIgnore().contains(user.getName().toLowerCase(Locale.ENGLISH)) && Permissions.CHAT_IGNORE_EXEMPT.isAuthorized(user); } finally { @@ -253,7 +249,7 @@ public abstract class UserBase extends AsyncStorageObjectHolder<UserData> implem } } - public void setIgnoredPlayer(final String name, final boolean set) + public void setIgnoredPlayer(final IUser user, final boolean set) { acquireWriteLock(); try @@ -264,11 +260,11 @@ public abstract class UserBase extends AsyncStorageObjectHolder<UserData> implem } if (set) { - getData().getIgnore().add(name.toLowerCase(Locale.ENGLISH)); + getData().getIgnore().add(user.getName().toLowerCase(Locale.ENGLISH)); } else { - getData().getIgnore().remove(name.toLowerCase(Locale.ENGLISH)); + getData().getIgnore().remove(user.getName().toLowerCase(Locale.ENGLISH)); } } finally @@ -314,6 +310,30 @@ public abstract class UserBase extends AsyncStorageObjectHolder<UserData> implem } } + public Location getHome(String name) throws Exception + { + acquireReadLock(); + try + { + if (getData().getHomes() == null) + { + return null; + } + try + { + return getData().getHomes().get(Util.sanitizeKey(name)).getBukkitLocation(); + } + catch (WorldNotLoadedException ex) + { + return null; + } + } + finally + { + unlock(); + } + } + public Location getHome(Location loc) { @@ -365,4 +385,21 @@ public abstract class UserBase extends AsyncStorageObjectHolder<UserData> implem unlock(); } } + + public List<String> getHomes() + { + acquireReadLock(); + try + { + if (getData().getHomes() == null) + { + return null; + } + return new ArrayList<String>(getData().getHomes().keySet()); + } + finally + { + unlock(); + } + } } diff --git a/Essentials/src/net/ess3/user/UserData.java b/Essentials/src/net/ess3/user/UserData.java index aecd32ced..3582eaa89 100644 --- a/Essentials/src/net/ess3/user/UserData.java +++ b/Essentials/src/net/ess3/user/UserData.java @@ -14,7 +14,7 @@ public class UserData implements StorageObject { public enum TimestampType { - JAIL, MUTE, LASTHEAL, LASTTELEPORT, LOGIN, LOGOUT + JAIL, MUTE, LASTHEAL, LASTTELEPORT, LOGIN, LOGOUT, KIT } private String nickname; private Double money; diff --git a/Essentials/src/net/ess3/user/UserMap.java b/Essentials/src/net/ess3/user/UserMap.java index cac3985ab..cc34536b3 100644 --- a/Essentials/src/net/ess3/user/UserMap.java +++ b/Essentials/src/net/ess3/user/UserMap.java @@ -1,18 +1,15 @@ package net.ess3.user; +import java.io.File; +import java.util.Locale; +import java.util.Set; import net.ess3.api.IEssentials; import net.ess3.api.IUser; import net.ess3.api.IUserMap; import net.ess3.api.InvalidNameException; -import net.ess3.api.server.Player; import net.ess3.storage.StorageObjectMap; -import net.ess3.utils.Util; -import java.io.File; -import java.util.Collections; -import java.util.LinkedHashSet; -import java.util.Locale; -import java.util.Set; import org.bukkit.Bukkit; +import org.bukkit.entity.Player; public class UserMap extends StorageObjectMap<IUser> implements IUserMap @@ -97,158 +94,4 @@ public class UserMap extends StorageObjectMap<IUser> implements IUserMap } return user; } - - @Override - public IUser matchUser(final String name, final boolean includeHidden, final boolean includeOffline) throws TooManyMatchesException - { - final Set<IUser> users = matchUsers(name, includeHidden, includeOffline); - if (users == null || users.isEmpty()) - { - return null; - } - else - { - if (users.size() > 1) - { - throw new TooManyMatchesException(); - } - else - { - return users.iterator().next(); - } - } - } - - @Override - public Set<IUser> matchUsers(final String name, final boolean includeHidden, final boolean includeOffline) - { - final String colorlessName = Util.stripColor(name); - final String[] search = colorlessName.split(","); - final boolean multisearch = search.length > 1; - final Set<IUser> result = new LinkedHashSet<IUser>(); - final String nicknamePrefix = Util.stripColor(getNickNamePrefix()); - for (String searchString : search) - { - if (searchString.isEmpty()) - { - continue; - } - - if (searchString.startsWith(nicknamePrefix)) - { - searchString = searchString.substring(nicknamePrefix.length()); - } - searchString = searchString.toLowerCase(Locale.ENGLISH); - final boolean multimatching = searchString.endsWith("*"); - if (multimatching) - { - searchString = searchString.substring(0, searchString.length() - 1); - } - Player match = null; - for (Player player : ess.getServer().getOnlinePlayers()) - { - if (player.getName().equalsIgnoreCase(searchString) - && (includeHidden || (includeOffline && player.getUser().isHidden()))) - { - match = player; - break; - } - } - if (match != null) - { - if (multimatching || multisearch) - { - result.add(match.getUser()); - } - else - { - return Collections.singleton(match.getUser()); - } - } - for (Player player : ess.getServer().getOnlinePlayers()) - { - final String nickname = player.getUser().getData().getNickname(); - if (nickname != null && !nickname.isEmpty() - && nickname.equalsIgnoreCase(searchString) - && (includeHidden || (includeOffline && player.getUser().isHidden()))) - { - if (multimatching || multisearch) - { - result.add(player.getUser()); - } - else - { - return Collections.singleton(player.getUser()); - } - } - } - if (includeOffline) - { - for (String playerName : getAllUniqueUsers()) - { - if (playerName.equals(searchString)) - { - match = getUser(playerName); - break; - } - } - if (match != null) - { - if (multimatching || multisearch) - { - result.add(match.getUser()); - } - else - { - return Collections.singleton(match.getUser()); - } - } - } - if (multimatching || match == null) - { - for (Player player : ess.getServer().getOnlinePlayers()) - { - if (player.getName().toLowerCase(Locale.ENGLISH).startsWith(searchString) - && (includeHidden || (includeOffline && player.getUser().isHidden()))) - { - result.add(player.getUser()); - break; - } - final String nickname = player.getUser().getData().getNickname(); - if (nickname != null && !nickname.isEmpty() - && nickname.toLowerCase(Locale.ENGLISH).startsWith(searchString) - && (includeHidden || (includeOffline && player.getUser().isHidden()))) - { - result.add(player.getUser()); - break; - } - } - if (includeOffline) - { - for (String playerName : getAllUniqueUsers()) - { - if (playerName.startsWith(searchString)) - { - result.add(getUser(playerName)); - break; - } - } - } - } - } - return result; - } - - private String getNickNamePrefix() - { - ess.getSettings().acquireReadLock(); - try - { - return ess.getSettings().getData().getChat().getNicknamePrefix(); - } - finally - { - ess.getSettings().unlock(); - } - } } diff --git a/Essentials/src/net/ess3/utils/DateUtil.java b/Essentials/src/net/ess3/utils/DateUtil.java index 02916139c..de2be3131 100644 --- a/Essentials/src/net/ess3/utils/DateUtil.java +++ b/Essentials/src/net/ess3/utils/DateUtil.java @@ -1,10 +1,10 @@ package net.ess3.utils; -import static net.ess3.I18n._; import java.util.Calendar; import java.util.GregorianCalendar; import java.util.regex.Matcher; import java.util.regex.Pattern; +import static net.ess3.I18n._; public class DateUtil { public static String formatDateDiff(long date) diff --git a/Essentials/src/net/ess3/utils/DescParseTickFormat.java b/Essentials/src/net/ess3/utils/DescParseTickFormat.java index 8c3fbadfe..1c93a3575 100644 --- a/Essentials/src/net/ess3/utils/DescParseTickFormat.java +++ b/Essentials/src/net/ess3/utils/DescParseTickFormat.java @@ -1,17 +1,16 @@ package net.ess3.utils; -import static net.ess3.I18n._; import java.text.SimpleDateFormat; import java.util.*; +import static net.ess3.I18n._; /** - * This utility class is used for converting between the ingame - * time in ticks to ingame time as a friendly string. - * Note that the time is INGAME. - * + * This utility class is used for converting between the ingame time in ticks to ingame time as a friendly string. Note + * that the time is INGAME. + * * http://www.minecraftwiki.net/wiki/Day/night_cycle - * + * * @author Olof Larsson */ public final class DescParseTickFormat @@ -153,30 +152,31 @@ public final class DescParseTickFormat int hours = 0; int minutes = 0; - desc = desc.toLowerCase(Locale.ENGLISH).replaceAll("[^0-9]", ""); + desc = desc.toLowerCase(Locale.ENGLISH); + String parsetime = desc.replaceAll("[^0-9]", ""); - if (desc.length() > 4) + if (parsetime.length() > 4) { throw new NumberFormatException(); } - if (desc.length() == 4) + if (parsetime.length() == 4) { - hours += Integer.parseInt(desc.substring(0, 2)); - minutes += Integer.parseInt(desc.substring(2, 4)); + hours += Integer.parseInt(parsetime.substring(0, 2)); + minutes += Integer.parseInt(parsetime.substring(2, 4)); } - else if (desc.length() == 3) + else if (parsetime.length() == 3) { - hours += Integer.parseInt(desc.substring(0, 1)); - minutes += Integer.parseInt(desc.substring(1, 3)); + hours += Integer.parseInt(parsetime.substring(0, 1)); + minutes += Integer.parseInt(parsetime.substring(1, 3)); } - else if (desc.length() == 2) + else if (parsetime.length() == 2) { - hours += Integer.parseInt(desc.substring(0, 2)); + hours += Integer.parseInt(parsetime.substring(0, 2)); } - else if (desc.length() == 1) + else if (parsetime.length() == 1) { - hours += Integer.parseInt(desc.substring(0, 1)); + hours += Integer.parseInt(parsetime.substring(0, 1)); } else { diff --git a/Essentials/src/net/ess3/utils/LocationUtil.java b/Essentials/src/net/ess3/utils/LocationUtil.java index 61cdcec6e..ecde8b8b7 100644 --- a/Essentials/src/net/ess3/utils/LocationUtil.java +++ b/Essentials/src/net/ess3/utils/LocationUtil.java @@ -1,8 +1,8 @@ package net.ess3.utils; -import static net.ess3.I18n._; import java.util.HashSet; import java.util.Set; +import static net.ess3.I18n._; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.World; diff --git a/Essentials/src/net/ess3/utils/Util.java b/Essentials/src/net/ess3/utils/Util.java index f00570685..273cd4679 100644 --- a/Essentials/src/net/ess3/utils/Util.java +++ b/Essentials/src/net/ess3/utils/Util.java @@ -1,17 +1,19 @@ package net.ess3.utils; -import static net.ess3.I18n._; -import net.ess3.api.IEssentials; -import net.ess3.api.ISettings; -import net.ess3.api.InvalidNameException; -import net.ess3.utils.gnu.inet.encoding.Punycode; -import net.ess3.utils.gnu.inet.encoding.PunycodeException; +import de.bananaco.bpermissions.imp.Permissions; import java.text.DecimalFormat; import java.text.DecimalFormatSymbols; import java.util.Collection; import java.util.Locale; import java.util.regex.Pattern; import lombok.Cleanup; +import static net.ess3.I18n._; +import net.ess3.api.IEssentials; +import net.ess3.api.ISettings; +import net.ess3.api.IUser; +import net.ess3.api.InvalidNameException; +import net.ess3.utils.gnu.inet.encoding.Punycode; +import net.ess3.utils.gnu.inet.encoding.PunycodeException; import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.block.Block; @@ -173,7 +175,7 @@ public final class Util public static String formatAsCurrency(final double value) { - + String str = dFormat.format(value); if (str.endsWith(".00")) { @@ -328,26 +330,113 @@ public final class Util perm.recalculatePermissibles(); return perm; } - private static transient final Pattern VANILLA_COLOR_PATTERN = Pattern.compile("\u00A7+[0-9A-FKa-fk]"); - private static transient final Pattern EASY_COLOR_PATTERN = Pattern.compile("&([0-9a-fk])"); + private static transient final Pattern URL_PATTERN = Pattern.compile("((?:(?:https?)://)?[\\w-_\\.]{2,})\\.([a-z]{2,3}(?:/\\S+)?)"); + private static transient final Pattern VANILLA_PATTERN = Pattern.compile("\u00A7+[0-9A-FK-ORa-fk-or]"); + private static transient final Pattern REPLACE_PATTERN = Pattern.compile("&([0-9a-fk-or])"); + private static transient final Pattern VANILLA_COLOR_PATTERN = Pattern.compile("\u00A7+[0-9A-Fa-f]"); + private static transient final Pattern VANILLA_MAGIC_PATTERN = Pattern.compile("\u00A7+[Kk]"); + private static transient final Pattern VANILLA_FORMAT_PATTERN = Pattern.compile("\u00A7+[L-ORl-or]"); + private static transient final Pattern REPLACE_COLOR_PATTERN = Pattern.compile("&([0-9a-f])"); + private static transient final Pattern REPLACE_MAGIC_PATTERN = Pattern.compile("&(k)"); + private static transient final Pattern REPLACE_FORMAT_PATTERN = Pattern.compile("&([l-or])"); - public static String stripColor(final String input) + public static String stripFormat(final String input) { if (input == null) { return null; } + return VANILLA_PATTERN.matcher(input).replaceAll(""); + } - return VANILLA_COLOR_PATTERN.matcher(input).replaceAll(""); + public static String replaceFormat(final String input) + { + if (input == null) + { + return null; + } + return REPLACE_PATTERN.matcher(input).replaceAll("\u00a7$1"); + } + + public static String blockURL(final String input) + { + if (input == null) + { + return null; + } + String text = URL_PATTERN.matcher(input).replaceAll("$1 $2"); + while (URL_PATTERN.matcher(text).find()) + { + text = URL_PATTERN.matcher(text).replaceAll("$1 $2"); + } + return text; + } + + public static String formatString(final IUser user, final String permBase, final String input) + { + if (input == null) + { + return null; + } + String message; + if (Permissions.hasPermission(user.getBase(), permBase + ".color")) + { + message = Util.replaceColor(input, REPLACE_COLOR_PATTERN); + } + else + { + message = Util.stripColor(input, VANILLA_COLOR_PATTERN); + } + if (Permissions.hasPermission(user.getBase(), permBase + ".magic")) + { + message = Util.replaceColor(message, REPLACE_MAGIC_PATTERN); + } + else + { + message = Util.stripColor(message, VANILLA_MAGIC_PATTERN); + } + if (Permissions.hasPermission(user.getBase(), permBase + ".format")) + { + message = Util.replaceColor(message, REPLACE_FORMAT_PATTERN); + } + else + { + message = Util.stripColor(message, VANILLA_FORMAT_PATTERN); + } + return message; } - public static String replaceColor(final String input) + public static String formatMessage(final IUser user, final String permBase, final String input) { if (input == null) { return null; } + String message = formatString(user, permBase, input); + if (!Permissions.hasPermission(user.getBase(), permBase + ".url")) + { + message = Util.blockURL(message); + } + return message; + } + + public static String stripColor(final String input) + { + if (input == null) + { + return null; + } + + return VANILLA_COLOR_PATTERN.matcher(input).replaceAll(""); + } - return EASY_COLOR_PATTERN.matcher(input).replaceAll("\u00a7$1"); + private static String stripColor(final String input, final Pattern pattern) + { + return pattern.matcher(input).replaceAll(""); + } + + private static String replaceColor(final String input, final Pattern pattern) + { + return pattern.matcher(input).replaceAll("\u00a7$1"); } } diff --git a/Essentials/src/net/ess3/utils/textreader/HelpInput.java b/Essentials/src/net/ess3/utils/textreader/HelpInput.java index 6f47dc90d..38f6306ac 100644 --- a/Essentials/src/net/ess3/utils/textreader/HelpInput.java +++ b/Essentials/src/net/ess3/utils/textreader/HelpInput.java @@ -1,15 +1,15 @@ package net.ess3.utils.textreader; -import static net.ess3.I18n._; -import net.ess3.api.IEssentials; -import net.ess3.api.ISettings; -import net.ess3.api.IUser; -import net.ess3.permissions.HelpPermissions; import java.io.IOException; import java.util.*; import java.util.logging.Level; import java.util.logging.Logger; import lombok.Cleanup; +import static net.ess3.I18n._; +import net.ess3.api.IEssentials; +import net.ess3.api.ISettings; +import net.ess3.api.IUser; +import net.ess3.permissions.HelpPermissions; import org.bukkit.plugin.Plugin; import org.bukkit.plugin.PluginDescriptionFile; @@ -30,33 +30,47 @@ public class HelpInput implements IText final ISettings settings = ess.getSettings(); settings.acquireReadLock(); boolean reported = false; + final List<String> newLines = new ArrayList<String>(); String pluginName = ""; + String pluginNameLow = ""; + if (!match.equalsIgnoreCase("")) + { + lines.add(_("helpMatching", match)); + } + for (Plugin p : ess.getServer().getPluginManager().getPlugins()) { try { + final List<String> pluginLines = new ArrayList<String>(); final PluginDescriptionFile desc = p.getDescription(); final Map<String, Map<String, Object>> cmds = desc.getCommands(); - pluginName = p.getDescription().getName().toLowerCase(Locale.ENGLISH); + pluginName = p.getDescription().getName(); + pluginNameLow = pluginName.toLowerCase(Locale.ENGLISH); + if (pluginNameLow.equals(match)) + { + lines.clear(); + newLines.clear(); + lines.add(_("helpFrom", p.getDescription().getName())); + } + for (Map.Entry<String, Map<String, Object>> k : cmds.entrySet()) { try { - if ((!match.equalsIgnoreCase("")) - && (!k.getKey().toLowerCase(Locale.ENGLISH).contains(match)) + if (!match.equalsIgnoreCase("") && (!pluginNameLow.contains(match)) && (!k.getKey().toLowerCase(Locale.ENGLISH).contains(match)) && (!(k.getValue().get(DESCRIPTION) instanceof String - && ((String)k.getValue().get(DESCRIPTION)).toLowerCase(Locale.ENGLISH).contains(match))) - && (!pluginName.contains(match))) + && ((String)k.getValue().get(DESCRIPTION)).toLowerCase(Locale.ENGLISH).contains(match)))) { continue; } - if (pluginName.contains("essentials")) + if (pluginNameLow.contains("essentials")) { final String node = "essentials." + k.getKey(); if (!settings.getData().getCommands().isDisabled(k.getKey()) && user.hasPermission(node)) { - lines.add(_("helpLine", k.getKey(), k.getValue().get(DESCRIPTION))); + pluginLines.add(_("helpLine", k.getKey(), k.getValue().get(DESCRIPTION))); } } else @@ -73,9 +87,9 @@ public class HelpInput implements IText { permissions = value.get(PERMISSIONS); } - if (HelpPermissions.getPermission(pluginName).isAuthorized(user)) + if (HelpPermissions.getPermission(pluginNameLow).isAuthorized(user)) { - lines.add(_("helpLine", k.getKey(), value.get(DESCRIPTION))); + pluginLines.add(_("helpLine", k.getKey(), value.get(DESCRIPTION))); } else if (permissions instanceof List && !((List<Object>)permissions).isEmpty()) { @@ -90,21 +104,21 @@ public class HelpInput implements IText } if (enabled) { - lines.add(_("helpLine", k.getKey(), value.get(DESCRIPTION))); + pluginLines.add(_("helpLine", k.getKey(), value.get(DESCRIPTION))); } } else if (permissions instanceof String && !"".equals(permissions)) { if (user.hasPermission(permissions.toString())) { - lines.add(_("helpLine", k.getKey(), value.get(DESCRIPTION))); + pluginLines.add(_("helpLine", k.getKey(), value.get(DESCRIPTION))); } } else { if (!settings.getData().getCommands().getHelp().isHidePermissionlessCommands()) { - lines.add(_("helpLine", k.getKey(), value.get(DESCRIPTION))); + pluginLines.add(_("helpLine", k.getKey(), value.get(DESCRIPTION))); } } } @@ -115,6 +129,18 @@ public class HelpInput implements IText continue; } } + if (!pluginLines.isEmpty()) + { + newLines.addAll(pluginLines); + if (pluginNameLow.equals(match)) + { + break; + } + if (match.equalsIgnoreCase("")) + { + lines.add(_("helpPlugin", pluginName, pluginNameLow)); + } + } } catch (NullPointerException ex) { @@ -124,12 +150,13 @@ public class HelpInput implements IText { if (!reported) { - logger.log(Level.WARNING, _("commandHelpFailedForPlugin", pluginName), ex); + logger.log(Level.WARNING, _("commandHelpFailedForPlugin", pluginNameLow), ex); } reported = true; continue; } } + lines.addAll(newLines); } @Override diff --git a/Essentials/src/net/ess3/utils/textreader/KeywordReplacer.java b/Essentials/src/net/ess3/utils/textreader/KeywordReplacer.java index 7bbff3fa3..5b0a5066f 100644 --- a/Essentials/src/net/ess3/utils/textreader/KeywordReplacer.java +++ b/Essentials/src/net/ess3/utils/textreader/KeywordReplacer.java @@ -40,16 +40,17 @@ public class KeywordReplacer implements IText @Cleanup final IUser user = ((Player)sender).getUser(); user.acquireReadLock(); + user.setDisplayNick(); displayName = user.getDisplayName(); userName = user.getName(); - ipAddress = user.getAddress().getAddress().toString(); - address = user.getAddress().toString(); + ipAddress = user.getAddress() == null || user.getAddress().getAddress() == null ? "" : user.getAddress().getAddress().toString(); + address = user.getAddress() == null ? "" : user.getAddress().toString(); balance = Double.toString(user.getMoney()); mails = Integer.toString(user.getData().getMails() == null ? 0 : user.getData().getMails().size()); - world = user.getLocation().getWorld().getName(); - worldTime12 = DescParseTickFormat.format12(user.getWorld().getTime()); - worldTime24 = DescParseTickFormat.format24(user.getWorld().getTime()); - worldDate = DateFormat.getDateInstance(DateFormat.MEDIUM, ess.getI18n().getCurrentLocale()).format(DescParseTickFormat.ticksToDate(user.getWorld().getFullTime())); + world = user.getLocation() == null || user.getLocation().getWorld() == null ? "" : user.getLocation().getWorld().getName(); + worldTime12 = DescParseTickFormat.format12(user.getWorld() == null ? 0 : user.getWorld().getTime()); + worldTime24 = DescParseTickFormat.format24(user.getWorld() == null ? 0 : user.getWorld().getTime()); + worldDate = DateFormat.getDateInstance(DateFormat.MEDIUM, ess.getI18n().getCurrentLocale()).format(DescParseTickFormat.ticksToDate(user.getWorld() == null ? 0 : user.getWorld().getFullTime())); } else { diff --git a/Essentials/src/net/ess3/utils/textreader/TextInput.java b/Essentials/src/net/ess3/utils/textreader/TextInput.java index a56059992..b0a0707af 100644 --- a/Essentials/src/net/ess3/utils/textreader/TextInput.java +++ b/Essentials/src/net/ess3/utils/textreader/TextInput.java @@ -1,11 +1,5 @@ package net.ess3.utils.textreader; -import net.ess3.api.IEssentials; -import net.ess3.api.IUser; -import net.ess3.api.InvalidNameException; -import net.ess3.api.server.CommandSender; -import net.ess3.api.server.Player; -import net.ess3.utils.Util; import java.io.*; import java.lang.ref.SoftReference; import java.util.*; @@ -83,10 +77,10 @@ public class TextInput implements IText } if (line.length() > 0 && line.charAt(0) == '#') { - bookmarks.put(line.substring(1).toLowerCase(Locale.ENGLISH).replaceAll("&[0-9a-f]", ""), lineNumber); - chapters.add(line.substring(1).replace('&', '๏ฟฝ').replace("๏ฟฝ", "&")); + bookmarks.put(line.substring(1).toLowerCase(Locale.ENGLISH).replaceAll("&[0-9a-fk]", ""), lineNumber); + chapters.add(line.substring(1).replace('&', 'ยง').replace("ยงยง", "&")); } - lines.add(line.replace('&', '๏ฟฝ').replace("๏ฟฝ", "&")); + lines.add(line.replace('&', 'ยง').replace("ยงยง", "&")); lineNumber++; } } @@ -118,7 +112,9 @@ public class TextInput implements IText } finally { + if(output != null) output.close(); + if(input != null) input.close(); } throw new FileNotFoundException("File " + filename + ".txt does not exist. Creating one for you."); diff --git a/Essentials/src/net/ess3/utils/textreader/TextPager.java b/Essentials/src/net/ess3/utils/textreader/TextPager.java index 795f35ec6..c1ca8e939 100644 --- a/Essentials/src/net/ess3/utils/textreader/TextPager.java +++ b/Essentials/src/net/ess3/utils/textreader/TextPager.java @@ -1,7 +1,5 @@ package net.ess3.utils.textreader; -import static net.ess3.I18n._; - import java.util.List; import java.util.Locale; import java.util.Map; @@ -49,7 +47,23 @@ public class TextPager final int pages = lines.size() / 9 + (lines.size() % 9 > 0 ? 1 : 0); if (!onePage) { - sender.sendMessage(_("infoPages", page, pages)); + StringBuilder content = new StringBuilder(); + final String[] title = commandName.split(" ", 2); + if (title.length > 1) + { + content.append(I18n.capitalCase(title[0])).append(": "); + content.append(title[1]); + } + else if (chapterPageStr != null) + { + content.append(I18n.capitalCase(commandName)).append(": "); + content.append(chapterPageStr); + } + else + { + content.append(I18n.capitalCase(commandName)); + } + sender.sendMessage(_("infoPages", page, pages, content)); } for (int i = start; i < lines.size() && i < start + (onePage ? 20 : 9); i++) { @@ -116,7 +130,7 @@ public class TextPager if (!onePage) { - sender.sendMessage(_("infoPages", page, pages)); + sender.sendMessage(_("infoPages", page, pages, I18n.capitalCase(commandName))); } for (int i = start; i < end && i < start + (onePage ? 20 : 9); i++) { diff --git a/Essentials/src/plugin.yml b/Essentials/src/plugin.yml index f7dae5740..76d930a5c 100644 --- a/Essentials/src/plugin.yml +++ b/Essentials/src/plugin.yml @@ -1,11 +1,11 @@ # This determines the command prefix when there are conflicts (/name:home, /name:help, etc.) -name: Essentials3 +name: Essentials-3 main: net.ess3.Essentials # Note to developers: This next line cannot change, or the automatic versioning system will break. version: ${build.number} website: http://tiny.cc/EssentialsWiki description: Provides an essential, core set of commands for Bukkit. -authors: [Zenexer, ementalo, Aelux, Brettflan, KimKandor, snowleo, ceulemans, Xeology, KHobbits, md_5] +authors: [Zenexer, ementalo, Aelux, Brettflan, KimKandor, snowleo, ceulemans, Xeology, KHobbits, md_5, Iaccidentally] commands: afk: description: Marks you as away-from-keyboard. @@ -49,7 +49,7 @@ commands: aliases: [ebroadcast,bcast,ebcast] bigtree: description: Spawn a big tree where you are looking. - usage: /<command> <tree|redwood> + usage: /<command> <tree|redwood|jungle> aliases: [ebigtree] burn: description: Set a player on fire. @@ -90,6 +90,11 @@ commands: essentials: description: Reloads essentials. usage: /<command> + aliases: [ess] + exp: + description: Give, set or look at a players exp. + usage: /<command> [show|set|give] [playername [amount]] + aliases: [eexp,xp] ext: description: Extinguish players. usage: /<command> [player] @@ -98,10 +103,14 @@ commands: description: Satisfy the hunger. usage: /<command> [player] aliases: [efeed,eat,eeat] + fly: + description: Take off, and soar! + usage: /<command> [player] [on|off] + aliases: [efly] itemdb: description: Searches for an item. usage: /<command> <item> - aliases: [eitemdb] + aliases: [eitemdb,itemno,eitemno,durability,dura,edura,edurability] fireball: description: Throw a fireball. usage: /<command> [small] @@ -115,17 +124,21 @@ commands: usage: /<command> [player] aliases: [coords,egetpos,position,eposition,whereami,ewhereami] gc: - description: Reports garbage collection info; useful to developers. + description: Reports garbage collection and tick info; useful to developers. usage: /<command> - aliases: [mem,memory,egc,emem,ememory] + aliases: [elag,lag,mem,memory,egc,emem,ememory] give: description: Give a player an item. usage: /<command> <player> <item|numeric> [amount <enchantmentname[:level]> ...] aliases: [egive] god: description: Enables your godly powers. - usage: /<command> [player] + usage: /<command> [player] [on|off] aliases: [tgm,godmode,egod,etgm,egodmode] + hat: + description: Get some cool new headgear + usage: /<command> [remove] + aliases: [ehat] heal: description: Heals you or the given player. usage: /<command> [player] @@ -176,7 +189,7 @@ commands: aliases: [ekickall] kit: description: Obtains the specified kit or views all available kits. - usage: /<command> [kit] + usage: /<command> [kit] [player] aliases: [ekit,kits,ekits] kill: description: Kills specified player. @@ -185,7 +198,7 @@ commands: killall: description: Kill all mobs in a world. usage: /<command> [mobType] [radius] - aliases: [ekillall,butcher,ebutcher] + aliases: [ekillall,butcher,ebutcher,mobkill,emobkill] kittycannon: description: Throw an exploding kitten at your opponent usage: /<command> @@ -199,7 +212,7 @@ commands: aliases: [strike,smite,thor,shock,elightning,estrike,esmite,ethor,eshock] mail: description: Manages inter-player, intra-server mail. - usage: /<command> [read|clear|send [to] [message]] + usage: /<command> [read|clear|send [to] [message]|sendall [message]] aliases: [email] me: description: Describes an action in the context of the player. @@ -242,8 +255,8 @@ commands: usage: /<command> aliases: [pong,echo,echo,eping,epong] powertool: - description: Assigns a command to the item in hand, {player} will be replaced by the name of the player that you click. - usage: /<command> [l:|a:|r:|c:|d:][command] [arguments] + description: Assigns a command to the item in hand. + usage: /<command> [l:|a:|r:|c:|d:][command] [arguments] - {player} can be replaced by name of a clicked player. aliases: [pt,epowertool,ept] powertooltoggle: description: Enables or disables all current powertools @@ -258,7 +271,7 @@ commands: usage: /<command> <message> aliases: [er,reply,ereply] realname: - description: Displays the username of a user based on nickname. + description: Displays the username of a user based on nick. usage: /<command> <nickname> aliases: [erealname] remove: @@ -308,15 +321,15 @@ commands: spawn: description: Teleport to the spawnpoint. usage: /<command> [player] - aliases: [esetspawn] + aliases: [espawn] spawner: description: Change the mob type of a spawner usage: /<command> <mob> - aliases: [espawner] + aliases: [espawner,changems,echangems] spawnmob: description: Spawns a mob. usage: /<command> <mob>[:data][,<mount>[:data]] [amount] [player] - aliases: [espawnmob] + aliases: [espawnmob,mob,emob] sudo: description: Make another user perform a command. usage: /<command> <player> <command [args]> @@ -338,7 +351,7 @@ commands: usage: /<command> [day|night|dawn|17:30|4pm|4000ticks] [worldname|all] aliases: [etime, day, night] togglejail: - description: Prevents a player from interacting with the world and teleports him/her to the jail specified + description: Jails/Unjails a player and tp them to the jail specified. usage: /<command> <player> <jailname> [datediff] aliases: [tjail,jail,ejail,unjail,eunjail,etogglejail] top: @@ -379,7 +392,7 @@ commands: aliases: [s,etphere] tpo: description: Teleport override for tptoggle. - usage: /<command> <player> + usage: /<command> <player> [otherplayer] aliases: [etpo] tpohere: description: Teleport here override for tptoggle. @@ -395,7 +408,7 @@ commands: aliases: [etptoggle] tree: description: Spawn a tree where you are looking. - usage: /<command> <tree|birch|redwood> + usage: /<command> <tree|birch|redwood|redmushroom|brownmushroom|jungle|junglebush|swamp> aliases: [etree] unban: description: Unbans the specified player. @@ -409,6 +422,10 @@ commands: description: Allows the unlimited placing of items. usage: /<command> <list|item|clear> [player] aliases: [eunlimited,ul,unl,eul,eunl] + vanish: + description: Hide yourself from other players. + usage: /<command> [on|off] + aliases: [evanish] warp: description: List all warps or warp to the specified location. usage: /<command> <pagenumber|warp> [player] diff --git a/Essentials/test/com/earth2me/essentials/EconomyTest.java b/Essentials/test/net/ess3/EconomyTest.java index e89bc832c..21669d7e6 100644 --- a/Essentials/test/com/earth2me/essentials/EconomyTest.java +++ b/Essentials/test/net/ess3/EconomyTest.java @@ -1,4 +1,4 @@ -package com.earth2me.essentials; +package net.ess3; import net.ess3.api.NoLoanPermittedException; import net.ess3.api.UserDoesNotExistException; diff --git a/Essentials/test/com/earth2me/essentials/FakeOfflinePlayer.java b/Essentials/test/net/ess3/FakeOfflinePlayer.java index 01dd470ca..de1f9064e 100644 --- a/Essentials/test/com/earth2me/essentials/FakeOfflinePlayer.java +++ b/Essentials/test/net/ess3/FakeOfflinePlayer.java @@ -1,4 +1,4 @@ -package com.earth2me.essentials; +package net.ess3; import java.util.Map; import org.bukkit.Bukkit; diff --git a/Essentials/test/com/earth2me/essentials/FakeServer.java b/Essentials/test/net/ess3/FakeServer.java index c0e0812d7..aeed3e4b8 100644 --- a/Essentials/test/com/earth2me/essentials/FakeServer.java +++ b/Essentials/test/net/ess3/FakeServer.java @@ -1,4 +1,4 @@ -package com.earth2me.essentials; +package net.ess3; import com.avaje.ebean.config.ServerConfig; import java.io.File; @@ -16,7 +16,6 @@ import org.bukkit.event.Event; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.inventory.InventoryType; -import org.bukkit.generator.ChunkGenerator; import org.bukkit.help.HelpMap; import org.bukkit.inventory.Inventory; import org.bukkit.inventory.InventoryHolder; @@ -884,4 +883,52 @@ public class FakeServer implements Server { throw new UnsupportedOperationException("Not supported yet."); } + + @Override + public String getWorldType() + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean getGenerateStructures() + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public long getConnectionThrottle() + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getMonsterSpawnLimit() + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getAnimalSpawnLimit() + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getWaterAnimalSpawnLimit() + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean isPrimaryThread() + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getMotd() + { + throw new UnsupportedOperationException("Not supported yet."); + } } diff --git a/Essentials/test/com/earth2me/essentials/FakeWorld.java b/Essentials/test/net/ess3/FakeWorld.java index 38026611f..fb617d98b 100644 --- a/Essentials/test/com/earth2me/essentials/FakeWorld.java +++ b/Essentials/test/net/ess3/FakeWorld.java @@ -1,4 +1,4 @@ -package com.earth2me.essentials; +package net.ess3; import java.io.File; import java.util.Collection; @@ -627,4 +627,52 @@ public class FakeWorld implements World { throw new UnsupportedOperationException("Not supported yet."); } + + @Override + public void setBiome(int arg0, int arg1, Biome arg2) + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getMonsterSpawnLimit() + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setMonsterSpawnLimit(int arg0) + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getAnimalSpawnLimit() + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setAnimalSpawnLimit(int arg0) + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getWaterAnimalSpawnLimit() + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setWaterAnimalSpawnLimit(int arg0) + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Entity spawnEntity(Location loc, EntityType type) + { + throw new UnsupportedOperationException("Not supported yet."); + } } diff --git a/Essentials/test/com/earth2me/essentials/StorageTest.java b/Essentials/test/net/ess3/StorageTest.java index 8513a177c..aac394bf6 100644 --- a/Essentials/test/com/earth2me/essentials/StorageTest.java +++ b/Essentials/test/net/ess3/StorageTest.java @@ -1,13 +1,13 @@ -package com.earth2me.essentials; +package net.ess3; + +import java.io.*; -import net.ess3.utils.ExecuteTimer; import net.ess3.settings.Settings; import net.ess3.storage.ObjectLoadException; import net.ess3.storage.StorageObject; import net.ess3.storage.YamlStorageReader; import net.ess3.storage.YamlStorageWriter; -import java.io.*; - +import net.ess3.utils.ExecuteTimer; import org.bukkit.Location; import org.bukkit.World; import org.bukkit.World.Environment; diff --git a/Essentials/test/com/earth2me/essentials/UserTest.java b/Essentials/test/net/ess3/UserTest.java index 75d762a75..3baa420df 100644 --- a/Essentials/test/com/earth2me/essentials/UserTest.java +++ b/Essentials/test/net/ess3/UserTest.java @@ -1,6 +1,11 @@ -package com.earth2me.essentials; +package net.ess3; +import java.io.IOException; +import junit.framework.TestCase; import net.ess3.api.IUser; +import net.ess3.user.User; +import org.bukkit.World.Environment; +import org.bukkit.plugin.InvalidDescriptionException; public class UserTest extends EssentialsTest diff --git a/Essentials/test/com/earth2me/essentials/UtilTest.java b/Essentials/test/net/ess3/UtilTest.java index 10b214280..dc7dc7b66 100644 --- a/Essentials/test/com/earth2me/essentials/UtilTest.java +++ b/Essentials/test/net/ess3/UtilTest.java @@ -1,4 +1,4 @@ -package com.earth2me.essentials; +package net.ess3; import net.ess3.api.InvalidNameException; import net.ess3.utils.DateUtil; diff --git a/Essentials2Compat/src/com/earth2me/essentials/Economy.java b/Essentials2Compat/src/com/earth2me/essentials/Economy.java new file mode 100644 index 000000000..bf1c9a61d --- /dev/null +++ b/Essentials2Compat/src/com/earth2me/essentials/Economy.java @@ -0,0 +1,245 @@ +package com.earth2me.essentials; + +import net.ess3.api.IEssentials; +import net.ess3.api.NoLoanPermittedException; +import net.ess3.api.UserDoesNotExistException; +import net.ess3.utils.Util; + + +/** + * Instead of using this api directly, we recommend to use the register plugin: http://bit.ly/RegisterMethod + */ +public final class Economy +{ + private Economy() + { + } + private static IEssentials ess; + private static final String noCallBeforeLoad = "Essentials API is called before Essentials is loaded."; + + /** + * Returns the balance of a user + * + * @param name Name of the user + * @return balance + * @throws net.ess3.api.UserDoesNotExistException + */ + public static double getMoney(String name) throws UserDoesNotExistException + { + if (ess == null) + { + throw new RuntimeException(noCallBeforeLoad); + } + return ess.getEconomy().getMoney(name); + } + + /** + * Sets the balance of a user + * + * @param name Name of the user + * @param balance The balance you want to set + * @throws UserDoesNotExistException If a user by that name does not exists + * @throws net.ess3.api.NoLoanPermittedException If the user is not allowed to have a negative balance + */ + public static void setMoney(String name, double balance) throws UserDoesNotExistException, NoLoanPermittedException + { + if (ess == null) + { + throw new RuntimeException(noCallBeforeLoad); + } + ess.getEconomy().setMoney(name, balance); + } + + /** + * Adds money to the balance of a user + * + * @param name Name of the user + * @param amount The money you want to add + * @throws UserDoesNotExistException If a user by that name does not exists + * @throws NoLoanPermittedException If the user is not allowed to have a negative balance + */ + public static void add(String name, double amount) throws UserDoesNotExistException, NoLoanPermittedException + { + double result = getMoney(name) + amount; + setMoney(name, result); + } + + /** + * Substracts money from the balance of a user + * + * @param name Name of the user + * @param amount The money you want to substract + * @throws UserDoesNotExistException If a user by that name does not exists + * @throws NoLoanPermittedException If the user is not allowed to have a negative balance + */ + public static void subtract(String name, double amount) throws UserDoesNotExistException, NoLoanPermittedException + { + double result = getMoney(name) - amount; + setMoney(name, result); + } + + /** + * Divides the balance of a user by a value + * + * @param name Name of the user + * @param value The balance is divided by this value + * @throws UserDoesNotExistException If a user by that name does not exists + * @throws NoLoanPermittedException If the user is not allowed to have a negative balance + */ + public static void divide(String name, double value) throws UserDoesNotExistException, NoLoanPermittedException + { + double result = getMoney(name) / value; + setMoney(name, result); + } + + /** + * Multiplies the balance of a user by a value + * + * @param name Name of the user + * @param value The balance is multiplied by this value + * @throws UserDoesNotExistException If a user by that name does not exists + * @throws NoLoanPermittedException If the user is not allowed to have a negative balance + */ + public static void multiply(String name, double value) throws UserDoesNotExistException, NoLoanPermittedException + { + double result = getMoney(name) * value; + setMoney(name, result); + } + + /** + * Resets the balance of a user to the starting balance + * + * @param name Name of the user + * @throws UserDoesNotExistException If a user by that name does not exists + * @throws NoLoanPermittedException If the user is not allowed to have a negative balance + */ + public static void resetBalance(String name) throws UserDoesNotExistException, NoLoanPermittedException + { + if (ess == null) + { + throw new RuntimeException(noCallBeforeLoad); + } + ess.getEconomy().resetBalance(name); + } + + /** + * @param name Name of the user + * @param amount The amount of money the user should have + * @return true, if the user has more or an equal amount of money + * @throws UserDoesNotExistException If a user by that name does not exists + */ + public static boolean hasEnough(String name, double amount) throws UserDoesNotExistException + { + return amount <= getMoney(name); + } + + /** + * @param name Name of the user + * @param amount The amount of money the user should have + * @return true, if the user has more money + * @throws UserDoesNotExistException If a user by that name does not exists + */ + public static boolean hasMore(String name, double amount) throws UserDoesNotExistException + { + return amount < getMoney(name); + } + + /** + * @param name Name of the user + * @param amount The amount of money the user should not have + * @return true, if the user has less money + * @throws UserDoesNotExistException If a user by that name does not exists + */ + public static boolean hasLess(String name, double amount) throws UserDoesNotExistException + { + return amount > getMoney(name); + } + + /** + * Test if the user has a negative balance + * + * @param name Name of the user + * @return true, if the user has a negative balance + * @throws UserDoesNotExistException If a user by that name does not exists + */ + public static boolean isNegative(String name) throws UserDoesNotExistException + { + return getMoney(name) < 0.0; + } + + /** + * Formats the amount of money like all other Essentials functions. Example: $100000 or $12345.67 + * + * @param amount The amount of money + * @return Formatted money + */ + public static String format(double amount) + { + if (ess == null) + { + throw new RuntimeException(noCallBeforeLoad); + } + return Util.displayCurrency(amount, ess); + } + + /** + * Test if a player exists to avoid the UserDoesNotExistException + * + * @param name Name of the user + * @return true, if the user exists + */ + public static boolean playerExists(String name) + { + if (ess == null) + { + throw new RuntimeException(noCallBeforeLoad); + } + return ess.getEconomy().playerExists(name); + } + + /** + * Test if a player is a npc + * + * @param name Name of the player + * @return true, if it's a npc + * @throws UserDoesNotExistException + */ + public static boolean isNPC(String name) throws UserDoesNotExistException + { + if (ess == null) + { + throw new RuntimeException(noCallBeforeLoad); + } + return ess.getEconomy().isNPC(name); + } + + /** + * Creates dummy files for a npc, if there is no player yet with that name. + * + * @param name Name of the player + * @return true, if a new npc was created + */ + public static boolean createNPC(String name) + { + if (ess == null) + { + throw new RuntimeException(noCallBeforeLoad); + } + return ess.getEconomy().createNPC(name); + } + + /** + * Deletes a user, if it is marked as npc. + * + * @param name Name of the player + * @throws UserDoesNotExistException + */ + public static void removeNPC(String name) throws UserDoesNotExistException + { + if (ess == null) + { + throw new RuntimeException(noCallBeforeLoad); + } + ess.getEconomy().removeNPC(name); + } +} diff --git a/Essentials2Compat/src/com/earth2me/essentials/Essentials.java b/Essentials2Compat/src/com/earth2me/essentials/Essentials.java index dc612e8d6..840ef7d37 100644 --- a/Essentials2Compat/src/com/earth2me/essentials/Essentials.java +++ b/Essentials2Compat/src/com/earth2me/essentials/Essentials.java @@ -9,14 +9,8 @@ public class Essentials extends JavaPlugin @Override public void onEnable() { - Bukkit.getLogger().info("You can remove this compatibility plugin, when all plugins are updated to Essentials 3"); + Bukkit.getLogger().info("You can remove this compatibility plugin, when all plugins are updated to Essentials-3"); //TODO: Update files to new 3.0 format //TODO: Move Eco Api here } - - @Override - public void onDisable() - { - throw new UnsupportedOperationException("Not supported yet."); - } } diff --git a/Essentials2Compat/src/com/earth2me/essentials/EssentialsConf.java b/Essentials2Compat/src/com/earth2me/essentials/EssentialsConf.java index dbdc9483b..cbc51eddd 100644 --- a/Essentials2Compat/src/com/earth2me/essentials/EssentialsConf.java +++ b/Essentials2Compat/src/com/earth2me/essentials/EssentialsConf.java @@ -1,7 +1,14 @@ package com.earth2me.essentials; import static net.ess3.I18n._; +import com.google.common.io.Files; import java.io.*; +import java.nio.ByteBuffer; +import java.nio.CharBuffer; +import java.nio.channels.FileChannel; +import java.nio.charset.Charset; +import java.nio.charset.CharsetDecoder; +import java.nio.charset.CoderResult; import java.util.HashMap; import java.util.Locale; import java.util.Map; @@ -25,6 +32,7 @@ public class EssentialsConf extends YamlConfiguration private transient File configFile; private transient String templateName = null; private transient Class<?> resourceClass = EssentialsConf.class; + private static final Charset UTF8 = Charset.forName("UTF-8"); public EssentialsConf(final File configFile) { @@ -32,7 +40,7 @@ public class EssentialsConf extends YamlConfiguration this.configFile = configFile; } - public void load() + public synchronized void load() { configFile = configFile.getAbsoluteFile(); if (!configFile.getParentFile().exists()) @@ -105,15 +113,48 @@ public class EssentialsConf extends YamlConfiguration try { - super.load(configFile); - } - catch (FileNotFoundException ex) - { - LOGGER.log(Level.SEVERE, null, ex); + final FileInputStream inputStream = new FileInputStream(configFile); + try + { + final FileChannel channel = inputStream.getChannel(); + final ByteBuffer buffer = ByteBuffer.allocate((int)configFile.length()); + channel.read(buffer); + buffer.rewind(); + final CharBuffer data = CharBuffer.allocate((int)configFile.length()); + CharsetDecoder decoder = UTF8.newDecoder(); + CoderResult result = decoder.decode(buffer, data, true); + if (result.isError()) + { + buffer.rewind(); + data.clear(); + LOGGER.log(Level.INFO, "File " + configFile.getAbsolutePath().toString() + " is not utf-8 encoded, trying " + Charset.defaultCharset().displayName()); + decoder = Charset.defaultCharset().newDecoder(); + result = decoder.decode(buffer, data, true); + if (result.isError()) + { + throw new InvalidConfigurationException("Invalid Characters in file " + configFile.getAbsolutePath().toString()); + } + else + { + decoder.flush(data); + } + } + else + { + decoder.flush(data); + } + final int end = data.position(); + data.rewind(); + super.loadFromString(data.subSequence(0, end).toString()); + } + finally + { + inputStream.close(); + } } catch (IOException ex) { - LOGGER.log(Level.SEVERE, null, ex); + LOGGER.log(Level.SEVERE, ex.getMessage(), ex); } catch (InvalidConfigurationException ex) { @@ -302,27 +343,55 @@ public class EssentialsConf extends YamlConfiguration return def; } } - - public void save() { + + public void save() + { try { save(configFile); } catch (IOException ex) { - LOGGER.log(Level.SEVERE, null, ex); + LOGGER.log(Level.SEVERE, ex.getMessage(), ex); } } - - public Object getProperty(String path) { + + @Override + public synchronized void save(final File file) throws IOException + { + if (file == null) + { + throw new IllegalArgumentException("File cannot be null"); + } + + Files.createParentDirs(file); + + final String data = saveToString(); + + final OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(file), UTF8); + + try + { + writer.write(data); + } + finally + { + writer.close(); + } + } + + public Object getProperty(String path) + { return get(path); } - - public void setProperty(String path, Object object) { + + public void setProperty(String path, Object object) + { set(path, object); } - - public void removeProperty(String path) { + + public void removeProperty(String path) + { set(path, null); } } diff --git a/Essentials2Compat/src/com/earth2me/essentials/EssentialsUpgrade.java b/Essentials2Compat/src/com/earth2me/essentials/EssentialsUpgrade.java index 859c08982..605262151 100644 --- a/Essentials2Compat/src/com/earth2me/essentials/EssentialsUpgrade.java +++ b/Essentials2Compat/src/com/earth2me/essentials/EssentialsUpgrade.java @@ -387,7 +387,6 @@ public class EssentialsUpgrade * ((Number)vals.get(4)).floatValue())); } } } } usersFile.renameTo(new File(usersFile.getAbsolutePath() + ".old")); * } */ - private void convertWarps() { final File warpsFolder = new File(ess.getDataFolder(), "warps"); @@ -462,56 +461,56 @@ public class EssentialsUpgrade } /*final File warpFile = new File(ess.getDataFolder(), "warps.txt"); - if (warpFile.exists()) - { - try - { - final BufferedReader rx = new BufferedReader(new FileReader(warpFile)); - try - { - for (String[] parts = new String[0]; rx.ready(); parts = rx.readLine().split(":")) - { - if (parts.length < 6) - { - continue; - } - final String name = parts[0]; - final double x = Double.parseDouble(parts[1].trim()); - final double y = Double.parseDouble(parts[2].trim()); - final double z = Double.parseDouble(parts[3].trim()); - final float yaw = Float.parseFloat(parts[4].trim()); - final float pitch = Float.parseFloat(parts[5].trim()); - if (name.isEmpty()) - { - continue; - } - World w = null; - for (World world : ess.getServer().getWorlds()) - { - if (world.getEnvironment() != World.Environment.NETHER) - { - w = world; - break; - } - } - final Location loc = new Location(name, x, y, z, yaw, pitch); - ess.getWarps().setWarp(name, loc); - if (!warpFile.renameTo(new File(ess.getDataFolder(), "warps.txt.old"))) - { - throw new Exception(_("fileRenameError", "warps.txt")); - } - } - } - finally - { - rx.close(); - } - } - catch (Exception ex) - { - LOGGER.log(Level.SEVERE, null, ex); - } - }*/ + if (warpFile.exists()) + { + try + { + final BufferedReader rx = new BufferedReader(new FileReader(warpFile)); + try + { + for (String[] parts = new String[0]; rx.ready(); parts = rx.readLine().split(":")) + { + if (parts.length < 6) + { + continue; + } + final String name = parts[0]; + final double x = Double.parseDouble(parts[1].trim()); + final double y = Double.parseDouble(parts[2].trim()); + final double z = Double.parseDouble(parts[3].trim()); + final float yaw = Float.parseFloat(parts[4].trim()); + final float pitch = Float.parseFloat(parts[5].trim()); + if (name.isEmpty()) + { + continue; + } + World w = null; + for (World world : ess.getServer().getWorlds()) + { + if (world.getEnvironment() != World.Environment.NETHER) + { + w = world; + break; + } + } + final Location loc = new Location(name, x, y, z, yaw, pitch); + ess.getWarps().setWarp(name, loc); + if (!warpFile.renameTo(new File(ess.getDataFolder(), "warps.txt.old"))) + { + throw new Exception(_("fileRenameError", "warps.txt")); + } + } + } + finally + { + rx.close(); + } + } + catch (Exception ex) + { + LOGGER.log(Level.SEVERE, null, ex); + } + }*/ } /* @@ -533,7 +532,7 @@ public class EssentialsUpgrade * ess.getDataFolder().getParentFile().getParentFile(); final File worldDirectory = new File(bukkitDirectory, name); * if (worldDirectory.exists() && worldDirectory.isDirectory()) { return new FakeWorld(worldDirectory.getName(), * World.Environment.NORMAL); } return null; - } + } */ public StoredLocation getFakeLocation(EssentialsConf config, String path) { @@ -691,6 +690,18 @@ public class EssentialsUpgrade doneFile.save(); } + private void warnMetrics() + { + if (doneFile.getBoolean("warnMetrics", false)) + { + return; + } + //todo - metrics + // ess.getSettings().setMetricsEnabled(false); + doneFile.setProperty("warnMetrics", true); + doneFile.save(); + } + public void beforeSettings() { if (!ess.getDataFolder().exists()) @@ -714,5 +725,6 @@ public class EssentialsUpgrade deleteOldItemsCsv(); updateSpawnsToNewSpawnsConfig(); updateJailsToNewJailsConfig(); + warnMetrics(); } } diff --git a/Essentials2Compat/src/plugin.yml b/Essentials2Compat/src/plugin.yml index fc318c962..bc721f650 100644 --- a/Essentials2Compat/src/plugin.yml +++ b/Essentials2Compat/src/plugin.yml @@ -4,3 +4,4 @@ version: 2.9 website: http://tiny.cc/EssentialsWiki description: Compatibility plugin for older plugins authors: [Zenexer, ementalo, Aelux, Brettflan, KimKandor, snowleo, ceulemans, Xeology, KHobbits] +depend: [Essentials-3] diff --git a/EssentialsAntiCheat/Instructions.txt b/EssentialsAntiCheat/Instructions.txt deleted file mode 100644 index e7dd42630..000000000 --- a/EssentialsAntiCheat/Instructions.txt +++ /dev/null @@ -1,939 +0,0 @@ - -################################################################################ -# # -# Important files, config.yml or "clean up your stuff" # -# # -################################################################################ - - 1) The config file for NoCheat is called "config.yml" now. - - 2) You can have different config files for different worlds. To achieve this, - copy the "config.yml" and rename the copy to "worldname_config.yml". Set- - tings in that file will now only affect the world with the name "worldname". - You may also delete all settings from that world-specific file that you - won't use. They'll be implicitly taken from the master "config.yml" file. - - 3) If you have files named "config.txt", "default_actions.txt" or "actions.txt" - please delete them. They are no longer used by NoCheat and serve no purpose - anymore. - - 4) Never change the amount of white-spaces in front of options in the config - file "config.yml". It will break the configuration. - - -################################################################################ -# # -# How "actions" work, an Overview # -# # -################################################################################ - - NoCheat allows to define in detail what should happen when a player fails a - check in form of "actions". There are 4 possible things that may be done. - (read on to learn in detail on how to define/modify actions): - - cancel: The effects of the action "cancel" depend on the check that it is - used for. Usually it means to prevent something from happening, - e.g. stop an attack or prevent sending of a chat message. - - log: Create and show/log a message. Log messages can be customized in - how often, when and where they are registered/shown. - - cmd: Execute a command of Bukkit or another plugin as if it were typed - into the server console by an admin. Like logging, these can be - customized. - - vl>X: Is meant to symbolize "violation level at least X". Used to define - actions that will be executed only if players reached a certain - violation level. Failing a check usually increases their "vl", not - failing checks reduces it over time. Violation levels mean different - things for different checks, e.g. they may describe moved distance - beyond the limit, number of attacks above the attack limit, sent - messages beyond the spam limit. - - -################################################################################ -# # -# How to customize your "actions" # -# # -################################################################################ - - 1) The "cancel" action is just the word "cancel". Read in the detailed option - description to find out what it does depending on the check that it is - assigned to. - - 2) The "log" action is a string of the form "log:string:delay:repeat:target". - - log: is simply used to let NoCheat know it is a log action. Don't remove - it from the action, or NoCheat will not know what it is and how to - handle it. - - string: is the message that will be logged. Because there is so little - space here, you only give a name here and define the actual - log message in the "strings" section of the config file. - - delay: a number declaring how many times that action initially has to be - executed before it really leads to logging a message. Use this for - situations where it's common to have false positives in checks and - you only want the log message to be shown if a player fails the - check multiple times within a minute. - - repeat: a number declaring how many seconds have to pass after logging the - message before it will be logged again for that player. This is - needed to prevent "log-spam". Usually a value of 5 seconds is - acceptable, for rare events you can use lower values. It is very - recommended to at least use the value 1 (one second) here. - - target: where should the message be logged to? You can use three letters - here. The order that you use is not important. - "c" means logging to console - "i" means logging to ingame chat and - "f" means logging to the log file. - - 3) The "cmd" action is a string of the form "cmd:string:delay:repeat". - - cmd: is simply used to let NoCheat know it is a command action. Don't - remove it from the action, or NoCheat will not know what it is and - how to handle it. - - string: is the command that will be issued. Because there is so little space - here, you only give a name here and define the actual command in the - "strings" section of the config file. - - delay: a number declaring how many times that action initially has to be - executed before it really leads to running the command in the - console. Use this to create e.g. a 3-strikes-law by setting it to 3. - Only if a player fails the check 3 times within 1 minute, the - command will be really run. - - repeat: a number declaring how many seconds have to pass after running the - command before it can be run again for that player. Because many - commands are expensive (take time, resources), you may want to limit - how often they can be called. - - 4) The "vl>" isn't really an action. It limits all actions that are written - afterwards to be only executed if the players violation level has reached - at least the given value. This allows to define layers of actions and - handle repeated or severe failing of checks different. For example the spam - check will only kick players if they reach a certain violation level (vl). - - -################################################################################ -# # -# Permissions # -# # -################################################################################ - - - NoCheat only supports "SuperPerms", CraftBukkits official permission framework. - You'll need to use a permissions plugin that supports "SuperPerms" to use it - with NoCheat. Here are some I know of: - - - bPermissions - - PermissionsEx - - Essentials GroupManager - - I personally recommend bPermissions, but any of them will do just fine. - - By default all these permissions are set to "op", which means players with - OP-status have all permissions, unless you change it. - --------------------------------------------------------------------------------- ---------------------------- Permissions for CHECKS ----------------------------- --------------------------------------------------------------------------------- - - These permission nodes are grouped the same way as the options in the config - file, based on the event type they belong to. The logic is, that a player - having one of these nodes means he will NOT be checked. Players without the - permission node will be checked. - - Example: A player has permission "nocheat.checks.moving.morepackets". That - means he is allowed to use that hack/cheat because NoCheat won't check/stop it. - - ------------------------- MOVING Permissions for CHECKS ------------------------- - - - nocheat.checks.moving.runfly - Allows the player to move freely. It also treats the player as if he has - the ".flying", ".swimming", ".sneaking" and ".nofall" permission too. - - - nocheat.checks.moving.flying - Allows the player to fly, independent of if he is in "creative mode" or not. - He will be limited in speed by the config settings "flyingspeedvertical" - and "flyingspeedhorizontal". It also treats the player as if he has the - ".nofall" permission too. - - - nocheat.checks.moving.swimming - Allows the player to swim as fast as he is allowed to walk. Normally a - player swims slower than he walks and NoCheat prevents faster movement in - water. - - - nocheat.checks.moving.sneaking - Allows the player to sneak faster than he is allowed to walk. Normally a - player sneaks a lot slower than he walks and NoCheat prevents faster - movement while sneaking. - - - nocheat.checks.moving.nofall - Allows the player to avoid fall damage by using hacks. Normally NoCheat - will keep track of a players movement and try to rectify the fall-damage - calculations of Minecraft in case they seem to be wrong because of players - tricking the server. - - - nocheat.checks.moving.morepackets - Allows players to make a lot more movements than normally possible. Doing - more movements will result in faster overall movement speed and causes the - server to spend a lot of additional time for processing these movements. - - --------------------- BLOCKBREAK Permissions for CHECKS ------------------------- - - - nocheat.checks.blockbreak.reach - Allows the player to break blocks that are further away than usual. - - - nocheat.checks.blockbreak.direction - Don't force players to look at the blocks that they try to destroy. - - - nocheat.checks.blockbreak.noswing - Don't force players to swing their arm when breaking blocks. - - --------------------- BLOCKPLACE Permissions for CHECKS ------------------------- - - - nocheat.checks.blockplace.reach - Allows the player to place blocks that are further away than usual. - - - nocheat.checks.blockplace.direction - Don't force players to look at the blocks that they try to place. - - ---------------------- INVENTORY Permissions for CHECKS ------------------------- - - - nocheat.checks.inventory.drop - Don't limit the number of items that a player may drop within a short time - - - nocheat.checks.inventory.instantbow - Don't prevent players from shooting their bows instantly without taking the - usual time to pull the string back - - - nocheat.checks.inventory.instanteat - Don't prevent players from eating their food instantly without taking the - usual time to munch on it - - ------------------------ CHAT Permissions for CHECKS ---------------------------- - - - nocheat.checks.chat.spam - Don't limit the number of messages and commands that a player may send in a - short timeframe - - - nocheat.checks.chat.color - Don't filter color codes from messages that get sent by players, allowing - them to use colors in their messages. - - ----------------------- FIGHT Permissions for CHECKS ---------------------------- - - - nocheat.checks.fight.direction - Don't force players to look at their targets while fighting - - - nocheat.checks.fight.noswing - Don't force players to move their arms while fighting - - - nocheat.checks.fight.reach - Don't limit the distance for fights - - - nocheat.checks.fight.speed - Don't limit the number of attacks that the player can do per second - - - nocheat.checks.fight.godmode - Don't prevent the player from keeping the temporary invulnerability that he - gets when taking damage - - - nocheat.checks.fight.instantheal - Don't prevent the player from accellerating their health generation by - food saturation - - --------------------------------------------------------------------------------- ------------------------ Permissions for ADMINISTRATION ------------------------- --------------------------------------------------------------------------------- - - - nocheat.admin.chatlog - The player will receive log messages that are directed at the "ingame chat" - as a normal chat message ingame. - - - nocheat.admin.commands - The player gets access to some of the "/nocheat" commands - - - nocheat.admin.reload - In combination with "nocheat.admin.commands", the player gets access to the - "/nocheat reload" command, which will cause NoCheat to reread its config - files. - - --------------------------------------------------------------------------------- ----------------------- Things to know about Permissions ------------------------ --------------------------------------------------------------------------------- - - NoCheat defines "parent" nodes for all permissions already for you. That means - you can use one of the following: - - - nocheat - - nocheat.admin - - nocheat.checks - - nocheat.checks.moving - - nocheat.checks.blockbreak - - nocheat.checks.blockplace - - nocheat.checks.inventory - - nocheat.checks.chat - - nocheat.checks.fight - - To give a player all the permissions that start with that permission node. - - Especially you don't have to and should not use ".*" anywhere when defining - NoCheat permissions. - - - You can exclude a specific player from getting logged by appending ".silent" - to the relevant permission node of the specific check. E.g. - - - nocheat.checks.moving.nofall.silent - - will prevent NoCheat from recording log messages for that player for the - "nofall" check, while still executing all other actions as usual. These silent - permissions won't show up elsewhere, e.g. when using the "nocheat permlist" - command. - - -################################################################################ -# # -# All available config settings # -# # -################################################################################ - - Here you'll find the whole list of settings that you can manipulate in the - config.yml file. It is further split into logical sections - - --------------------------------------------------------------------------------- --------------------------------- LOGGING Section ------------------------------- --------------------------------------------------------------------------------- - - Everything that in general has to do with controlling NoCheats logging can be - found at this part of the config.yml - - active: - - Should messages get logged at all. If you are not interested in messages, - set this to false and you'll hear and see (almost) nothing of NoCheat. - - prefix: - - Will be placed in front of many log messages. To get colors, use "&" - followed by a number (0-9) or a letter (A-F). E.g. "&7NC&f:" would produce - the letters NC in red (&7), followed by black text (&f). - - filename: - - The name of the logfile that NoCheat will use to log its messages. The - default name is "nocheat.log", but you can use a different one if you want - to. - - file: - - Should the logfile be used at all. Set to false if you don't want to use - the logfile. By default the logfile will be used (true). - - console: - - Should the server console be used to display messages. Set to false if you - don't want NoCheat to show messages related to checks in the console. Error - messages may still get displayed there though. - - ingamechat: - - Should NoCheat display messages in the ingame chat? Set to false if you - don't want NoCheat to show messages ingame. The messages will only be seen - by players with the permission node "nocheat.admin.chatlog" or if you don't - use a permissions plugin, by players who are OP. - - showactivechecks: - - Should NoCheat display lists of checks that are enabled for each world. Set - to true if you are unsure that your (multiworld) setup of the config files - is done correctly. - - debugmessages: - - Should some additional messages be displayed in the server console, e.g. - about NoCheat encountering lag. The displayed messages may change from - version to version. This is deactivated by default. - - --------------------------------------------------------------------------------- --------------------------------- CHECKS Section -------------------------------- --------------------------------------------------------------------------------- - - Everything that in has to do with the various checks that NoCheat runs on the - players. Use these to specify what will be done, how it will be done and what - happens if somebody fails checks. - - ------------------------------ INVENTORY Subsection ----------------------------- - - Checks that at least technically have to do with the inventory or usage of - items can be found here. - - 1) DROP: - - The "inventory.drop" check. It limits how many separate items a player can - drop onto the ground within a specific time. Dropping a lot of separate - items at once can cause lag on the server, therefore this check exists. - - active: - Should the check be enabled. Set to false if you are not interested in - this at all - - time: - Over how many seconds should dropped items be counted, before the - counter gets reset and starts at zero again. - - limit: - How many items may be dropped in the timeframe that is specified by - the "time" setting. Please consider that dying causes a player to drop - up to 36 separate items (stacks). Therefore this value shouldn't be - set below ~50. - - actions: - What should happen when a player goes beyond the set limit. Default - settings log a message and kick the player from the server. The VL of - the drop check symbolizes how many items a player dropped beyond the - set limit. If the limit is 100 and he tried to drop 130, he will have a - Violation Level of 130 - 100 = 30. - - 2) INSTANTBOW: - - Players may attack extremely fast and with a fully charged bow without - waiting for it to be fully pulled back. This is a significant advantage in - PvP and PvE combat. - - active: - Should players be checked for this behavior. Set to false if you don't - care about players using bows faster than normally possible. - - actions: - What should happen if the player fails this check. Default is to stop - the attack ("cancel" it) and log messages. The Violation Level (VL) for - this check the time difference between how long it took the player to - fire an arrow and how long NoCheat thinks he should have taken, in - 1/10 seconds. Therefore a VL of 10 would mean that the player shot an - arrow 1 second faster than NoCheat expected. The VL gets increased with - every failed check and slowly decreased for every passed check. - - 3) INSTANTEAT: - - Players may eat various kinds of food instantly instead of waiting the - usual time munching on the item. - - active: - Should players be checked for this behavior. Set to false if you don't - care about players eating their food faster than normally possible. - - actions: - What should happen if the player fails this check. Default is to stop - the eating ("cancel" it) and log messages. The Violation Level (VL) for - this check the time difference between how long it took the player to - eat his food and how long NoCheat thinks he should have taken, in - 1/10 seconds. Therefore a VL of 10 would mean that the player ate his - food 1 second faster than NoCheat expected. The VL gets increased with - every failed check and slowly decreased for every passed check. - - ------------------------------- MOVING Subsection ------------------------------- - - Checks that at least technically have to do with the player moving around or - impacting the world with his movement can be found here. - - 1) RUNFLY: - - Players may move in illegal ways (flying, running too fast) or try to - trick the server into thinking that they are not falling/flying by - cleverly manipulating the data that they send to the server. - - active: - Should players get checked for this type of movement related hacks at - all. If deactivated, player may freely move around on the server, fly - or run really fast. - - walkspeed: - How fast should the player be allowed to walk. Default is "100", - meaning 100% of normal walking speed. You will not see this option in - your config.yml file, because normally you shouldn't have to change the - walking speed of players at all (NoCheat knows when players sprint, use - Swiftness potions etc and will already adapt the speed based on that - data). - - sprintspeed: - How fast should the player be allowed to sprint. Default is "100", - meaning 100% of normal sprinting speed. You will not see this option in - your config.yml file, because normally you shouldn't have to change the - sprinting speed of players at all (NoCheat knows when players sprint, - use Swiftness potions etc and will already adapt the speed based on - that data). - - sneakspeed: - How fast should the player be allowed to sneak. Default is "100", - meaning 100% of normal sneaking speed. You will not see this option in - your config.yml file, because normally you shouldn't have to change the - sneaking speed of players at all (NoCheat knows when players sprint, - use Swiftness potions etc and will already adapt the speed based on - that data). - - swimspeed: - How fast should the player be allowed to swim. Default is "100", - meaning 100% of normal swimming speed. You will not see this option in - your config.yml file, because normally you shouldn't have to change the - swimming speed of players at all (NoCheat knows when players sprint, - use Swiftness potions etc and will already adapt the speed based on - that data). - - allowfastsneaking: - Should sneaking players be allowed to move as fast as normal players. - Set this to true, if you use plugins that enable players to do that - (e.g. the "Heroes" plugin or other RPG plugins tend to do that) - - actions: - What should happen when a player sneaks/swims/walks/runs faster than - normally allowed or is flying. Default is to log messages (depending on - how severe the cheating is) and teleport the player to the last known - legitimate location on ground that NoCheat can remember for that player - ("cancel" the movement) - - checknofall: - Should players be checked for a common type of "nofall" hack, that - allows them to avoid taking damage when falling. If you don't care - about fall damage, you can deactivate this. It gets deactivated if a - player is allowed to fly (see some lines below), because it doesn't - make sense to allow flying and then hurt players when they land. - - nofallaggressivemode: - Enable an improved version of nofall check, that will catch additional - types of "nofall" hacks and deal damage to players directly. This is - usually safe to activate. It will only work if the "checknofall" is - also set to "true". - - nofallactions: - What should happen if a player is considered to be using a "nofall" - hack. Default reaction is to log a message and encourage Bukkit to deal - fall damage anyway ("cancel" the hack). The Violation Level is the - fall distance in blocks that the player tried to avoid. It gets - increased every time that the player fails the check, and decreased - over time if the player doesn't fail the check. - - FLYING: - This is an entire subsection dedicated to the "moving.flying" check. - It will be used instead of the "runfly" check whenever a player has - the right to fly. - - allowflyingalways: - Should all players be allowed to fly always. - - allowflyingincreative: - Should players that are set to "creative mode" be allowed to fly. If - they are already allowed because of "allowflyingalways" to fly, this - setting gets ignored. - - flyingspeedlimithorizontal: - How many 1/100 blocks may a player fly horizontal within one "step". - The official "creative mode" flying reaches speeds of about 0.6 - blocks which means a value of 60 here. - - flyingspeedlimitvertical: - How many 1/100 blocks may a player fly vertically up within one - "step". A value of 100 which means 1 block seems reasonable for most - cases. - - flyingheightlimit: - What is the maximum height (in blocks) that a player may reach by - flying, relative to the max world height he is in. Some servers - experience lag when players fly very, very high. This value is how - far above the map height a player may fly. - - actions: - What should happen if a player flies faster/higher than defined here? - Default is to log messages and to prevent the player from moving - ("cancel" his last movement). The Violation Level (VL) of this check - is the distance that the player went beyond what NoCheat allowed him. - The VL increases with every failed check and slowly decreases for - every passed check. - - 2) MOREPACKETS: - - The morepackets check is complementary to the "runfly" check. While the - "runfly" check(s) limit the distance a player can move per step, this - "morepackets" check limits the number of "steps" a player may take per - second. A normal value is 20 steps per second. - - active: - Should players be checked for this kind of cheating. If you are not - interested in players that cheat that way, set this to false. It is a - good idea to have this active, because players that cheat by sending - more packets than normally allowed may lag the server (each of those - packets has to be processed, after all). - - actions: - What should happen if a player is considered to be cheating by taking - more steps per second than normal. Default is to log messages and - teleport the player back to a location where he was ~1 second before - ("cancel" his movement). The Violation Level VL is the number of - packets that the player sent beyond the expected amount - - ----------------------------- BLOCKBREAK Subsection ----------------------------- - - Checks that at least technically have to do with the player breaking blocks. - - 1) REACH: - - Players may slightly increase the distance at which they can break - blocks. This check will try to identify that by comparing player and - block location. - - active: - Should players be checked for this behaviour. - - actions: - What should happen if the player is considered to cheat this way. The - default is to prevent him from breaking the block ("cancel" breaking) - and on repeated offenses to log messages about it. The Violation Level - (VL) is the distance in Blocks between the reach distance that NoCheat - allowed and what the player actually tried to use. The VL increases - with every failed attempt to break a block out of reach, and decreases - with every successful attempt. - - 2) DIRECTION: - - Players may break blocks without really looking at them. This is often - combined with breaking a lot of blocks surrounding the player at the same - time. - - active: - Should players get checked for this type of hack - - precision: - How strict should NoCheat be when comparing the players line of view - with the broken block location. The value represents (roughly) the - amount of 1/100 blocks that the player is allowed to look past the to - be broken block. 50 (0.5 blocks) seems a good default value. - - penaltytime: - If a player fails this check, how long should he be prevented from - breaking blocks afterwards, in milliseconds. This is intended to make - automated destruction of blocks harder. 0.3 seconds (value 300) is the - default. Set to 0, if you don't want to limit players at all after - failing this check. - - actions: - What should happen if a player fails this check. Default is to prevent - the breaking of the block ("cancel" it) and after repeated/more severe - offenses to log a message. The Violation Level (VL) for this check is - the distance in Blocks between the line of view of the player and the - block. It increases with every failure and decreases with every - successful block break. - - 3) NOSWING: - - Players may break blocks without moving their arm. This is confusing for - nearby players, as they won't see who broke the blocks. - - active: - Should players get checked for this type of hack - - actions: - What should happen if the player didn't swing his arm first? Default is - to log a message and prevent the breaking of the block ("cancel" it). - The Violation Level (VL) is the number of block-break attempts without - first swinging the arm. It increases with every failed attempt by 1 and - decreases with every successful attempt slowly. - - ----------------------------- BLOCKPLACE Subsection ----------------------------- - - Checks that at least technically have to do with the player placing blocks. - - 1) REACH: - - Players may slightly increase the distance at which they can place - blocks. This check will try to identify that by comparing player and - block location. - - active: - Should players be checked for this behaviour. - - actions: - What should happen if the player is considered to cheat this way. The - default is to prevent him from placing the block ("cancel" placing) - and on repeated offenses to log messages about it. The Violation Level - (VL) is the distance in Blocks between the reach distance that NoCheat - allowed and what the player actually tried to use. The VL increases - with every failed attempt to place a block out of reach, and decreases - with every successful attempt. - - 2) DIRECTION: - - Players may place blocks without really looking at them. This is often - combined with placing a lot of blocks in a certain shape. - - active: - Should players get checked for this type of hack - - precision: - How strict should NoCheat be when comparing the players line of view - with the placed block location. The value represents (roughly) the - amount of 1/100 blocks that the player is allowed to look past the to - be placed block. 75 (0.75 blocks) seems a good default value. - - penaltytime: - If a player fails this check, how long should he be prevented from - placing blocks afterwards, in milliseconds. This is intended to make - automated placing of blocks harder. 0.1 second (value 100) is the - default. Set to 0, if you don't want to limit players at all after - failing this check. - - actions: - What should happen if a player fails this check. Default is to prevent - the placing of the block ("cancel" it) and after repeated/more severe - offenses to log a message. The Violation Level (VL) for this check is - the distance in Blocks between the line of view of the player and the - block. It increases with every failure and decreases with every - successful block placement. - - -------------------------------- CHAT Subsection -------------------------------- - - Checks that at least technically have to do with chat or commands. - - 1) COLOR: - - Players may use color-codes to send colored messages. This may be used - to fool other players into believing they are admins or similar. - - active: - Should player messages get checked for the use of color codes. - - actions: - What should be done if a player sends messages with color codes. - Default is to log a message and prevent ("cancel") the use of the - color codes, by filtering them from the message. The message itself - will still be transmitted. The Violation Level (VL) for this check is - the number of messages that contained color codes. It increases with - each color-code message by 1 and decreases slowly with colorless - messages. - - 2) SPAM: - - Players may send a ton of messages/commands in a short time to cause - lag or even crash a server. - - active: - Should player messages get checked for sending of too many messages. - - whitelist: - A " " (whitespace) separated list of words. Messages that start with - these sequences will not be counted. This is ideal to exempt commands - from getting filtered, by e.g. adding "/help" to the list. - - timeframe: - For how many seconds should messages and commands be counted, before - the counters get reset and counting starts at zero again. - - messagelimit: - How many "normal" chat messages may be sent within the timeframe. All - messages that don't start with "/" are considered "normal". - - commandlimit: - How many commands may be issued within the timeframe. Some mods (e.g. - TooManyItems) send a command on every mouse-click, which may cause - problems if this is set too low. So choose wisely. Every message that - starts with "/" is considered a command, even if the command doesn't - exist. - - actions: - What should happen if players send more messages/commands than declared - by the above limits? Default is to prevent the message/command from - being processed ("cancel" them) and for severe cases where players send - a lot of messages/commands, kick them. The Violation Level (VL) is the - number of messages/commands that were sent beyond the specified limits. - It gets increased for every message/command by 1 and reset to zero when - the "timeframe" has passed. - - ------------------------------- FIGHT Subsection -------------------------------- - - Checks that at least technically have to do with direct combat. - - 1) DIRECTION: - - Players may attack other players and creatures without really looking at - them. This is often combined with automatically attacking every living - thing within reach ("kill-aura"). This check will check if the attacker - looks at his target. - - active: - Should players get checked for this type of hack - - precision: - How strict should NoCheat be when comparing the players line of view - with the his target's location. The value represents (roughly) the - amount of 1/100 blocks that the player is allowed to look past the to - be attacked entity. 75 (0.75 blocks) seems a good default value. - - penaltytime: - If a player fails this check, how long should he be prevented from - attacking stuff afterwards, in milliseconds. This is intended to make - automated attacking of enemies harder. 0.5 second (value 500) is the - default. Set to 0, if you don't want to limit players at all after - failing this check. - - actions: - What should happen if a player fails this check. Default is to prevent - the attack from happening ("cancel" it) and after repeated/more severe - offenses to log a message. The Violation Level (VL) for this check is - the distance in Blocks between the line of view of the player and the - target. It increases with every failure and decreases with every - successful attack. - - 2) NOSWING: - - Players may attack entities without moving their arm. This is confusing - for nearby players, as they won't see who is attacking them or the nearby - creatures. - - active: - Should players get checked for this type of hack - - actions: - What should happen if the player didn't swing his arm first? Default is - to log a message and prevent the attack from happening ("cancel" it). - The Violation Level (VL) is the number of attacking attempts without - first swinging the arm. It increases with every failed attempt by 1 and - decreases with every successful attempt slowly. - - 3) REACH: - - Players may slightly increase the distance at which they can attack enemy - creatures/players. This check will try to identify that by comparing - player and target location. - - active: - Should players be checked for this behaviour. - - distance: - How far can the enemy be away from the attacker, in 1/100 Blocks. The - default value of 400, which is 4.00 blocks seems to work fine most of - the time. Increase if you get to many false positives to e.g. 425 or - 450. - - penaltytime: - If a player fails this check, how long should he be prevented from - attacking stuff afterwards, in milliseconds. This is intended to make - automated attacking of enemies harder. 0.5 second (value 500) is the - default. Set to 0, if you don't want to limit players at all after - failing this check. - - actions: - What should happen if the player is considered to cheat this way. The - default is to prevent him from attacking the target ("cancel" attack) - and on repeated offenses to log messages about it. The Violation Level - (VL) is the distance in Blocks between the reach distance that NoCheat - allowed and what the player actually tried to use. The VL increases - with every failed attempt to attack enemies out of reach, and decreases - with every successful attempt. - - 4) SPEED: - - Players may be attacking extremely fast within a short time by using - automated clicking or hacks. This is an advantage in many situations. - - active: - Should players be checked for this behavior. - - attacklimit: - How many attacks may a player start within 1 second. Consider setting - this to a value that's close to how fast you believe players can click - their mouse. The default is 15 per second. - - actions: - What should happen if the player fails this check. Default is to stop - the attack ("cancel" it) and log messages. The Violation Level (VL) is - the number of attacks beyond the set limit. For each failed check it - is increased by 1 and it gets decreased for every successful attack. - - 5) GODMODE: - - Players may trick Bukkit into not dealing them damage when they get - attacked. This will try to identify and correct that behavior. - - active: - Should players be checked for this behavior. - - actions: - What should happen if the player fails this check. Default is to make - him vulnerable to the attack ("cancel" his "godmode") and log messages. - The Violation Level (VL) for this check is the number of ticks that the - player seemingly tried to stay invulnerable. A second has 20 ticks. - Every time the player fails the check, the VL gets increased by the - amount of ticks (but at most 15 per failed check), and everytime the - player didn't avoid taking damage it gets reduced slowly. - - 6) INSTANTHEAL: - - Players may trick Bukkit into regenerating their health faster when they - are satiated (full food bar) than normally possible. This will try to - identify and correct that behaviour. - - active: - Should players be checked for this behavior. - - actions: - What should happen if the player fails this check. Default is to not - allow the health regeneration ("cancel" the regeneration) and log a - message. The Violation LEvel (VL) for this check is the number of - seconds that the player tried to skip while regenerating health. It - gets reduced whenever the player regenerates health while obeying the - normal regeneration times. - - --------------------------------------------------------------------------------- -------------------------------- STRINGS Section -------------------------------- --------------------------------------------------------------------------------- - - This is the section that defines various strings for "log" or "cmd" actions. - Each has a name (the part in front of ":") and a definition (the part behind - the ":"). Whenever you use a "log" or "cmd" action in one of the "actions: " - options of this config file, the string will be taken from this section. - Arbitrary many additional strings may be defined here, or existing strings - may be changed. - - Most messages/commands use place-holders in [ ], which will be replaced at - runtime with relevant information. Some of these may only be available in - certain circumstances, only "[player]" can be used everywhere, especially - in "cmd" actions. - - -################################################################################ -# # -# Other noteworthy stuff, DONATIONS # -# # -################################################################################ - - -- NoCheat isn't perfect and won't prevent all forms of cheating. It's a best - effort approach. - -- NoCheat may make mistakes. Don't see everything NoCheat says or does as - indisputable fact that somebody cheated. It's not possible to be 100% sure - if somebody is cheating or not, NoCheat will try to be right most of the - time. - -Thank you for reading this file. It took hours to write it, so it's nice that -people actually take a look at it. ;) diff --git a/EssentialsAntiCheat/README.txt b/EssentialsAntiCheat/README.txt deleted file mode 100644 index 73ad6d1e9..000000000 --- a/EssentialsAntiCheat/README.txt +++ /dev/null @@ -1,9 +0,0 @@ -Copyright (c) 2012 Wilfried Pasquazzo (Evenprime) -<wilfried.pasquazzo@gmail.com> - -# Dual-Licensed - you may freely choose between (or use both): -# -# 1) GPL v3 (see LICENSE_GPL3.txt) -# 2) MIT (see LICENSE_MIT.txt) -# -#
\ No newline at end of file diff --git a/EssentialsAntiCheat/pom.xml b/EssentialsAntiCheat/pom.xml deleted file mode 100644 index f80fa4656..000000000 --- a/EssentialsAntiCheat/pom.xml +++ /dev/null @@ -1,21 +0,0 @@ - -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - - <parent> - <groupId>net.essentials3</groupId> - <artifactId>BuildAll</artifactId> - <version>3.0-SNAPSHOT</version> - <relativePath>../pom.xml</relativePath> - </parent> - - <artifactId>EssentialsAntiCheat</artifactId> - <dependencies> - <dependency> - <groupId>org.bukkit</groupId> - <artifactId>craftbukkit</artifactId> - <version>${bukkitversion}</version> - </dependency> - </dependencies> -</project> diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/Colors.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/Colors.java deleted file mode 100644 index 053b177e5..000000000 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/Colors.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.earth2me.essentials.anticheat; - -import org.bukkit.ChatColor; - - -/** - * Manages color codes in NoCheat - * - */ -public class Colors -{ - /** - * Replace instances of &X with a color - * - * @param text - * @return - */ - public static String replaceColors(String text) - { - for (ChatColor c : ChatColor.values()) - { - text = text.replace("&" + c.getChar(), c.toString()); - } - - return text; - } - - /** - * Remove instances of &X - * - * @param text - * @return - */ - public static String removeColors(String text) - { - for (ChatColor c : ChatColor.values()) - { - text = text.replace("&" + c.getChar(), ""); - } - return text; - } -} diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/ConfigItem.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/ConfigItem.java deleted file mode 100644 index 5fc2e3290..000000000 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/ConfigItem.java +++ /dev/null @@ -1,6 +0,0 @@ -package com.earth2me.essentials.anticheat; - - -public interface ConfigItem -{ -} diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/DataItem.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/DataItem.java deleted file mode 100644 index e99314108..000000000 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/DataItem.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.earth2me.essentials.anticheat; - - -/** - * - * Every class that is extending this has to implement an empty Constructor() - * - */ -public interface DataItem -{ -} diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/EventManager.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/EventManager.java deleted file mode 100644 index 8bfb5da68..000000000 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/EventManager.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.earth2me.essentials.anticheat; - -import com.earth2me.essentials.anticheat.config.ConfigurationCacheStore; -import java.util.List; -import org.bukkit.event.Listener; - - -public interface EventManager extends Listener -{ - /** - * Used for debug output, if checks are activated for the world-specific config that is given as a parameter - * - * @param cc The config - * @return A list of active/enabled checks - */ - public List<String> getActiveChecks(ConfigurationCacheStore cc); -} diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/NoCheat.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/NoCheat.java deleted file mode 100644 index 666a04332..000000000 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/NoCheat.java +++ /dev/null @@ -1,233 +0,0 @@ -package com.earth2me.essentials.anticheat; - -import com.earth2me.essentials.anticheat.checks.WorkaroundsListener; -import com.earth2me.essentials.anticheat.checks.blockbreak.BlockBreakCheckListener; -import com.earth2me.essentials.anticheat.checks.blockplace.BlockPlaceCheckListener; -import com.earth2me.essentials.anticheat.checks.chat.ChatCheckListener; -import com.earth2me.essentials.anticheat.checks.fight.FightCheckListener; -import com.earth2me.essentials.anticheat.checks.inventory.InventoryCheckListener; -import com.earth2me.essentials.anticheat.checks.moving.MovingCheckListener; -import com.earth2me.essentials.anticheat.command.CommandHandler; -import com.earth2me.essentials.anticheat.config.ConfigurationCacheStore; -import com.earth2me.essentials.anticheat.config.ConfigurationManager; -import com.earth2me.essentials.anticheat.config.Permissions; -import com.earth2me.essentials.anticheat.data.PlayerManager; -import com.earth2me.essentials.anticheat.debug.ActiveCheckPrinter; -import com.earth2me.essentials.anticheat.debug.LagMeasureTask; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.logging.Logger; -import org.bukkit.Bukkit; -import org.bukkit.World; -import org.bukkit.command.Command; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.Listener; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.plugin.java.JavaPlugin; - - -/** - * - * NoCheat - * - * Check various player events for their plausibility and log/deny them/react to them based on configuration - */ -public class NoCheat extends JavaPlugin implements Listener -{ - private ConfigurationManager conf; - private CommandHandler commandHandler; - private PlayerManager players = new PlayerManager(this); - private List<EventManager> eventManagers = new ArrayList<EventManager>(); - private LagMeasureTask lagMeasureTask; - private Logger fileLogger; - - @Override - public void onDisable() - { - if (lagMeasureTask != null) - { - lagMeasureTask.cancel(); - } - - if (conf != null) - { - conf.cleanup(); - } - - // Just to be sure nothing gets left out - getServer().getScheduler().cancelTasks(this); - } - - @Override - public void onEnable() - { - commandHandler = new CommandHandler(this); - conf = new ConfigurationManager(this, getDataFolder()); - // Set up the event listeners - eventManagers.add(new MovingCheckListener(this)); - eventManagers.add(new WorkaroundsListener()); - eventManagers.add(new ChatCheckListener(this)); - eventManagers.add(new BlockBreakCheckListener(this)); - eventManagers.add(new BlockPlaceCheckListener(this)); - eventManagers.add(new FightCheckListener(this)); - eventManagers.add(new InventoryCheckListener(this)); - - // Then set up a task to monitor server lag - if (lagMeasureTask == null) - { - lagMeasureTask = new LagMeasureTask(this); - lagMeasureTask.start(); - } - - // Then print a list of active checks per world - ActiveCheckPrinter.printActiveChecks(this, eventManagers); - - // register all listeners - for (EventManager eventManager : eventManagers) - { - Bukkit.getPluginManager().registerEvents(eventManager, this); - } - - getServer().getPluginManager().registerEvents(this, this); - } - - public ConfigurationCacheStore getConfig(Player player) - { - if (player != null) - { - return getConfig(player.getWorld()); - } - else - { - return conf.getConfigurationCacheForWorld(null); - } - } - - public ConfigurationCacheStore getConfig(World world) - { - if (world != null) - { - return conf.getConfigurationCacheForWorld(world.getName()); - } - else - { - return conf.getConfigurationCacheForWorld(null); - } - } - - @Override - public boolean onCommand(CommandSender sender, Command command, String label, String[] args) - { - boolean result = commandHandler.handleCommand(this, sender, command, label, args); - - return result; - } - - public boolean skipCheck() - { - if (lagMeasureTask != null) - { - return lagMeasureTask.skipCheck(); - } - return false; - } - - public void reloadConfiguration() - { - conf.cleanup(); - this.conf = new ConfigurationManager(this, this.getDataFolder()); - players.cleanDataMap(); - } - - /** - * Call this periodically to walk over the stored data map and remove old/unused entries - * - */ - public void cleanDataMap() - { - players.cleanDataMap(); - } - - /** - * An interface method usable by other plugins to collect information about a player. It will include the plugin - * version, two timestamps (beginning and end of data collection for that player), and various data from checks) - * - * @param playerName a player name - * @return A newly created map of identifiers and corresponding values - */ - public Map<String, Object> getPlayerData(String playerName) - { - - Map<String, Object> map = players.getPlayerData(playerName); - map.put("nocheat.version", this.getDescription().getVersion()); - return map; - } - - public NoCheatPlayer getPlayer(Player player) - { - return players.getPlayer(player); - } - - @EventHandler(priority = EventPriority.MONITOR) - public void logEvent(NoCheatLogEvent event) - { - if (event.toConsole()) - { - // Console logs are not colored - getServer().getLogger().info(Colors.removeColors(event.getPrefix() + event.getMessage())); - } - if (event.toChat()) - { - for (Player player : Bukkit.getServer().getOnlinePlayers()) - { - if (player.hasPermission(Permissions.ADMIN_CHATLOG)) - { - // Chat logs are potentially colored - player.sendMessage(Colors.replaceColors(event.getPrefix() + event.getMessage())); - } - } - } - if (event.toFile()) - { - // File logs are not colored - fileLogger.info(Colors.removeColors(event.getMessage())); - } - } - - @EventHandler - public void onPlayerJoin(PlayerJoinEvent event) - { - Player p = event.getPlayer(); - String message = ""; - if (!p.hasPermission(Permissions.ZOMBES_FLY)) - { - message += "ยงf ยงf ยง1 ยง0 ยง2 ยง4"; // Zombes fly - } - if (!p.hasPermission(Permissions.ZOMBES_CHEAT)) - { - message += "ยงf ยงf ยง2 ยง0 ยง4 ยง8"; // Zombes cheat - } - if (!p.hasPermission(Permissions.CJB_FLY)) - { - message += "ยง3 ยง9 ยง2 ยง0 ยง0 ยง1"; // CJB fly - } - if (!p.hasPermission(Permissions.CJB_XRAY)) - { - message += "ยง3 ยง9 ยง2 ยง0 ยง0 ยง2"; // CJB xray - } - if (!p.hasPermission(Permissions.CJB_MINIMAP)) - { - message += "ยง3 ยง9 ยง2 ยง0 ยง0 ยง3"; // CJB minimap players - } - p.sendMessage(message); - } - - public void setFileLogger(Logger logger) - { - this.fileLogger = logger; - } -} diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/NoCheatLogEvent.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/NoCheatLogEvent.java deleted file mode 100644 index fe56f1572..000000000 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/NoCheatLogEvent.java +++ /dev/null @@ -1,83 +0,0 @@ -package com.earth2me.essentials.anticheat; - -import org.bukkit.event.Event; -import org.bukkit.event.HandlerList; - - -public class NoCheatLogEvent extends Event -{ - private static final HandlerList handlers = new HandlerList(); - private String message; - private String prefix; - private boolean toConsole, toChat, toFile; - - public NoCheatLogEvent(String prefix, String message, boolean toConsole, boolean toChat, boolean toFile) - { - this.prefix = prefix; - this.message = message; - this.toConsole = toConsole; - this.toChat = toChat; - this.toFile = toFile; - } - - public String getPrefix() - { - return prefix; - } - - public void setPrefix(String prefix) - { - this.prefix = prefix; - } - - public String getMessage() - { - return message; - } - - public void setMessage(String message) - { - this.message = message; - } - - public boolean toFile() - { - return toFile; - } - - public void setToFile(boolean toFile) - { - this.toFile = toFile; - } - - public boolean toChat() - { - return toChat; - } - - public void setToChat(boolean toChat) - { - this.toChat = toChat; - } - - public boolean toConsole() - { - return toConsole; - } - - public void setToConsole(boolean toConsole) - { - this.toConsole = toConsole; - } - - @Override - public HandlerList getHandlers() - { - return handlers; - } - - public static HandlerList getHandlerList() - { - return handlers; - } -} diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/NoCheatPlayer.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/NoCheatPlayer.java deleted file mode 100644 index bb8ee8a7a..000000000 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/NoCheatPlayer.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.earth2me.essentials.anticheat; - -import com.earth2me.essentials.anticheat.config.ConfigurationCacheStore; -import com.earth2me.essentials.anticheat.data.DataStore; -import com.earth2me.essentials.anticheat.data.ExecutionHistory; -import org.bukkit.entity.Player; - - -public interface NoCheatPlayer -{ - public boolean hasPermission(String permission); - - public String getName(); - - public Player getPlayer(); - - public DataStore getDataStore(); - - public boolean isDead(); - - public boolean isSprinting(); - - public int getTicksLived(); - - public ConfigurationCacheStore getConfigurationStore(); - - public float getSpeedAmplifier(); - - public float getJumpAmplifier(); - - public boolean isCreative(); - - public ExecutionHistory getExecutionHistory(); - - public void dealFallDamage(); -} diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/actions/Action.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/actions/Action.java deleted file mode 100644 index aa72472ff..000000000 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/actions/Action.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.earth2me.essentials.anticheat.actions; - - -/** - * An action gets executed as the result of a failed check. If it 'really' gets executed depends on how many executions - * have occurred within the last 60 seconds and how much time was between this and the previous execution - * - */ -public abstract class Action -{ - /** - * Delay in violations. An "ExecutionHistory" will use this info to make sure that there were at least "delay" - * attempts to execute this action before it really gets executed. - */ - public final int delay; - /** - * Repeat only every "repeat" seconds. An "ExecutionHistory" will use this info to make sure that there were at - * least "repeat" seconds between the last execution of this action and this execution. - */ - public final int repeat; - /** - * The name of the action, to identify it, e.g. in the config file - */ - public final String name; - - public Action(String name, int delay, int repeat) - { - this.name = name; - this.delay = delay; - this.repeat = repeat; - } -} diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/actions/ParameterName.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/actions/ParameterName.java deleted file mode 100644 index 6f2b2181e..000000000 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/actions/ParameterName.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.earth2me.essentials.anticheat.actions; - - -/** - * Some wildcards that are used in commands and log messages - */ -public enum ParameterName -{ - PLAYER("player"), LOCATION("location"), WORLD("world"), - VIOLATIONS("violations"), MOVEDISTANCE("movedistance"), - REACHDISTANCE("reachdistance"), FALLDISTANCE("falldistance"), - LOCATION_TO("locationto"), CHECK("check"), PACKETS("packets"), - TEXT("text"), PLACE_LOCATION("placelocation"), - PLACE_AGAINST("placeagainst"), BLOCK_TYPE("blocktype"), LIMIT("limit"), - FOOD("food"), SERVERS("servers"); - private final String s; - - private ParameterName(String s) - { - this.s = s; - } - - public static ParameterName get(String s) - { - for (ParameterName c : ParameterName.values()) - { - if (c.s.equals(s)) - { - return c; - } - } - - return null; - } -} diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/actions/types/ActionList.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/actions/types/ActionList.java deleted file mode 100644 index 25a7ba296..000000000 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/actions/types/ActionList.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.earth2me.essentials.anticheat.actions.types; - -import com.earth2me.essentials.anticheat.actions.Action; -import java.util.*; - - -/** - * A list of actions, that associates actions to tresholds. It allows to retrieve all actions that match a certain - * treshold - * - */ -public class ActionList -{ - // This is a very bad design decision, but it's also really - // convenient to define this here - public final String permissionSilent; - - public ActionList(String permission) - { - this.permissionSilent = permission + ".silent"; - } - // If there are no actions registered, we still return an Array. It's - // just empty/size=0 - private final static Action[] emptyArray = new Action[0]; - // The actions of this ActionList, "bundled" by treshold (violation level) - private final Map<Integer, Action[]> actions = new HashMap<Integer, Action[]>(); - // The tresholds of this list - private final List<Integer> tresholds = new ArrayList<Integer>(); - - /** - * Add an entry to this actionList. The list will be sorted by tresholds automatically after the insertion. - * - * @param treshold The minimum violation level a player needs to have to be suspected to the given actions - * @param actions The actions that will be used if the player reached the accompanying treshold/violation level - */ - public void setActions(Integer treshold, Action[] actions) - { - - if (!this.tresholds.contains(treshold)) - { - this.tresholds.add(treshold); - Collections.sort(this.tresholds); - } - - this.actions.put(treshold, actions); - } - - /** - * Get a list of actions that match the violation level. The only method that has to be called by a check - * - * @param violationLevel The violation level that should be matched. - * @return The array of actions whose treshold was closest to the violationLevel but not bigger - */ - public Action[] getActions(double violationLevel) - { - - Integer result = null; - - for (Integer treshold : tresholds) - { - if (treshold <= violationLevel) - { - result = treshold; - } - } - - if (result != null) - { - return actions.get(result); - } - else - { - return emptyArray; - } - } - - /** - * Get a sorted list of the tresholds/violation levels that were used in this list - * - * @return The sorted list of tresholds - */ - public List<Integer> getTresholds() - { - return tresholds; - } -} diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/actions/types/ActionWithParameters.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/actions/types/ActionWithParameters.java deleted file mode 100644 index c07d20198..000000000 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/actions/types/ActionWithParameters.java +++ /dev/null @@ -1,94 +0,0 @@ -package com.earth2me.essentials.anticheat.actions.types; - -import com.earth2me.essentials.anticheat.NoCheatPlayer; -import com.earth2me.essentials.anticheat.actions.Action; -import com.earth2me.essentials.anticheat.actions.ParameterName; -import com.earth2me.essentials.anticheat.checks.Check; -import java.util.ArrayList; - - -/** - * Action with parameters is used to - * - */ -public abstract class ActionWithParameters extends Action -{ - private final ArrayList<Object> messageParts; - - public ActionWithParameters(String name, int delay, int repeat, String message) - { - super(name, delay, repeat); - - messageParts = new ArrayList<Object>(); - - parseMessage(message); - } - - private void parseMessage(String message) - { - String parts[] = message.split("\\[", 2); - - // No opening braces left - if (parts.length != 2) - { - messageParts.add(message); - } - // Found an opening brace - else - { - String parts2[] = parts[1].split("\\]", 2); - - // Found no matching closing brace - if (parts2.length != 2) - { - messageParts.add(message); - } - // Found a matching closing brace - else - { - ParameterName w = ParameterName.get(parts2[0]); - - if (w != null) - { - // Found an existing wildcard inbetween the braces - messageParts.add(parts[0]); - messageParts.add(w); - - // Go further down recursive - parseMessage(parts2[1]); - } - else - { - messageParts.add(message); - } - } - } - } - - /** - * Get a string with all the wildcards replaced with data from LogData - * - * @param data - * @return - */ - protected String getMessage(NoCheatPlayer player, Check check) - { - - StringBuilder log = new StringBuilder(100); // Should be big enough most - // of the time - - for (Object part : messageParts) - { - if (part instanceof String) - { - log.append((String)part); - } - else - { - log.append(check.getParameter((ParameterName)part, player)); - } - } - - return log.toString(); - } -} diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/actions/types/ConsolecommandAction.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/actions/types/ConsolecommandAction.java deleted file mode 100644 index 5af889c16..000000000 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/actions/types/ConsolecommandAction.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.earth2me.essentials.anticheat.actions.types; - -import com.earth2me.essentials.anticheat.NoCheatPlayer; -import com.earth2me.essentials.anticheat.checks.Check; - - -/** - * Execute a command by imitating an admin typing the command directly into the console - * - */ -public class ConsolecommandAction extends ActionWithParameters -{ - public ConsolecommandAction(String name, int delay, int repeat, String command) - { - // Log messages may have color codes now - super(name, delay, repeat, command); - } - - /** - * Fill in the placeholders ( stuff that looks like '[something]') with information, make a nice String out of it - * that can be directly used as a command in the console. - * - * @param player The player that is used to fill in missing data - * @param check The check that is used to fill in missing data - * @return The complete, ready to use, command - */ - public String getCommand(NoCheatPlayer player, Check check) - { - return super.getMessage(player, check); - } - - /** - * Convert the commands data into a string that can be used in the config files - */ - public String toString() - { - return "cmd:" + name + ":" + delay + ":" + repeat; - } -} diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/actions/types/DummyAction.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/actions/types/DummyAction.java deleted file mode 100644 index d89372144..000000000 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/actions/types/DummyAction.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.earth2me.essentials.anticheat.actions.types; - -import com.earth2me.essentials.anticheat.actions.Action; - - -/** - * If an action can't be parsed correctly, at least keep it stored in this form to not lose it when loading/storing the - * config file - * - */ -public class DummyAction extends Action -{ - // The original string used for this action definition - private final String def; - - public DummyAction(String def) - { - super("dummyAction", 10000, 10000); - this.def = def; - } - - public String toString() - { - return def; - } -} diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/actions/types/LogAction.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/actions/types/LogAction.java deleted file mode 100644 index 16830b8d7..000000000 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/actions/types/LogAction.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.earth2me.essentials.anticheat.actions.types; - -import com.earth2me.essentials.anticheat.NoCheatPlayer; -import com.earth2me.essentials.anticheat.checks.Check; - - -/** - * Print a log message to various locations - * - */ -public class LogAction extends ActionWithParameters -{ - // Some flags to decide where the log message should show up, based on - // the config file - private final boolean toChat; - private final boolean toConsole; - private final boolean toFile; - - public LogAction(String name, int delay, int repeat, boolean toChat, boolean toConsole, boolean toFile, String message) - { - super(name, delay, repeat, message); - this.toChat = toChat; - this.toConsole = toConsole; - this.toFile = toFile; - } - - /** - * Parse the final log message out of various data from the player and check that triggered the action. - * - * @param player The player that is used as a source for the log message - * @param check The check that is used as a source for the log message - * @return - */ - public String getLogMessage(NoCheatPlayer player, Check check) - { - return super.getMessage(player, check); - } - - /** - * Should the message be shown in chat? - * - * @return true, if yes - */ - public boolean toChat() - { - return toChat; - } - - /** - * Should the message be shown in the console? - * - * @return true, if yes - */ - public boolean toConsole() - { - return toConsole; - } - - /** - * Should the message be written to the logfile? - * - * @return true, if yes - */ - public boolean toFile() - { - return toFile; - } - - /** - * Create the string that's used to define the action in the logfile - */ - public String toString() - { - return "log:" + name + ":" + delay + ":" + repeat + ":" + (toConsole ? "c" : "") + (toChat ? "i" : "") + (toFile ? "f" : ""); - } -} diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/actions/types/SpecialAction.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/actions/types/SpecialAction.java deleted file mode 100644 index 5e4a93b3d..000000000 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/actions/types/SpecialAction.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.earth2me.essentials.anticheat.actions.types; - -import com.earth2me.essentials.anticheat.actions.Action; - - -/** - * Do something check-specific. Usually that is to cancel the event, undo something the player did, or do something the - * server should've done - * - */ -public class SpecialAction extends Action -{ - public SpecialAction() - { - super("cancel", 0, 0); - } - - public String toString() - { - return "cancel"; - } -} diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/Check.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/Check.java deleted file mode 100644 index 5482efa5a..000000000 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/Check.java +++ /dev/null @@ -1,159 +0,0 @@ -package com.earth2me.essentials.anticheat.checks; - -import com.earth2me.essentials.anticheat.NoCheat; -import com.earth2me.essentials.anticheat.NoCheatLogEvent; -import com.earth2me.essentials.anticheat.NoCheatPlayer; -import com.earth2me.essentials.anticheat.actions.Action; -import com.earth2me.essentials.anticheat.actions.ParameterName; -import com.earth2me.essentials.anticheat.actions.types.*; -import com.earth2me.essentials.anticheat.config.ConfigurationCacheStore; -import com.earth2me.essentials.anticheat.data.Statistics.Id; -import java.util.Locale; -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.command.CommandException; - - -/** - * The abstract Check class, providing some basic functionality - * - */ -public abstract class Check -{ - private final String name; - // used to bundle information of multiple checks - private final String groupId; - protected final NoCheat plugin; - - public Check(NoCheat plugin, String groupId, String name) - { - this.plugin = plugin; - this.groupId = groupId; - this.name = name; - } - - /** - * Execute some actions for the specified player - * - * @param player - * @param actions - * @return - */ - protected final boolean executeActions(NoCheatPlayer player, ActionList actionList, double violationLevel) - { - - boolean special = false; - - // Get the to be executed actions - Action[] actions = actionList.getActions(violationLevel); - - final long time = System.currentTimeMillis() / 1000L; - - // The configuration will be needed too - final ConfigurationCacheStore cc = player.getConfigurationStore(); - - for (Action ac : actions) - { - if (player.getExecutionHistory().executeAction(groupId, ac, time)) - { - // The executionHistory said it really is time to execute the - // action, find out what it is and do what is needed - if (ac instanceof LogAction && !player.hasPermission(actionList.permissionSilent)) - { - executeLogAction((LogAction)ac, this, player, cc); - } - else if (ac instanceof SpecialAction) - { - special = true; - } - else if (ac instanceof ConsolecommandAction) - { - executeConsoleCommand((ConsolecommandAction)ac, this, player, cc); - } - else if (ac instanceof DummyAction) - { - // nothing - it's a "DummyAction" after all - } - } - } - - return special; - } - - /** - * Collect information about the players violations - * - * @param player - * @param id - * @param vl - */ - protected void incrementStatistics(NoCheatPlayer player, Id id, double vl) - { - player.getDataStore().getStatistics().increment(id, vl); - } - - private final void executeLogAction(LogAction l, Check check, NoCheatPlayer player, ConfigurationCacheStore cc) - { - - if (!cc.logging.active) - { - return; - } - - // Fire one of our custom "Log" Events - Bukkit.getServer().getPluginManager().callEvent(new NoCheatLogEvent(cc.logging.prefix, l.getLogMessage(player, check), cc.logging.toConsole && l.toConsole(), cc.logging.toChat && l.toChat(), cc.logging.toFile && l.toFile())); - } - - private final void executeConsoleCommand(ConsolecommandAction action, Check check, NoCheatPlayer player, ConfigurationCacheStore cc) - { - final String command = action.getCommand(player, check); - - try - { - plugin.getServer().dispatchCommand(Bukkit.getConsoleSender(), command); - } - catch (CommandException e) - { - plugin.getLogger().warning("failed to execute the command '" + command + "': " + e.getMessage() + ", please check if everything is setup correct."); - } - catch (Exception e) - { - // I don't care in this case, your problem if your command fails - } - } - - /** - * Replace a parameter for commands or log actions with an actual value. Individual checks should override this to - * get their own parameters handled too. - * - * @param wildcard - * @param player - * @return - */ - public String getParameter(ParameterName wildcard, NoCheatPlayer player) - { - - if (wildcard == ParameterName.PLAYER) - { - return player.getName(); - } - else if (wildcard == ParameterName.CHECK) - { - return name; - } - else if (wildcard == ParameterName.LOCATION) - { - Location l = player.getPlayer().getLocation(); - return String.format(Locale.US, "%.2f,%.2f,%.2f", l.getX(), l.getY(), l.getZ()); - } - else if (wildcard == ParameterName.WORLD) - { - return player.getPlayer().getWorld().getName(); - } - else - { - return "the Author was lazy and forgot to define " + wildcard + "."; - } - - } -} diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/CheckUtil.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/CheckUtil.java deleted file mode 100644 index 390d2207d..000000000 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/CheckUtil.java +++ /dev/null @@ -1,372 +0,0 @@ -package com.earth2me.essentials.anticheat.checks; - -import com.earth2me.essentials.anticheat.NoCheatPlayer; -import com.earth2me.essentials.anticheat.data.PreciseLocation; -import java.util.HashSet; -import java.util.Set; -import net.minecraft.server.Block; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.World; -import org.bukkit.inventory.ItemStack; -import org.bukkit.util.Vector; - - -/** - * Some stuff that's used by different checks or just too complex to keep in other places - * - */ -public class CheckUtil -{ - /** - * Check if a player looks at a target of a specific size, with a specific precision value (roughly) - */ - public static double directionCheck(final NoCheatPlayer player, final double targetX, final double targetY, final double targetZ, final double targetWidth, final double targetHeight, final double precision) - { - - // Eye location of the player - final Location eyes = player.getPlayer().getEyeLocation(); - - final double factor = Math.sqrt(Math.pow(eyes.getX() - targetX, 2) + Math.pow(eyes.getY() - targetY, 2) + Math.pow(eyes.getZ() - targetZ, 2)); - - // View direction of the player - final Vector direction = eyes.getDirection(); - - final double x = targetX - eyes.getX(); - final double y = targetY - eyes.getY(); - final double z = targetZ - eyes.getZ(); - - final double xPrediction = factor * direction.getX(); - final double yPrediction = factor * direction.getY(); - final double zPrediction = factor * direction.getZ(); - - double off = 0.0D; - - off += Math.max(Math.abs(x - xPrediction) - (targetWidth / 2 + precision), 0.0D); - off += Math.max(Math.abs(z - zPrediction) - (targetWidth / 2 + precision), 0.0D); - off += Math.max(Math.abs(y - yPrediction) - (targetHeight / 2 + precision), 0.0D); - - if (off > 1) - { - off = Math.sqrt(off); - } - - return off; - } - - /** - * Check if a player is close enough to a target, based on his eye location - * - * @param player - * @param targetX - * @param targetY - * @param targetZ - * @param limit - * @return - */ - public static final double reachCheck(final NoCheatPlayer player, final double targetX, final double targetY, final double targetZ, final double limit) - { - - final Location eyes = player.getPlayer().getEyeLocation(); - - final double distance = Math.sqrt(Math.pow(eyes.getX() - targetX, 2) + Math.pow(eyes.getY() - targetY, 2) + Math.pow(eyes.getZ() - targetZ, 2)); - - return Math.max(distance - limit, 0.0D); - } - private final static double magic = 0.45D; - private final static double magic2 = 0.55D; - private static final int NONSOLID = 1; // 0x00000001 - private static final int SOLID = 2; // 0x00000010 - // All liquids are "nonsolid" too - private static final int LIQUID = 4 | NONSOLID; // 0x00000101 - // All ladders are "nonsolid" and "solid" too - private static final int LADDER = 8 | NONSOLID | SOLID; // 0x00001011 - // All fences are solid - fences are treated specially due - // to being 1.5 blocks high - private static final int FENCE = 16 | SOLID | NONSOLID; // 0x00010011 - private static final int INGROUND = 128; - private static final int ONGROUND = 256; - // Until I can think of a better way to determine if a block is solid or - // not, this is what I'll do - private static final int types[]; - private static final Set<Material> foods = new HashSet<Material>(); - - static - { - types = new int[256]; - - // Find and define properties of all other blocks - for (int i = 0; i < types.length; i++) - { - - // Everything unknown is considered nonsolid and solid - types[i] = NONSOLID | SOLID; - - if (Block.byId[i] != null) - { - if (Block.byId[i].material.isSolid()) - { - // STONE, CAKE, LEAFS, ... - types[i] = SOLID; - } - else if (Block.byId[i].material.isLiquid()) - { - // WATER, LAVA, ... - types[i] = LIQUID; - } - else - { - // AIR, SAPLINGS, ... - types[i] = NONSOLID; - } - } - } - - // Some exceptions where the above method fails - - // du'h - types[Material.AIR.getId()] = NONSOLID; - - // Webs slow down a players fall extremely, so it makes - // sense to treat them as optionally solid - types[Material.WEB.getId()] = SOLID | NONSOLID; - - // Obvious - types[Material.LADDER.getId()] = LADDER; - types[Material.WATER_LILY.getId()] = LADDER; - types[Material.VINE.getId()] = LADDER; - - types[Material.FENCE.getId()] = FENCE; - types[Material.FENCE_GATE.getId()] = FENCE; - types[Material.NETHER_FENCE.getId()] = FENCE; - - // These are sometimes solid, sometimes not - types[Material.IRON_FENCE.getId()] = SOLID | NONSOLID; - types[Material.THIN_GLASS.getId()] = SOLID | NONSOLID; - - // Signs are NOT solid, despite the game claiming they are - types[Material.WALL_SIGN.getId()] = NONSOLID; - types[Material.SIGN_POST.getId()] = NONSOLID; - - // (trap)doors can be solid or not - types[Material.WOODEN_DOOR.getId()] = SOLID | NONSOLID; - types[Material.IRON_DOOR_BLOCK.getId()] = SOLID | NONSOLID; - types[Material.TRAP_DOOR.getId()] = SOLID | NONSOLID; - - // repeaters are technically half blocks - types[Material.DIODE_BLOCK_OFF.getId()] = SOLID | NONSOLID; - types[Material.DIODE_BLOCK_ON.getId()] = SOLID | NONSOLID; - - // pressure plates are so slim, you can consider them - // nonsolid too - types[Material.STONE_PLATE.getId()] = SOLID | NONSOLID; - types[Material.WOOD_PLATE.getId()] = SOLID | NONSOLID; - - // We need to know what is considered food for the instanteat check - foods.add(Material.APPLE); - foods.add(Material.BREAD); - foods.add(Material.COOKED_BEEF); - foods.add(Material.COOKED_CHICKEN); - foods.add(Material.COOKED_FISH); - foods.add(Material.COOKIE); - foods.add(Material.GOLDEN_APPLE); - foods.add(Material.GRILLED_PORK); - foods.add(Material.MELON); - foods.add(Material.MUSHROOM_SOUP); - foods.add(Material.PORK); - foods.add(Material.RAW_BEEF); - foods.add(Material.RAW_CHICKEN); - foods.add(Material.RAW_FISH); - foods.add(Material.ROTTEN_FLESH); - foods.add(Material.SPIDER_EYE); - } - - /** - * Ask NoCheat what it thinks about a certain location. Is it a place where a player can safely stand, should it be - * considered as being inside a liquid etc. - * - * @param world The world the coordinates belong to - * @param location The precise location in the world - * - * @return - */ - public static final int evaluateLocation(final World world, final PreciseLocation location) - { - - final int lowerX = lowerBorder(location.x); - final int upperX = upperBorder(location.x); - final int Y = (int)location.y; - final int lowerZ = lowerBorder(location.z); - final int upperZ = upperBorder(location.z); - - // Check the four borders of the players hitbox for something he could - // be standing on, and combine the results - int result = 0; - - result |= evaluateSimpleLocation(world, lowerX, Y, lowerZ); - result |= evaluateSimpleLocation(world, upperX, Y, lowerZ); - result |= evaluateSimpleLocation(world, upperX, Y, upperZ); - result |= evaluateSimpleLocation(world, lowerX, Y, upperZ); - - if (!isInGround(result)) - { - // Original location: X, Z (allow standing in walls this time) - if (isSolid(types[world.getBlockTypeIdAt(Location.locToBlock(location.x), Location.locToBlock(location.y), Location.locToBlock(location.z))])) - { - result |= INGROUND; - } - } - - return result; - } - - /** - * Evaluate a location by only looking at a specific "column" of the map to find out if that "column" would allow a - * player to stand, swim etc. there - * - * @param world - * @param x - * @param y - * @param z - * @return Returns INGROUND, ONGROUND, LIQUID, combination of the three or 0 - */ - private static final int evaluateSimpleLocation(final World world, final int x, final int y, final int z) - { - - // First we need to know about the block itself, the block - // below it and the block above it - final int top = types[world.getBlockTypeIdAt(x, y + 1, z)]; - final int base = types[world.getBlockTypeIdAt(x, y, z)]; - final int below = types[world.getBlockTypeIdAt(x, y - 1, z)]; - - int type = 0; - // Special case: Standing on a fence - // Behave as if there is a block on top of the fence - if ((below == FENCE) && base != FENCE && isNonSolid(top)) - { - type = INGROUND; - } - // Special case: Fence - // Being a bit above a fence - else if (below != FENCE && isNonSolid(base) && types[world.getBlockTypeIdAt(x, y - 2, z)] == FENCE) - { - type = ONGROUND; - } - else if (isNonSolid(top)) - { - // Simplest (and most likely) case: - // Below the player is a solid block - if (isSolid(below) && isNonSolid(base)) - { - type = ONGROUND; - } - // Next (likely) case: - // There is a ladder - else if (isLadder(base) || isLadder(top)) - { - type = ONGROUND; - } - // Next (likely) case: - // At least the block the player stands - // in is solid - else if (isSolid(base)) - { - type = INGROUND; - } - } - - // (In every case, check for water) - if (isLiquid(base) || isLiquid(top)) - { - type |= LIQUID | INGROUND; - } - - return type; - } - - public static final boolean isSolid(final int value) - { - return (value & SOLID) == SOLID; - } - - public static final boolean isLiquid(final int value) - { - return (value & LIQUID) == LIQUID; - } - - private static final boolean isNonSolid(final int value) - { - return ((value & NONSOLID) == NONSOLID); - } - - private static final boolean isLadder(final int value) - { - return ((value & LADDER) == LADDER); - } - - public static final boolean isOnGround(final int fromType) - { - return (fromType & ONGROUND) == ONGROUND; - } - - public static final boolean isInGround(final int fromType) - { - return (fromType & INGROUND) == INGROUND; - } - - /** - * Personal Rounding function to determine if a player is still touching a block or not - * - * @param d1 - * @return - */ - private static final int lowerBorder(final double d1) - { - - final double floor = Math.floor(d1); - - if (floor + magic <= d1) - { - return (int)(floor); - } - else - { - return (int)(floor - 1); - } - } - - /** - * Personal Rounding function to determine if a player is still touching a block or not - * - * @param d1 - * @return - */ - private static final int upperBorder(final double d1) - { - - final double floor = Math.floor(d1); - - if (floor + magic2 < d1) - { - return (int)(floor + 1); - } - else - { - return (int)floor; - } - } - - public static int getType(final int typeId) - { - return types[typeId]; - } - - public static boolean isFood(ItemStack item) - { - if (item == null) - { - return false; - } - return foods.contains(item.getType()); - } -} diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/WorkaroundsListener.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/WorkaroundsListener.java deleted file mode 100644 index 7191c0c23..000000000 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/WorkaroundsListener.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.earth2me.essentials.anticheat.checks; - -import com.earth2me.essentials.anticheat.EventManager; -import com.earth2me.essentials.anticheat.config.ConfigurationCacheStore; -import java.util.Collections; -import java.util.List; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.Listener; -import org.bukkit.event.player.PlayerMoveEvent; -import org.bukkit.event.player.PlayerToggleSprintEvent; - - -/** - * Only place that listens to Player-teleport related events and dispatches them to relevant checks - * - */ -public class WorkaroundsListener implements Listener, EventManager -{ - public WorkaroundsListener() - { - } - - @EventHandler(priority = EventPriority.HIGHEST) - public void playerMove(final PlayerMoveEvent event) - { - // No typo here. I really only handle cancelled events and ignore others - if (!event.isCancelled()) - { - return; - } - - // Fix a common mistake that other developers make (cancelling move - // events is crazy, rather set the target location to the from location) - event.setCancelled(false); - event.setTo(event.getFrom().clone()); - } - - @EventHandler(priority = EventPriority.HIGHEST) - public void toggleSprint(final PlayerToggleSprintEvent event) - { - // Some plugins cancel "sprinting", which makes no sense at all because - // it doesn't stop people from sprinting and rewards them by reducing - // their hunger bar as if they were walking instead of sprinting - if (event.isCancelled() && event.isSprinting()) - { - event.setCancelled(false); - } - } - - public List<String> getActiveChecks(ConfigurationCacheStore cc) - { - return Collections.emptyList(); - } -} diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/blockbreak/BlockBreakCheck.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/blockbreak/BlockBreakCheck.java deleted file mode 100644 index 6e349c85c..000000000 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/blockbreak/BlockBreakCheck.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.earth2me.essentials.anticheat.checks.blockbreak; - -import com.earth2me.essentials.anticheat.NoCheat; -import com.earth2me.essentials.anticheat.NoCheatPlayer; -import com.earth2me.essentials.anticheat.checks.Check; -import com.earth2me.essentials.anticheat.config.ConfigurationCacheStore; -import com.earth2me.essentials.anticheat.data.DataStore; - - -/** - * Abstract base class for BlockBreakChecks. Provides some static convenience methods for retrieving data and config - * objects for players - * - */ -public abstract class BlockBreakCheck extends Check -{ - private static final String id = "blockbreak"; - - public BlockBreakCheck(NoCheat plugin, String name) - { - super(plugin, id, name); - } - - /** - * Get the "BlockBreakData" object that belongs to the player. Will ensure that such a object exists and if not, - * create one - * - * @param player - * @return - */ - public static BlockBreakData getData(NoCheatPlayer player) - { - DataStore base = player.getDataStore(); - BlockBreakData data = base.get(id); - if (data == null) - { - data = new BlockBreakData(); - base.set(id, data); - } - return data; - } - - /** - * Get the BlockBreakConfig object that belongs to the world that the player currently resides in. - * - * @param player - * @return - */ - public static BlockBreakConfig getConfig(NoCheatPlayer player) - { - return getConfig(player.getConfigurationStore()); - } - - public static BlockBreakConfig getConfig(ConfigurationCacheStore cache) - { - BlockBreakConfig config = cache.get(id); - if (config == null) - { - config = new BlockBreakConfig(cache.getConfiguration()); - cache.set(id, config); - } - return config; - } -} diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/blockbreak/BlockBreakCheckListener.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/blockbreak/BlockBreakCheckListener.java deleted file mode 100644 index f59ed481c..000000000 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/blockbreak/BlockBreakCheckListener.java +++ /dev/null @@ -1,174 +0,0 @@ -package com.earth2me.essentials.anticheat.checks.blockbreak; - -import com.earth2me.essentials.anticheat.EventManager; -import com.earth2me.essentials.anticheat.NoCheat; -import com.earth2me.essentials.anticheat.NoCheatPlayer; -import com.earth2me.essentials.anticheat.config.ConfigurationCacheStore; -import com.earth2me.essentials.anticheat.config.Permissions; -import java.util.LinkedList; -import java.util.List; -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.BlockDamageEvent; -import org.bukkit.event.player.PlayerAnimationEvent; -import org.bukkit.event.player.PlayerInteractEvent; - - -/** - * Central location to listen to events that are relevant for the blockbreak checks - * - */ -public class BlockBreakCheckListener implements Listener, EventManager -{ - private final NoswingCheck noswingCheck; - private final ReachCheck reachCheck; - private final DirectionCheck directionCheck; - private final NoCheat plugin; - - public BlockBreakCheckListener(NoCheat plugin) - { - - noswingCheck = new NoswingCheck(plugin); - reachCheck = new ReachCheck(plugin); - directionCheck = new DirectionCheck(plugin); - - this.plugin = plugin; - } - - /** - * We listen to blockBreak events for obvious reasons - * - * @param event The blockbreak event - */ - @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) - public void blockBreak(final BlockBreakEvent event) - { - boolean cancelled = false; - - final NoCheatPlayer player = plugin.getPlayer(event.getPlayer()); - final BlockBreakConfig cc = BlockBreakCheck.getConfig(player); - final BlockBreakData data = BlockBreakCheck.getData(player); - - // Remember the location of the block that will be broken - data.brokenBlockLocation.set(event.getBlock()); - - // Only if the block got damaged directly before, do the check(s) - if (!data.brokenBlockLocation.equals(data.lastDamagedBlock)) - { - // Something caused a blockbreak event that's not from the player - // Don't check it at all - data.lastDamagedBlock.reset(); - return; - } - - // Now do the actual checks, if still needed. It's a good idea to make - // computationally cheap checks first, because it may save us from - // doing the computationally expensive checks. - - // First NoSwing: Did the arm of the player move before breaking this - // block? - if (cc.noswingCheck && !player.hasPermission(Permissions.BLOCKBREAK_NOSWING)) - { - cancelled = noswingCheck.check(player, data, cc); - } - - // Second Reach: Is the block really in reach distance - if (!cancelled && cc.reachCheck && !player.hasPermission(Permissions.BLOCKBREAK_REACH)) - { - cancelled = reachCheck.check(player, data, cc); - } - - // Third Direction: Did the player look at the block at all - if (!cancelled && cc.directionCheck && !player.hasPermission(Permissions.BLOCKBREAK_DIRECTION)) - { - cancelled = directionCheck.check(player, data, cc); - } - - // At least one check failed and demanded to cancel the event - if (cancelled) - { - event.setCancelled(cancelled); - } - } - - /** - * We listen to BlockDamage events to grab the information if it has been an "insta-break". That info may come in - * handy later. - * - * @param event The BlockDamage event - */ - @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) - public void blockHit(final BlockDamageEvent event) - { - NoCheatPlayer player = plugin.getPlayer(event.getPlayer()); - BlockBreakData data = BlockBreakCheck.getData(player); - - // Only interested in insta-break events here - if (event.getInstaBreak()) - { - // Remember this location. We handle insta-breaks slightly - // different in some of the blockbreak checks. - data.instaBrokenBlockLocation.set(event.getBlock()); - } - - } - - /** - * We listen to BlockInteract events to be (at least in many cases) able to distinguish between blockbreak events - * that were triggered by players actually digging and events that were artificially created by plugins. - * - * @param event - */ - @EventHandler(priority = EventPriority.MONITOR) - public void blockInteract(final PlayerInteractEvent event) - { - - if (event.getClickedBlock() == null) - { - return; - } - - NoCheatPlayer player = plugin.getPlayer(event.getPlayer()); - BlockBreakData data = BlockBreakCheck.getData(player); - // Remember this location. Only blockbreakevents for this specific - // block will be handled at all - data.lastDamagedBlock.set(event.getClickedBlock()); - } - - /** - * We listen to PlayerAnimationEvent because it is (currently) equivalent to "player swings arm" and we want to - * check if he did that between blockbreaks. - * - * @param event The PlayerAnimation Event - */ - @EventHandler(priority = EventPriority.MONITOR) - public void armSwing(final PlayerAnimationEvent event) - { - // Just set a flag to true when the arm was swung - BlockBreakCheck.getData(plugin.getPlayer(event.getPlayer())).armswung = true; - } - - public List<String> getActiveChecks(ConfigurationCacheStore cc) - { - LinkedList<String> s = new LinkedList<String>(); - - BlockBreakConfig bb = BlockBreakCheck.getConfig(cc); - - if (bb.directionCheck) - { - s.add("blockbreak.direction"); - } - if (bb.reachCheck) - { - s.add("blockbreak.reach"); - } - if (bb.noswingCheck) - { - s.add("blockbreak.noswing"); - } - - return s; - } -} diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/blockbreak/BlockBreakConfig.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/blockbreak/BlockBreakConfig.java deleted file mode 100644 index aed4a6a08..000000000 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/blockbreak/BlockBreakConfig.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.earth2me.essentials.anticheat.checks.blockbreak; - -import com.earth2me.essentials.anticheat.ConfigItem; -import com.earth2me.essentials.anticheat.actions.types.ActionList; -import com.earth2me.essentials.anticheat.config.ConfPaths; -import com.earth2me.essentials.anticheat.config.NoCheatConfiguration; -import com.earth2me.essentials.anticheat.config.Permissions; - - -/** - * Configurations specific for the "BlockBreak" checks Every world gets one of these assigned to it, or if a world - * doesn't get it's own, it will use the "global" version - * - */ -public class BlockBreakConfig implements ConfigItem -{ - public final boolean reachCheck; - public final double reachDistance; - public final ActionList reachActions; - public final boolean directionCheck; - public final ActionList directionActions; - public final double directionPrecision; - public final long directionPenaltyTime; - public final boolean noswingCheck; - public final ActionList noswingActions; - - public BlockBreakConfig(NoCheatConfiguration data) - { - - reachCheck = data.getBoolean(ConfPaths.BLOCKBREAK_REACH_CHECK); - reachDistance = 535D / 100D; - reachActions = data.getActionList(ConfPaths.BLOCKBREAK_REACH_ACTIONS, Permissions.BLOCKBREAK_REACH); - directionCheck = data.getBoolean(ConfPaths.BLOCKBREAK_DIRECTION_CHECK); - directionPrecision = ((double)data.getInt(ConfPaths.BLOCKBREAK_DIRECTION_PRECISION)) / 100D; - directionPenaltyTime = data.getInt(ConfPaths.BLOCKBREAK_DIRECTION_PENALTYTIME); - directionActions = data.getActionList(ConfPaths.BLOCKBREAK_DIRECTION_ACTIONS, Permissions.BLOCKBREAK_DIRECTION); - noswingCheck = data.getBoolean(ConfPaths.BLOCKBREAK_NOSWING_CHECK); - noswingActions = data.getActionList(ConfPaths.BLOCKBREAK_NOSWING_ACTIONS, Permissions.BLOCKBREAK_NOSWING); - } -} diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/blockbreak/BlockBreakData.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/blockbreak/BlockBreakData.java deleted file mode 100644 index dcf39adfc..000000000 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/blockbreak/BlockBreakData.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.earth2me.essentials.anticheat.checks.blockbreak; - -import com.earth2me.essentials.anticheat.DataItem; -import com.earth2me.essentials.anticheat.data.SimpleLocation; - - -/** - * Player specific data for the blockbreak checks - * - */ -public class BlockBreakData implements DataItem -{ - // Keep track of violation levels for the three checks - public double reachVL = 0.0D; - public double directionVL = 0.0D; - public double noswingVL = 0.0D; - // Used for the penalty time feature of the direction check - public long directionLastViolationTime = 0; - // Have a nicer/simpler way to work with block locations instead of - // Bukkits own "Location" class - public final SimpleLocation instaBrokenBlockLocation = new SimpleLocation(); - public final SimpleLocation brokenBlockLocation = new SimpleLocation(); - public final SimpleLocation lastDamagedBlock = new SimpleLocation(); - // indicate if the player swung his arm since he got checked last time - public boolean armswung = true; - // For logging, remember the reachDistance that was calculated in the - // reach check - public double reachDistance; -} diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/blockbreak/DirectionCheck.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/blockbreak/DirectionCheck.java deleted file mode 100644 index d0c7b10f8..000000000 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/blockbreak/DirectionCheck.java +++ /dev/null @@ -1,100 +0,0 @@ -package com.earth2me.essentials.anticheat.checks.blockbreak; - -import java.util.Locale; -import com.earth2me.essentials.anticheat.NoCheat; -import com.earth2me.essentials.anticheat.NoCheatPlayer; -import com.earth2me.essentials.anticheat.actions.ParameterName; -import com.earth2me.essentials.anticheat.checks.CheckUtil; -import com.earth2me.essentials.anticheat.data.SimpleLocation; -import com.earth2me.essentials.anticheat.data.Statistics.Id; - - -/** - * The DirectionCheck will find out if a player tried to interact with something that's not in his field of view. - * - */ -public class DirectionCheck extends BlockBreakCheck -{ - public DirectionCheck(NoCheat plugin) - { - super(plugin, "blockbreak.direction"); - } - - public boolean check(final NoCheatPlayer player, final BlockBreakData data, final BlockBreakConfig ccblockbreak) - { - - final SimpleLocation brokenBlock = data.brokenBlockLocation; - boolean cancel = false; - - // How far "off" is the player with his aim. We calculate from the - // players eye location and view direction to the center of the target - // block. If the line of sight is more too far off, "off" will be - // bigger than 0 - double off = CheckUtil.directionCheck(player, brokenBlock.x + 0.5D, brokenBlock.y + 0.5D, brokenBlock.z + 0.5D, 1D, 1D, ccblockbreak.directionPrecision); - - final long time = System.currentTimeMillis(); - - if (off < 0.1D) - { - // Player did likely nothing wrong - // reduce violation counter to reward him - data.directionVL *= 0.9D; - } - else - { - // Player failed the check - // Increment violation counter - if (data.instaBrokenBlockLocation.equals(brokenBlock)) - { - // Instabreak block failures are very common, so don't be as - // hard on people failing them - off /= 5; - } - - // Add to the overall violation level of the check and add to - // statistics - data.directionVL += off; - incrementStatistics(player, Id.BB_DIRECTION, off); - - // Execute whatever actions are associated with this check and the - // violation level and find out if we should cancel the event - cancel = executeActions(player, ccblockbreak.directionActions, data.directionVL); - - if (cancel) - { - // if we should cancel, remember the current time too - data.directionLastViolationTime = time; - } - } - - // If the player is still in penalty time, cancel the event anyway - if (data.directionLastViolationTime + ccblockbreak.directionPenaltyTime > time) - { - // A saveguard to avoid people getting stuck in penalty time - // indefinitely in case the system time of the server gets changed - if (data.directionLastViolationTime > time) - { - data.directionLastViolationTime = 0; - } - - // He is in penalty time, therefore request cancelling of the event - return true; - } - - return cancel; - } - - @Override - public String getParameter(ParameterName wildcard, NoCheatPlayer player) - { - - if (wildcard == ParameterName.VIOLATIONS) - { - return String.format(Locale.US, "%d", (int)getData(player).directionVL); - } - else - { - return super.getParameter(wildcard, player); - } - } -} diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/blockbreak/NoswingCheck.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/blockbreak/NoswingCheck.java deleted file mode 100644 index af53c419f..000000000 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/blockbreak/NoswingCheck.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.earth2me.essentials.anticheat.checks.blockbreak; - -import java.util.Locale; -import com.earth2me.essentials.anticheat.NoCheat; -import com.earth2me.essentials.anticheat.NoCheatPlayer; -import com.earth2me.essentials.anticheat.actions.ParameterName; -import com.earth2me.essentials.anticheat.data.Statistics.Id; - - -/** - * We require that the player moves his arm between blockbreaks, this is what gets checked here. - * - */ -public class NoswingCheck extends BlockBreakCheck -{ - public NoswingCheck(NoCheat plugin) - { - super(plugin, "blockbreak.noswing"); - } - - public boolean check(NoCheatPlayer player, BlockBreakData data, BlockBreakConfig cc) - { - - boolean cancel = false; - - // did he swing his arm before - if (data.armswung) - { - // "consume" the flag - data.armswung = false; - // reward with lowering of the violation level - data.noswingVL *= 0.90D; - } - else - { - // he failed, increase vl and statistics - data.noswingVL += 1; - incrementStatistics(player, Id.BB_NOSWING, 1); - - // Execute whatever actions are associated with this check and the - // violation level and find out if we should cancel the event - cancel = executeActions(player, cc.noswingActions, data.noswingVL); - } - - return cancel; - } - - @Override - public String getParameter(ParameterName wildcard, NoCheatPlayer player) - { - - if (wildcard == ParameterName.VIOLATIONS) - { - return String.format(Locale.US, "%d", (int)getData(player).noswingVL); - } - else - { - return super.getParameter(wildcard, player); - } - } -} diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/blockbreak/ReachCheck.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/blockbreak/ReachCheck.java deleted file mode 100644 index b764eedcb..000000000 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/blockbreak/ReachCheck.java +++ /dev/null @@ -1,75 +0,0 @@ -package com.earth2me.essentials.anticheat.checks.blockbreak; - -import java.util.Locale; -import com.earth2me.essentials.anticheat.NoCheat; -import com.earth2me.essentials.anticheat.NoCheatPlayer; -import com.earth2me.essentials.anticheat.actions.ParameterName; -import com.earth2me.essentials.anticheat.checks.CheckUtil; -import com.earth2me.essentials.anticheat.data.SimpleLocation; -import com.earth2me.essentials.anticheat.data.Statistics.Id; - - -/** - * The reach check will find out if a player interacts with something that's too far away - * - */ -public class ReachCheck extends BlockBreakCheck -{ - public ReachCheck(NoCheat plugin) - { - super(plugin, "blockbreak.reach"); - } - - public boolean check(NoCheatPlayer player, BlockBreakData data, BlockBreakConfig cc) - { - - boolean cancel = false; - - final SimpleLocation brokenBlock = data.brokenBlockLocation; - - // Distance is calculated from eye location to center of targeted block - // If the player is further away from his target than allowed, the - // difference will be assigned to "distance" - final double distance = CheckUtil.reachCheck(player, brokenBlock.x + 0.5D, brokenBlock.y + 0.5D, brokenBlock.z + 0.5D, player.isCreative() ? cc.reachDistance + 2 : cc.reachDistance); - - if (distance <= 0D) - { - // Player passed the check, reward him - data.reachVL *= 0.9D; - } - else - { - // He failed, increment violation level and statistics - data.reachVL += distance; - incrementStatistics(player, Id.BB_REACH, distance); - - // Remember how much further than allowed he tried to reach for - // logging, if necessary - data.reachDistance = distance; - - // Execute whatever actions are associated with this check and the - // violation level and find out if we should cancel the event - cancel = executeActions(player, cc.reachActions, data.reachVL); - } - - return cancel; - } - - @Override - public String getParameter(ParameterName wildcard, NoCheatPlayer player) - { - - if (wildcard == ParameterName.VIOLATIONS) - { - return String.format(Locale.US, "%d", (int)getData(player).reachVL); - } - else if (wildcard == ParameterName.REACHDISTANCE) - { - return String.format(Locale.US, "%.2f", getData(player).reachDistance); - } - else - { - return super.getParameter(wildcard, player); - } - } -} diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/blockplace/BlockPlaceCheck.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/blockplace/BlockPlaceCheck.java deleted file mode 100644 index e20a74ca9..000000000 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/blockplace/BlockPlaceCheck.java +++ /dev/null @@ -1,99 +0,0 @@ -package com.earth2me.essentials.anticheat.checks.blockplace; - -import com.earth2me.essentials.anticheat.NoCheat; -import com.earth2me.essentials.anticheat.NoCheatPlayer; -import com.earth2me.essentials.anticheat.actions.ParameterName; -import com.earth2me.essentials.anticheat.checks.Check; -import com.earth2me.essentials.anticheat.config.ConfigurationCacheStore; -import com.earth2me.essentials.anticheat.data.DataStore; -import com.earth2me.essentials.anticheat.data.SimpleLocation; -import java.util.Locale; - - -/** - * Abstract base class for BlockPlace checks, provides some convenience methods for access to data and config that's - * relevant to this checktype - */ -public abstract class BlockPlaceCheck extends Check -{ - private static final String id = "blockplace"; - - public BlockPlaceCheck(NoCheat plugin, String name) - { - super(plugin, id, name); - } - - @Override - public String getParameter(ParameterName wildcard, NoCheatPlayer player) - { - if (wildcard == ParameterName.PLACE_LOCATION) - { - SimpleLocation l = getData(player).blockPlaced; - if (l.isSet()) - { - return String.format(Locale.US, "%d %d %d", l.x, l.y, l.z); - } - else - { - return "null"; - } - } - else if (wildcard == ParameterName.PLACE_AGAINST) - { - SimpleLocation l = getData(player).blockPlacedAgainst; - if (l.isSet()) - { - return String.format(Locale.US, "%d %d %d", l.x, l.y, l.z); - } - else - { - return "null"; - } - } - else - { - return super.getParameter(wildcard, player); - } - } - - /** - * Get the "BlockPlaceData" object that belongs to the player. Will ensure that such a object exists and if not, - * create one - * - * @param player - * @return - */ - public static BlockPlaceData getData(NoCheatPlayer player) - { - DataStore base = player.getDataStore(); - BlockPlaceData data = base.get(id); - if (data == null) - { - data = new BlockPlaceData(); - base.set(id, data); - } - return data; - } - - /** - * Get the BlockPlaceConfig object that belongs to the world that the player currently resides in. - * - * @param player - * @return - */ - public static BlockPlaceConfig getConfig(NoCheatPlayer player) - { - return getConfig(player.getConfigurationStore()); - } - - public static BlockPlaceConfig getConfig(ConfigurationCacheStore cache) - { - BlockPlaceConfig config = cache.get(id); - if (config == null) - { - config = new BlockPlaceConfig(cache.getConfiguration()); - cache.set(id, config); - } - return config; - } -} diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/blockplace/BlockPlaceCheckListener.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/blockplace/BlockPlaceCheckListener.java deleted file mode 100644 index 6896e36c9..000000000 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/blockplace/BlockPlaceCheckListener.java +++ /dev/null @@ -1,96 +0,0 @@ -package com.earth2me.essentials.anticheat.checks.blockplace; - -import com.earth2me.essentials.anticheat.EventManager; -import com.earth2me.essentials.anticheat.NoCheat; -import com.earth2me.essentials.anticheat.NoCheatPlayer; -import com.earth2me.essentials.anticheat.config.ConfigurationCacheStore; -import com.earth2me.essentials.anticheat.config.Permissions; -import java.util.LinkedList; -import java.util.List; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.Listener; -import org.bukkit.event.block.BlockPlaceEvent; - - -/** - * Central location to listen to Block-related events and dispatching them to checks - * - */ -public class BlockPlaceCheckListener implements Listener, EventManager -{ - private final ReachCheck reachCheck; - private final DirectionCheck directionCheck; - private final NoCheat plugin; - - public BlockPlaceCheckListener(NoCheat plugin) - { - - this.plugin = plugin; - - reachCheck = new ReachCheck(plugin); - directionCheck = new DirectionCheck(plugin); - } - - /** - * We listen to BlockPlace events for obvious reasons - * - * @param event the BlockPlace event - */ - @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) - protected void handleBlockPlaceEvent(BlockPlaceEvent event) - { - if (event.getBlock() == null || event.getBlockAgainst() == null) - { - return; - } - - boolean cancelled = false; - - final NoCheatPlayer player = plugin.getPlayer(event.getPlayer()); - final BlockPlaceConfig cc = BlockPlaceCheck.getConfig(player); - final BlockPlaceData data = BlockPlaceCheck.getData(player); - - // Remember these locations and put them in a simpler "format" - data.blockPlaced.set(event.getBlock()); - data.blockPlacedAgainst.set(event.getBlockAgainst()); - - // Now do the actual checks - - // First the reach check - if (cc.reachCheck && !player.hasPermission(Permissions.BLOCKPLACE_REACH)) - { - cancelled = reachCheck.check(player, data, cc); - } - - // Second the direction check - if (!cancelled && cc.directionCheck && !player.hasPermission(Permissions.BLOCKPLACE_DIRECTION)) - { - cancelled = directionCheck.check(player, data, cc); - } - - // If one of the checks requested to cancel the event, do so - if (cancelled) - { - event.setCancelled(cancelled); - } - } - - public List<String> getActiveChecks(ConfigurationCacheStore cc) - { - LinkedList<String> s = new LinkedList<String>(); - - BlockPlaceConfig bp = BlockPlaceCheck.getConfig(cc); - - if (bp.reachCheck) - { - s.add("blockplace.reach"); - } - if (bp.directionCheck) - { - s.add("blockplace.direction"); - } - - return s; - } -} diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/blockplace/BlockPlaceConfig.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/blockplace/BlockPlaceConfig.java deleted file mode 100644 index 26c8d0f6d..000000000 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/blockplace/BlockPlaceConfig.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.earth2me.essentials.anticheat.checks.blockplace; - -import com.earth2me.essentials.anticheat.ConfigItem; -import com.earth2me.essentials.anticheat.actions.types.ActionList; -import com.earth2me.essentials.anticheat.config.ConfPaths; -import com.earth2me.essentials.anticheat.config.NoCheatConfiguration; -import com.earth2me.essentials.anticheat.config.Permissions; - - -/** - * Configurations specific for the "BlockPlace" checks Every world gets one of these assigned to it, or if a world - * doesn't get it's own, it will use the "global" version - * - */ -public class BlockPlaceConfig implements ConfigItem -{ - public final boolean reachCheck; - public final double reachDistance; - public final ActionList reachActions; - public final boolean directionCheck; - public final ActionList directionActions; - public final long directionPenaltyTime; - public final double directionPrecision; - - public BlockPlaceConfig(NoCheatConfiguration data) - { - - reachCheck = data.getBoolean(ConfPaths.BLOCKPLACE_REACH_CHECK); - reachDistance = 535D / 100D; - reachActions = data.getActionList(ConfPaths.BLOCKPLACE_REACH_ACTIONS, Permissions.BLOCKPLACE_REACH); - - directionCheck = data.getBoolean(ConfPaths.BLOCKPLACE_DIRECTION_CHECK); - directionPenaltyTime = data.getInt(ConfPaths.BLOCKPLACE_DIRECTION_PENALTYTIME); - directionPrecision = ((double)data.getInt(ConfPaths.BLOCKPLACE_DIRECTION_PRECISION)) / 100D; - directionActions = data.getActionList(ConfPaths.BLOCKPLACE_DIRECTION_ACTIONS, Permissions.BLOCKPLACE_DIRECTION); - } -} diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/blockplace/BlockPlaceData.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/blockplace/BlockPlaceData.java deleted file mode 100644 index 47ff9d58a..000000000 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/blockplace/BlockPlaceData.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.earth2me.essentials.anticheat.checks.blockplace; - -import com.earth2me.essentials.anticheat.DataItem; -import com.earth2me.essentials.anticheat.data.SimpleLocation; - - -/** - * Player specific data for the blockbreak checks - * - */ -public class BlockPlaceData implements DataItem -{ - // Keep track of violation levels for the two checks - public double reachVL = 0.0D; - public double directionVL = 0.0D; - // Used for the penalty time feature of the direction check - public long directionLastViolationTime = 0; - // Have a nicer/simpler way to work with block locations instead of - // Bukkits own "Location" class - public final SimpleLocation blockPlacedAgainst = new SimpleLocation(); - public final SimpleLocation blockPlaced = new SimpleLocation(); - // For logging, remember the reachDistance that was calculated in the - // reach check - public double reachdistance; -} diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/blockplace/DirectionCheck.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/blockplace/DirectionCheck.java deleted file mode 100644 index 8aa782d19..000000000 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/blockplace/DirectionCheck.java +++ /dev/null @@ -1,131 +0,0 @@ -package com.earth2me.essentials.anticheat.checks.blockplace; - -import com.earth2me.essentials.anticheat.NoCheat; -import com.earth2me.essentials.anticheat.NoCheatPlayer; -import com.earth2me.essentials.anticheat.actions.ParameterName; -import com.earth2me.essentials.anticheat.checks.CheckUtil; -import com.earth2me.essentials.anticheat.data.SimpleLocation; -import com.earth2me.essentials.anticheat.data.Statistics.Id; -import java.util.Locale; -import org.bukkit.Location; - - -/** - * The DirectionCheck will find out if a player tried to interact with something that's not in his field of view. - * - */ -public class DirectionCheck extends BlockPlaceCheck -{ - public DirectionCheck(NoCheat plugin) - { - super(plugin, "blockplace.direction"); - } - - public boolean check(NoCheatPlayer player, BlockPlaceData data, BlockPlaceConfig cc) - { - - boolean cancel = false; - - final SimpleLocation blockPlaced = data.blockPlaced; - final SimpleLocation blockPlacedAgainst = data.blockPlacedAgainst; - - // How far "off" is the player with his aim. We calculate from the - // players eye location and view direction to the center of the target - // block. If the line of sight is more too far off, "off" will be - // bigger than 0 - double off = CheckUtil.directionCheck(player, blockPlacedAgainst.x + 0.5D, blockPlacedAgainst.y + 0.5D, blockPlacedAgainst.z + 0.5D, 1D, 1D, cc.directionPrecision); - - // now check if the player is looking at the block from the correct side - double off2 = 0.0D; - - // Find out against which face the player tried to build, and if he - // stood on the correct side of it - Location eyes = player.getPlayer().getEyeLocation(); - if (blockPlaced.x > blockPlacedAgainst.x) - { - off2 = blockPlacedAgainst.x + 0.5D - eyes.getX(); - } - else if (blockPlaced.x < blockPlacedAgainst.x) - { - off2 = -(blockPlacedAgainst.x + 0.5D - eyes.getX()); - } - else if (blockPlaced.y > blockPlacedAgainst.y) - { - off2 = blockPlacedAgainst.y + 0.5D - eyes.getY(); - } - else if (blockPlaced.y < blockPlacedAgainst.y) - { - off2 = -(blockPlacedAgainst.y + 0.5D - eyes.getY()); - } - else if (blockPlaced.z > blockPlacedAgainst.z) - { - off2 = blockPlacedAgainst.z + 0.5D - eyes.getZ(); - } - else if (blockPlaced.z < blockPlacedAgainst.z) - { - off2 = -(blockPlacedAgainst.z + 0.5D - eyes.getZ()); - } - - // If he wasn't on the correct side, add that to the "off" value - if (off2 > 0.0D) - { - off += off2; - } - - final long time = System.currentTimeMillis(); - - if (off < 0.1D) - { - // Player did nothing wrong - // reduce violation counter to reward him - data.directionVL *= 0.9D; - } - else - { - // Player failed the check - // Increment violation counter and statistics - data.directionVL += off; - incrementStatistics(player, Id.BP_DIRECTION, off); - - // Execute whatever actions are associated with this check and the - // violation level and find out if we should cancel the event - cancel = executeActions(player, cc.directionActions, data.directionVL); - - if (cancel) - { - // if we should cancel, remember the current time too - data.directionLastViolationTime = time; - } - } - - // If the player is still in penalty time, cancel the event anyway - if (data.directionLastViolationTime + cc.directionPenaltyTime > time) - { - // A safeguard to avoid people getting stuck in penalty time - // indefinitely in case the system time of the server gets changed - if (data.directionLastViolationTime > time) - { - data.directionLastViolationTime = 0; - } - - // He is in penalty time, therefore request cancelling of the event - return true; - } - - return cancel; - } - - @Override - public String getParameter(ParameterName wildcard, NoCheatPlayer player) - { - - if (wildcard == ParameterName.VIOLATIONS) - { - return String.format(Locale.US, "%d", (int)getData(player).directionVL); - } - else - { - return super.getParameter(wildcard, player); - } - } -} diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/blockplace/ReachCheck.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/blockplace/ReachCheck.java deleted file mode 100644 index 6e13a9348..000000000 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/blockplace/ReachCheck.java +++ /dev/null @@ -1,75 +0,0 @@ -package com.earth2me.essentials.anticheat.checks.blockplace; - -import com.earth2me.essentials.anticheat.NoCheat; -import com.earth2me.essentials.anticheat.NoCheatPlayer; -import com.earth2me.essentials.anticheat.actions.ParameterName; -import com.earth2me.essentials.anticheat.checks.CheckUtil; -import com.earth2me.essentials.anticheat.data.SimpleLocation; -import com.earth2me.essentials.anticheat.data.Statistics.Id; -import java.util.Locale; - - -/** - * The reach check will find out if a player interacts with something that's too far away - * - */ -public class ReachCheck extends BlockPlaceCheck -{ - public ReachCheck(NoCheat plugin) - { - super(plugin, "blockplace.reach"); - } - - public boolean check(NoCheatPlayer player, BlockPlaceData data, BlockPlaceConfig cc) - { - - boolean cancel = false; - - final SimpleLocation placedAgainstBlock = data.blockPlacedAgainst; - - // Distance is calculated from eye location to center of targeted block - // If the player is further away from his target than allowed, the - // difference will be assigned to "distance" - final double distance = CheckUtil.reachCheck(player, placedAgainstBlock.x + 0.5D, placedAgainstBlock.y + 0.5D, placedAgainstBlock.z + 0.5D, player.isCreative() ? cc.reachDistance + 2 : cc.reachDistance); - - if (distance <= 0D) - { - // Player passed the check, reward him - data.reachVL *= 0.9D; - } - else - { - // He failed, increment violation level and statistics - data.reachVL += distance; - incrementStatistics(player, Id.BP_REACH, distance); - - // Remember how much further than allowed he tried to reach for - // logging, if necessary - data.reachdistance = distance; - - // Execute whatever actions are associated with this check and the - // violation level and find out if we should cancel the event - cancel = executeActions(player, cc.reachActions, data.reachVL); - } - - return cancel; - } - - @Override - public String getParameter(ParameterName wildcard, NoCheatPlayer player) - { - - if (wildcard == ParameterName.VIOLATIONS) - { - return String.format(Locale.US, "%d", (int)getData(player).reachVL); - } - else if (wildcard == ParameterName.REACHDISTANCE) - { - return String.format(Locale.US, "%.2f", getData(player).reachdistance); - } - else - { - return super.getParameter(wildcard, player); - } - } -} diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/chat/ChatCheck.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/chat/ChatCheck.java deleted file mode 100644 index b1f14deec..000000000 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/chat/ChatCheck.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.earth2me.essentials.anticheat.checks.chat; - -import com.earth2me.essentials.anticheat.NoCheat; -import com.earth2me.essentials.anticheat.NoCheatPlayer; -import com.earth2me.essentials.anticheat.actions.ParameterName; -import com.earth2me.essentials.anticheat.checks.Check; -import com.earth2me.essentials.anticheat.config.ConfigurationCacheStore; -import com.earth2me.essentials.anticheat.data.DataStore; - - -/** - * Abstract base class for Chat checks, provides some convenience methods for access to data and config that's relevant - * to this checktype - */ -public abstract class ChatCheck extends Check -{ - private static final String id = "chat"; - - public ChatCheck(NoCheat plugin, String name) - { - super(plugin, id, name); - } - - @Override - public String getParameter(ParameterName wildcard, NoCheatPlayer player) - { - - if (wildcard == ParameterName.TEXT) - // Filter colors from the players message when logging - { - return getData(player).message.replaceAll("\302\247.", "").replaceAll("\247.", ""); - } - else - { - return super.getParameter(wildcard, player); - } - } - - /** - * Get the "ChatData" object that belongs to the player. Will ensure that such a object exists and if not, create - * one - * - * @param player - * @return - */ - public static ChatData getData(NoCheatPlayer player) - { - DataStore base = player.getDataStore(); - ChatData data = base.get(id); - if (data == null) - { - data = new ChatData(); - base.set(id, data); - } - return data; - } - - /** - * Get the ChatConfig object that belongs to the world that the player currently resides in. - * - * @param player - * @return - */ - public static ChatConfig getConfig(NoCheatPlayer player) - { - return getConfig(player.getConfigurationStore()); - } - - public static ChatConfig getConfig(ConfigurationCacheStore cache) - { - ChatConfig config = cache.get(id); - if (config == null) - { - config = new ChatConfig(cache.getConfiguration()); - cache.set(id, config); - } - return config; - } -} diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/chat/ChatCheckListener.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/chat/ChatCheckListener.java deleted file mode 100644 index 965a374aa..000000000 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/chat/ChatCheckListener.java +++ /dev/null @@ -1,108 +0,0 @@ -package com.earth2me.essentials.anticheat.checks.chat; - -import com.earth2me.essentials.anticheat.EventManager; -import com.earth2me.essentials.anticheat.NoCheat; -import com.earth2me.essentials.anticheat.NoCheatPlayer; -import com.earth2me.essentials.anticheat.config.ConfigurationCacheStore; -import com.earth2me.essentials.anticheat.config.Permissions; -import java.util.LinkedList; -import java.util.List; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.Listener; -import org.bukkit.event.player.PlayerChatEvent; -import org.bukkit.event.player.PlayerCommandPreprocessEvent; - - -/** - * Central location to listen to events that are relevant for the chat checks - * - */ -public class ChatCheckListener implements Listener, EventManager -{ - private final SpamCheck spamCheck; - private final ColorCheck colorCheck; - private final NoCheat plugin; - - public ChatCheckListener(NoCheat plugin) - { - - this.plugin = plugin; - - spamCheck = new SpamCheck(plugin); - colorCheck = new ColorCheck(plugin); - } - - /** - * We listen to PlayerCommandPreprocess events because commands can be used for spamming too. - * - * @param event The PlayerCommandPreprocess Event - */ - @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) - public void commandPreprocess(final PlayerCommandPreprocessEvent event) - { - // This type of event is derived from PlayerChatEvent, therefore - // just treat it like that - chat(event); - } - - /** - * We listen to PlayerChat events for obvious reasons - * - * @param event The PlayerChat event - */ - @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) - public void chat(final PlayerChatEvent event) - { - boolean cancelled = false; - - final NoCheatPlayer player = plugin.getPlayer(event.getPlayer()); - final ChatConfig cc = ChatCheck.getConfig(player); - final ChatData data = ChatCheck.getData(player); - - // Remember the original message - data.message = event.getMessage(); - - // Now do the actual checks - - // First the spam check - if (cc.spamCheck && !player.hasPermission(Permissions.CHAT_SPAM)) - { - cancelled = spamCheck.check(player, data, cc); - } - - // Second the color check - if (!cancelled && cc.colorCheck && !player.hasPermission(Permissions.CHAT_COLOR)) - { - cancelled = colorCheck.check(player, data, cc); - } - - // If one of the checks requested the event to be cancelled, do it - if (cancelled) - { - event.setCancelled(cancelled); - } - else - { - // In case one of the events modified the message, make sure that - // the new message gets used - event.setMessage(data.message); - } - } - - public List<String> getActiveChecks(ConfigurationCacheStore cc) - { - LinkedList<String> s = new LinkedList<String>(); - - ChatConfig c = ChatCheck.getConfig(cc); - if (c.spamCheck) - { - s.add("chat.spam"); - } - if (c.colorCheck) - { - s.add("chat.color"); - } - return s; - } -} diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/chat/ChatConfig.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/chat/ChatConfig.java deleted file mode 100644 index 06ad5c9fc..000000000 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/chat/ChatConfig.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.earth2me.essentials.anticheat.checks.chat; - -import java.util.LinkedList; -import java.util.List; -import com.earth2me.essentials.anticheat.ConfigItem; -import com.earth2me.essentials.anticheat.actions.types.ActionList; -import com.earth2me.essentials.anticheat.config.ConfPaths; -import com.earth2me.essentials.anticheat.config.NoCheatConfiguration; -import com.earth2me.essentials.anticheat.config.Permissions; - - -/** - * Configurations specific for the "Chat" checks Every world gets one of these assigned to it, or if a world doesn't get - * it's own, it will use the "global" version - * - */ -public class ChatConfig implements ConfigItem -{ - public final boolean spamCheck; - public final String[] spamWhitelist; - public final long spamTimeframe; - public final int spamMessageLimit; - public final int spamCommandLimit; - public final ActionList spamActions; - public final boolean colorCheck; - public final ActionList colorActions; - - public ChatConfig(NoCheatConfiguration data) - { - - spamCheck = data.getBoolean(ConfPaths.CHAT_SPAM_CHECK); - spamWhitelist = splitWhitelist(data.getString(ConfPaths.CHAT_SPAM_WHITELIST)); - spamTimeframe = data.getInt(ConfPaths.CHAT_SPAM_TIMEFRAME) * 1000L; - spamMessageLimit = data.getInt(ConfPaths.CHAT_SPAM_MESSAGELIMIT); - spamCommandLimit = data.getInt(ConfPaths.CHAT_SPAM_COMMANDLIMIT); - spamActions = data.getActionList(ConfPaths.CHAT_SPAM_ACTIONS, Permissions.CHAT_SPAM); - colorCheck = data.getBoolean(ConfPaths.CHAT_COLOR_CHECK); - colorActions = data.getActionList(ConfPaths.CHAT_COLOR_ACTIONS, Permissions.CHAT_COLOR); - } - - /** - * Convenience method to split a string into an array on every occurance of the "," character, removing all - * whitespaces before and after it too. - * - * @param string The string containing text seperated by "," - * @return An array of the seperate texts - */ - private String[] splitWhitelist(String string) - { - - List<String> strings = new LinkedList<String>(); - string = string.trim(); - - for (String s : string.split(",")) - { - if (s != null && s.trim().length() > 0) - { - strings.add(s.trim()); - } - } - - return strings.toArray(new String[strings.size()]); - } -} diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/chat/ChatData.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/chat/ChatData.java deleted file mode 100644 index b05cb2579..000000000 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/chat/ChatData.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.earth2me.essentials.anticheat.checks.chat; - -import com.earth2me.essentials.anticheat.DataItem; - - -/** - * Player specific data for the chat checks - * - */ -public class ChatData implements DataItem -{ - // Keep track of the violation levels for the two checks - public int spamVL; - public int colorVL; - // Count messages and commands - public int messageCount = 0; - public int commandCount = 0; - // Remember when the last check time period started - public long spamLastTime = 0; - // Remember the last chat message or command for logging purposes - public String message = ""; -} diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/chat/ColorCheck.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/chat/ColorCheck.java deleted file mode 100644 index 2468c7065..000000000 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/chat/ColorCheck.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.earth2me.essentials.anticheat.checks.chat; - -import java.util.Locale; -import com.earth2me.essentials.anticheat.NoCheat; -import com.earth2me.essentials.anticheat.NoCheatPlayer; -import com.earth2me.essentials.anticheat.actions.ParameterName; -import com.earth2me.essentials.anticheat.data.Statistics.Id; - - -public class ColorCheck extends ChatCheck -{ - public ColorCheck(NoCheat plugin) - { - super(plugin, "chat.color"); - } - - public boolean check(NoCheatPlayer player, ChatData data, ChatConfig cc) - { - - if (data.message.contains("\247")) - { - - data.colorVL += 1; - incrementStatistics(player, Id.CHAT_COLOR, 1); - - boolean filter = executeActions(player, cc.colorActions, data.colorVL); - - if (filter) - { - // Remove color codes - data.message = data.message.replaceAll("\302\247.", "").replaceAll("\247.", ""); - } - } - - return false; - } - - public String getParameter(ParameterName wildcard, NoCheatPlayer player) - { - - if (wildcard == ParameterName.VIOLATIONS) - { - return String.format(Locale.US, "%d", getData(player).colorVL); - } - else - { - return super.getParameter(wildcard, player); - } - } -} diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/chat/SpamCheck.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/chat/SpamCheck.java deleted file mode 100644 index 8bf893091..000000000 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/chat/SpamCheck.java +++ /dev/null @@ -1,96 +0,0 @@ -package com.earth2me.essentials.anticheat.checks.chat; - -import com.earth2me.essentials.anticheat.NoCheat; -import com.earth2me.essentials.anticheat.NoCheatPlayer; -import com.earth2me.essentials.anticheat.actions.ParameterName; -import com.earth2me.essentials.anticheat.data.Statistics.Id; -import java.util.Locale; - - -/** - * The SpamCheck will count messages and commands over a short timeframe to see if the player tried to send too many of - * them - * - */ -public class SpamCheck extends ChatCheck -{ - public SpamCheck(NoCheat plugin) - { - super(plugin, "chat.spam"); - } - - public boolean check(NoCheatPlayer player, ChatData data, ChatConfig cc) - { - - boolean cancel = false; - // Maybe it's a command and on the whitelist - for (String s : cc.spamWhitelist) - { - if (data.message.startsWith(s)) - { - // It is - return false; - } - } - - int commandLimit = cc.spamCommandLimit; - int messageLimit = cc.spamMessageLimit; - long timeframe = cc.spamTimeframe; - - final long time = System.currentTimeMillis(); - - // Has enough time passed? Then reset the counters - if (data.spamLastTime + timeframe <= time) - { - data.spamLastTime = time; - data.messageCount = 0; - data.commandCount = 0; - } - // Security check, if the system time changes - else if (data.spamLastTime > time) - { - data.spamLastTime = Integer.MIN_VALUE; - } - - // Increment appropriate counter - if (data.message.startsWith("/")) - { - data.commandCount++; - } - else - { - data.messageCount++; - } - - // Did the player go over the limit on at least one of the counters? - if (data.messageCount > messageLimit || data.commandCount > commandLimit) - { - - // Set the vl as the number of messages above the limit and - // increment statistics - data.spamVL = Math.max(0, data.messageCount - messageLimit); - data.spamVL += Math.max(0, data.commandCount - commandLimit); - incrementStatistics(player, Id.CHAT_SPAM, 1); - - // Execute whatever actions are associated with this check and the - // violation level and find out if we should cancel the event - cancel = executeActions(player, cc.spamActions, data.spamVL); - } - - return cancel; - } - - @Override - public String getParameter(ParameterName wildcard, NoCheatPlayer player) - { - - if (wildcard == ParameterName.VIOLATIONS) - { - return String.format(Locale.US, "%d", getData(player).spamVL); - } - else - { - return super.getParameter(wildcard, player); - } - } -} diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/fight/DirectionCheck.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/fight/DirectionCheck.java deleted file mode 100644 index 93ce58221..000000000 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/fight/DirectionCheck.java +++ /dev/null @@ -1,120 +0,0 @@ -package com.earth2me.essentials.anticheat.checks.fight; - -import com.earth2me.essentials.anticheat.NoCheat; -import com.earth2me.essentials.anticheat.NoCheatPlayer; -import com.earth2me.essentials.anticheat.actions.ParameterName; -import com.earth2me.essentials.anticheat.checks.CheckUtil; -import com.earth2me.essentials.anticheat.config.Permissions; -import com.earth2me.essentials.anticheat.data.Statistics.Id; -import java.util.Locale; -import net.minecraft.server.Entity; -import net.minecraft.server.EntityComplex; -import net.minecraft.server.EntityComplexPart; - - -/** - * The DirectionCheck will find out if a player tried to interact with something that's not in his field of view. - * - */ -public class DirectionCheck extends FightCheck -{ - public DirectionCheck(NoCheat plugin) - { - super(plugin, "fight.direction", Permissions.FIGHT_DIRECTION); - } - - public boolean check(NoCheatPlayer player, FightData data, FightConfig cc) - { - - boolean cancel = false; - - final long time = System.currentTimeMillis(); - - // Get the damagee (entity that got hit) - Entity entity = data.damagee; - - // Safeguard, if entity is complex, this check will fail - // due to giant and hard to define hitboxes - if (entity instanceof EntityComplex || entity instanceof EntityComplexPart) - { - return false; - } - - // Find out how wide the entity is - final float width = entity.length > entity.width ? entity.length : entity.width; - // entity.height is broken and will always be 0, therefore - // calculate height instead based on boundingBox - final double height = entity.boundingBox.e - entity.boundingBox.b; - - // How far "off" is the player with his aim. We calculate from the - // players eye location and view direction to the center of the target - // entity. If the line of sight is more too far off, "off" will be - // bigger than 0 - final double off = CheckUtil.directionCheck(player, entity.locX, entity.locY + (height / 2D), entity.locZ, width, height, cc.directionPrecision); - - if (off < 0.1D) - { - // Player did probably nothing wrong - // reduce violation counter to reward him - data.directionVL *= 0.80D; - } - else - { - // Player failed the check - // Increment violation counter and statistics, but only if there - // wasn't serious lag - if (!plugin.skipCheck()) - { - double sqrt = Math.sqrt(off); - data.directionVL += sqrt; - incrementStatistics(player, Id.FI_DIRECTION, sqrt); - } - - // Execute whatever actions are associated with this check and the - // violation level and find out if we should cancel the event - cancel = executeActions(player, cc.directionActions, data.directionVL); - - if (cancel) - { - // if we should cancel, remember the current time too - data.directionLastViolationTime = time; - } - } - - // If the player is still in penalty time, cancel the event anyway - if (data.directionLastViolationTime + cc.directionPenaltyTime > time) - { - // A safeguard to avoid people getting stuck in penalty time - // indefinitely in case the system time of the server gets changed - if (data.directionLastViolationTime > time) - { - data.directionLastViolationTime = 0; - } - - // He is in penalty time, therefore request cancelling of the event - return true; - } - - return cancel; - } - - @Override - public boolean isEnabled(FightConfig cc) - { - return cc.directionCheck; - } - - @Override - public String getParameter(ParameterName wildcard, NoCheatPlayer player) - { - - if (wildcard == ParameterName.VIOLATIONS) - { - return String.format(Locale.US, "%d", (int)getData(player).directionVL); - } - else - { - return super.getParameter(wildcard, player); - } - } -} diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/fight/FightCheck.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/fight/FightCheck.java deleted file mode 100644 index f8dd4e3db..000000000 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/fight/FightCheck.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.earth2me.essentials.anticheat.checks.fight; - -import com.earth2me.essentials.anticheat.NoCheat; -import com.earth2me.essentials.anticheat.NoCheatPlayer; -import com.earth2me.essentials.anticheat.checks.Check; -import com.earth2me.essentials.anticheat.config.ConfigurationCacheStore; -import com.earth2me.essentials.anticheat.data.DataStore; - - -/** - * Abstract base class for Fight checks, provides some convenience methods for access to data and config that's relevant - * to this checktype - */ -public abstract class FightCheck extends Check -{ - private static final String id = "fight"; - public final String permission; - - public FightCheck(NoCheat plugin, String name, String permission) - { - super(plugin, id, name); - this.permission = permission; - } - - public abstract boolean check(NoCheatPlayer player, FightData data, FightConfig cc); - - public abstract boolean isEnabled(FightConfig cc); - - /** - * Get the "FightData" object that belongs to the player. Will ensure that such a object exists and if not, create - * one - * - * @param player - * @return - */ - public static FightData getData(NoCheatPlayer player) - { - DataStore base = player.getDataStore(); - FightData data = base.get(id); - if (data == null) - { - data = new FightData(); - base.set(id, data); - } - return data; - } - - /** - * Get the FightConfig object that belongs to the world that the player currently resides in. - * - * @param player - * @return - */ - public static FightConfig getConfig(NoCheatPlayer player) - { - return getConfig(player.getConfigurationStore()); - } - - public static FightConfig getConfig(ConfigurationCacheStore cache) - { - FightConfig config = cache.get(id); - if (config == null) - { - config = new FightConfig(cache.getConfiguration()); - cache.set(id, config); - } - return config; - } -} diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/fight/FightCheckListener.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/fight/FightCheckListener.java deleted file mode 100644 index 05a9b1701..000000000 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/fight/FightCheckListener.java +++ /dev/null @@ -1,281 +0,0 @@ -package com.earth2me.essentials.anticheat.checks.fight; - -import com.earth2me.essentials.anticheat.EventManager; -import com.earth2me.essentials.anticheat.NoCheat; -import com.earth2me.essentials.anticheat.NoCheatPlayer; -import com.earth2me.essentials.anticheat.config.ConfigurationCacheStore; -import java.util.AbstractList; -import java.util.ArrayList; -import java.util.LinkedList; -import java.util.List; -import org.bukkit.craftbukkit.entity.CraftEntity; -import org.bukkit.craftbukkit.entity.CraftPlayer; -import org.bukkit.entity.Entity; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.Listener; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.event.entity.EntityDamageEvent; -import org.bukkit.event.entity.EntityDamageEvent.DamageCause; -import org.bukkit.event.entity.EntityDeathEvent; -import org.bukkit.event.entity.EntityRegainHealthEvent; -import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason; -import org.bukkit.event.player.PlayerAnimationEvent; - - -/** - * Central location to listen to events that are relevant for the fight checks - * - */ -public class FightCheckListener implements Listener, EventManager -{ - private final List<FightCheck> checks = new ArrayList<FightCheck>(); - private final GodmodeCheck godmodeCheck; - private final InstanthealCheck instanthealCheck; - private final NoCheat plugin; - - public FightCheckListener(NoCheat plugin) - { - // Keep these in a list, because they can be executed in a bundle - this.checks.add(new SpeedCheck(plugin)); - this.checks.add(new NoswingCheck(plugin)); - this.checks.add(new DirectionCheck(plugin)); - this.checks.add(new ReachCheck(plugin)); - - this.godmodeCheck = new GodmodeCheck(plugin); - this.instanthealCheck = new InstanthealCheck(plugin); - - this.plugin = plugin; - } - - /** - * We listen to EntityDamage events for obvious reasons - * - * @param event The EntityDamage Event - */ - @EventHandler(priority = EventPriority.LOWEST) - public void entityDamage(final EntityDamageEvent event) - { - - // Filter some unwanted events right now - if (event.isCancelled() || !(event instanceof EntityDamageByEntityEvent)) - { - return; - } - - final EntityDamageByEntityEvent e = (EntityDamageByEntityEvent)event; - if (!(e.getDamager() instanceof Player)) - { - return; - } - - if (e.getCause() == DamageCause.ENTITY_ATTACK) - { - normalDamage(e); - } - else if (e.getCause() == DamageCause.CUSTOM) - { - customDamage(e); - } - } - - /** - * We listen to EntityDamage events (again) for obvious reasons - * - * @param event The EntityDamage Event - */ - @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) - public void entityDamageForGodmodeCheck(final EntityDamageEvent event) - { - // Filter unwanted events right here - final Entity entity = event.getEntity(); - if (!(entity instanceof Player) || entity.isDead()) - { - return; - } - - NoCheatPlayer player = plugin.getPlayer((Player)entity); - FightConfig cc = FightCheck.getConfig(player); - - if (!godmodeCheck.isEnabled(cc) || player.hasPermission(godmodeCheck.permission)) - { - return; - } - - FightData data = FightCheck.getData(player); - - // Run the godmode check on the attacked player - boolean cancelled = godmodeCheck.check(plugin.getPlayer((Player)entity), data, cc); - - // It requested to "cancel" the players invulnerability, so set his - // noDamageTicks to 0 - if (cancelled) - { - // Remove the invulnerability from the player - player.getPlayer().setNoDamageTicks(0); - } - } - - /** - * We listen to EntityRegainHealth events of type "Satiated" for instantheal check - * - * @param event The EntityRegainHealth Event - */ - @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) - public void satiatedRegen(final EntityRegainHealthEvent event) - { - - if (!(event.getEntity() instanceof Player) || event.getRegainReason() != RegainReason.SATIATED) - { - return; - } - - boolean cancelled = false; - - NoCheatPlayer player = plugin.getPlayer((Player)event.getEntity()); - FightConfig config = FightCheck.getConfig(player); - - if (!instanthealCheck.isEnabled(config) || player.hasPermission(instanthealCheck.permission)) - { - return; - } - - FightData data = FightCheck.getData(player); - - cancelled = instanthealCheck.check(player, data, config); - - if (cancelled) - { - event.setCancelled(true); - } - } - - /** - * A player attacked something with DamageCause ENTITY_ATTACK. That's most likely what we want to really check. - * - * @param event The EntityDamageByEntityEvent - */ - private void normalDamage(final EntityDamageByEntityEvent event) - { - - final Player damager = (Player)event.getDamager(); - - final NoCheatPlayer player = plugin.getPlayer(damager); - final FightConfig cc = FightCheck.getConfig(player); - final FightData data = FightCheck.getData(player); - - // For some reason we decided to skip this event anyway - if (data.skipNext) - { - data.skipNext = false; - return; - } - - boolean cancelled = false; - - // Get the attacked entity and remember it - data.damagee = ((CraftEntity)event.getEntity()).getHandle(); - - // Run through the four main checks - for (FightCheck check : checks) - { - // If it should be executed, do it - if (!cancelled && check.isEnabled(cc) && !player.hasPermission(check.permission)) - { - cancelled = check.check(player, data, cc); - } - } - - // Forget the attacked entity (to allow garbage collecting etc. - data.damagee = null; - - // One of the checks requested the event to be cancelled, so do it - if (cancelled) - { - event.setCancelled(cancelled); - } - } - - /** - * There is an unofficial agreement that if a plugin wants an attack to not get checked by NoCheat, it either has to - * use a Damage type different from ENTITY_ATTACK or fire an event with damage type CUSTOM and damage 0 directly - * before the to-be-ignored event. - * - * @param event The EntityDamageByEntityEvent - */ - private void customDamage(final EntityDamageByEntityEvent event) - { - - final Player damager = (Player)event.getDamager(); - final NoCheatPlayer player = plugin.getPlayer(damager); - - final FightData data = FightCheck.getData(player); - - // Skip the next damage event, because it is with high probability - // something from the Heroes plugin - data.skipNext = true; - } - - /** - * We listen to death events to prevent a very specific method of doing godmode. - * - * @param event The EntityDeathEvent - */ - @EventHandler(priority = EventPriority.MONITOR) - protected void death(final EntityDeathEvent event) - { - // Only interested in dying players - if (!(event.getEntity() instanceof CraftPlayer)) - { - return; - } - - godmodeCheck.death((CraftPlayer)event.getEntity()); - } - - /** - * We listen to PlayerAnimationEvent because it is used for arm swinging - * - * @param event The PlayerAnimationEvent - */ - @EventHandler(priority = EventPriority.MONITOR) - protected void armSwing(final PlayerAnimationEvent event) - { - // Set a flag telling us that the arm has been swung - FightCheck.getData(plugin.getPlayer(event.getPlayer())).armswung = true; - } - - public List<String> getActiveChecks(ConfigurationCacheStore cc) - { - LinkedList<String> s = new LinkedList<String>(); - - FightConfig f = FightCheck.getConfig(cc); - - if (f.directionCheck) - { - s.add("fight.direction"); - } - if (f.noswingCheck) - { - s.add("fight.noswing"); - } - if (f.reachCheck) - { - s.add("fight.reach"); - } - if (f.speedCheck) - { - s.add("fight.speed"); - } - if (f.godmodeCheck) - { - s.add("fight.godmode"); - } - if (f.instanthealCheck) - { - s.add("fight.instantHeal"); - } - return s; - } -} diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/fight/FightConfig.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/fight/FightConfig.java deleted file mode 100644 index 9a36128ae..000000000 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/fight/FightConfig.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.earth2me.essentials.anticheat.checks.fight; - -import com.earth2me.essentials.anticheat.ConfigItem; -import com.earth2me.essentials.anticheat.actions.types.ActionList; -import com.earth2me.essentials.anticheat.config.ConfPaths; -import com.earth2me.essentials.anticheat.config.NoCheatConfiguration; -import com.earth2me.essentials.anticheat.config.Permissions; - - -/** - * Configurations specific for the "Fight" checks Every world gets one of these assigned to it, or if a world doesn't - * get it's own, it will use the "global" version - * - */ -public class FightConfig implements ConfigItem -{ - public final boolean directionCheck; - public final double directionPrecision; - public final ActionList directionActions; - public final long directionPenaltyTime; - public final boolean noswingCheck; - public final ActionList noswingActions; - public final boolean reachCheck; - public final double reachLimit; - public final long reachPenaltyTime; - public final ActionList reachActions; - public final int speedAttackLimit; - public final ActionList speedActions; - public final boolean speedCheck; - public final boolean godmodeCheck; - public final ActionList godmodeActions; - public final boolean instanthealCheck; - public final ActionList instanthealActions; - - public FightConfig(NoCheatConfiguration data) - { - - directionCheck = data.getBoolean(ConfPaths.FIGHT_DIRECTION_CHECK); - directionPrecision = ((double)(data.getInt(ConfPaths.FIGHT_DIRECTION_PRECISION))) / 100D; - directionPenaltyTime = data.getInt(ConfPaths.FIGHT_DIRECTION_PENALTYTIME); - directionActions = data.getActionList(ConfPaths.FIGHT_DIRECTION_ACTIONS, Permissions.FIGHT_DIRECTION); - noswingCheck = data.getBoolean(ConfPaths.FIGHT_NOSWING_CHECK); - noswingActions = data.getActionList(ConfPaths.FIGHT_NOSWING_ACTIONS, Permissions.FIGHT_NOSWING); - reachCheck = data.getBoolean(ConfPaths.FIGHT_REACH_CHECK); - reachLimit = ((double)(data.getInt(ConfPaths.FIGHT_REACH_LIMIT))) / 100D; - reachPenaltyTime = data.getInt(ConfPaths.FIGHT_REACH_PENALTYTIME); - reachActions = data.getActionList(ConfPaths.FIGHT_REACH_ACTIONS, Permissions.FIGHT_REACH); - speedCheck = data.getBoolean(ConfPaths.FIGHT_SPEED_CHECK); - speedActions = data.getActionList(ConfPaths.FIGHT_SPEED_ACTIONS, Permissions.FIGHT_SPEED); - speedAttackLimit = data.getInt(ConfPaths.FIGHT_SPEED_ATTACKLIMIT); - - godmodeCheck = data.getBoolean(ConfPaths.FIGHT_GODMODE_CHECK); - godmodeActions = data.getActionList(ConfPaths.FIGHT_GODMODE_ACTIONS, Permissions.FIGHT_GODMODE); - - instanthealCheck = data.getBoolean(ConfPaths.FIGHT_INSTANTHEAL_CHECK); - instanthealActions = data.getActionList(ConfPaths.FIGHT_INSTANTHEAL_ACTIONS, Permissions.FIGHT_INSTANTHEAL); - } -} diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/fight/FightData.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/fight/FightData.java deleted file mode 100644 index 9f3a5a5d4..000000000 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/fight/FightData.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.earth2me.essentials.anticheat.checks.fight; - -import com.earth2me.essentials.anticheat.DataItem; -import net.minecraft.server.Entity; - - -/** - * Player specific data for the fight checks - * - */ -public class FightData implements DataItem -{ - // Keep track of the violation levels of the checks - public double directionVL; - public double noswingVL; - public double reachVL; - public int speedVL; - public double godmodeVL; - public double instanthealVL; - // For checks that have penalty time - public long directionLastViolationTime; - public long reachLastViolationTime; - // godmode check needs to know these - public long godmodeLastDamageTime; - public int godmodeLastAge; - public int godmodeBuffer = 40; - // last time player regenerated health by satiation - public long instanthealLastRegenTime; - // three seconds buffer to smooth out lag - public long instanthealBuffer = 3000; - // While handling an event, use this to keep the attacked entity - public Entity damagee; - // The player swung his arm - public boolean armswung = true; - // For some reason the next event should be ignored - public boolean skipNext = false; - // Keep track of time and amount of attacks - public long speedTime; - public int speedAttackCount; -} diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/fight/GodmodeCheck.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/fight/GodmodeCheck.java deleted file mode 100644 index cd0fd6aaa..000000000 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/fight/GodmodeCheck.java +++ /dev/null @@ -1,151 +0,0 @@ -package com.earth2me.essentials.anticheat.checks.fight; - -import com.earth2me.essentials.anticheat.NoCheat; -import com.earth2me.essentials.anticheat.NoCheatPlayer; -import com.earth2me.essentials.anticheat.actions.ParameterName; -import com.earth2me.essentials.anticheat.config.Permissions; -import com.earth2me.essentials.anticheat.data.Statistics; -import java.util.Locale; -import net.minecraft.server.EntityPlayer; -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.entity.CraftPlayer; - - -/** - * The Godmode Check will find out if a player tried to stay invulnerable after being hit or after dying - * - */ -public class GodmodeCheck extends FightCheck -{ - public GodmodeCheck(NoCheat plugin) - { - super(plugin, "fight.godmode", Permissions.FIGHT_GODMODE); - } - - @Override - public boolean check(NoCheatPlayer player, FightData data, FightConfig cc) - { - - boolean cancelled = false; - - long time = System.currentTimeMillis(); - - // Check at most once a second - if (data.godmodeLastDamageTime + 1000L < time) - { - data.godmodeLastDamageTime = time; - - // How old is the player now? - int age = player.getTicksLived(); - // How much older did he get? - int ageDiff = Math.max(0, age - data.godmodeLastAge); - // Is he invulnerable? - int nodamageTicks = player.getPlayer().getNoDamageTicks(); - - if (nodamageTicks > 0 && ageDiff < 15) - { - // He is invulnerable and didn't age fast enough, that costs - // some points - data.godmodeBuffer -= (15 - ageDiff); - - // Still points left? - if (data.godmodeBuffer <= 0) - { - // No, that means VL and statistics increased - data.godmodeVL -= data.godmodeBuffer; - incrementStatistics(player, Statistics.Id.FI_GODMODE, -data.godmodeBuffer); - - // Execute whatever actions are associated with this check and the - // violation level and find out if we should cancel the event - cancelled = executeActions(player, cc.godmodeActions, data.godmodeVL); - } - } - else - { - // Give some new points, once a second - data.godmodeBuffer += 15; - data.godmodeVL *= 0.95; - } - - if (data.godmodeBuffer < 0) - { - // Can't have less than 0 - data.godmodeBuffer = 0; - } - else if (data.godmodeBuffer > 30) - { - // And 30 is enough for simple lag situations - data.godmodeBuffer = 30; - } - - // Start age counting from a new time - data.godmodeLastAge = age; - } - - return cancelled; - } - - @Override - public boolean isEnabled(FightConfig cc) - { - return cc.godmodeCheck; - } - - @Override - public String getParameter(ParameterName wildcard, NoCheatPlayer player) - { - - if (wildcard == ParameterName.VIOLATIONS) - { - return String.format(Locale.US, "%d", (int)getData(player).godmodeVL); - } - else - { - return super.getParameter(wildcard, player); - } - } - - /** - * If a player apparently died, make sure he really dies after some time if he didn't already, by setting up a - * Bukkit task - * - * @param player The player - */ - public void death(CraftPlayer player) - { - // First check if the player is really dead (e.g. another plugin could - // have just fired an artificial event) - if (player.getHealth() <= 0 && player.isDead()) - { - try - { - final EntityPlayer entity = player.getHandle(); - - // Schedule a task to be executed in roughly 1.5 seconds - Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() - { - public void run() - { - try - { - // Check again if the player should be dead, and - // if the game didn't mark him as dead - if (entity.getHealth() <= 0 && !entity.dead) - { - // Artifically "kill" him - entity.deathTicks = 19; - entity.a(true); - } - } - catch (Exception e) - { - } - } - }, 30); - } - catch (Exception e) - { - } - } - } -} diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/fight/InstanthealCheck.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/fight/InstanthealCheck.java deleted file mode 100644 index 33fcbfd3a..000000000 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/fight/InstanthealCheck.java +++ /dev/null @@ -1,94 +0,0 @@ -package com.earth2me.essentials.anticheat.checks.fight; - -import com.earth2me.essentials.anticheat.NoCheat; -import com.earth2me.essentials.anticheat.NoCheatPlayer; -import com.earth2me.essentials.anticheat.actions.ParameterName; -import com.earth2me.essentials.anticheat.config.Permissions; -import com.earth2me.essentials.anticheat.data.Statistics; -import java.util.Locale; - - -/** - * The instantheal Check should find out if a player tried to artificially accellerate the health regeneration by food - * - */ -public class InstanthealCheck extends FightCheck -{ - public InstanthealCheck(NoCheat plugin) - { - super(plugin, "fight.instantheal", Permissions.FIGHT_INSTANTHEAL); - } - - @Override - public boolean check(NoCheatPlayer player, FightData data, FightConfig cc) - { - - boolean cancelled = false; - - long time = System.currentTimeMillis(); - - // security check if system time ran backwards - if (data.instanthealLastRegenTime > time) - { - data.instanthealLastRegenTime = 0; - return false; - } - - long difference = time - (data.instanthealLastRegenTime + 3500L); - - data.instanthealBuffer += difference; - - if (data.instanthealBuffer < 0) - { - // Buffer has been fully consumed - // Increase vl and statistics - double vl = data.instanthealVL -= data.instanthealBuffer / 1000; - incrementStatistics(player, Statistics.Id.FI_INSTANTHEAL, vl); - - data.instanthealBuffer = 0; - - // Execute whatever actions are associated with this check and the - // violation level and find out if we should cancel the event - cancelled = executeActions(player, cc.instanthealActions, data.instanthealVL); - } - else - { - // vl gets decreased - data.instanthealVL *= 0.9; - } - - // max 2 seconds buffer - if (data.instanthealBuffer > 2000L) - { - data.instanthealBuffer = 2000L; - } - - if (!cancelled) - { - // New reference time - data.instanthealLastRegenTime = time; - } - - return cancelled; - } - - @Override - public boolean isEnabled(FightConfig cc) - { - return cc.instanthealCheck; - } - - @Override - public String getParameter(ParameterName wildcard, NoCheatPlayer player) - { - - if (wildcard == ParameterName.VIOLATIONS) - { - return String.format(Locale.US, "%d", (int)getData(player).instanthealVL); - } - else - { - return super.getParameter(wildcard, player); - } - } -} diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/fight/NoswingCheck.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/fight/NoswingCheck.java deleted file mode 100644 index 99d7ac1fd..000000000 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/fight/NoswingCheck.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.earth2me.essentials.anticheat.checks.fight; - -import com.earth2me.essentials.anticheat.NoCheat; -import com.earth2me.essentials.anticheat.NoCheatPlayer; -import com.earth2me.essentials.anticheat.actions.ParameterName; -import com.earth2me.essentials.anticheat.config.Permissions; -import com.earth2me.essentials.anticheat.data.Statistics.Id; -import java.util.Locale; - - -/** - * We require that the player moves his arm between attacks, this is what gets checked here. - * - */ -public class NoswingCheck extends FightCheck -{ - public NoswingCheck(NoCheat plugin) - { - super(plugin, "fight.noswing", Permissions.FIGHT_NOSWING); - } - - public boolean check(NoCheatPlayer player, FightData data, FightConfig cc) - { - - boolean cancel = false; - - // did he swing his arm before? - if (data.armswung) - { - // Yes, reward him with reduction of his vl - data.armswung = false; - data.noswingVL *= 0.90D; - } - else - { - // No, increase vl and statistics - data.noswingVL += 1; - incrementStatistics(player, Id.FI_NOSWING, 1); - - // Execute whatever actions are associated with this check and the - // violation level and find out if we should cancel the event - cancel = executeActions(player, cc.noswingActions, data.noswingVL); - } - - return cancel; - } - - @Override - public boolean isEnabled(FightConfig cc) - { - return cc.noswingCheck; - } - - @Override - public String getParameter(ParameterName wildcard, NoCheatPlayer player) - { - - if (wildcard == ParameterName.VIOLATIONS) - { - return String.format(Locale.US, "%d", (int)getData(player).noswingVL); - } - else - { - return super.getParameter(wildcard, player); - } - } -} diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/fight/ReachCheck.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/fight/ReachCheck.java deleted file mode 100644 index c56caed08..000000000 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/fight/ReachCheck.java +++ /dev/null @@ -1,113 +0,0 @@ -package com.earth2me.essentials.anticheat.checks.fight; - -import com.earth2me.essentials.anticheat.NoCheat; -import com.earth2me.essentials.anticheat.NoCheatPlayer; -import com.earth2me.essentials.anticheat.actions.ParameterName; -import com.earth2me.essentials.anticheat.checks.CheckUtil; -import com.earth2me.essentials.anticheat.config.Permissions; -import com.earth2me.essentials.anticheat.data.Statistics.Id; -import java.util.Locale; -import net.minecraft.server.Entity; -import net.minecraft.server.EntityComplex; -import net.minecraft.server.EntityComplexPart; - - -/** - * The reach check will find out if a player interacts with something that's too far away - * - */ -public class ReachCheck extends FightCheck -{ - public ReachCheck(NoCheat plugin) - { - super(plugin, "fight.reach", Permissions.FIGHT_REACH); - } - - public boolean check(NoCheatPlayer player, FightData data, FightConfig cc) - { - - boolean cancel = false; - - final long time = System.currentTimeMillis(); - - // Get the width of the damagee - Entity entity = data.damagee; - - // Safeguard, if entity is Giant or Ender Dragon, this check will fail - // due to giant and hard to define hitboxes - if (entity instanceof EntityComplex || entity instanceof EntityComplexPart) - { - return false; - } - - // Distance is calculated from eye location to center of targeted - // If the player is further away from his target than allowed, the - // difference will be assigned to "distance" - final double off = CheckUtil.reachCheck(player, entity.locX, entity.locY + 1.0D, entity.locZ, cc.reachLimit); - - if (off < 0.1D) - { - // Player did probably nothing wrong - // reduce violation counter to reward him - data.reachVL *= 0.80D; - } - else - { - // Player failed the check - // Increment violation counter and statistics - // This is influenced by lag, so don't do it if there was lag - if (!plugin.skipCheck()) - { - double sqrt = Math.sqrt(off); - data.reachVL += sqrt; - incrementStatistics(player, Id.FI_REACH, sqrt); - } - - // Execute whatever actions are associated with this check and the - // violation level and find out if we should cancel the event - cancel = executeActions(player, cc.reachActions, data.reachVL); - - if (cancel) - { - // if we should cancel, remember the current time too - data.reachLastViolationTime = time; - } - } - - // If the player is still in penalty time, cancel the event anyway - if (data.reachLastViolationTime + cc.reachPenaltyTime > time) - { - // A safeguard to avoid people getting stuck in penalty time - // indefinitely in case the system time of the server gets changed - if (data.reachLastViolationTime > time) - { - data.reachLastViolationTime = 0; - } - - // He is in penalty time, therefore request cancelling of the event - return true; - } - - return cancel; - } - - @Override - public boolean isEnabled(FightConfig cc) - { - return cc.reachCheck; - } - - @Override - public String getParameter(ParameterName wildcard, NoCheatPlayer player) - { - - if (wildcard == ParameterName.VIOLATIONS) - { - return String.format(Locale.US, "%d", (int)getData(player).reachVL); - } - else - { - return super.getParameter(wildcard, player); - } - } -} diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/fight/SpeedCheck.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/fight/SpeedCheck.java deleted file mode 100644 index baa7db9c5..000000000 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/fight/SpeedCheck.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.earth2me.essentials.anticheat.checks.fight; - -import com.earth2me.essentials.anticheat.NoCheat; -import com.earth2me.essentials.anticheat.NoCheatPlayer; -import com.earth2me.essentials.anticheat.actions.ParameterName; -import com.earth2me.essentials.anticheat.config.Permissions; -import com.earth2me.essentials.anticheat.data.Statistics.Id; -import java.util.Locale; - - -/** - * The speed check will find out if a player interacts with something that's too far away - * - */ -public class SpeedCheck extends FightCheck -{ - public SpeedCheck(NoCheat plugin) - { - super(plugin, "fight.speed", Permissions.FIGHT_SPEED); - } - - public boolean check(NoCheatPlayer player, FightData data, FightConfig cc) - { - - boolean cancel = false; - - final long time = System.currentTimeMillis(); - - // Check if one second has passed and reset counters and vl in that case - if (data.speedTime + 1000L <= time) - { - data.speedTime = time; - data.speedAttackCount = 0; - data.speedVL = 0; - } - - // count the attack - data.speedAttackCount++; - - // too many attacks - if (data.speedAttackCount > cc.speedAttackLimit) - { - // if there was lag, don't count it towards statistics and vl - if (!plugin.skipCheck()) - { - data.speedVL += 1; - incrementStatistics(player, Id.FI_SPEED, 1); - } - - // Execute whatever actions are associated with this check and the - // violation level and find out if we should cancel the event - cancel = executeActions(player, cc.speedActions, data.speedVL); - } - - return cancel; - } - - @Override - public boolean isEnabled(FightConfig cc) - { - return cc.speedCheck; - } - - @Override - public String getParameter(ParameterName wildcard, NoCheatPlayer player) - { - - if (wildcard == ParameterName.VIOLATIONS) - { - return String.format(Locale.US, "%d", getData(player).speedVL); - } - else if (wildcard == ParameterName.LIMIT) - { - return String.format(Locale.US, "%d", getConfig(player.getConfigurationStore()).speedAttackLimit); - } - else - { - return super.getParameter(wildcard, player); - } - } -} diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/inventory/DropCheck.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/inventory/DropCheck.java deleted file mode 100644 index 2e9d030f7..000000000 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/inventory/DropCheck.java +++ /dev/null @@ -1,71 +0,0 @@ -package com.earth2me.essentials.anticheat.checks.inventory; - -import com.earth2me.essentials.anticheat.NoCheat; -import com.earth2me.essentials.anticheat.NoCheatPlayer; -import com.earth2me.essentials.anticheat.actions.ParameterName; -import com.earth2me.essentials.anticheat.data.Statistics.Id; -import java.util.Locale; - - -/** - * The DropCheck will find out if a player drops too many items within a short amount of time - * - */ -public class DropCheck extends InventoryCheck -{ - public DropCheck(NoCheat plugin) - { - super(plugin, "inventory.drop"); - } - - public boolean check(NoCheatPlayer player, InventoryData data, InventoryConfig cc) - { - - boolean cancel = false; - - final long time = System.currentTimeMillis(); - - // Has the configured time passed? If so, reset the counter - if (data.dropLastTime + cc.dropTimeFrame <= time) - { - data.dropLastTime = time; - data.dropCount = 0; - data.dropVL = 0; - } - // Security check, if the system time changes - else if (data.dropLastTime > time) - { - data.dropLastTime = Integer.MIN_VALUE; - } - - data.dropCount++; - - // The player dropped more than he should - if (data.dropCount > cc.dropLimit) - { - // Set vl and increment statistics - data.dropVL = data.dropCount - cc.dropLimit; - incrementStatistics(player, Id.INV_DROP, 1); - - // Execute whatever actions are associated with this check and the - // violation level and find out if we should cancel the event - cancel = executeActions(player, cc.dropActions, data.dropVL); - } - - return cancel; - } - - @Override - public String getParameter(ParameterName wildcard, NoCheatPlayer player) - { - - if (wildcard == ParameterName.VIOLATIONS) - { - return String.format(Locale.US, "%d", getData(player).dropVL); - } - else - { - return super.getParameter(wildcard, player); - } - } -} diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/inventory/InstantBowCheck.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/inventory/InstantBowCheck.java deleted file mode 100644 index 7d4fcf3bb..000000000 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/inventory/InstantBowCheck.java +++ /dev/null @@ -1,72 +0,0 @@ -package com.earth2me.essentials.anticheat.checks.inventory; - -import com.earth2me.essentials.anticheat.NoCheat; -import com.earth2me.essentials.anticheat.NoCheatPlayer; -import com.earth2me.essentials.anticheat.actions.ParameterName; -import com.earth2me.essentials.anticheat.data.Statistics.Id; -import java.util.Locale; -import org.bukkit.event.entity.EntityShootBowEvent; - - -/** - * The InstantBowCheck will find out if a player pulled the string of his bow too fast - */ -public class InstantBowCheck extends InventoryCheck -{ - public InstantBowCheck(NoCheat plugin) - { - super(plugin, "inventory.instantbow"); - } - - public boolean check(NoCheatPlayer player, EntityShootBowEvent event, InventoryData data, InventoryConfig cc) - { - - boolean cancelled = false; - - long time = System.currentTimeMillis(); - - // How fast will the arrow be? - float bowForce = event.getForce(); - - // Rough estimation of how long pulling the string should've taken - long expectedTimeWhenStringDrawn = data.lastBowInteractTime + (int)(bowForce * bowForce * 700F); - - if (expectedTimeWhenStringDrawn < time) - { - // The player was slow enough, reward him by lowering the vl - data.instantBowVL *= 0.90D; - } - else if (data.lastBowInteractTime > time) - { - // Security check if time ran backwards, reset - data.lastBowInteractTime = 0; - } - else - { - // Player was too fast, increase violation level and statistics - int vl = ((int)(expectedTimeWhenStringDrawn - time)) / 100; - data.instantBowVL += vl; - incrementStatistics(player, Id.INV_BOW, vl); - - // Execute whatever actions are associated with this check and the - // violation level and find out if we should cancel the event - cancelled = executeActions(player, cc.bowActions, data.instantBowVL); - } - - return cancelled; - } - - @Override - public String getParameter(ParameterName wildcard, NoCheatPlayer player) - { - - if (wildcard == ParameterName.VIOLATIONS) - { - return String.format(Locale.US, "%d", getData(player).instantBowVL); - } - else - { - return super.getParameter(wildcard, player); - } - } -} diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/inventory/InstantEatCheck.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/inventory/InstantEatCheck.java deleted file mode 100644 index 05a668dd7..000000000 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/inventory/InstantEatCheck.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.earth2me.essentials.anticheat.checks.inventory; - -import com.earth2me.essentials.anticheat.NoCheat; -import com.earth2me.essentials.anticheat.NoCheatPlayer; -import com.earth2me.essentials.anticheat.actions.ParameterName; -import com.earth2me.essentials.anticheat.data.Statistics.Id; -import java.util.Locale; -import org.bukkit.event.entity.FoodLevelChangeEvent; - - -/** - * The InstantEatCheck will find out if a player eats his food too fast - */ -public class InstantEatCheck extends InventoryCheck -{ - public InstantEatCheck(NoCheat plugin) - { - super(plugin, "inventory.instanteat"); - } - - public boolean check(NoCheatPlayer player, FoodLevelChangeEvent event, InventoryData data, InventoryConfig cc) - { - - // Hunger level change seems to not be the result of eating - if (data.foodMaterial == null || event.getFoodLevel() <= player.getPlayer().getFoodLevel()) - { - return false; - } - - boolean cancelled = false; - - long time = System.currentTimeMillis(); - // rough estimation about how long it should take to eat - long expectedTimeWhenEatingFinished = data.lastEatInteractTime + 700; - - if (expectedTimeWhenEatingFinished < time) - { - // Acceptable, reduce VL to reward the player - data.instantEatVL *= 0.60D; - } - else if (data.lastEatInteractTime > time) - { - // Security test, if time ran backwards, reset - data.lastEatInteractTime = 0; - } - else - { - // Player was too fast, increase violation level and statistics - int vl = ((int)(expectedTimeWhenEatingFinished - time)) / 100; - data.instantEatVL += vl; - incrementStatistics(player, Id.INV_EAT, vl); - - // Execute whatever actions are associated with this check and the - // violation level and find out if we should cancel the event - cancelled = executeActions(player, cc.eatActions, data.instantEatVL); - } - - return cancelled; - } - - @Override - public String getParameter(ParameterName wildcard, NoCheatPlayer player) - { - - if (wildcard == ParameterName.VIOLATIONS) - { - return String.format(Locale.US, "%d", (int)getData(player).instantEatVL); - } - else if (wildcard == ParameterName.FOOD) - { - return getData(player).foodMaterial.toString(); - } - else - { - return super.getParameter(wildcard, player); - } - } -} diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/inventory/InventoryCheck.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/inventory/InventoryCheck.java deleted file mode 100644 index ad60ffa3e..000000000 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/inventory/InventoryCheck.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.earth2me.essentials.anticheat.checks.inventory; - -import com.earth2me.essentials.anticheat.NoCheat; -import com.earth2me.essentials.anticheat.NoCheatPlayer; -import com.earth2me.essentials.anticheat.checks.Check; -import com.earth2me.essentials.anticheat.config.ConfigurationCacheStore; -import com.earth2me.essentials.anticheat.data.DataStore; - - -/** - * Abstract base class for Inventory checks, provides some convenience methods for access to data and config that's - * relevant to this checktype - */ -public abstract class InventoryCheck extends Check -{ - private static final String id = "inventory"; - - public InventoryCheck(NoCheat plugin, String name) - { - super(plugin, id, name); - } - - /** - * Get the "InventoryData" object that belongs to the player. Will ensure that such a object exists and if not, - * create one - * - * @param player - * @return - */ - public static InventoryData getData(NoCheatPlayer player) - { - DataStore base = player.getDataStore(); - InventoryData data = base.get(id); - if (data == null) - { - data = new InventoryData(); - base.set(id, data); - } - return data; - } - - /** - * Get the InventoryConfig object that belongs to the world that the player currently resides in. - * - * @param player - * @return - */ - public static InventoryConfig getConfig(NoCheatPlayer player) - { - return getConfig(player.getConfigurationStore()); - } - - public static InventoryConfig getConfig(ConfigurationCacheStore cache) - { - InventoryConfig config = cache.get(id); - if (config == null) - { - config = new InventoryConfig(cache.getConfiguration()); - cache.set(id, config); - } - return config; - } -} diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/inventory/InventoryCheckListener.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/inventory/InventoryCheckListener.java deleted file mode 100644 index f42a37185..000000000 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/inventory/InventoryCheckListener.java +++ /dev/null @@ -1,196 +0,0 @@ -package com.earth2me.essentials.anticheat.checks.inventory; - -import com.earth2me.essentials.anticheat.EventManager; -import com.earth2me.essentials.anticheat.NoCheat; -import com.earth2me.essentials.anticheat.NoCheatPlayer; -import com.earth2me.essentials.anticheat.checks.CheckUtil; -import com.earth2me.essentials.anticheat.config.ConfigurationCacheStore; -import com.earth2me.essentials.anticheat.config.Permissions; -import java.util.LinkedList; -import java.util.List; -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.Action; -import org.bukkit.event.entity.EntityShootBowEvent; -import org.bukkit.event.entity.FoodLevelChangeEvent; -import org.bukkit.event.player.PlayerDropItemEvent; -import org.bukkit.event.player.PlayerInteractEvent; - - -/** - * Central location to listen to events that are relevant for the inventory checks - * - */ -public class InventoryCheckListener implements Listener, EventManager -{ - private final DropCheck dropCheck; - private final InstantBowCheck instantBowCheck; - private final InstantEatCheck instantEatCheck; - private final NoCheat plugin; - - public InventoryCheckListener(NoCheat plugin) - { - - this.dropCheck = new DropCheck(plugin); - this.instantBowCheck = new InstantBowCheck(plugin); - this.instantEatCheck = new InstantEatCheck(plugin); - - this.plugin = plugin; - } - - /** - * We listen to DropItem Event for the dropCheck - * - * @param event The PlayerDropItem Event - */ - @EventHandler(priority = EventPriority.LOWEST) - protected void handlePlayerDropItemEvent(final PlayerDropItemEvent event) - { - - if (event.isCancelled() || event.getPlayer().isDead()) - { - return; - } - - boolean cancelled = false; - - final NoCheatPlayer player = plugin.getPlayer(event.getPlayer()); - final InventoryConfig cc = InventoryCheck.getConfig(player); - final InventoryData data = InventoryCheck.getData(player); - - // If it should be executed, do it - if (cc.dropCheck && !player.hasPermission(Permissions.INVENTORY_DROP)) - { - cancelled = dropCheck.check(player, data, cc); - } - - if (cancelled) - { - // Cancelling drop events is not save (in certain circumstances - // items will disappear completely). So don't do it and kick - // players instead by default - // event.setCancelled(true); - } - } - - /** - * We listen to PlayerInteractEvent for the instantEat and instantBow checks - * - * @param event The PlayerInteractEvent - */ - @EventHandler(priority = EventPriority.LOWEST) - public void interact(final PlayerInteractEvent event) - { - - // Only interested in right-clicks while holding an item - if (!event.hasItem() || !(event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK)) - { - return; - } - - NoCheatPlayer player = plugin.getPlayer(event.getPlayer()); - final InventoryData data = InventoryCheck.getData(player); - - if (event.getItem().getType() == Material.BOW) - { - // It was a bow, the player starts to pull the string - // Remember this time - data.lastBowInteractTime = System.currentTimeMillis(); - } - else if (CheckUtil.isFood(event.getItem())) - { - // It was food, the player starts to eat some food - // Remember this time and the type of food - data.foodMaterial = event.getItem().getType(); - data.lastEatInteractTime = System.currentTimeMillis(); - } - else - { - // Nothing that we are interested in, reset data - data.lastBowInteractTime = 0; - data.lastEatInteractTime = 0; - data.foodMaterial = null; - } - } - - /** - * We listen to FoodLevelChange Event because Bukkit doesn't provide a PlayerFoodEating Event (or whatever it would - * be called). - * - * @param event The FoodLevelChangeEvent - */ - @EventHandler(priority = EventPriority.LOWEST) - public void foodchanged(final FoodLevelChangeEvent event) - { - // Only if a player ate food - if (!event.isCancelled() && event.getEntity() instanceof Player) - { - final NoCheatPlayer player = plugin.getPlayer((Player)event.getEntity()); - final InventoryConfig cc = InventoryCheck.getConfig(player); - final InventoryData data = InventoryCheck.getData(player); - - // Only if he should get checked - if (cc.eatCheck && !player.hasPermission(Permissions.INVENTORY_INSTANTEAT)) - { - - boolean cancelled = instantEatCheck.check(player, event, data, cc); - - // The check requested the foodlevelchange to get cancelled - event.setCancelled(cancelled); - } - - // Forget the food material, as the info is no longer needed - data.foodMaterial = null; - } - - } - - /** - * We listen to EntityShootBowEvent for the instantbow check - * - * @param event The EntityShootBowEvent - */ - @EventHandler(priority = EventPriority.LOWEST) - public void bowfired(final EntityShootBowEvent event) - { - // Only if a player shot the arrow - if (!event.isCancelled() && event.getEntity() instanceof Player) - { - final NoCheatPlayer player = plugin.getPlayer((Player)event.getEntity()); - final InventoryConfig cc = InventoryCheck.getConfig(player); - - // Only if he should get checked - if (cc.bowCheck && !player.hasPermission(Permissions.INVENTORY_INSTANTBOW)) - { - final InventoryData data = InventoryCheck.getData(player); - boolean cancelled = instantBowCheck.check(player, event, data, cc); - - // The check requested the bowshooting to get cancelled - event.setCancelled(cancelled); - } - } - } - - public List<String> getActiveChecks(ConfigurationCacheStore cc) - { - LinkedList<String> s = new LinkedList<String>(); - - InventoryConfig i = InventoryCheck.getConfig(cc); - if (i.dropCheck) - { - s.add("inventory.dropCheck"); - } - if (i.bowCheck) - { - s.add("inventory.instantbow"); - } - if (i.eatCheck) - { - s.add("inventory.instanteat"); - } - return s; - } -} diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/inventory/InventoryConfig.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/inventory/InventoryConfig.java deleted file mode 100644 index 44f59ff04..000000000 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/inventory/InventoryConfig.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.earth2me.essentials.anticheat.checks.inventory; - -import com.earth2me.essentials.anticheat.ConfigItem; -import com.earth2me.essentials.anticheat.actions.types.ActionList; -import com.earth2me.essentials.anticheat.config.ConfPaths; -import com.earth2me.essentials.anticheat.config.NoCheatConfiguration; -import com.earth2me.essentials.anticheat.config.Permissions; - - -/** - * Configurations specific for the "Inventory" checks Every world gets one of these assigned to it, or if a world - * doesn't get it's own, it will use the "global" version - * - */ -public class InventoryConfig implements ConfigItem -{ - public final boolean dropCheck; - public final long dropTimeFrame; - public final int dropLimit; - public final ActionList dropActions; - public final boolean bowCheck; - public final ActionList bowActions; - public final boolean eatCheck; - public final ActionList eatActions; - - public InventoryConfig(NoCheatConfiguration data) - { - - dropCheck = data.getBoolean(ConfPaths.INVENTORY_DROP_CHECK); - dropTimeFrame = data.getInt(ConfPaths.INVENTORY_DROP_TIMEFRAME) * 1000; - dropLimit = data.getInt(ConfPaths.INVENTORY_DROP_LIMIT); - dropActions = data.getActionList(ConfPaths.INVENTORY_DROP_ACTIONS, Permissions.INVENTORY_DROP); - - bowCheck = data.getBoolean(ConfPaths.INVENTORY_INSTANTBOW_CHECK); - bowActions = data.getActionList(ConfPaths.INVENTORY_INSTANTBOW_ACTIONS, Permissions.INVENTORY_INSTANTBOW); - - eatCheck = data.getBoolean(ConfPaths.INVENTORY_INSTANTEAT_CHECK); - eatActions = data.getActionList(ConfPaths.INVENTORY_INSTANTEAT_ACTIONS, Permissions.INVENTORY_INSTANTEAT); - } -} diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/inventory/InventoryData.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/inventory/InventoryData.java deleted file mode 100644 index daeef8679..000000000 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/inventory/InventoryData.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.earth2me.essentials.anticheat.checks.inventory; - -import com.earth2me.essentials.anticheat.DataItem; -import org.bukkit.Material; - - -/** - * Player specific data for the inventory checks - * - */ -public class InventoryData implements DataItem -{ - // Keep track of the violation levels of the three checks - public int dropVL; - public int instantBowVL; - public double instantEatVL; - // Time and amount of dropped items - public long dropLastTime; - public int dropCount; - // Times when bow shootinhg and eating started - public long lastBowInteractTime; - public long lastEatInteractTime; - // What the player is eating - public Material foodMaterial; -} diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/moving/FlyingCheck.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/moving/FlyingCheck.java deleted file mode 100644 index c96d9f9c3..000000000 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/moving/FlyingCheck.java +++ /dev/null @@ -1,170 +0,0 @@ -package com.earth2me.essentials.anticheat.checks.moving; - -import com.earth2me.essentials.anticheat.NoCheat; -import com.earth2me.essentials.anticheat.NoCheatPlayer; -import com.earth2me.essentials.anticheat.actions.ParameterName; -import com.earth2me.essentials.anticheat.data.PreciseLocation; -import com.earth2me.essentials.anticheat.data.Statistics.Id; -import java.util.Locale; - - -/** - * A check designed for people that are allowed to fly. The complement to the "RunningCheck", which is for people that - * aren't allowed to fly, and therefore have tighter rules to obey. - * - */ -public class FlyingCheck extends MovingCheck -{ - public FlyingCheck(NoCheat plugin) - { - super(plugin, "moving.flying"); - } - // Determined by trial and error, the flying movement speed of the creative - // mode - private static final double creativeSpeed = 0.60D; - - public PreciseLocation check(NoCheatPlayer player, MovingData data, MovingConfig ccmoving) - { - - // The setBack is the location that players may get teleported to when - // they fail the check - final PreciseLocation setBack = data.runflySetBackPoint; - - final PreciseLocation from = data.from; - final PreciseLocation to = data.to; - - // If we have no setback, define one now - if (!setBack.isSet()) - { - setBack.set(from); - } - - // Used to store the location where the player gets teleported to - PreciseLocation newToLocation = null; - - // Before doing anything, do a basic height check to determine if - // players are flying too high - int maxheight = ccmoving.flyingHeightLimit + player.getPlayer().getWorld().getMaxHeight(); - - if (to.y - data.vertFreedom > maxheight) - { - newToLocation = new PreciseLocation(); - newToLocation.set(setBack); - newToLocation.y = maxheight - 10; - return newToLocation; - } - - // Calculate some distances - final double yDistance = to.y - from.y; - final double xDistance = to.x - from.x; - final double zDistance = to.z - from.z; - - // How far did the player move horizontally - final double horizontalDistance = Math.sqrt((xDistance * xDistance + zDistance * zDistance)); - - double resultHoriz = 0; - double resultVert = 0; - double result = 0; - - // In case of creative game mode give at least 0.60 speed limit horizontal - double speedLimitHorizontal = player.isCreative() ? Math.max(creativeSpeed, ccmoving.flyingSpeedLimitHorizontal) : ccmoving.flyingSpeedLimitHorizontal; - - // If the player is affected by potion of swiftness - speedLimitHorizontal *= player.getSpeedAmplifier(); - - // Finally, determine how far the player went beyond the set limits - resultHoriz = Math.max(0.0D, horizontalDistance - data.horizFreedom - speedLimitHorizontal); - - boolean sprinting = player.isSprinting(); - - data.bunnyhopdelay--; - - if (resultHoriz > 0 && sprinting) - { - - // Try to treat it as a the "bunnyhop" problem - // The bunnyhop problem is that landing and immediatly jumping - // again leads to a player moving almost twice as far in that step - if (data.bunnyhopdelay <= 0 && resultHoriz < 0.4D) - { - data.bunnyhopdelay = 9; - resultHoriz = 0; - } - } - - resultHoriz *= 100; - - // Is the player affected by the "jumping" potion - // This is really just a very, very crude estimation and far from - // reality - double jumpAmplifier = player.getJumpAmplifier(); - if (jumpAmplifier > data.lastJumpAmplifier) - { - data.lastJumpAmplifier = jumpAmplifier; - } - - double speedLimitVertical = ccmoving.flyingSpeedLimitVertical * data.lastJumpAmplifier; - - if (data.from.y >= data.to.y && data.lastJumpAmplifier > 0) - { - data.lastJumpAmplifier--; - } - - // super simple, just check distance compared to max distance vertical - resultVert = Math.max(0.0D, yDistance - data.vertFreedom - speedLimitVertical) * 100; - - result = resultHoriz + resultVert; - - // The player went to far, either horizontal or vertical - if (result > 0) - { - - // Increment violation counter and statistics - data.runflyVL += result; - if (resultHoriz > 0) - { - incrementStatistics(player, Id.MOV_RUNNING, resultHoriz); - } - - if (resultVert > 0) - { - incrementStatistics(player, Id.MOV_FLYING, resultVert); - } - - // Execute whatever actions are associated with this check and the - // violation level and find out if we should cancel the event - boolean cancel = executeActions(player, ccmoving.flyingActions, data.runflyVL); - - // Was one of the actions a cancel? Then really do it - if (cancel) - { - newToLocation = setBack; - } - } - - // Slowly reduce the violation level with each event - data.runflyVL *= 0.97; - - // If the player did not get cancelled, define a new setback point - if (newToLocation == null) - { - setBack.set(to); - } - - return newToLocation; - } - - @Override - public String getParameter(ParameterName wildcard, NoCheatPlayer player) - { - - if (wildcard == ParameterName.VIOLATIONS) - { - return String.format(Locale.US, "%d", (int)getData(player).runflyVL); - } - else - { - return super.getParameter(wildcard, player); - } - } -} diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/moving/MorePacketsCheck.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/moving/MorePacketsCheck.java deleted file mode 100644 index d5ae30340..000000000 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/moving/MorePacketsCheck.java +++ /dev/null @@ -1,132 +0,0 @@ -package com.earth2me.essentials.anticheat.checks.moving; - -import com.earth2me.essentials.anticheat.NoCheat; -import com.earth2me.essentials.anticheat.NoCheatPlayer; -import com.earth2me.essentials.anticheat.actions.ParameterName; -import com.earth2me.essentials.anticheat.data.PreciseLocation; -import com.earth2me.essentials.anticheat.data.Statistics.Id; -import java.util.Locale; - - -/** - * The morePacketsCheck (previously called SpeedhackCheck) will try to identify players that send more than the usual - * amount of move-packets to the server to be able to move faster than normal, without getting caught by the other - * checks (flying/running). - * - * It monitors the number of packets sent to the server within 1 second and compares it to the "legal" number of packets - * for that timeframe (22). - * - */ -public class MorePacketsCheck extends MovingCheck -{ - // 20 would be for perfect internet connections, 22 is good enough - private final static int packetsPerTimeframe = 22; - - public MorePacketsCheck(NoCheat plugin) - { - super(plugin, "moving.morepackets"); - } - - /** - * 1. Players get assigned a certain amount of "free" packets as a limit initially 2. Every move packet reduces that - * limit by 1 3. If more than 1 second of time passed, the limit gets increased by 22 * time in seconds, up to 50 - * and he gets a new "setback" location 4. If the player reaches limit = 0 -> teleport him back to "setback" 5. If - * there was a long pause (maybe lag), limit may be up to 100 - * - */ - public PreciseLocation check(NoCheatPlayer player, MovingData data, MovingConfig cc) - { - - PreciseLocation newToLocation = null; - - if (!data.morePacketsSetbackPoint.isSet()) - { - data.morePacketsSetbackPoint.set(data.from); - } - - long time = System.currentTimeMillis(); - - // Take a packet from the buffer - data.morePacketsBuffer--; - - // Player used up buffer, he fails the check - if (data.morePacketsBuffer < 0) - { - - data.morePacketsVL = -data.morePacketsBuffer; - incrementStatistics(player, Id.MOV_MOREPACKETS, 1); - - data.packets = -data.morePacketsBuffer; - - // Execute whatever actions are associated with this check and the - // violation level and find out if we should cancel the event - final boolean cancel = executeActions(player, cc.morePacketsActions, data.morePacketsVL); - - if (cancel) - { - newToLocation = data.morePacketsSetbackPoint; - } - } - - if (data.morePacketsLastTime + 1000 < time) - { - // More than 1 second elapsed, but how many? - double seconds = ((double)(time - data.morePacketsLastTime)) / 1000D; - - // For each second, fill the buffer - data.morePacketsBuffer += packetsPerTimeframe * seconds; - - // If there was a long pause (maybe server lag?) - // Allow buffer to grow up to 100 - if (seconds > 2) - { - if (data.morePacketsBuffer > 100) - { - data.morePacketsBuffer = 100; - } - // Else only allow growth up to 50 - } - else - { - if (data.morePacketsBuffer > 50) - { - data.morePacketsBuffer = 50; - } - } - - // Set the new "last" time - data.morePacketsLastTime = time; - - // Set the new "setback" location - if (newToLocation == null) - { - data.morePacketsSetbackPoint.set(data.from); - } - } - else if (data.morePacketsLastTime > time) - { - // Security check, maybe system time changed - data.morePacketsLastTime = time; - } - - return newToLocation; - } - - @Override - public String getParameter(ParameterName wildcard, NoCheatPlayer player) - { - - if (wildcard == ParameterName.VIOLATIONS) - { - return String.format(Locale.US, "%d", (int)getData(player).morePacketsVL); - } - else if (wildcard == ParameterName.PACKETS) - { - return String.format(Locale.US, "%d", getData(player).packets); - } - else - { - return super.getParameter(wildcard, player); - } - } -} diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/moving/MovingCheck.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/moving/MovingCheck.java deleted file mode 100644 index fed104130..000000000 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/moving/MovingCheck.java +++ /dev/null @@ -1,93 +0,0 @@ -package com.earth2me.essentials.anticheat.checks.moving; - -import com.earth2me.essentials.anticheat.NoCheat; -import com.earth2me.essentials.anticheat.NoCheatPlayer; -import com.earth2me.essentials.anticheat.actions.ParameterName; -import com.earth2me.essentials.anticheat.checks.Check; -import com.earth2me.essentials.anticheat.config.ConfigurationCacheStore; -import com.earth2me.essentials.anticheat.data.DataStore; -import com.earth2me.essentials.anticheat.data.PreciseLocation; -import java.util.Locale; - - -/** - * Abstract base class for Moving checks, provides some convenience methods for access to data and config that's - * relevant to this checktype - */ -public abstract class MovingCheck extends Check -{ - private static final String id = "moving"; - - public MovingCheck(NoCheat plugin, String name) - { - super(plugin, id, name); - } - - @Override - public String getParameter(ParameterName wildcard, NoCheatPlayer player) - { - - if (wildcard == ParameterName.LOCATION) - { - PreciseLocation from = getData(player).from; - return String.format(Locale.US, "%.2f,%.2f,%.2f", from.x, from.y, from.z); - } - else if (wildcard == ParameterName.MOVEDISTANCE) - { - PreciseLocation from = getData(player).from; - PreciseLocation to = getData(player).to; - return String.format(Locale.US, "%.2f,%.2f,%.2f", to.x - from.x, to.y - from.y, to.z - from.z); - } - else if (wildcard == ParameterName.LOCATION_TO) - { - PreciseLocation to = getData(player).to; - return String.format(Locale.US, "%.2f,%.2f,%.2f", to.x, to.y, to.z); - } - else - { - return super.getParameter(wildcard, player); - } - - } - - /** - * Get the "MovingData" object that belongs to the player. Will ensure that such a object exists and if not, create - * one - * - * @param player - * @return - */ - public static MovingData getData(NoCheatPlayer player) - { - DataStore base = player.getDataStore(); - MovingData data = base.get(id); - if (data == null) - { - data = new MovingData(); - base.set(id, data); - } - return data; - } - - /** - * Get the MovingConfig object that belongs to the world that the player currently resides in. - * - * @param player - * @return - */ - public static MovingConfig getConfig(NoCheatPlayer player) - { - return getConfig(player.getConfigurationStore()); - } - - public static MovingConfig getConfig(ConfigurationCacheStore cache) - { - MovingConfig config = cache.get(id); - if (config == null) - { - config = new MovingConfig(cache.getConfiguration()); - cache.set(id, config); - } - return config; - } -} diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/moving/MovingCheckListener.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/moving/MovingCheckListener.java deleted file mode 100644 index 31ef7c84e..000000000 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/moving/MovingCheckListener.java +++ /dev/null @@ -1,362 +0,0 @@ -package com.earth2me.essentials.anticheat.checks.moving; - -import com.earth2me.essentials.anticheat.EventManager; -import com.earth2me.essentials.anticheat.NoCheat; -import com.earth2me.essentials.anticheat.NoCheatPlayer; -import com.earth2me.essentials.anticheat.checks.CheckUtil; -import com.earth2me.essentials.anticheat.config.ConfigurationCacheStore; -import com.earth2me.essentials.anticheat.config.Permissions; -import com.earth2me.essentials.anticheat.data.PreciseLocation; -import java.util.LinkedList; -import java.util.List; -import org.bukkit.Location; -import org.bukkit.block.Block; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.Listener; -import org.bukkit.event.block.BlockPlaceEvent; -import org.bukkit.event.player.*; -import org.bukkit.util.Vector; - - -/** - * Central location to listen to events that are relevant for the moving checks - * - */ -public class MovingCheckListener implements Listener, EventManager -{ - private final MorePacketsCheck morePacketsCheck; - private final FlyingCheck flyingCheck; - private final RunningCheck runningCheck; - private final NoCheat plugin; - - public MovingCheckListener(NoCheat plugin) - { - - flyingCheck = new FlyingCheck(plugin); - runningCheck = new RunningCheck(plugin); - morePacketsCheck = new MorePacketsCheck(plugin); - - this.plugin = plugin; - } - - /** - * A workaround for players placing blocks below them getting pushed off the block by NoCheat. - * - * It essentially moves the "setbackpoint" to the top of the newly placed block, therefore tricking NoCheat into - * thinking the player was already on top of that block and should be allowed to stay there - * - * @param event The BlockPlaceEvent - */ - @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) - public void blockPlace(final BlockPlaceEvent event) - { - final NoCheatPlayer player = plugin.getPlayer(event.getPlayer()); - final MovingConfig config = MovingCheck.getConfig(player); - - // If the player is allowed to fly anyway, the workaround is not needed - // It's kind of expensive (looking up block types) therefore it makes - // sense to avoid it - if (config.allowFlying || !config.runflyCheck || player.hasPermission(Permissions.MOVING_FLYING) || player.hasPermission(Permissions.MOVING_RUNFLY)) - { - return; - } - - // Get the player-specific stored data that applies here - final MovingData data = MovingCheck.getData(player); - - final Block block = event.getBlockPlaced(); - - if (block == null || !data.runflySetBackPoint.isSet()) - { - return; - } - - // Keep some results of "expensive calls - final Location l = player.getPlayer().getLocation(); - final int playerX = l.getBlockX(); - final int playerY = l.getBlockY(); - final int playerZ = l.getBlockZ(); - final int blockY = block.getY(); - - // Was the block below the player? - if (Math.abs(playerX - block.getX()) <= 1 && Math.abs(playerZ - block.getZ()) <= 1 && playerY - blockY >= 0 && playerY - blockY <= 2) - { - // yes - final int type = CheckUtil.getType(block.getTypeId()); - if (CheckUtil.isSolid(type) || CheckUtil.isLiquid(type)) - { - if (blockY + 1 >= data.runflySetBackPoint.y) - { - data.runflySetBackPoint.y = (blockY + 1); - data.jumpPhase = 0; - } - } - } - } - - /** - * If a player gets teleported, it may have two reasons. Either it was NoCheat or another plugin. If it was NoCheat, - * the target location should match the "data.teleportTo" value. - * - * On teleports, reset some movement related data that gets invalid - * - * @param event The PlayerTeleportEvent - */ - @EventHandler(priority = EventPriority.HIGHEST) - public void teleport(final PlayerTeleportEvent event) - { - - NoCheatPlayer player = plugin.getPlayer(event.getPlayer()); - final MovingData data = MovingCheck.getData(player); - - // If it was a teleport initialized by NoCheat, do it anyway - // even if another plugin said "no" - if (data.teleportTo.isSet() && data.teleportTo.equals(event.getTo())) - { - event.setCancelled(false); - } - else - { - // Only if it wasn't NoCheat, drop data from morepackets check. - // If it was NoCheat, we don't want players to exploit the - // runfly check teleporting to get rid of the "morepackets" - // data. - data.clearMorePacketsData(); - } - - // Always drop data from runfly check, as it always loses its validity - // after teleports. Always! - data.teleportTo.reset(); - data.clearRunFlyData(); - } - - /** - * Just for security, if a player switches between worlds, reset the runfly and morepackets checks data, because it - * is definitely invalid now - * - * @param event The PlayerChangedWorldEvent - */ - @EventHandler(priority = EventPriority.MONITOR) - public void worldChange(final PlayerChangedWorldEvent event) - { - // Maybe this helps with people teleporting through multiverse portals having problems? - final MovingData data = MovingCheck.getData(plugin.getPlayer(event.getPlayer())); - data.teleportTo.reset(); - data.clearRunFlyData(); - data.clearMorePacketsData(); - } - - /** - * When a player uses a portal, all information related to the moving checks becomes invalid. - * - * @param event - */ - @EventHandler(priority = EventPriority.MONITOR) - public void portal(final PlayerPortalEvent event) - { - final MovingData data = MovingCheck.getData(plugin.getPlayer(event.getPlayer())); - data.clearMorePacketsData(); - data.clearRunFlyData(); - } - - /** - * When a player respawns, all information related to the moving checks becomes invalid. - * - * @param event - */ - @EventHandler(priority = EventPriority.MONITOR) - public void respawn(final PlayerRespawnEvent event) - { - final MovingData data = MovingCheck.getData(plugin.getPlayer(event.getPlayer())); - data.clearMorePacketsData(); - data.clearRunFlyData(); - } - - /** - * When a player moves, he will be checked for various suspicious behaviour. - * - * @param event The PlayerMoveEvent - */ - @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) - public void move(final PlayerMoveEvent event) - { - - // Don't care for vehicles - if (event.getPlayer().isInsideVehicle()) - { - return; - } - - // Don't care for movements that are very high distance or to another - // world (such that it is very likely the event data was modified by - // another plugin before we got it) - if (!event.getFrom().getWorld().equals(event.getTo().getWorld()) || event.getFrom().distanceSquared(event.getTo()) > 400) - { - return; - } - - final NoCheatPlayer player = plugin.getPlayer(event.getPlayer()); - - final MovingConfig cc = MovingCheck.getConfig(player); - final MovingData data = MovingCheck.getData(player); - - // Advance various counters and values that change per movement - // tick. They are needed to decide on how fast a player may - // move. - tickVelocities(data); - - // Remember locations - data.from.set(event.getFrom()); - final Location to = event.getTo(); - data.to.set(to); - - PreciseLocation newTo = null; - - /** - * RUNFLY CHECK SECTION * - */ - // If the player isn't handled by runfly checks - if (!cc.runflyCheck || player.hasPermission(Permissions.MOVING_RUNFLY)) - { - // Just because he is allowed now, doesn't mean he will always - // be. So forget data about the player related to moving - data.clearRunFlyData(); - } - else if (cc.allowFlying || (player.isCreative() && cc.identifyCreativeMode) || player.hasPermission(Permissions.MOVING_FLYING)) - { - // Only do the limited flying check - newTo = flyingCheck.check(player, data, cc); - } - else - { - // Go for the full treatment - newTo = runningCheck.check(player, data, cc); - } - - /** - * MOREPACKETS CHECK SECTION * - */ - if (!cc.morePacketsCheck || player.hasPermission(Permissions.MOVING_MOREPACKETS)) - { - data.clearMorePacketsData(); - } - else if (newTo == null) - { - newTo = morePacketsCheck.check(player, data, cc); - } - - // Did one of the check(s) decide we need a new "to"-location? - if (newTo != null) - { - // Compose a new location based on coordinates of "newTo" and - // viewing direction of "event.getTo()" to allow the player to - // look somewhere else despite getting pulled back by NoCheat - event.setTo(new Location(player.getPlayer().getWorld(), newTo.x, newTo.y, newTo.z, to.getYaw(), to.getPitch())); - - // remember where we send the player to - data.teleportTo.set(newTo); - } - } - - /** - * Just try to estimate velocities over time Not very precise, but works good enough most of the time. - * - * @param data - */ - private void tickVelocities(MovingData data) - { - - /** - * ****** DO GENERAL DATA MODIFICATIONS ONCE FOR EACH EVENT **** - */ - if (data.horizVelocityCounter > 0) - { - data.horizVelocityCounter--; - } - else if (data.horizFreedom > 0.001) - { - data.horizFreedom *= 0.90; - } - - if (data.vertVelocity <= 0.1) - { - data.vertVelocityCounter--; - } - if (data.vertVelocityCounter > 0) - { - data.vertFreedom += data.vertVelocity; - data.vertVelocity *= 0.90; - } - else if (data.vertFreedom > 0.001) - { - // Counter has run out, now reduce the vert freedom over time - data.vertFreedom *= 0.93; - } - } - - /** - * Player got a velocity packet. The server can't keep track of actual velocity values (by design), so we have to - * try and do that ourselves. Very rough estimates. - * - * @param event The PlayerVelocityEvent - */ - @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) - public void velocity(final PlayerVelocityEvent event) - { - final MovingData data = MovingCheck.getData(plugin.getPlayer(event.getPlayer())); - - final Vector v = event.getVelocity(); - - double newVal = v.getY(); - if (newVal >= 0.0D) - { - data.vertVelocity += newVal; - data.vertFreedom += data.vertVelocity; - } - - data.vertVelocityCounter = 50; - - newVal = Math.sqrt(Math.pow(v.getX(), 2) + Math.pow(v.getZ(), 2)); - if (newVal > 0.0D) - { - data.horizFreedom += newVal; - data.horizVelocityCounter = 30; - } - } - - public List<String> getActiveChecks(ConfigurationCacheStore cc) - { - LinkedList<String> s = new LinkedList<String>(); - - MovingConfig m = MovingCheck.getConfig(cc); - - if (m.runflyCheck) - { - - if (!m.allowFlying) - { - s.add("moving.runfly"); - if (m.sneakingCheck) - { - s.add("moving.sneaking"); - } - if (m.nofallCheck) - { - s.add("moving.nofall"); - } - } - else - { - s.add("moving.flying"); - } - - } - if (m.morePacketsCheck) - { - s.add("moving.morepackets"); - } - - return s; - } -} diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/moving/MovingConfig.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/moving/MovingConfig.java deleted file mode 100644 index 54e2834a4..000000000 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/moving/MovingConfig.java +++ /dev/null @@ -1,71 +0,0 @@ -package com.earth2me.essentials.anticheat.checks.moving; - -import com.earth2me.essentials.anticheat.ConfigItem; -import com.earth2me.essentials.anticheat.actions.types.ActionList; -import com.earth2me.essentials.anticheat.config.ConfPaths; -import com.earth2me.essentials.anticheat.config.NoCheatConfiguration; -import com.earth2me.essentials.anticheat.config.Permissions; - - -/** - * Configurations specific for the Move Checks. Every world gets one of these assigned to it. - * - */ -public class MovingConfig implements ConfigItem -{ - public final boolean runflyCheck; - public final boolean identifyCreativeMode; - public final double walkingSpeedLimit; - public final double sprintingSpeedLimit; - public final double jumpheight; - public final double swimmingSpeedLimit; - public final boolean sneakingCheck; - public final double sneakingSpeedLimit; - public final ActionList actions; - public final boolean allowFlying; - public final double flyingSpeedLimitVertical; - public final double flyingSpeedLimitHorizontal; - public final ActionList flyingActions; - public final boolean nofallCheck; - public final boolean nofallaggressive; - public final float nofallMultiplier; - public final ActionList nofallActions; - public final boolean morePacketsCheck; - public final ActionList morePacketsActions; - public final int flyingHeightLimit; - - public MovingConfig(NoCheatConfiguration data) - { - - identifyCreativeMode = data.getBoolean(ConfPaths.MOVING_RUNFLY_FLYING_ALLOWINCREATIVE); - - runflyCheck = data.getBoolean(ConfPaths.MOVING_RUNFLY_CHECK); - - int walkspeed = data.getInt(ConfPaths.MOVING_RUNFLY_WALKSPEED, 100); - int sprintspeed = data.getInt(ConfPaths.MOVING_RUNFLY_SPRINTSPEED, 100); - int swimspeed = data.getInt(ConfPaths.MOVING_RUNFLY_SWIMSPEED, 100); - int sneakspeed = data.getInt(ConfPaths.MOVING_RUNFLY_SNEAKSPEED, 100); - walkingSpeedLimit = (0.22 * walkspeed) / 100D; - sprintingSpeedLimit = (0.35 * sprintspeed) / 100D; - swimmingSpeedLimit = (0.18 * swimspeed) / 100D; - sneakingSpeedLimit = (0.14 * sneakspeed) / 100D; - jumpheight = ((double)135) / 100D; - - sneakingCheck = !data.getBoolean(ConfPaths.MOVING_RUNFLY_ALLOWFASTSNEAKING); - actions = data.getActionList(ConfPaths.MOVING_RUNFLY_ACTIONS, Permissions.MOVING_RUNFLY); - - allowFlying = data.getBoolean(ConfPaths.MOVING_RUNFLY_FLYING_ALLOWALWAYS); - flyingSpeedLimitVertical = ((double)data.getInt(ConfPaths.MOVING_RUNFLY_FLYING_SPEEDLIMITVERTICAL)) / 100D; - flyingSpeedLimitHorizontal = ((double)data.getInt(ConfPaths.MOVING_RUNFLY_FLYING_SPEEDLIMITHORIZONTAL)) / 100D; - flyingHeightLimit = data.getInt(ConfPaths.MOVING_RUNFLY_FLYING_HEIGHTLIMIT); - flyingActions = data.getActionList(ConfPaths.MOVING_RUNFLY_FLYING_ACTIONS, Permissions.MOVING_FLYING); - - nofallCheck = data.getBoolean(ConfPaths.MOVING_RUNFLY_CHECKNOFALL); - nofallMultiplier = ((float)200) / 100F; - nofallaggressive = data.getBoolean(ConfPaths.MOVING_RUNFLY_NOFALLAGGRESSIVE); - nofallActions = data.getActionList(ConfPaths.MOVING_RUNFLY_NOFALLACTIONS, Permissions.MOVING_NOFALL); - - morePacketsCheck = data.getBoolean(ConfPaths.MOVING_MOREPACKETS_CHECK); - morePacketsActions = data.getActionList(ConfPaths.MOVING_MOREPACKETS_ACTIONS, Permissions.MOVING_MOREPACKETS); - } -} diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/moving/MovingData.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/moving/MovingData.java deleted file mode 100644 index e57a59d29..000000000 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/moving/MovingData.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.earth2me.essentials.anticheat.checks.moving; - -import com.earth2me.essentials.anticheat.DataItem; -import com.earth2me.essentials.anticheat.data.PreciseLocation; -import com.earth2me.essentials.anticheat.data.Statistics.Id; - - -/** - * Player specific data for the moving check group - */ -public class MovingData implements DataItem -{ - // Keep track of the violation levels of the checks - public double runflyVL; - public double nofallVL; - public double morePacketsVL; - // Count how long a player is in the air - public int jumpPhase; - // Remember how big the players last JumpAmplifier (potion effect) was - public double lastJumpAmplifier; - // Remember for a short time that the player was on ice and therefore - // should be allowed to move a bit faster - public int onIce; - // Where should a player be teleported back to when failing the check - public final PreciseLocation runflySetBackPoint = new PreciseLocation(); - // Some values for estimating movement freedom - public double vertFreedom; - public double vertVelocity; - public int vertVelocityCounter; - public double horizFreedom; - public int horizVelocityCounter; - public double horizontalBuffer; - public int bunnyhopdelay; - // Keep track of estimated fall distance to compare to real fall distance - public float fallDistance; - public float lastAddedFallDistance; - // Keep track of when "morePackets" last time checked and how much packets - // a player sent and may send before failing the check - public long morePacketsLastTime; - public int packets; - public int morePacketsBuffer = 50; - // Where to teleport the player that fails the "morepackets" check - public final PreciseLocation morePacketsSetbackPoint = new PreciseLocation(); - // When NoCheat does teleport the player, remember the target location to - // be able to distinguish "our" teleports from teleports of others - public final PreciseLocation teleportTo = new PreciseLocation(); - // For logging and convenience, make copies of the events locations - public final PreciseLocation from = new PreciseLocation(); - public final PreciseLocation to = new PreciseLocation(); - // For convenience, remember if the locations are considered "on ground" - // by NoCheat - public boolean fromOnOrInGround; - public boolean toOnOrInGround; - public Id statisticCategory = Id.MOV_RUNNING; - - public void clearRunFlyData() - { - runflySetBackPoint.reset(); - jumpPhase = 0; - fallDistance = 0; - lastAddedFallDistance = 0; - bunnyhopdelay = 0; - } - - public void clearMorePacketsData() - { - morePacketsSetbackPoint.reset(); - } -} diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/moving/NoFallCheck.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/moving/NoFallCheck.java deleted file mode 100644 index 6a531e3c2..000000000 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/moving/NoFallCheck.java +++ /dev/null @@ -1,151 +0,0 @@ -package com.earth2me.essentials.anticheat.checks.moving; - -import com.earth2me.essentials.anticheat.NoCheat; -import com.earth2me.essentials.anticheat.NoCheatPlayer; -import com.earth2me.essentials.anticheat.actions.ParameterName; -import com.earth2me.essentials.anticheat.data.Statistics.Id; -import java.util.Locale; - - -/** - * A check to see if people cheat by tricking the server to not deal them fall damage. - * - */ -public class NoFallCheck extends MovingCheck -{ - public NoFallCheck(NoCheat plugin) - { - super(plugin, "moving.nofall"); - } - - /** - * Calculate if and how much the player "failed" this check. - * - */ - public void check(NoCheatPlayer player, MovingData data, MovingConfig cc) - { - - // If the player is serverside in creative mode, we have to stop here to - // avoid hurting him when he switches back to "normal" mode - if (player.isCreative()) - { - data.fallDistance = 0F; - data.lastAddedFallDistance = 0F; - return; - } - - // This check is pretty much always a step behind for technical reasons. - if (data.fromOnOrInGround) - { - // Start with zero fall distance - data.fallDistance = 0F; - } - - if (cc.nofallaggressive && data.fromOnOrInGround && data.toOnOrInGround && data.from.y <= data.to.y && player.getPlayer().getFallDistance() > 3.0F) - { - data.fallDistance = player.getPlayer().getFallDistance(); - data.nofallVL += data.fallDistance; - incrementStatistics(player, Id.MOV_NOFALL, data.fallDistance); - - // Execute whatever actions are associated with this check and the - // violation level and find out if we should cancel the event - final boolean cancel = executeActions(player, cc.nofallActions, data.nofallVL); - if (cancel) - { - player.dealFallDamage(); - } - data.fallDistance = 0F; - } - - // If we increased fall height before for no good reason, reduce now by - // the same amount - if (player.getPlayer().getFallDistance() > data.lastAddedFallDistance) - { - player.getPlayer().setFallDistance(player.getPlayer().getFallDistance() - data.lastAddedFallDistance); - } - - data.lastAddedFallDistance = 0; - - // We want to know if the fallDistance recorded by the game is smaller - // than the fall distance recorded by the plugin - final float difference = data.fallDistance - player.getPlayer().getFallDistance(); - - if (difference > 1.0F && data.toOnOrInGround && data.fallDistance > 2.0F) - { - data.nofallVL += difference; - incrementStatistics(player, Id.MOV_NOFALL, difference); - - // Execute whatever actions are associated with this check and the - // violation level and find out if we should cancel the event - final boolean cancel = executeActions(player, cc.nofallActions, data.nofallVL); - - // If "cancelled", the fall damage gets dealt in a way that's - // visible to other plugins - if (cancel) - { - // Increase the fall distance a bit :) - final float totalDistance = data.fallDistance + difference * (cc.nofallMultiplier - 1.0F); - - player.getPlayer().setFallDistance(totalDistance); - } - - data.fallDistance = 0F; - } - - // Increase the fall distance that is recorded by the plugin, AND set - // the fall distance of the player - // to whatever he would get with this move event. This modifies - // Minecrafts fall damage calculation - // slightly, but that's still better than ignoring players that try to - // use "teleports" or "stepdown" - // to avoid falldamage. It is only added for big height differences - // anyway, as to avoid to much deviation - // from the original Minecraft feeling. - - final double oldY = data.from.y; - final double newY = data.to.y; - - if (oldY > newY) - { - final float dist = (float)(oldY - newY); - data.fallDistance += dist; - - if (dist > 1.0F) - { - data.lastAddedFallDistance = dist; - player.getPlayer().setFallDistance(player.getPlayer().getFallDistance() + dist); - } - else - { - data.lastAddedFallDistance = 0.0F; - } - } - else - { - data.lastAddedFallDistance = 0.0F; - } - - // Reduce falldamage violation level - data.nofallVL *= 0.95D; - - return; - } - - @Override - public String getParameter(ParameterName wildcard, NoCheatPlayer player) - { - - if (wildcard == ParameterName.VIOLATIONS) - { - return String.format(Locale.US, "%d", (int)getData(player).nofallVL); - } - else if (wildcard == ParameterName.FALLDISTANCE) - { - return String.format(Locale.US, "%.2f", getData(player).fallDistance); - } - else - { - return super.getParameter(wildcard, player); - } - } -} diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/moving/RunningCheck.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/moving/RunningCheck.java deleted file mode 100644 index bb5444be9..000000000 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/checks/moving/RunningCheck.java +++ /dev/null @@ -1,303 +0,0 @@ -package com.earth2me.essentials.anticheat.checks.moving; - -import com.earth2me.essentials.anticheat.NoCheat; -import com.earth2me.essentials.anticheat.NoCheatPlayer; -import com.earth2me.essentials.anticheat.actions.ParameterName; -import com.earth2me.essentials.anticheat.checks.CheckUtil; -import com.earth2me.essentials.anticheat.config.Permissions; -import com.earth2me.essentials.anticheat.data.PreciseLocation; -import com.earth2me.essentials.anticheat.data.Statistics.Id; -import java.util.Locale; -import org.bukkit.Material; -import org.bukkit.block.Block; - - -/** - * The counterpart to the FlyingCheck. People that are not allowed to fly get checked by this. It will try to identify - * when they are jumping, check if they aren't jumping too high or far, check if they aren't moving too fast on normal - * ground, while sprinting, sneaking or swimming. - * - */ -public class RunningCheck extends MovingCheck -{ - private final static double maxBonus = 1D; - // How many move events can a player have in air before he is expected to - // lose altitude (or eventually land somewhere) - private final static int jumpingLimit = 6; - private final NoFallCheck noFallCheck; - - public RunningCheck(NoCheat plugin) - { - - super(plugin, "moving.running"); - - this.noFallCheck = new NoFallCheck(plugin); - } - - public PreciseLocation check(NoCheatPlayer player, MovingData data, MovingConfig cc) - { - - // Some shortcuts: - final PreciseLocation setBack = data.runflySetBackPoint; - final PreciseLocation to = data.to; - final PreciseLocation from = data.from; - - // Calculate some distances - final double xDistance = data.to.x - from.x; - final double zDistance = to.z - from.z; - final double horizontalDistance = Math.sqrt((xDistance * xDistance + zDistance * zDistance)); - - if (!setBack.isSet()) - { - setBack.set(from); - } - - // To know if a player "is on ground" is useful - final int fromType = CheckUtil.evaluateLocation(player.getPlayer().getWorld(), from); - final int toType = CheckUtil.evaluateLocation(player.getPlayer().getWorld(), to); - - final boolean fromOnGround = CheckUtil.isOnGround(fromType); - final boolean fromInGround = CheckUtil.isInGround(fromType); - final boolean toOnGround = CheckUtil.isOnGround(toType); - final boolean toInGround = CheckUtil.isInGround(toType); - - PreciseLocation newToLocation = null; - - final double resultHoriz = Math.max(0.0D, checkHorizontal(player, data, CheckUtil.isLiquid(fromType) && CheckUtil.isLiquid(toType), horizontalDistance, cc)); - final double resultVert = Math.max(0.0D, checkVertical(player, data, fromOnGround, toOnGround, cc)); - - final double result = (resultHoriz + resultVert) * 100; - - data.jumpPhase++; - - // Slowly reduce the level with each event - data.runflyVL *= 0.95; - - // Did the player move in unexpected ways? - if (result > 0) - { - // Increment violation counter - data.runflyVL += result; - - incrementStatistics(player, data.statisticCategory, result); - - boolean cancel = executeActions(player, cc.actions, data.runflyVL); - - // Was one of the actions a cancel? Then do it - if (cancel) - { - newToLocation = setBack; - } - else if (toOnGround || toInGround) - { - // In case it only gets logged, not stopped by NoCheat - // Update the setback location at least a bit - setBack.set(to); - data.jumpPhase = 0; - - } - } - else - { - // Decide if we should create a new setBack point - // These are the result of a lot of bug reports, experience and - // trial and error - - if ((toInGround && from.y >= to.y) || CheckUtil.isLiquid(toType)) - { - // Yes, if the player moved down "into" the ground or into liquid - setBack.set(to); - setBack.y = Math.ceil(setBack.y); - data.jumpPhase = 0; - } - else if (toOnGround && (from.y >= to.y || setBack.y <= Math.floor(to.y))) - { - // Yes, if the player moved down "onto" the ground and the new - // setback point is higher up than the old or at least at the - // same height - setBack.set(to); - setBack.y = Math.floor(setBack.y); - data.jumpPhase = 0; - } - else if (fromOnGround || fromInGround || toOnGround || toInGround) - { - // The player at least touched the ground somehow - data.jumpPhase = 0; - } - } - - /** - * ******* EXECUTE THE NOFALL CHECK ******************* - */ - final boolean checkNoFall = cc.nofallCheck && !player.hasPermission(Permissions.MOVING_NOFALL); - - if (checkNoFall && newToLocation == null) - { - data.fromOnOrInGround = fromOnGround || fromInGround; - data.toOnOrInGround = toOnGround || toInGround; - noFallCheck.check(player, data, cc); - } - - return newToLocation; - } - - /** - * Calculate how much the player failed this check - * - */ - private double checkHorizontal(final NoCheatPlayer player, final MovingData data, final boolean isSwimming, final double totalDistance, final MovingConfig cc) - { - - // How much further did the player move than expected?? - double distanceAboveLimit = 0.0D; - - // A player is considered sprinting if the flag is set and if he has - // enough food level (configurable) - final boolean sprinting = player.isSprinting() && (player.getPlayer().getFoodLevel() > 5); - - double limit = 0.0D; - - Id statisticsCategory = null; - - // Player on ice? Give him higher max speed - Block b = player.getPlayer().getLocation().getBlock(); - if (b.getType() == Material.ICE || b.getRelative(0, -1, 0).getType() == Material.ICE) - { - data.onIce = 20; - } - else if (data.onIce > 0) - { - data.onIce--; - } - - if (cc.sneakingCheck && player.getPlayer().isSneaking() && !player.hasPermission(Permissions.MOVING_SNEAKING)) - { - limit = cc.sneakingSpeedLimit; - statisticsCategory = Id.MOV_SNEAKING; - } - else if (isSwimming && !player.hasPermission(Permissions.MOVING_SWIMMING)) - { - limit = cc.swimmingSpeedLimit; - statisticsCategory = Id.MOV_SWIMMING; - } - else if (!sprinting) - { - limit = cc.walkingSpeedLimit; - statisticsCategory = Id.MOV_RUNNING; - } - else - { - limit = cc.sprintingSpeedLimit; - statisticsCategory = Id.MOV_RUNNING; - } - - if (data.onIce > 0) - { - limit *= 2.5; - } - - // Taken directly from Minecraft code, should work - limit *= player.getSpeedAmplifier(); - - distanceAboveLimit = totalDistance - limit - data.horizFreedom; - - data.bunnyhopdelay--; - - // Did he go too far? - if (distanceAboveLimit > 0 && sprinting) - { - - // Try to treat it as a the "bunnyhop" problem - if (data.bunnyhopdelay <= 0 && distanceAboveLimit > 0.05D && distanceAboveLimit < 0.4D) - { - data.bunnyhopdelay = 9; - distanceAboveLimit = 0; - } - } - - if (distanceAboveLimit > 0) - { - // Try to consume the "buffer" - distanceAboveLimit -= data.horizontalBuffer; - data.horizontalBuffer = 0; - - // Put back the "overconsumed" buffer - if (distanceAboveLimit < 0) - { - data.horizontalBuffer = -distanceAboveLimit; - } - } - // He was within limits, give the difference as buffer - else - { - data.horizontalBuffer = Math.min(maxBonus, data.horizontalBuffer - distanceAboveLimit); - } - - if (distanceAboveLimit > 0) - { - data.statisticCategory = statisticsCategory; - } - - return distanceAboveLimit; - } - - /** - * Calculate if and how much the player "failed" this check. - * - */ - private double checkVertical(final NoCheatPlayer player, final MovingData data, final boolean fromOnGround, final boolean toOnGround, final MovingConfig cc) - { - - // How much higher did the player move than expected?? - double distanceAboveLimit = 0.0D; - - // Potion effect "Jump" - double jumpAmplifier = player.getJumpAmplifier(); - if (jumpAmplifier > data.lastJumpAmplifier) - { - data.lastJumpAmplifier = jumpAmplifier; - } - - double limit = data.vertFreedom + cc.jumpheight; - - limit *= data.lastJumpAmplifier; - - if (data.jumpPhase > jumpingLimit + data.lastJumpAmplifier) - { - limit -= (data.jumpPhase - jumpingLimit) * 0.15D; - } - - distanceAboveLimit = data.to.y - data.runflySetBackPoint.y - limit; - - if (distanceAboveLimit > 0) - { - data.statisticCategory = Id.MOV_FLYING; - } - - if (toOnGround || fromOnGround) - { - data.lastJumpAmplifier = 0; - } - - return distanceAboveLimit; - } - - @Override - public String getParameter(ParameterName wildcard, NoCheatPlayer player) - { - - if (wildcard == ParameterName.CHECK) - // Workaround for something until I find a better way to do it - { - return getData(player).statisticCategory.toString(); - } - else if (wildcard == ParameterName.VIOLATIONS) - { - return String.format(Locale.US, "%d", (int)getData(player).runflyVL); - } - else - { - return super.getParameter(wildcard, player); - } - } -} diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/command/CommandHandler.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/command/CommandHandler.java deleted file mode 100644 index 075d64c73..000000000 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/command/CommandHandler.java +++ /dev/null @@ -1,163 +0,0 @@ -package com.earth2me.essentials.anticheat.command; - -import com.earth2me.essentials.anticheat.NoCheat; -import com.earth2me.essentials.anticheat.config.Permissions; -import java.util.*; -import java.util.Map.Entry; -import org.bukkit.command.Command; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; -import org.bukkit.permissions.Permission; - - -/** - * Handle all NoCheat related commands in a common place - */ -public class CommandHandler -{ - private final List<Permission> perms; - - public CommandHandler(NoCheat plugin) - { - // Make a copy to allow sorting - perms = new LinkedList<Permission>(plugin.getDescription().getPermissions()); - - // Sort NoCheats permission by name and parent-child relation with - // a custom sorting method - Collections.sort(perms, new Comparator<Permission>() - { - public int compare(Permission o1, Permission o2) - { - - String name1 = o1.getName(); - String name2 = o2.getName(); - - if (name1.equals(name2)) - { - return 0; - } - - if (name1.startsWith(name2)) - { - return 1; - } - - if (name2.startsWith(name1)) - { - return -1; - } - - return name1.compareTo(name2); - } - }); - } - - /** - * Handle a command that is directed at NoCheat - * - * @param plugin - * @param sender - * @param command - * @param label - * @param args - * @return - */ - public boolean handleCommand(NoCheat plugin, CommandSender sender, Command command, String label, String[] args) - { - - boolean result = false; - // Not our command, how did it get here? - if (!command.getName().equalsIgnoreCase("nocheat") || args.length == 0) - { - result = false; - } - else if (args[0].equalsIgnoreCase("permlist") && args.length >= 2) - { - // permlist command was used - result = handlePermlistCommand(plugin, sender, args); - - } - else if (args[0].equalsIgnoreCase("reload")) - { - // reload command was used - result = handleReloadCommand(plugin, sender); - } - else if (args[0].equalsIgnoreCase("playerinfo") && args.length >= 2) - { - // playerinfo command was used - result = handlePlayerInfoCommand(plugin, sender, args); - } - - return result; - } - - private boolean handlePlayerInfoCommand(NoCheat plugin, CommandSender sender, String[] args) - { - - Map<String, Object> map = plugin.getPlayerData(args[1]); - String filter = ""; - - if (args.length > 2) - { - filter = args[2]; - } - - sender.sendMessage("PlayerInfo for " + args[1]); - for (Entry<String, Object> entry : map.entrySet()) - { - if (entry.getKey().contains(filter)) - { - sender.sendMessage(entry.getKey() + ": " + entry.getValue()); - } - } - return true; - } - - private boolean handlePermlistCommand(NoCheat plugin, CommandSender sender, String[] args) - { - - // Get the player by name - Player player = plugin.getServer().getPlayerExact(args[1]); - if (player == null) - { - sender.sendMessage("Unknown player: " + args[1]); - return true; - } - - // Should permissions be filtered by prefix? - String prefix = ""; - if (args.length == 3) - { - prefix = args[2]; - } - - sender.sendMessage("Player " + player.getName() + " has the permission(s):"); - - for (Permission permission : perms) - { - if (permission.getName().startsWith(prefix)) - { - sender.sendMessage(permission.getName() + ": " + player.hasPermission(permission)); - } - } - return true; - } - - private boolean handleReloadCommand(NoCheat plugin, CommandSender sender) - { - - // Players need a special permission for this - if (!(sender instanceof Player) || sender.hasPermission(Permissions.ADMIN_RELOAD)) - { - sender.sendMessage("[NoCheat] Reloading configuration"); - plugin.reloadConfiguration(); - sender.sendMessage("[NoCheat] Configuration reloaded"); - } - else - { - sender.sendMessage("You lack the " + Permissions.ADMIN_RELOAD + " permission to use 'reload'"); - } - - return true; - } -} diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/config/ActionFactory.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/config/ActionFactory.java deleted file mode 100644 index 5e07661c1..000000000 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/config/ActionFactory.java +++ /dev/null @@ -1,183 +0,0 @@ -package com.earth2me.essentials.anticheat.config; - -import com.earth2me.essentials.anticheat.actions.Action; -import com.earth2me.essentials.anticheat.actions.types.*; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - - -/** - * Helps with creating Actions out of text string definitions - * - */ -public class ActionFactory -{ - private static final Map<String, Object> lib = new HashMap<String, Object>(); - - public ActionFactory(Map<String, Object> library) - { - lib.putAll(library); - } - - public Action createAction(String actionDefinition) - { - - actionDefinition = actionDefinition.toLowerCase(); - - if (actionDefinition.equals("cancel")) - { - return new SpecialAction(); - } - - if (actionDefinition.startsWith("log:")) - { - return parseLogAction(actionDefinition.split(":", 2)[1]); - } - - if (actionDefinition.startsWith("cmd:")) - { - return parseCmdAction(actionDefinition.split(":", 2)[1]); - } - - throw new IllegalArgumentException("NoCheat doesn't understand action '" + actionDefinition + "' at all"); - } - - private Action parseCmdAction(String definition) - { - String[] parts = definition.split(":"); - String name = parts[0]; - Object command = lib.get(parts[0]); - int delay = 0; - int repeat = 1; - - if (command == null) - { - throw new IllegalArgumentException("NoCheat doesn't know command '" + name + "'. Have you forgotten to define it?"); - } - - if (parts.length > 1) - { - try - { - delay = Integer.parseInt(parts[1]); - repeat = Integer.parseInt(parts[2]); - } - catch (Exception e) - { - // TODO - System.out.println("NoCheat couldn't parse details of command '" + definition + "', will use default values instead."); - delay = 0; - repeat = 1; - } - } - - return new ConsolecommandAction(name, delay, repeat, command.toString()); - } - - private Action parseLogAction(String definition) - { - String[] parts = definition.split(":"); - String name = parts[0]; - Object message = lib.get(parts[0]); - int delay = 0; - int repeat = 1; - boolean toConsole = true; - boolean toFile = true; - boolean toChat = true; - - if (message == null) - { - throw new IllegalArgumentException("NoCheat doesn't know log message '" + name + "'. Have you forgotten to define it?"); - } - - try - { - delay = Integer.parseInt(parts[1]); - repeat = Integer.parseInt(parts[2]); - toConsole = parts[3].contains("c"); - toChat = parts[3].contains("i"); - toFile = parts[3].contains("f"); - } - catch (Exception e) - { - System.out.println("NoCheat couldn't parse details of log action '" + definition + "', will use default values instead."); - e.printStackTrace(); - delay = 0; - repeat = 1; - toConsole = true; - toFile = true; - toChat = true; - } - - return new LogAction(name, delay, repeat, toChat, toConsole, toFile, message.toString()); - } - - public Action[] createActions(String... definitions) - { - List<Action> actions = new ArrayList<Action>(); - - for (String def : definitions) - { - if (def.length() == 0) - { - continue; - } - try - { - actions.add(createAction(def)); - } - catch (IllegalArgumentException e) - { - System.out.println(e.getMessage()); - actions.add(new DummyAction(def)); - } - } - - return actions.toArray(new Action[actions.size()]); - } - - public ActionList createActionList(String definition, String permission) - { - ActionList list = new ActionList(permission); - - boolean first = true; - - for (String s : definition.split("vl>")) - { - s = s.trim(); - - if (s.length() == 0) - { - first = false; - continue; - } - - try - { - Integer vl; - String def; - if (first) - { - first = false; - vl = 0; - def = s; - } - else - { - String[] listEntry = s.split("\\s+", 2); - vl = Integer.parseInt(listEntry[0]); - def = listEntry[1]; - } - list.setActions(vl, createActions(def.split("\\s+"))); - } - catch (Exception e) - { - System.out.println("NoCheat couldn't parse action definition 'vl:" + s + "'"); - } - } - - return list; - } -} diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/config/ConfPaths.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/config/ConfPaths.java deleted file mode 100644 index 66473633d..000000000 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/config/ConfPaths.java +++ /dev/null @@ -1,142 +0,0 @@ -package com.earth2me.essentials.anticheat.config; - -/** - * Paths for the configuration options Making everything final static prevents accidentially modifying any of these - * - */ -public abstract class ConfPaths -{ - // TODO - private final static String LOGGING = "logging."; - public final static String LOGGING_ACTIVE = LOGGING + "active"; - public final static String LOGGING_PREFIX = LOGGING + "prefix"; - public final static String LOGGING_FILENAME = LOGGING + "filename"; - public final static String LOGGING_LOGTOFILE = LOGGING + "file"; - public final static String LOGGING_LOGTOCONSOLE = LOGGING + "console"; - public final static String LOGGING_LOGTOINGAMECHAT = LOGGING + "ingamechat"; - public final static String LOGGING_SHOWACTIVECHECKS = LOGGING + "showactivechecks"; - public final static String LOGGING_DEBUGMESSAGES = LOGGING + "debugmessages"; - - private final static String CHECKS = "checks."; - - private final static String INVENTORY = CHECKS + "inventory."; - - private final static String INVENTORY_DROP = INVENTORY + "drop."; - public final static String INVENTORY_DROP_CHECK = INVENTORY_DROP + "active"; - public final static String INVENTORY_DROP_TIMEFRAME = INVENTORY_DROP + "time"; - public final static String INVENTORY_DROP_LIMIT = INVENTORY_DROP + "limit"; - public final static String INVENTORY_DROP_ACTIONS = INVENTORY_DROP + "actions"; - - private static final String INVENTORY_INSTANTBOW = INVENTORY + "instantbow."; - public final static String INVENTORY_INSTANTBOW_CHECK = INVENTORY_INSTANTBOW + "active"; - public static final String INVENTORY_INSTANTBOW_ACTIONS = INVENTORY_INSTANTBOW + "actions"; - - private static final String INVENTORY_INSTANTEAT = INVENTORY + "instanteat."; - public final static String INVENTORY_INSTANTEAT_CHECK = INVENTORY_INSTANTEAT + "active"; - public static final String INVENTORY_INSTANTEAT_ACTIONS = INVENTORY_INSTANTEAT + "actions"; - - private final static String MOVING = CHECKS + "moving."; - - private final static String MOVING_RUNFLY = MOVING + "runfly."; - public final static String MOVING_RUNFLY_CHECK = MOVING_RUNFLY + "active"; - - // These four are not automatically shown in the config - public final static String MOVING_RUNFLY_WALKSPEED = MOVING_RUNFLY + "walkspeed"; - public final static String MOVING_RUNFLY_SNEAKSPEED = MOVING_RUNFLY + "sneakspeed"; - public final static String MOVING_RUNFLY_SWIMSPEED = MOVING_RUNFLY + "swimspeed"; - public final static String MOVING_RUNFLY_SPRINTSPEED = MOVING_RUNFLY + "sprintspeed"; - - public final static String MOVING_RUNFLY_ALLOWFASTSNEAKING = MOVING_RUNFLY + "allowfastsneaking"; - public final static String MOVING_RUNFLY_ACTIONS = MOVING_RUNFLY + "actions"; - - public final static String MOVING_RUNFLY_CHECKNOFALL = MOVING_RUNFLY + "checknofall"; - public final static String MOVING_RUNFLY_NOFALLAGGRESSIVE = MOVING_RUNFLY + "nofallaggressivemode"; - public final static String MOVING_RUNFLY_NOFALLACTIONS = MOVING_RUNFLY + "nofallactions"; - - private final static String MOVING_RUNFLY_FLYING = MOVING_RUNFLY + "flying."; - public final static String MOVING_RUNFLY_FLYING_ALLOWALWAYS = MOVING_RUNFLY_FLYING + "allowflyingalways"; - public final static String MOVING_RUNFLY_FLYING_ALLOWINCREATIVE = MOVING_RUNFLY_FLYING + "allowflyingincreative"; - public final static String MOVING_RUNFLY_FLYING_SPEEDLIMITVERTICAL = MOVING_RUNFLY_FLYING + "flyingspeedlimitvertical"; - public final static String MOVING_RUNFLY_FLYING_SPEEDLIMITHORIZONTAL = MOVING_RUNFLY_FLYING + "flyingspeedlimithorizontal"; - public final static String MOVING_RUNFLY_FLYING_HEIGHTLIMIT = MOVING_RUNFLY_FLYING + "flyingheightlimit"; - public final static String MOVING_RUNFLY_FLYING_ACTIONS = MOVING_RUNFLY_FLYING + "actions"; - - private final static String MOVING_MOREPACKETS = MOVING + "morepackets."; - public final static String MOVING_MOREPACKETS_CHECK = MOVING_MOREPACKETS + "active"; - public final static String MOVING_MOREPACKETS_ACTIONS = MOVING_MOREPACKETS + "actions"; - - private final static String BLOCKBREAK = CHECKS + "blockbreak."; - - private final static String BLOCKBREAK_REACH = BLOCKBREAK + "reach."; - public final static String BLOCKBREAK_REACH_CHECK = BLOCKBREAK_REACH + "active"; - public final static String BLOCKBREAK_REACH_ACTIONS = BLOCKBREAK_REACH + "actions"; - - private final static String BLOCKBREAK_DIRECTION = BLOCKBREAK + "direction."; - public final static String BLOCKBREAK_DIRECTION_CHECK = BLOCKBREAK_DIRECTION + "active"; - public final static String BLOCKBREAK_DIRECTION_PRECISION = BLOCKBREAK_DIRECTION + "precision"; - public final static String BLOCKBREAK_DIRECTION_PENALTYTIME = BLOCKBREAK_DIRECTION + "penaltytime"; - public final static String BLOCKBREAK_DIRECTION_ACTIONS = BLOCKBREAK_DIRECTION + "actions"; - - private final static String BLOCKBREAK_NOSWING = BLOCKBREAK + "noswing."; - public static final String BLOCKBREAK_NOSWING_CHECK = BLOCKBREAK_NOSWING + "active"; - public static final String BLOCKBREAK_NOSWING_ACTIONS = BLOCKBREAK_NOSWING + "actions"; - - private final static String BLOCKPLACE = CHECKS + "blockplace."; - - private final static String BLOCKPLACE_REACH = BLOCKPLACE + "reach."; - public final static String BLOCKPLACE_REACH_CHECK = BLOCKPLACE_REACH + "active"; - public final static String BLOCKPLACE_REACH_ACTIONS = BLOCKPLACE_REACH + "actions"; - - private final static String BLOCKPLACE_DIRECTION = BLOCKPLACE + "direction."; - public final static String BLOCKPLACE_DIRECTION_CHECK = BLOCKPLACE_DIRECTION + "active"; - public final static String BLOCKPLACE_DIRECTION_PRECISION = BLOCKPLACE_DIRECTION + "precision"; - public final static String BLOCKPLACE_DIRECTION_PENALTYTIME = BLOCKPLACE_DIRECTION + "penaltytime"; - public final static String BLOCKPLACE_DIRECTION_ACTIONS = BLOCKPLACE_DIRECTION + "actions"; - - private final static String CHAT = CHECKS + "chat."; - - private final static String CHAT_COLOR = CHAT + "color."; - public final static String CHAT_COLOR_CHECK = CHAT_COLOR + "active"; - public final static String CHAT_COLOR_ACTIONS = CHAT_COLOR + "actions"; - - private final static String CHAT_SPAM = CHAT + "spam."; - public final static String CHAT_SPAM_CHECK = CHAT_SPAM + "active"; - public final static String CHAT_SPAM_WHITELIST = CHAT_SPAM + "whitelist"; - public final static String CHAT_SPAM_TIMEFRAME = CHAT_SPAM + "timeframe"; - public final static String CHAT_SPAM_MESSAGELIMIT = CHAT_SPAM + "messagelimit"; - public final static String CHAT_SPAM_COMMANDLIMIT = CHAT_SPAM + "commandlimit"; - public final static String CHAT_SPAM_ACTIONS = CHAT_SPAM + "actions"; - - private final static String FIGHT = CHECKS + "fight."; - - private final static String FIGHT_DIRECTION = FIGHT + "direction."; - public final static String FIGHT_DIRECTION_CHECK = FIGHT_DIRECTION + "active"; - public final static String FIGHT_DIRECTION_PRECISION = FIGHT_DIRECTION + "precision"; - public final static String FIGHT_DIRECTION_PENALTYTIME = FIGHT_DIRECTION + "penaltytime"; - public final static String FIGHT_DIRECTION_ACTIONS = FIGHT_DIRECTION + "actions"; - - private final static String FIGHT_NOSWING = FIGHT + "noswing."; - public final static String FIGHT_NOSWING_CHECK = FIGHT_NOSWING + "active"; - public final static String FIGHT_NOSWING_ACTIONS = FIGHT_NOSWING + "actions"; - - private final static String FIGHT_REACH = FIGHT + "reach."; - public static final String FIGHT_REACH_CHECK = FIGHT_REACH + "active"; - public static final String FIGHT_REACH_LIMIT = FIGHT_REACH + "distance"; - public static final String FIGHT_REACH_PENALTYTIME = FIGHT_REACH + "penaltytime"; - public static final String FIGHT_REACH_ACTIONS = FIGHT_REACH + "actions"; - - private final static String FIGHT_SPEED = FIGHT + "speed."; - public final static String FIGHT_SPEED_CHECK = FIGHT_SPEED + "active"; - public final static String FIGHT_SPEED_ATTACKLIMIT = FIGHT_SPEED + "attacklimit"; - public final static String FIGHT_SPEED_ACTIONS = FIGHT_SPEED + "actions"; - - private final static String FIGHT_GODMODE = FIGHT + "godmode."; - public static final String FIGHT_GODMODE_CHECK = FIGHT_GODMODE + "active"; - public final static String FIGHT_GODMODE_ACTIONS = FIGHT_GODMODE + "actions"; - - private final static String FIGHT_INSTANTHEAL = FIGHT + "instantheal."; - public static final String FIGHT_INSTANTHEAL_CHECK = FIGHT_INSTANTHEAL + "active"; - public final static String FIGHT_INSTANTHEAL_ACTIONS = FIGHT_INSTANTHEAL + "actions"; - - public final static String STRINGS = "strings"; -} diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/config/ConfigurationCacheStore.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/config/ConfigurationCacheStore.java deleted file mode 100644 index fa404d5ea..000000000 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/config/ConfigurationCacheStore.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.earth2me.essentials.anticheat.config; - -import com.earth2me.essentials.anticheat.ConfigItem; -import java.util.HashMap; -import java.util.Map; - - -/** - * A class to keep all configurables of the plugin associated with a world - * - */ -public class ConfigurationCacheStore -{ - public final LoggingConfig logging; - private final Map<String, ConfigItem> configMap = new HashMap<String, ConfigItem>(); - private final NoCheatConfiguration data; - - /** - * Instantiate a config cache and populate it with the data of a Config tree (and its parent tree) - */ - public ConfigurationCacheStore(NoCheatConfiguration data) - { - - logging = new LoggingConfig(data); - - this.data = data; - } - - @SuppressWarnings("unchecked") - public <T extends ConfigItem> T get(String id) - { - return (T)configMap.get(id); - } - - public void set(String id, ConfigItem config) - { - - configMap.put(id, config); - } - - public NoCheatConfiguration getConfiguration() - { - return this.data; - } -} diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/config/ConfigurationManager.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/config/ConfigurationManager.java deleted file mode 100644 index 283ad88d2..000000000 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/config/ConfigurationManager.java +++ /dev/null @@ -1,257 +0,0 @@ -package com.earth2me.essentials.anticheat.config; - -import com.earth2me.essentials.anticheat.NoCheat; -import java.io.File; -import java.io.PrintWriter; -import java.io.StringWriter; -import java.text.SimpleDateFormat; -import java.util.HashMap; -import java.util.Map; -import java.util.Map.Entry; -import java.util.logging.*; - - -/** - * Central location for everything that's described in the configuration file(s) - * - */ -public class ConfigurationManager -{ - private final static String configFileName = "config.yml"; - private final Map<String, ConfigurationCacheStore> worldnameToConfigCacheMap = new HashMap<String, ConfigurationCacheStore>(); - private FileHandler fileHandler; - private final NoCheat plugin; - - - private static class LogFileFormatter extends Formatter - { - private final SimpleDateFormat date; - - public LogFileFormatter() - { - date = new SimpleDateFormat("yy.MM.dd HH:mm:ss"); - } - - @Override - public String format(LogRecord record) - { - StringBuilder builder = new StringBuilder(); - Throwable ex = record.getThrown(); - - builder.append(date.format(record.getMillis())); - builder.append(" ["); - builder.append(record.getLevel().getLocalizedName().toUpperCase()); - builder.append("] "); - builder.append(record.getMessage()); - builder.append('\n'); - - if (ex != null) - { - StringWriter writer = new StringWriter(); - ex.printStackTrace(new PrintWriter(writer)); - builder.append(writer); - } - - return builder.toString(); - } - } - - public ConfigurationManager(NoCheat plugin, File rootConfigFolder) - { - - this.plugin = plugin; - - // Setup the real configuration - initializeConfig(rootConfigFolder); - - } - - /** - * Read the configuration file and assign either standard values or whatever is declared in the file - * - * @param configurationFile - */ - private void initializeConfig(File rootConfigFolder) - { - - // First try to obtain and parse the global config file - NoCheatConfiguration root = new NoCheatConfiguration(); - root.setDefaults(new DefaultConfiguration()); - root.options().copyDefaults(true); - root.options().copyHeader(true); - - File globalConfigFile = getGlobalConfigFile(rootConfigFolder); - - if (globalConfigFile.exists()) - { - try - { - root.load(globalConfigFile); - } - catch (Exception e) - { - e.printStackTrace(); - } - } - - try - { - root.save(globalConfigFile); - } - catch (Exception e) - { - e.printStackTrace(); - } - - root.regenerateActionLists(); - - // Create a corresponding Configuration Cache - // put the global config on the config map - worldnameToConfigCacheMap.put(null, new ConfigurationCacheStore(root)); - - plugin.setFileLogger(setupFileLogger(new File(rootConfigFolder, root.getString(ConfPaths.LOGGING_FILENAME)))); - - // Try to find world-specific config files - Map<String, File> worldFiles = getWorldSpecificConfigFiles(rootConfigFolder); - - for (Entry<String, File> worldEntry : worldFiles.entrySet()) - { - - File worldConfigFile = worldEntry.getValue(); - - NoCheatConfiguration world = new NoCheatConfiguration(); - world.setDefaults(root); - - try - { - world.load(worldConfigFile); - - worldnameToConfigCacheMap.put(worldEntry.getKey(), new ConfigurationCacheStore(world)); - - // write the config file back to disk immediately - world.save(worldConfigFile); - - } - catch (Exception e) - { - plugin.getLogger().warning("Couldn't load world-specific config for " + worldEntry.getKey()); - e.printStackTrace(); - } - - world.regenerateActionLists(); - } - } - - private static File getGlobalConfigFile(File rootFolder) - { - - File globalConfig = new File(rootFolder, configFileName); - - return globalConfig; - } - - private static Map<String, File> getWorldSpecificConfigFiles(File rootFolder) - { - - HashMap<String, File> files = new HashMap<String, File>(); - - if (rootFolder.isDirectory()) - { - for (File f : rootFolder.listFiles()) - { - if (f.isFile()) - { - String filename = f.getName(); - if (filename.matches(".+_" + configFileName + "$")) - { - // Get the first part = world name - String worldname = filename.substring(0, filename.length() - (configFileName.length() + 1)); - files.put(worldname, f); - } - } - } - } - return files; - } - - private Logger setupFileLogger(File logfile) - { - - Logger l = Logger.getAnonymousLogger(); - l.setLevel(Level.INFO); - // Ignore parent's settings - l.setUseParentHandlers(false); - for (Handler h : l.getHandlers()) - { - l.removeHandler(h); - } - - if (fileHandler != null) - { - fileHandler.close(); - l.removeHandler(fileHandler); - fileHandler = null; - } - - try - { - try - { - logfile.getParentFile().mkdirs(); - } - catch (Exception e) - { - e.printStackTrace(); - } - fileHandler = new FileHandler(logfile.getCanonicalPath(), true); - fileHandler.setLevel(Level.ALL); - fileHandler.setFormatter(new LogFileFormatter()); - - l.addHandler(fileHandler); - } - catch (Exception e) - { - e.printStackTrace(); - } - - return l; - } - - /** - * Reset the loggers and flush and close the fileHandlers to be able to use them next time without problems - */ - public void cleanup() - { - fileHandler.flush(); - fileHandler.close(); - Logger l = Logger.getLogger("NoCheat"); - l.removeHandler(fileHandler); - fileHandler = null; - } - - /** - * Get the cache of the specified world, or the default cache, if no cache exists for that world. - * - * @param worldname - * @return - */ - public ConfigurationCacheStore getConfigurationCacheForWorld(String worldname) - { - - ConfigurationCacheStore cache = worldnameToConfigCacheMap.get(worldname); - - if (cache != null) - { - return cache; - } - else - { - // Enter a reference to the cache under the new name - // to be faster in looking it up later - cache = worldnameToConfigCacheMap.get(null); - worldnameToConfigCacheMap.put(worldname, cache); - - return cache; - } - } -} diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/config/DefaultConfiguration.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/config/DefaultConfiguration.java deleted file mode 100644 index fd61cac5d..000000000 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/config/DefaultConfiguration.java +++ /dev/null @@ -1,154 +0,0 @@ -package com.earth2me.essentials.anticheat.config; - - -/** - * These are the default settings for NoCheat. They will be used in addition to/in replacement of configurations given - * in the config.yml file - * - */ -public class DefaultConfiguration extends NoCheatConfiguration -{ - public DefaultConfiguration() - { - - super(); - - this.options().header("Main configuration file for NoCheat. Read \"Instructions.txt\""); - - /** - * LOGGING * - */ - set(ConfPaths.LOGGING_ACTIVE, true); - set(ConfPaths.LOGGING_SHOWACTIVECHECKS, false); - set(ConfPaths.LOGGING_DEBUGMESSAGES, false); - set(ConfPaths.LOGGING_PREFIX, "&4NC&f: "); - set(ConfPaths.LOGGING_FILENAME, "nocheat.log"); - set(ConfPaths.LOGGING_LOGTOFILE, true); - set(ConfPaths.LOGGING_LOGTOCONSOLE, true); - set(ConfPaths.LOGGING_LOGTOINGAMECHAT, true); - - /** - * * INVENTORY ** - */ - set(ConfPaths.INVENTORY_DROP_CHECK, true); - set(ConfPaths.INVENTORY_DROP_TIMEFRAME, 20); - set(ConfPaths.INVENTORY_DROP_LIMIT, 100); - set(ConfPaths.INVENTORY_DROP_ACTIONS, "log:drop:0:1:cif cmd:kick"); - - set(ConfPaths.INVENTORY_INSTANTBOW_CHECK, true); - set(ConfPaths.INVENTORY_INSTANTBOW_ACTIONS, "log:ibow:2:5:if cancel"); - - set(ConfPaths.INVENTORY_INSTANTEAT_CHECK, true); - set(ConfPaths.INVENTORY_INSTANTEAT_ACTIONS, "log:ieat:2:5:if cancel"); - - /** - * * MOVING ** - */ - set(ConfPaths.MOVING_RUNFLY_CHECK, true); - set(ConfPaths.MOVING_RUNFLY_ALLOWFASTSNEAKING, false); - set(ConfPaths.MOVING_RUNFLY_ACTIONS, "log:moveshort:3:5:f cancel vl>100 log:moveshort:0:5:if cancel vl>400 log:movelong:0:5:cif cancel"); - - set(ConfPaths.MOVING_RUNFLY_CHECKNOFALL, true); - set(ConfPaths.MOVING_RUNFLY_NOFALLAGGRESSIVE, true); - set(ConfPaths.MOVING_RUNFLY_NOFALLACTIONS, "log:nofall:0:5:cif cancel"); - - set(ConfPaths.MOVING_RUNFLY_FLYING_ALLOWALWAYS, false); - set(ConfPaths.MOVING_RUNFLY_FLYING_ALLOWINCREATIVE, true); - set(ConfPaths.MOVING_RUNFLY_FLYING_SPEEDLIMITHORIZONTAL, 60); - set(ConfPaths.MOVING_RUNFLY_FLYING_SPEEDLIMITVERTICAL, 100); - set(ConfPaths.MOVING_RUNFLY_FLYING_HEIGHTLIMIT, 128); - set(ConfPaths.MOVING_RUNFLY_FLYING_ACTIONS, "log:moveshort:3:5:f cancel vl>100 log:moveshort:0:5:if cancel vl>400 log:movelong:0:5:cif cancel"); - - set(ConfPaths.MOVING_MOREPACKETS_CHECK, true); - set(ConfPaths.MOVING_MOREPACKETS_ACTIONS, "log:morepackets:3:2:if cancel vl>20 log:morepackets:0:2:if cancel"); - - /** - * * BLOCKBREAK ** - */ - set(ConfPaths.BLOCKBREAK_REACH_CHECK, true); - set(ConfPaths.BLOCKBREAK_REACH_ACTIONS, "cancel vl>5 log:bbreach:0:2:if cancel"); - - set(ConfPaths.BLOCKBREAK_DIRECTION_CHECK, true); - set(ConfPaths.BLOCKBREAK_DIRECTION_PRECISION, 50); - set(ConfPaths.BLOCKBREAK_DIRECTION_PENALTYTIME, 300); - set(ConfPaths.BLOCKBREAK_DIRECTION_ACTIONS, "cancel vl>10 log:bbdirection:0:5:if cancel"); - - set(ConfPaths.BLOCKBREAK_NOSWING_CHECK, true); - set(ConfPaths.BLOCKBREAK_NOSWING_ACTIONS, "log:bbnoswing:3:2:if cancel"); - - /** - * * BLOCKPLACE ** - */ - set(ConfPaths.BLOCKPLACE_REACH_CHECK, true); - set(ConfPaths.BLOCKPLACE_REACH_ACTIONS, "cancel vl>5 log:bpreach:0:2:if cancel"); - - set(ConfPaths.BLOCKPLACE_DIRECTION_CHECK, true); - set(ConfPaths.BLOCKPLACE_DIRECTION_PRECISION, 75); - set(ConfPaths.BLOCKPLACE_DIRECTION_PENALTYTIME, 100); - set(ConfPaths.BLOCKPLACE_DIRECTION_ACTIONS, "cancel vl>10 log:bpdirection:0:3:if cancel"); - - /** - * * CHAT ** - */ - set(ConfPaths.CHAT_COLOR_CHECK, true); - set(ConfPaths.CHAT_COLOR_ACTIONS, "log:color:0:1:if cancel"); - - set(ConfPaths.CHAT_SPAM_CHECK, true); - set(ConfPaths.CHAT_SPAM_WHITELIST, ""); - set(ConfPaths.CHAT_SPAM_TIMEFRAME, 3); - set(ConfPaths.CHAT_SPAM_MESSAGELIMIT, 3); - set(ConfPaths.CHAT_SPAM_COMMANDLIMIT, 12); - set(ConfPaths.CHAT_SPAM_ACTIONS, "log:spam:0:3:if cancel vl>30 log:spam:0:3:cif cancel cmd:kick"); - - /** - * * FIGHT ** - */ - set(ConfPaths.FIGHT_DIRECTION_CHECK, true); - set(ConfPaths.FIGHT_DIRECTION_PRECISION, 75); - set(ConfPaths.FIGHT_DIRECTION_PENALTYTIME, 500); - set(ConfPaths.FIGHT_DIRECTION_ACTIONS, "cancel vl>5 log:fdirection:3:5:f cancel vl>20 log:fdirection:0:5:if cancel vl>50 log:fdirection:0:5:cif cancel"); - - set(ConfPaths.FIGHT_NOSWING_CHECK, true); - set(ConfPaths.FIGHT_NOSWING_ACTIONS, "log:fnoswing:0:5:cif cancel"); - - set(ConfPaths.FIGHT_REACH_CHECK, true); - set(ConfPaths.FIGHT_REACH_LIMIT, 400); - set(ConfPaths.FIGHT_REACH_PENALTYTIME, 500); - set(ConfPaths.FIGHT_REACH_ACTIONS, "cancel vl>10 log:freach:2:5:if cancel"); - - set(ConfPaths.FIGHT_SPEED_CHECK, true); - set(ConfPaths.FIGHT_SPEED_ATTACKLIMIT, 15); - set(ConfPaths.FIGHT_SPEED_ACTIONS, "log:fspeed:0:5:if cancel"); - - set(ConfPaths.FIGHT_GODMODE_CHECK, true); - set(ConfPaths.FIGHT_GODMODE_ACTIONS, "log:fgod:2:5:if cancel"); - - set(ConfPaths.FIGHT_INSTANTHEAL_CHECK, true); - set(ConfPaths.FIGHT_INSTANTHEAL_ACTIONS, "log:fheal:1:1:if cancel"); - - set(ConfPaths.STRINGS + ".drop", "[player] failed [check]: Tried to drop more items than allowed. VL [violations]"); - set(ConfPaths.STRINGS + ".moveshort", "[player] failed [check]. VL [violations]"); - set(ConfPaths.STRINGS + ".movelong", "[player] in [world] at [location] moving to [locationto] over distance [movedistance] failed check [check]. Total violation level so far [violations]"); - set(ConfPaths.STRINGS + ".nofall", "[player] failed [check]: tried to avoid fall damage for ~[falldistance] blocks. VL [violations]"); - set(ConfPaths.STRINGS + ".morepackets", "[player] failed [check]: Sent [packets] more packets than expected. Total violation level [violations]"); - set(ConfPaths.STRINGS + ".bbreach", "[player] failed [check]: tried to interact with a block over distance [reachdistance]. VL [violations]"); - set(ConfPaths.STRINGS + ".bbdirection", "[player] failed [check]: tried to interact with a block out of line of sight. VL [violations]"); - set(ConfPaths.STRINGS + ".bbnoswing", "[player] failed [check]: Didn't swing arm. VL [violations]"); - set(ConfPaths.STRINGS + ".bpreach", "[player] failed [check]: tried to interact with a block over distance [reachdistance]. VL [violations]"); - set(ConfPaths.STRINGS + ".bpdirection", "[player] failed [check]: tried to interact with a block out of line of sight. VL [violations]"); - set(ConfPaths.STRINGS + ".color", "[player] failed [check]: Sent colored chat message '[text]'. VL [violations]"); - set(ConfPaths.STRINGS + ".spam", "[player] failed [check]: Last sent message '[text]'. VL [violations]"); - set(ConfPaths.STRINGS + ".fdirection", "[player] failed [check]: tried to interact with a block out of line of sight. VL [violations]"); - set(ConfPaths.STRINGS + ".freach", "[player] failed [check]: tried to attack entity out of reach. VL [violations]"); - set(ConfPaths.STRINGS + ".fspeed", "[player] failed [check]: tried to attack more than [limit] times per second. VL [violations]"); - set(ConfPaths.STRINGS + ".fnoswing", "[player] failed [check]: Didn't swing arm. VL [violations]"); - set(ConfPaths.STRINGS + ".fgod", "[player] failed [check]: Avoided taking damage or lagging. VL [violations]"); - set(ConfPaths.STRINGS + ".fheal", "[player] failed [check]: Tried to regenerate health faster than normal. VL [violations]"); - set(ConfPaths.STRINGS + ".ibow", "[player] failed [check]: Fires bow to fast. VL [violations]"); - set(ConfPaths.STRINGS + ".ieat", "[player] failed [check]: Eats food [food] too fast. VL [violations]"); - set(ConfPaths.STRINGS + ".kick", "kick [player]"); - - // Update internal factory based on all the new entries to the "actions" section - regenerateActionLists(); - } -} diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/config/LoggingConfig.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/config/LoggingConfig.java deleted file mode 100644 index 9875c7715..000000000 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/config/LoggingConfig.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.earth2me.essentials.anticheat.config; - - -/** - * Configurations specific for logging. Every world gets one of these. - * - */ -public class LoggingConfig -{ - public final boolean active; - public final boolean showactivechecks; - public final boolean toFile; - public final boolean toConsole; - public final boolean toChat; - public final String prefix; - public final boolean debugmessages; - - public LoggingConfig(NoCheatConfiguration data) - { - - active = data.getBoolean(ConfPaths.LOGGING_ACTIVE); - showactivechecks = data.getBoolean(ConfPaths.LOGGING_SHOWACTIVECHECKS); - debugmessages = data.getBoolean(ConfPaths.LOGGING_DEBUGMESSAGES); - prefix = data.getString(ConfPaths.LOGGING_PREFIX); - toFile = data.getBoolean(ConfPaths.LOGGING_LOGTOFILE); - toConsole = data.getBoolean(ConfPaths.LOGGING_LOGTOCONSOLE); - toChat = data.getBoolean(ConfPaths.LOGGING_LOGTOINGAMECHAT); - } -} diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/config/NoCheatConfiguration.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/config/NoCheatConfiguration.java deleted file mode 100644 index e137ff480..000000000 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/config/NoCheatConfiguration.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.earth2me.essentials.anticheat.config; - -import com.earth2me.essentials.anticheat.actions.Action; -import com.earth2me.essentials.anticheat.actions.types.ActionList; -import java.lang.reflect.Field; -import org.bukkit.configuration.MemorySection; -import org.bukkit.configuration.file.YamlConfiguration; -import org.yaml.snakeyaml.DumperOptions; - - -public class NoCheatConfiguration extends YamlConfiguration -{ - private ActionFactory factory; - - @Override - public String saveToString() - { - // Some reflection wizardry to avoid having a lot of - // linebreaks in the yml file, and get a "footer" into the file - try - { - Field op; - op = YamlConfiguration.class.getDeclaredField("yamlOptions"); - op.setAccessible(true); - DumperOptions options = (DumperOptions)op.get(this); - options.setWidth(200); - } - catch (Exception e) - { - } - - String result = super.saveToString(); - - return result; - } - - /** - * Do this after reading new data - */ - public void regenerateActionLists() - { - factory = new ActionFactory(((MemorySection)this.get(ConfPaths.STRINGS)).getValues(false)); - } - - /** - * A convenience method to get action lists from the config - * - * @param path - * @return - */ - public ActionList getActionList(String path, String permission) - { - - String value = this.getString(path); - return factory.createActionList(value, permission); - } - - /** - * Savely store ActionLists back into the yml file - * - * @param path - * @param list - */ - public void set(String path, ActionList list) - { - StringBuilder string = new StringBuilder(); - - for (int treshold : list.getTresholds()) - { - if (treshold > 0) - { - string.append(" vl>").append(treshold); - } - for (Action action : list.getActions(treshold)) - { - string.append(" ").append(action); - } - } - - set(path, string.toString().trim()); - } -} diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/config/Permissions.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/config/Permissions.java deleted file mode 100644 index cdd4ba6cd..000000000 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/config/Permissions.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.earth2me.essentials.anticheat.config; - - -/** - * The various permission nodes used by NoCheat - * - */ -public class Permissions -{ - private static final String NOCHEAT = "nocheat"; - private static final String ADMIN = NOCHEAT + ".admin"; - private static final String CHECKS = NOCHEAT + ".checks"; - private static final String MOD = NOCHEAT + ".mod"; - public static final String MOVING = CHECKS + ".moving"; - public static final String MOVING_RUNFLY = MOVING + ".runfly"; - public static final String MOVING_SWIMMING = MOVING + ".swimming"; - public static final String MOVING_SNEAKING = MOVING + ".sneaking"; - public static final String MOVING_FLYING = MOVING + ".flying"; - public static final String MOVING_NOFALL = MOVING + ".nofall"; - public static final String MOVING_MOREPACKETS = MOVING + ".morepackets"; - public static final String BLOCKBREAK = CHECKS + ".blockbreak"; - public static final String BLOCKBREAK_REACH = BLOCKBREAK + ".reach"; - public static final String BLOCKBREAK_DIRECTION = BLOCKBREAK + ".direction"; - public static final String BLOCKBREAK_NOSWING = BLOCKBREAK + ".noswing"; - public static final String BLOCKPLACE = CHECKS + ".blockplace"; - public static final String BLOCKPLACE_REACH = BLOCKPLACE + ".reach"; - public static final String BLOCKPLACE_DIRECTION = BLOCKPLACE + ".direction"; - public static final String CHAT = CHECKS + ".chat"; - public static final String CHAT_SPAM = CHAT + ".spam"; - public static final String CHAT_COLOR = CHAT + ".color"; - public static final String FIGHT = CHECKS + ".fight"; - public static final String FIGHT_DIRECTION = FIGHT + ".direction"; - public static final String FIGHT_NOSWING = FIGHT + ".noswing"; - public static final String FIGHT_REACH = FIGHT + ".reach"; - public static final String FIGHT_SPEED = FIGHT + ".speed"; - public static final String FIGHT_GODMODE = FIGHT + ".godmode"; - public static final String FIGHT_INSTANTHEAL = FIGHT + ".instantheal"; - public static final String ADMIN_CHATLOG = ADMIN + ".chatlog"; - public static final String ADMIN_COMMANDS = ADMIN + ".commands"; - public static final String ADMIN_RELOAD = ADMIN + ".reload"; - public static final String INVENTORY = CHECKS + ".inventory"; - public static final String INVENTORY_DROP = INVENTORY + ".drop"; - public static final String INVENTORY_INSTANTBOW = INVENTORY + ".instantbow"; - public static final String INVENTORY_INSTANTEAT = INVENTORY + ".instanteat"; - public static final String ZOMBES_CHEAT = MOD + ".zombes.cheat"; - public static final String ZOMBES_FLY = MOD + ".zombes.fly"; - public static final String CJB_FLY = MOD + ".cjb.fly"; - public static final String CJB_XRAY = MOD + ".cjb.xray"; - public static final String CJB_MINIMAP = MOD + ".cjb.minimap"; -} diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/data/DataStore.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/data/DataStore.java deleted file mode 100644 index 1f5b6ea71..000000000 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/data/DataStore.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.earth2me.essentials.anticheat.data; - -import com.earth2me.essentials.anticheat.DataItem; -import java.util.HashMap; -import java.util.Map; - - -public class DataStore -{ - private final Map<String, DataItem> dataMap = new HashMap<String, DataItem>(); - private final Statistics statistics = new Statistics(); - private final long timestamp = System.currentTimeMillis(); - - @SuppressWarnings("unchecked") - public <T extends DataItem> T get(String id) - { - return (T)dataMap.get(id); - } - - public void set(String id, DataItem data) - { - dataMap.put(id, data); - } - - public Map<String, Object> collectData() - { - Map<String, Object> map = statistics.get(); - map.put("nocheat.starttime", timestamp); - map.put("nocheat.endtime", System.currentTimeMillis()); - - return map; - } - - public Statistics getStatistics() - { - return statistics; - } -} diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/data/ExecutionHistory.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/data/ExecutionHistory.java deleted file mode 100644 index da57c3c50..000000000 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/data/ExecutionHistory.java +++ /dev/null @@ -1,145 +0,0 @@ -package com.earth2me.essentials.anticheat.data; - -import com.earth2me.essentials.anticheat.actions.Action; -import java.util.HashMap; -import java.util.Map; - - -/** - * Store amount of action executions for last 60 seconds for various actions - * - */ -public class ExecutionHistory -{ - private static class ExecutionHistoryEntry - { - private final int executionTimes[]; - private long lastExecution = 0; - private int totalEntries = 0; - private long lastClearedTime = 0; - - private ExecutionHistoryEntry(int monitoredTimeFrame) - { - this.executionTimes = new int[monitoredTimeFrame]; - } - - /** - * Remember an execution at the specific time - */ - private void addCounter(long time) - { - // clear out now outdated values from the array - if (time - lastClearedTime > 0) - { - // Clear the next few fields of the array - clearTimes(lastClearedTime + 1, time - lastClearedTime); - lastClearedTime = time + 1; - } - - executionTimes[(int)(time % executionTimes.length)]++; - totalEntries++; - } - - /** - * Clean parts of the array - * - * @param start - * @param length - */ - private void clearTimes(long start, long length) - { - - if (length <= 0) - { - return; // nothing to do (yet) - } - if (length > executionTimes.length) - { - length = executionTimes.length; - } - - int j = (int)start % executionTimes.length; - - for (int i = 0; i < length; i++) - { - if (j == executionTimes.length) - { - j = 0; - } - - totalEntries -= executionTimes[j]; - executionTimes[j] = 0; - - j++; - } - } - - public int getCounter() - { - return totalEntries; - } - - public long getLastExecution() - { - return lastExecution; - } - - public void setLastExecution(long time) - { - this.lastExecution = time; - } - } - // Store data between Events - // time + action + action-counter - private final Map<String, Map<Action, ExecutionHistoryEntry>> executionHistories; - - public ExecutionHistory() - { - executionHistories = new HashMap<String, Map<Action, ExecutionHistoryEntry>>(); - } - - /** - * Returns true, if the action should be executed, because all time criteria have been met. Will add a entry with - * the time to a list which will influence further requests, so only use once and remember the result - * - * @param check - * @param action - * @param time a time IN SECONDS - * @return - */ - public boolean executeAction(String check, Action action, long time) - { - - Map<Action, ExecutionHistoryEntry> executionHistory = executionHistories.get(check); - - if (executionHistory == null) - { - executionHistory = new HashMap<Action, ExecutionHistoryEntry>(); - executionHistories.put(check, executionHistory); - } - - ExecutionHistoryEntry entry = executionHistory.get(action); - - if (entry == null) - { - entry = new ExecutionHistoryEntry(60); - executionHistory.put(action, entry); - } - - // update entry - entry.addCounter(time); - - if (entry.getCounter() > action.delay) - { - // Execute action? - if (entry.getLastExecution() <= time - action.repeat) - { - // Execute action! - entry.setLastExecution(time); - return true; - } - } - - return false; - } -} diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/data/PlayerManager.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/data/PlayerManager.java deleted file mode 100644 index 7a13628c6..000000000 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/data/PlayerManager.java +++ /dev/null @@ -1,80 +0,0 @@ -package com.earth2me.essentials.anticheat.data; - -import com.earth2me.essentials.anticheat.NoCheat; -import com.earth2me.essentials.anticheat.NoCheatPlayer; -import com.earth2me.essentials.anticheat.player.NoCheatPlayerImpl; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import org.bukkit.entity.Player; - - -/** - * Provide secure access to player-specific data objects for various checks or check groups. - */ -public class PlayerManager -{ - // Store data between Events - private final Map<String, NoCheatPlayerImpl> players; - private final NoCheat plugin; - - public PlayerManager(NoCheat plugin) - { - this.players = new HashMap<String, NoCheatPlayerImpl>(); - this.plugin = plugin; - } - - /** - * Get a data object of the specified class. If none is stored yet, create one. - */ - public NoCheatPlayer getPlayer(Player player) - { - - NoCheatPlayerImpl p = this.players.get(player.getName().toLowerCase()); - - if (p == null) - { - p = new NoCheatPlayerImpl(player, plugin); - this.players.put(player.getName().toLowerCase(), p); - } - - p.setLastUsedTime(System.currentTimeMillis()); - p.refresh(player); - - return p; - } - - public void cleanDataMap() - { - long time = System.currentTimeMillis(); - List<String> removals = new ArrayList<String>(5); - - for (Entry<String, NoCheatPlayerImpl> e : this.players.entrySet()) - { - if (e.getValue().shouldBeRemoved(time)) - { - removals.add(e.getKey()); - } - } - - for (String key : removals) - { - this.players.remove(key); - } - } - - public Map<String, Object> getPlayerData(String playerName) - { - - NoCheatPlayer player = this.players.get(playerName.toLowerCase()); - - if (player != null) - { - return player.getDataStore().collectData(); - } - - return new HashMap<String, Object>(); - } -} diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/data/PreciseLocation.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/data/PreciseLocation.java deleted file mode 100644 index 5cf828c96..000000000 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/data/PreciseLocation.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.earth2me.essentials.anticheat.data; - -import org.bukkit.Location; - - -/** - * A class to store x,y,z triple data, instead of using bukkits Location objects, which can't be easily recycled - * - */ -public final class PreciseLocation -{ - public double x; - public double y; - public double z; - - public PreciseLocation() - { - reset(); - } - - public final void set(Location location) - { - x = location.getX(); - y = location.getY(); - z = location.getZ(); - } - - public final void set(PreciseLocation location) - { - x = location.x; - y = location.y; - z = location.z; - } - - public final boolean isSet() - { - return x != Double.MAX_VALUE; - } - - public final void reset() - { - x = Double.MAX_VALUE; - y = Double.MAX_VALUE; - z = Double.MAX_VALUE; - } - - public final boolean equals(Location location) - { - return location.getX() == x && location.getY() == y && location.getZ() == z; - } -} diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/data/SimpleLocation.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/data/SimpleLocation.java deleted file mode 100644 index 34923051e..000000000 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/data/SimpleLocation.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.earth2me.essentials.anticheat.data; - -import org.bukkit.Location; -import org.bukkit.block.Block; - - -/** - * To avoid constantly creating and referencing "Location" objects, which in turn reference a whole lot of other - * unnecessary stuff, rather use our own "Location" object which is easily reusable. - * - */ -public final class SimpleLocation -{ - public int x; - public int y; - public int z; - - public SimpleLocation() - { - reset(); - } - - @Override - public final boolean equals(Object object) - { - if (!(object instanceof SimpleLocation)) - { - return false; - } - - SimpleLocation simpleLocation = (SimpleLocation)object; - - if (!isSet() && !simpleLocation.isSet()) - { - return true; - } - else if (!isSet() || !simpleLocation.isSet()) - { - return false; - } - - return simpleLocation.x == x && simpleLocation.y == y && simpleLocation.z == z; - } - - @Override - public final int hashCode() - { - return x * 1000000 + y * 1000 + z; - } - - public final void set(Block block) - { - x = block.getX(); - y = block.getY(); - z = block.getZ(); - } - - public final void setLocation(Location location) - { - x = location.getBlockX(); - y = location.getBlockY(); - z = location.getBlockZ(); - } - - public final boolean isSet() - { - return x != Integer.MAX_VALUE; - } - - public final void reset() - { - x = Integer.MAX_VALUE; - y = Integer.MAX_VALUE; - z = Integer.MAX_VALUE; - } -} diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/data/Statistics.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/data/Statistics.java deleted file mode 100644 index 9c83e97d5..000000000 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/data/Statistics.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.earth2me.essentials.anticheat.data; - -import java.util.HashMap; -import java.util.Map; -import java.util.Map.Entry; -import java.util.TreeMap; - - -public class Statistics -{ - public enum Id - { - BB_DIRECTION("blockbreak.direction"), BB_NOSWING("blockbreak.noswing"), - BB_REACH("blockbreak.reach"), BP_DIRECTION("blockplace.direction"), - BP_REACH("blockplace.reach"), CHAT_COLOR("chat.color"), - CHAT_SPAM("chat.spam"), FI_DIRECTION("fight.direction"), - FI_NOSWING("fight.noswing"), FI_REACH("fight.reach"), - FI_SPEED("fight.speed"), INV_DROP("inventory.drop"), - INV_BOW("inventory.instantbow"), INV_EAT("inventory.instanteat"), - MOV_RUNNING("moving.running"), MOV_FLYING("moving.flying"), - MOV_MOREPACKETS("moving.morepackets"), MOV_NOFALL("moving.nofall"), - MOV_SNEAKING("moving.sneaking"), MOV_SWIMMING("moving.swimming"), - FI_GODMODE("fight.godmode"), FI_INSTANTHEAL("fight.instantheal"); - private final String name; - - private Id(String name) - { - this.name = name; - } - - public String toString() - { - return this.name; - } - } - private final Map<Id, Double> statisticVLs = new HashMap<Id, Double>(Id.values().length); - private final Map<Id, Integer> statisticFails = new HashMap<Id, Integer>(Id.values().length); - - public Statistics() - { - // Initialize statistic values - for (Id id : Id.values()) - { - statisticVLs.put(id, 0D); - statisticFails.put(id, 0); - } - } - - public void increment(Id id, double vl) - { - Double stored = statisticVLs.get(id); - if (stored == null) - { - stored = 0D; - } - statisticVLs.put(id, stored + vl); - - Integer failed = statisticFails.get(id); - if (failed == null) - { - failed = 0; - } - statisticFails.put(id, failed + 1); - } - - public Map<String, Object> get() - { - Map<String, Object> map = new TreeMap<String, Object>(); - - for (Entry<Id, Double> entry : statisticVLs.entrySet()) - { - map.put(entry.getKey().toString() + ".vl", entry.getValue().intValue()); - } - - for (Entry<Id, Integer> entry : statisticFails.entrySet()) - { - map.put(entry.getKey().toString() + ".failed", entry.getValue()); - } - - return map; - } -} diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/debug/ActiveCheckPrinter.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/debug/ActiveCheckPrinter.java deleted file mode 100644 index 295acb9ef..000000000 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/debug/ActiveCheckPrinter.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.earth2me.essentials.anticheat.debug; - -import com.earth2me.essentials.anticheat.EventManager; -import com.earth2me.essentials.anticheat.NoCheat; -import com.earth2me.essentials.anticheat.config.ConfigurationCacheStore; -import java.util.List; -import org.bukkit.World; - - -/** - * Prints the list of active checks per world on startup, if requested - * - */ -public class ActiveCheckPrinter -{ - public static void printActiveChecks(NoCheat plugin, List<EventManager> eventManagers) - { - - boolean introPrinted = false; - - // Print active checks for NoCheat, if needed. - for (World world : plugin.getServer().getWorlds()) - { - - StringBuilder line = new StringBuilder(" ").append(world.getName()).append(": "); - - int length = line.length(); - - ConfigurationCacheStore cc = plugin.getConfig(world); - - if (!cc.logging.showactivechecks) - { - continue; - } - - for (EventManager em : eventManagers) - { - if (em.getActiveChecks(cc).isEmpty()) - { - continue; - } - - for (String active : em.getActiveChecks(cc)) - { - line.append(active).append(' '); - } - - if (!introPrinted) - { - plugin.getLogger().info("Active Checks: "); - introPrinted = true; - } - - plugin.getServer().getLogger().info(line.toString()); - - line = new StringBuilder(length); - - for (int i = 0; i < length; i++) - { - line.append(' '); - } - } - - } - } -} diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/debug/LagMeasureTask.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/debug/LagMeasureTask.java deleted file mode 100644 index 4acb5a5f2..000000000 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/debug/LagMeasureTask.java +++ /dev/null @@ -1,99 +0,0 @@ -package com.earth2me.essentials.anticheat.debug; - -import com.earth2me.essentials.anticheat.NoCheat; -import org.bukkit.World; - - -/** - * A task running in the background that measures tick time vs. real time - * - */ -public class LagMeasureTask implements Runnable -{ - private int ingameseconds = 1; - private long lastIngamesecondTime = System.currentTimeMillis(); - private long lastIngamesecondDuration = 2000L; - private boolean skipCheck = false; - private int lagMeasureTaskId = -1; - private final NoCheat plugin; - - public LagMeasureTask(NoCheat plugin) - { - this.plugin = plugin; - } - - public void start() - { - // start measuring with a delay of 10 seconds - lagMeasureTaskId = plugin.getServer().getScheduler().scheduleSyncRepeatingTask(plugin, this, 20, 20); - } - - public void run() - { - try - { - boolean oldStatus = skipCheck; - // If the previous second took to long, skip checks during - // this second - skipCheck = lastIngamesecondDuration > 2000; - - if (plugin.getConfig((World)null).logging.debugmessages) - { - if (oldStatus != skipCheck && skipCheck) - { - plugin.getLogger().warning("detected server lag, some checks will not work."); - } - else if (oldStatus != skipCheck && !skipCheck) - { - plugin.getLogger().info("server lag seems to have stopped, reenabling checks."); - } - } - - long time = System.currentTimeMillis(); - lastIngamesecondDuration = time - lastIngamesecondTime; - if (lastIngamesecondDuration < 1000) - { - lastIngamesecondDuration = 1000; - } - else if (lastIngamesecondDuration > 3600000) - { - lastIngamesecondDuration = 3600000; // top limit of 1 - // hour per "second" - } - lastIngamesecondTime = time; - ingameseconds++; - - // Check if some data is outdated now and let it be removed - if (ingameseconds % 62 == 0) - { - plugin.cleanDataMap(); - } - } - catch (Exception e) - { - // Just prevent this thread from dying for whatever reason - } - - } - - public void cancel() - { - if (lagMeasureTaskId != -1) - { - try - { - plugin.getServer().getScheduler().cancelTask(lagMeasureTaskId); - } - catch (Exception e) - { - plugin.getLogger().warning("Couldn't cancel LagMeasureTask: " + e.getMessage()); - } - lagMeasureTaskId = -1; - } - } - - public boolean skipCheck() - { - return skipCheck; - } -} diff --git a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/player/NoCheatPlayerImpl.java b/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/player/NoCheatPlayerImpl.java deleted file mode 100644 index 07f66b375..000000000 --- a/EssentialsAntiCheat/src/com/earth2me/essentials/anticheat/player/NoCheatPlayerImpl.java +++ /dev/null @@ -1,151 +0,0 @@ -package com.earth2me.essentials.anticheat.player; - -import com.earth2me.essentials.anticheat.NoCheat; -import com.earth2me.essentials.anticheat.NoCheatPlayer; -import com.earth2me.essentials.anticheat.config.ConfigurationCacheStore; -import com.earth2me.essentials.anticheat.data.DataStore; -import com.earth2me.essentials.anticheat.data.ExecutionHistory; -import net.minecraft.server.EntityPlayer; -import net.minecraft.server.MobEffectList; -import org.bukkit.GameMode; -import org.bukkit.craftbukkit.entity.CraftPlayer; -import org.bukkit.entity.Player; - - -public class NoCheatPlayerImpl implements NoCheatPlayer -{ - private Player player; - private final NoCheat plugin; - private final DataStore data; - private ConfigurationCacheStore config; - private long lastUsedTime; - private final ExecutionHistory history; - - public NoCheatPlayerImpl(Player player, NoCheat plugin) - { - - this.player = player; - this.plugin = plugin; - this.data = new DataStore(); - this.history = new ExecutionHistory(); - - this.lastUsedTime = System.currentTimeMillis(); - } - - public void refresh(Player player) - { - this.player = player; - this.config = plugin.getConfig(player); - } - - public boolean isDead() - { - return this.player.getHealth() <= 0 || this.player.isDead(); - } - - public boolean hasPermission(String permission) - { - return player.hasPermission(permission); - } - - public DataStore getDataStore() - { - return data; - } - - public ConfigurationCacheStore getConfigurationStore() - { - return config; - } - - public Player getPlayer() - { - return player; - } - - public String getName() - { - return player.getName(); - } - - public int getTicksLived() - { - return player.getTicksLived(); - } - - public float getSpeedAmplifier() - { - EntityPlayer ep = ((CraftPlayer)player).getHandle(); - if (ep.hasEffect(MobEffectList.FASTER_MOVEMENT)) - { - // Taken directly from Minecraft code, should work - return 1.0F + 0.2F * (float)(ep.getEffect(MobEffectList.FASTER_MOVEMENT).getAmplifier() + 1); // TODO - } - else - { - return 1.0F; - } - } - - @Override - public float getJumpAmplifier() - { - EntityPlayer ep = ((CraftPlayer)player).getHandle(); - if (ep.hasEffect(MobEffectList.JUMP)) - { - int amp = ep.getEffect(MobEffectList.JUMP).getAmplifier(); - // Very rough estimates only - // TODO - if (amp > 20) - { - return 1.5F * (float)(ep.getEffect(MobEffectList.JUMP).getAmplifier() + 1); - } - else - { - return 1.2F * (float)(ep.getEffect(MobEffectList.JUMP).getAmplifier() + 1); - } - } - else - { - return 1.0F; - } - } - - public boolean isSprinting() - { - return player.isSprinting(); - } - - public void setLastUsedTime(long currentTimeInMilliseconds) - { - this.lastUsedTime = currentTimeInMilliseconds; - } - - public boolean shouldBeRemoved(long currentTimeInMilliseconds) - { - if (lastUsedTime > currentTimeInMilliseconds) - { - // Should never happen, but if it does, fix it somewhat - lastUsedTime = currentTimeInMilliseconds; - } - return lastUsedTime + 60000L < currentTimeInMilliseconds; - } - - public boolean isCreative() - { - return player.getGameMode() == GameMode.CREATIVE; - } - - @Override - public ExecutionHistory getExecutionHistory() - { - return history; - } - - @Override - public void dealFallDamage() - { - EntityPlayer p = ((CraftPlayer)player).getHandle(); - p.b(0D, true); - } -} diff --git a/EssentialsAntiCheat/src/plugin.yml b/EssentialsAntiCheat/src/plugin.yml deleted file mode 100644 index a1a5afac9..000000000 --- a/EssentialsAntiCheat/src/plugin.yml +++ /dev/null @@ -1,107 +0,0 @@ -name: EssentialsAntiCheat -main: com.earth2me.essentials.anticheat.NoCheat -# Note to developers: This next line cannot change, or the automatic versioning system will break. -version: ${build.number} -website: http://tiny.cc/EssentialsWiki -description: Detect and Fight the exploitation of various Flaws/Bugs in Minecraft. -authors: [Evenprime, md_5] -commands: - nocheat: - description: NoCheat command(s) - permission: nocheat.admin.commands - usage: | - /<command> permlist player [permission]: list NoCheat permissions of player, optionally only if beginning with [permission] - /<command> playerinfo player: show the collected data NoCheat collected about a player - /<command> reload: fast reload of NoCheats configuration file(s) - needs additional permissions - -permissions: - nocheat: - description: Allow a player to bypass all checks and give him all admin permissions - children: - nocheat.admin: - description: Give a player all admin rights - children: - nocheat.admin.chatlog: - description: Player can see NoCheats log messages in the ingame chat - nocheat.admin.commands: - description: allow use of the "nocheat" commands (may be given to players to allow them to check statistics) - nocheat.admin.reload: - description: allow access to the special "nocheat reload" command (only intended for the actual server administrator) - nocheat.mod.all: - description: Various simple cheat mods which they player may or may not be allowed to use - children: - nocheat.mod.zombes.fly: - description: Allow the use of the Zombes fly hack - nocheat.mod.zombes.cheat: - description: Allow the use of the Zombes cheat hack, includes xray - nocheat.mod.cjb.fly: - description: Allow the use of CJB's fly hack - nocheat.mod.cjb.xray: - description: Allow the use of CJB's xray - nocheat.mod.cjb.minimap: - description: Allow the use of CJB's minimap - nocheat.checks: - description: Allow the player to bypass all checks - children: - nocheat.checks.moving: - description: Allow the player to bypass all moving related checks - children: - nocheat.checks.moving.runfly: - description: Allow a player to move as free and as fast as he wants (ignores flying, swimming and sneaking settings) - nocheat.checks.moving.flying: - description: Allow a player to fly, but only within given speed limits (ignores swimming and sneaking settings) - nocheat.checks.moving.swimming: - description: Allow a player to move through water without slowdown - nocheat.checks.moving.sneaking: - description: Allow a player to sneak without slowdown - nocheat.checks.moving.nofall: - description: Allow a player to cheat and not take fall damage at all - nocheat.checks.moving.morepackets: - description: Allow a player to send more move-event-packets than normal, causing him to move faster than normal - nocheat.checks.blockbreak: - description: Allow the player to bypass all blockbreak checks - children: - nocheat.checks.blockbreak.reach: - description: Allow a player to break blocks at maximum range (about 6-7 blocks, in creative mode unlimited) - nocheat.checks.blockbreak.direction: - description: Allow a player to break blocks that are not in front of them - nocheat.checks.blockbreak.noswing: - description: Allow a player to break blocks without swinging their arm - nocheat.checks.blockplace: - description: Allow the player to bypass all blockplace checks - children: - nocheat.checks.blockplace.reach: - description: Allow a player to place blocks at maximum range (about 6-7 blocks) - nocheat.checks.blockplace.direction: - description: Allow a player to place blocks outside their line of view - nocheat.checks.chat: - description: Allow the player to bypass all chat checks - children: - nocheat.checks.chat.spam: - description: Allow a player to send an infinite amount of chat messages - nocheat.checks.chat.color: - description: Allow a player to send colored chat messages - nocheat.checks.fight: - description: Allow the player to bypass all fight checks - children: - nocheat.checks.fight.direction: - description: Allow a player to attack players and monster even if they are not in his field of view - nocheat.checks.fight.noswing: - description: Allow a player to fight without swinging their arm - nocheat.checks.fight.reach: - description: Allow a player to fight over bigger distances than usual - nocheat.checks.fight.speed: - description: Allow a player to attack faster than usual - nocheat.checks.fight.godmode: - description: Allow a player to not take damage by exploiting a design flaw in Minecraft - nocheat.checks.fight.instantheal: - description: Allow a player to artificially speed up his health regeneration - nocheat.checks.inventory: - description: Allow the player to bypass all inventory checks - children: - nocheat.checks.inventory.drop: - description: Allow a player to drop more items in a short timeframe than the defined limit - nocheat.checks.inventory.instanteat: - description: Allow a player to eat food faster than normally possible - nocheat.checks.inventory.instantbow: - description: Allow a player to charge his bow faster than usual diff --git a/EssentialsChat/src/com/earth2me/essentials/chat/ChatPermissions.java b/EssentialsChat/src/net/ess3/chat/ChatPermissions.java index 361bbbdda..888b85f9d 100644 --- a/EssentialsChat/src/com/earth2me/essentials/chat/ChatPermissions.java +++ b/EssentialsChat/src/net/ess3/chat/ChatPermissions.java @@ -1,4 +1,4 @@ -package com.earth2me.essentials.chat; +package net.ess3.chat; import net.ess3.api.IPermission; import net.ess3.permissions.BasePermission; @@ -6,7 +6,9 @@ import java.util.HashMap; import java.util.Locale; import java.util.Map; -public class ChatPermissions { + +public class ChatPermissions +{ private static Map<String, IPermission> permissions = new HashMap<String, IPermission>(); public static IPermission getPermission(final String groupName) @@ -14,7 +16,7 @@ public class ChatPermissions { IPermission perm = permissions.get(groupName); if (perm == null) { - perm = new BasePermission("essentials.chat.",groupName.toLowerCase(Locale.ENGLISH)); + perm = new BasePermission("essentials.chat.", groupName.toLowerCase(Locale.ENGLISH)); permissions.put(groupName, perm); } return perm; diff --git a/EssentialsChat/src/com/earth2me/essentials/chat/ChatStore.java b/EssentialsChat/src/net/ess3/chat/ChatStore.java index 4f6630187..4d696fb36 100644 --- a/EssentialsChat/src/com/earth2me/essentials/chat/ChatStore.java +++ b/EssentialsChat/src/net/ess3/chat/ChatStore.java @@ -1,8 +1,8 @@ -package com.earth2me.essentials.chat; +package net.ess3.chat; -import net.ess3.economy.Trade; import net.ess3.api.IEssentials; import net.ess3.api.IUser; +import net.ess3.economy.Trade; public class ChatStore diff --git a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChat.java b/EssentialsChat/src/net/ess3/chat/EssentialsChat.java index 53f2aa591..4c922c45f 100644 --- a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChat.java +++ b/EssentialsChat/src/net/ess3/chat/EssentialsChat.java @@ -1,10 +1,10 @@ -package com.earth2me.essentials.chat; +package net.ess3.chat; import static net.ess3.I18n._; import net.ess3.api.IEssentials; -import com.earth2me.essentials.chat.listenerlevel.EssentialsChatPlayerListenerHighest; -import com.earth2me.essentials.chat.listenerlevel.EssentialsChatPlayerListenerLowest; -import com.earth2me.essentials.chat.listenerlevel.EssentialsChatPlayerListenerNormal; +import net.ess3.chat.listenerlevel.EssentialsChatPlayerListenerHighest; +import net.ess3.chat.listenerlevel.EssentialsChatPlayerListenerLowest; +import net.ess3.chat.listenerlevel.EssentialsChatPlayerListenerNormal; import java.util.HashMap; import java.util.Map; import java.util.logging.Level; @@ -22,7 +22,7 @@ public class EssentialsChat extends JavaPlugin public void onEnable() { final PluginManager pluginManager = getServer().getPluginManager(); - final IEssentials ess = (IEssentials)pluginManager.getPlugin("Essentials3"); + final IEssentials ess = (IEssentials)pluginManager.getPlugin("Essentials-3"); if (!this.getDescription().getVersion().equals(ess.getDescription().getVersion())) { LOGGER.log(Level.WARNING, _("versionMismatchAll")); @@ -45,9 +45,4 @@ public class EssentialsChat extends JavaPlugin final EssentialsLocalChatEventListener localChatListener = new EssentialsLocalChatEventListener(getServer(), ess); pluginManager.registerEvents(localChatListener, this); } - - @Override - public void onDisable() - { - } } diff --git a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayer.java b/EssentialsChat/src/net/ess3/chat/EssentialsChatPlayer.java index 6376f9171..ae8fce4a1 100644 --- a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatPlayer.java +++ b/EssentialsChat/src/net/ess3/chat/EssentialsChatPlayer.java @@ -1,14 +1,14 @@ -package com.earth2me.essentials.chat; +package net.ess3.chat; -import net.ess3.api.ChargeException; import static net.ess3.I18n._; -import net.ess3.economy.Trade; -import net.ess3.utils.Util; +import net.ess3.api.ChargeException; import net.ess3.api.IEssentials; import net.ess3.api.IRanks; import net.ess3.api.ISettings; import net.ess3.api.IUser; +import net.ess3.economy.Trade; import net.ess3.permissions.Permissions; +import net.ess3.utils.Util; import java.util.Locale; import java.util.Map; import java.util.logging.Logger; @@ -111,6 +111,7 @@ public abstract class EssentialsChatPlayer implements Listener protected void handleLocalChat(final PlayerChatEvent event, final ChatStore chatStore) { + long radius = 0; ISettings settings = ess.getSettings(); settings.acquireReadLock(); diff --git a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsLocalChatEvent.java b/EssentialsChat/src/net/ess3/chat/EssentialsLocalChatEvent.java index 2eae385a9..e0ce6602d 100644 --- a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsLocalChatEvent.java +++ b/EssentialsChat/src/net/ess3/chat/EssentialsLocalChatEvent.java @@ -1,4 +1,4 @@ -package com.earth2me.essentials.chat; +package net.ess3.chat; import org.bukkit.entity.Player; import org.bukkit.event.Cancellable; @@ -98,6 +98,7 @@ public class EssentialsLocalChatEvent extends Event implements Cancellable return parentEvent; } + @Override public HandlerList getHandlers() { return handlers; @@ -107,4 +108,4 @@ public class EssentialsLocalChatEvent extends Event implements Cancellable { return handlers; } -}
\ No newline at end of file +} diff --git a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsLocalChatEventListener.java b/EssentialsChat/src/net/ess3/chat/EssentialsLocalChatEventListener.java index 86b4760c5..be7b20ba6 100644 --- a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsLocalChatEventListener.java +++ b/EssentialsChat/src/net/ess3/chat/EssentialsLocalChatEventListener.java @@ -1,4 +1,4 @@ -package com.earth2me.essentials.chat; +package net.ess3.chat; import static net.ess3.I18n._; import net.ess3.api.IEssentials; @@ -18,7 +18,6 @@ public class EssentialsLocalChatEventListener implements Listener { protected transient IEssentials ess; protected final transient Server server; - private static final Logger LOGGER = Logger.getLogger("Minecraft"); public EssentialsLocalChatEventListener(final Server server, final IEssentials ess) { @@ -37,33 +36,33 @@ public class EssentialsLocalChatEventListener implements Listener { String type = _("chatTypeLocal"); final IUser user = ess.getUser(onlinePlayer); - //TODO: remove reference to op - if (user.isIgnoringPlayer(sender.getName()) && !sender.isOp()) + if (user.isIgnoringPlayer(ess.getUser(sender))) { continue; } if (!user.equals(sender)) { + boolean abort = false; final Location playerLoc = user.getLocation(); if (playerLoc.getWorld() != world) { - continue; + abort = true; } final double delta = playerLoc.distanceSquared(loc); if (delta > event.getRadius()) { - if (Permissions.CHAT_SPY.isAuthorized(user)) + abort = true; + } + + if (abort) + { + if (ChatPermissions.getPermission("spy").isAuthorized(user)) { type = type.concat(_("chatTypeSpy")); } - else - { - continue; - } } } - final String message = type.concat(String.format(event.getFormat(), sender.getDisplayName(), event.getMessage())); user.sendMessage(message); } diff --git a/EssentialsChat/src/com/earth2me/essentials/chat/listenerlevel/EssentialsChatPlayerListenerHighest.java b/EssentialsChat/src/net/ess3/chat/listenerlevel/EssentialsChatPlayerListenerHighest.java index eba0b02c8..46dc2af82 100644 --- a/EssentialsChat/src/com/earth2me/essentials/chat/listenerlevel/EssentialsChatPlayerListenerHighest.java +++ b/EssentialsChat/src/net/ess3/chat/listenerlevel/EssentialsChatPlayerListenerHighest.java @@ -1,8 +1,8 @@ -package com.earth2me.essentials.chat.listenerlevel; +package net.ess3.chat.listenerlevel; import net.ess3.api.IEssentials; -import com.earth2me.essentials.chat.ChatStore; -import com.earth2me.essentials.chat.EssentialsChatPlayer; +import net.ess3.chat.ChatStore; +import net.ess3.chat.EssentialsChatPlayer; import java.util.Map; import org.bukkit.Server; import org.bukkit.event.EventHandler; diff --git a/EssentialsChat/src/com/earth2me/essentials/chat/listenerlevel/EssentialsChatPlayerListenerLowest.java b/EssentialsChat/src/net/ess3/chat/listenerlevel/EssentialsChatPlayerListenerLowest.java index 7be17c73c..dfe96df35 100644 --- a/EssentialsChat/src/com/earth2me/essentials/chat/listenerlevel/EssentialsChatPlayerListenerLowest.java +++ b/EssentialsChat/src/net/ess3/chat/listenerlevel/EssentialsChatPlayerListenerLowest.java @@ -1,9 +1,9 @@ -package com.earth2me.essentials.chat.listenerlevel; +package net.ess3.chat.listenerlevel; import net.ess3.api.IEssentials; import net.ess3.api.IUser; -import com.earth2me.essentials.chat.ChatStore; -import com.earth2me.essentials.chat.EssentialsChatPlayer; +import net.ess3.chat.ChatStore; +import net.ess3.chat.EssentialsChatPlayer; import java.util.Map; import org.bukkit.Server; import org.bukkit.event.EventHandler; diff --git a/EssentialsChat/src/com/earth2me/essentials/chat/listenerlevel/EssentialsChatPlayerListenerNormal.java b/EssentialsChat/src/net/ess3/chat/listenerlevel/EssentialsChatPlayerListenerNormal.java index f6b8fa334..2e3b44549 100644 --- a/EssentialsChat/src/com/earth2me/essentials/chat/listenerlevel/EssentialsChatPlayerListenerNormal.java +++ b/EssentialsChat/src/net/ess3/chat/listenerlevel/EssentialsChatPlayerListenerNormal.java @@ -1,8 +1,8 @@ -package com.earth2me.essentials.chat.listenerlevel; +package net.ess3.chat.listenerlevel; import net.ess3.api.IEssentials; -import com.earth2me.essentials.chat.ChatStore; -import com.earth2me.essentials.chat.EssentialsChatPlayer; +import net.ess3.chat.ChatStore; +import net.ess3.chat.EssentialsChatPlayer; import java.util.Map; import org.bukkit.Server; import org.bukkit.event.EventHandler; diff --git a/EssentialsChat/src/plugin.yml b/EssentialsChat/src/plugin.yml index 488ef7b50..6e314cbbb 100644 --- a/EssentialsChat/src/plugin.yml +++ b/EssentialsChat/src/plugin.yml @@ -1,10 +1,10 @@ # This determines the command prefix when there are conflicts (/name:home, /name:help, etc.) name: EssentialsChat -main: com.earth2me.essentials.chat.EssentialsChat +main: net.ess3.chat.EssentialsChat # Note to developers: This next line cannot change, or the automatic versioning system will break. version: ${build.number} website: http://tiny.cc/EssentialsWiki description: Provides chat control features for Essentials. Requires Permissions. authors: [Zenexer, ementalo, Aelux, Brettflan, KimKandor, snowleo, ceulemans, Xeology, KHobbits, md_5, Okamosy] -depend: [Essentials3] +depend: [Essentials-3] #softdepend: [Factions]
\ No newline at end of file diff --git a/EssentialsGeoIP/src/com/earth2me/essentials/geoip/ConfigHolder.java b/EssentialsGeoIP/src/net/ess3/geoip/ConfigHolder.java index 39d7528df..068a1ba45 100644 --- a/EssentialsGeoIP/src/com/earth2me/essentials/geoip/ConfigHolder.java +++ b/EssentialsGeoIP/src/net/ess3/geoip/ConfigHolder.java @@ -1,4 +1,4 @@ -package com.earth2me.essentials.geoip; +package net.ess3.geoip; import net.ess3.api.IEssentials; import net.ess3.settings.geoip.GeoIP; @@ -7,6 +7,7 @@ import java.io.File; import java.io.IOException; import org.bukkit.plugin.Plugin; + public class ConfigHolder extends AsyncStorageObjectHolder<GeoIP> { private final transient Plugin geoip; @@ -24,4 +25,13 @@ public class ConfigHolder extends AsyncStorageObjectHolder<GeoIP> return new File(geoip.getDataFolder(), "config.yml"); } + @Override + public void finishRead() + { + } + + @Override + public void finishWrite() + { + } } diff --git a/EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIP.java b/EssentialsGeoIP/src/net/ess3/geoip/EssentialsGeoIP.java index 125ba3144..9767f213b 100644 --- a/EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIP.java +++ b/EssentialsGeoIP/src/net/ess3/geoip/EssentialsGeoIP.java @@ -1,4 +1,4 @@ -package com.earth2me.essentials.geoip; +package net.ess3.geoip; import static net.ess3.I18n._; import net.ess3.api.IEssentials; @@ -9,25 +9,17 @@ import org.bukkit.plugin.java.JavaPlugin; public class EssentialsGeoIP extends JavaPlugin { - public EssentialsGeoIP() - { - } - - @Override - public void onDisable() - { - } - @Override public void onEnable() { final PluginManager pm = getServer().getPluginManager(); - final IEssentials ess = (IEssentials)pm.getPlugin("Essentials3"); + final IEssentials ess = (IEssentials)pm.getPlugin("Essentials-3"); if (!this.getDescription().getVersion().equals(ess.getDescription().getVersion())) { getLogger().log(Level.WARNING, _("versionMismatchAll")); } - if (!ess.isEnabled()) { + if (!ess.isEnabled()) + { this.setEnabled(false); return; } diff --git a/EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIPPlayerListener.java b/EssentialsGeoIP/src/net/ess3/geoip/EssentialsGeoIPPlayerListener.java index c0fbfa9f7..14554e3a9 100644 --- a/EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIPPlayerListener.java +++ b/EssentialsGeoIP/src/net/ess3/geoip/EssentialsGeoIPPlayerListener.java @@ -1,4 +1,4 @@ -package com.earth2me.essentials.geoip; +package net.ess3.geoip; import static net.ess3.I18n._; import net.ess3.api.IEssentials; @@ -53,7 +53,11 @@ public class EssentialsGeoIPPlayerListener implements Listener, IReload config.acquireReadLock(); try { + if (event.getPlayer().getAddress() == null || event.getPlayer().getAddress().getAddress() == null) { + return; + } final InetAddress address = event.getPlayer().getAddress().getAddress(); + final StringBuilder builder = new StringBuilder(); if (config.getData().getDatabase().isShowCities()) { diff --git a/EssentialsGeoIP/src/plugin.yml b/EssentialsGeoIP/src/plugin.yml index 9d55446bd..709e6d92b 100644 --- a/EssentialsGeoIP/src/plugin.yml +++ b/EssentialsGeoIP/src/plugin.yml @@ -1,9 +1,9 @@ # This determines the command prefix when there are conflicts (/name:home, /name:help, etc.) name: EssentialsGeoIP -main: com.earth2me.essentials.geoip.EssentialsGeoIP +main: net.ess3.geoip.EssentialsGeoIP # Note to developers: This next line cannot change, or the automatic versioning system will break. version: ${build.number} website: http://tiny.cc/EssentialsWiki description: Shows the country or city of a user on login and /whois. authors: [Zenexer, ementalo, Aelux, Brettflan, KimKandor, snowleo, ceulemans, Xeology, KHobbits] -depend: [Essentials3]
\ No newline at end of file +depend: [Essentials-3]
\ No newline at end of file diff --git a/EssentialsGroupManager/src/Changelog.txt b/EssentialsGroupManager/src/Changelog.txt index 9d7187690..4a3c232be 100644 --- a/EssentialsGroupManager/src/Changelog.txt +++ b/EssentialsGroupManager/src/Changelog.txt @@ -146,4 +146,41 @@ v 1.9: - Removed BukkitPermsOverride as this is now the default with bukkit handling child nodes.
- Prevent adding inheritances and info nodes to globalgroups. These are permissions collections, not player groups.
- Prevent promoting players to, and demoting to GlobalGroups.
- - Make 'manload' reload the config correctly.
\ No newline at end of file + - Make 'manload' reload the config correctly.
+ - Minor optimization when checking bukkit permissions.
+ - Better reporting when a users.yml is failing to load.
+ - Expanded '/manuadd'to accept an optional variable for the world (eg '/manuadd <player> <group> <world>').
+ - Removed some debug spam.
+ - Don't remove an attachment on a player leaving as Bukkit never forgets it. This fixes non mirrored permissions being messed up if a player relogs.
+ - Treat all world names as lower case for file handling (please check in your worlds folder. You should have no folders with upper case letters from now).
+ - Auto rename all case sensitive world folders to lower case (if possible).
+ - Update GlobalGroups.yml for new/changed Towny permission nodes.
+ - Stop attempting to push empty permissions when players edit the yml's incorrectly.
+ - Catch errors caused by bad indentation in yml's.
+ - Force remove player attachments on disconnect, and tidyup during player join in case of any errors. Fixes a bug of losing permissions.
+ - Added a new permission node 'groupmanager.op'. This will cause players with this node to be treated as op's when
+ using GroupManager commands (they will still require each commands permission node to use them).
+ - Prevent Null entries in group inheritance from throwing errors.
+v 2.0:
+ - Fix GM reporting of permission inheritance to retain the correct order. Lower inheritance groups can no longer negate a higher groups permissions.
+ - Fix an error I caused trying to modify an unmodifiable list when parsing '*' permissions.
+ - Don't throw errors when attempting to remove permission attachments (bukkit will have already removed it).
+ - Remove all permission attachments when performing a manload or restart.
+ - Expand 'manwhois' to also list a users subgroups.
+ - Fix a concurrent modification error when removing all attachments.
+ - Better handling of errors in user and group yml's.
+ - Added missing confirmation message on '/manload'.
+ - Stop the error on shutdown if GM failed to load at startup.
+ - GroupManager will now generate it's own log (in the GM folder) to keep things tidy, but also to account of those players unable to find/access their server.log.
+ - Startup errors will now lock out ALL commands other than '/manload'
+ - Fix 'manuadd' to use the default or selected world (via 'manselect'), if the world is not specified in the command.
+ - Expand GlobalGroups.yml and groups.yml to cover the VanishNoPacket plugin. Demonstrating how to negate and add nodes when using the '*' permission with inheritance.
+ - Fix silly nested throw/catch statements. Errors are now correctly generated when reading yml's.
+ - Unregister the worldsHolder as a service on a reload/shutdown instead of the whole plugin.
+ - Update all code formatting to use tabs for indentation.
+ - Stop using our own deprecated methods as we tell others to do.
+ - Finally remove all deprecated methods.
+ - Re-initialize the WorldsHolder on a reload, as un-registering and re-registering a new holder means all plugins have to check for the new service on every quiery.
+ - Prevent null perms getting past the GlobalGroups loader.
+ - Fix forgetting sub groups on a manload.
+ - Allow 'manucheckp' to notify when superperms reports false but it is really negated.
\ No newline at end of file diff --git a/EssentialsGroupManager/src/globalgroups.yml b/EssentialsGroupManager/src/globalgroups.yml index f21034237..04b670ae7 100644 --- a/EssentialsGroupManager/src/globalgroups.yml +++ b/EssentialsGroupManager/src/globalgroups.yml @@ -1,5 +1,101 @@ +# These groups only contain permission nodes.
+#
+# **** You can NOT add anything other than permission nodes ****
+#
+# These collections are to be inherited in your different worlds groups.yml's
+# They can also be added as one of a users subgroups, but NOT as a primary group.
+# These collections are available to ALL group and user yml's.
+#
+# Add to and customize these groups to fit yoru needs.
+
groups:
+# Permission nodes for GroupManager
+# by ElgarL, snowleo, continued from gabrielcouto's original
+# http://dev.bukkit.org/server-mods/essentials/
+
+ g:groupmanager_default:
+ permissions:
+ - groupmanager.notify.self
+
+ g:groupmanager_moderator:
+ permissions:
+ - groupmanager.listgroups
+ - groupmanager.mandemote
+ - groupmanager.manpromote
+ - groupmanager.manselect
+ - groupmanager.manuadd
+ - groupmanager.manudel
+ - groupmanager.manwhois
+ - groupmanager.notify.other
+
+ g:groupmanager_admin:
+ permissions:
+ - groupmanager.mantogglevalidate
+ - groupmanager.mansave
+ - groupmanager.mangcheckp
+ - groupmanager.manglistp
+ - groupmanager.manucheckp
+ - groupmanager.manulistp
+
+# Permission nodes for CraftBukkit
+# by many devs and contributors
+# http://dl.bukkit.org/
+
+ g:bukkit_default:
+ permissions:
+ - bukkit.broadcast.user
+ - -bukkit.command.plugins
+
+ g:bukkit_moderator:
+ permissions:
+ - bukkit.command.ban
+ - bukkit.command.ban.ip
+ - bukkit.command.ban.player
+ - bukkit.command.gamemode
+ - bukkit.command.kick
+ - bukkit.command.unban
+ - bukkit.command.unban.ip
+ - bukkit.command.unban.player
+
+ g:bukkit_admin:
+ permissions:
+ - bukkit.broadcast
+ - bukkit.broadcast.admin
+ - bukkit.command.give
+ - bukkit.command.help
+ - bukkit.command.kill
+ - bukkit.command.list
+ - bukkit.command.me
+ - -bukkit.command.op
+ - -bukkit.command.op.give
+ - -bukkit.command.op.take
+ - bukkit.command.plugins
+ - bukkit.command.reload
+ - bukkit.command.save
+ - bukkit.command.save.disable
+ - bukkit.command.save.enable
+ - bukkit.command.save.perform
+ - bukkit.command.say
+ - bukkit.command.stop
+ - bukkit.command.teleport
+ - bukkit.command.tell
+ - bukkit.command.time
+ - bukkit.command.time.add
+ - bukkit.command.time.set
+ - bukkit.command.version
+ - bukkit.command.whitelist
+ - bukkit.command.whitelist.add
+ - bukkit.command.whitelist.disable
+ - bukkit.command.whitelist.enable
+ - bukkit.command.whitelist.list
+ - bukkit.command.whitelist.reload
+ - bukkit.command.whitelist.remove
+
+# Permission nodes for Essentials
+# by ementalo, snowleo, and KHobbits
+# http://dev.bukkit.org/server-mods/essentials/
+
g:essentials_default:
permissions:
- essentials.help
@@ -8,7 +104,6 @@ groups: - essentials.motd
- essentials.rules
- essentials.spawn
- - groupmanager.notify.self
g:essentials_builder:
permissions:
@@ -19,24 +114,33 @@ groups: - essentials.balance.others
- essentials.balancetop
- essentials.chat.color
+ - essentials.chat.format
- essentials.chat.shout
- essentials.chat.question
- essentials.compass
+ - essentials.delhome
- essentials.depth
+ - essentials.getpos
- essentials.home
- essentials.ignore
+ - essentials.itemdb
- essentials.kit
- essentials.kit.tools
- essentials.mail
- essentials.mail.send
- essentials.me
- essentials.msg
+ - essentials.msg.color
+ - essentials.msg.format
- essentials.nick
- essentials.pay
- essentials.ping
- essentials.powertool
+ - essentials.powertooltoggle
- essentials.protect
+ - essentials.seen
- essentials.sethome
+ - essentials.sethome.multiple
- essentials.signs.use.*
- essentials.signs.create.disposal
- essentials.signs.create.mail
@@ -58,15 +162,21 @@ groups: g:essentials_moderator:
permissions:
+ - -essentials.spawner.enderdragon
+ - essentials.afk.kickexempt
- essentials.ban
- essentials.ban.notify
- essentials.banip
- essentials.broadcast
+ - essentials.chat.url
+ - essentials.chat.magic
- essentials.clearinventory
- essentials.delwarp
- essentials.eco.loan
- essentials.ext
+ - essentials.fly
- essentials.getpos
+ - essentials.getpos.others
- essentials.helpop.recieve
- essentials.home.others
- essentials.invsee
@@ -75,13 +185,19 @@ groups: - essentials.kick
- essentials.kick.notify
- essentials.kill
+ - essentials.kit.*
+ - essentials.msg.magic
- essentials.mute
+ - essentials.nick.color
- essentials.nick.others
- essentials.realname
+ - essentials.seen.banreason
+ - essentials.seen.extra
- essentials.setwarp
- essentials.signs.create.*
- essentials.signs.break.*
- essentials.spawner
+ - essentials.spawner.*
- essentials.thunder
- essentials.time
- essentials.time.set
@@ -93,6 +209,7 @@ groups: - essentials.togglejail
- essentials.top
- essentials.tp
+ - essentials.tp.others
- essentials.tphere
- essentials.tppos
- essentials.tptoggle
@@ -101,14 +218,7 @@ groups: - essentials.weather
- essentials.whois
- essentials.world
- - groupmanager.listgroups
- - groupmanager.mandemote
- - groupmanager.manpromote
- - groupmanager.manselect
- - groupmanager.manuadd
- - groupmanager.manudel
- - groupmanager.manwhois
- - groupmanager.notify.other
+ - essentials.world.*
g:essentials_admin:
permissions:
@@ -118,108 +228,82 @@ groups: - -essentials.reloadall
- -essentials.plugin
- essentials.*
- - groupmanager.mantogglevalidate
- - groupmanager.mansave
- - groupmanager.mangcheckp
- - groupmanager.manglistp
- - groupmanager.manucheckp
- - groupmanager.manulistp
-
- g:bukkit_default:
- permissions:
- - bukkit.broadcast.user
- - -bukkit.command.plugins
-
- g:bukkit_moderator:
- permissions:
- - bukkit.command.ban
- - bukkit.command.ban.ip
- - bukkit.command.ban.player
- - bukkit.command.gamemode
- - bukkit.command.kick
- - bukkit.command.unban
- - bukkit.command.unban.ip
- - bukkit.command.unban.player
- g:bukkit_admin:
+# Permission nodes for Towny by ElgarL
+# http://dev.bukkit.org/server-mods/towny-advanced/
+
+ g:towny_default:
permissions:
- - bukkit.broadcast
- - bukkit.broadcast.admin
- - bukkit.command.give
- - bukkit.command.help
- - bukkit.command.kill
- - bukkit.command.list
- - bukkit.command.me
- - -bukkit.command.op
- - -bukkit.command.op.give
- - -bukkit.command.op.take
- - bukkit.command.plugins
- - bukkit.command.reload
- - bukkit.command.save
- - bukkit.command.save.disable
- - bukkit.command.save.enable
- - bukkit.command.save.perform
- - bukkit.command.say
- - bukkit.command.stop
- - bukkit.command.teleport
- - bukkit.command.tell
- - bukkit.command.time
- - bukkit.command.time.add
- - bukkit.command.time.set
- - bukkit.command.version
- - bukkit.command.whitelist
- - bukkit.command.whitelist.add
- - bukkit.command.whitelist.disable
- - bukkit.command.whitelist.enable
- - bukkit.command.whitelist.list
- - bukkit.command.whitelist.reload
- - bukkit.command.whitelist.remove
+ - towny.chat.general
+ - towny.chat.local
g:towny_builder:
permissions:
- towny.town.*
- towny.nation.*
- - towny.chat.tc
- - towny.chat.nc
- - towny.wild.block.6.*
- - towny.wild.block.14.destroy
- - towny.wild.block.15.destroy
- - towny.wild.block.16.destroy
- - towny.wild.block.17.*
- - towny.wild.block.18.destroy
- - towny.wild.block.21.destroy
- - towny.wild.block.31.destroy
- - towny.wild.block.37.destroy
- - towny.wild.block.38.destroy
- - towny.wild.block.39.destroy
- - towny.wild.block.40.destroy
- - towny.wild.block.50.destroy
- - towny.wild.block.56.destroy
- - towny.wild.block.73.destroy
- - towny.wild.block.74.destroy
- - towny.wild.block.78.destroy
- - towny.wild.block.81.destroy
- - towny.wild.block.82.destroy
- - towny.wild.block.83.destroy
- - towny.wild.block.86.destroy
- - towny.wild.block.103.destroy
- - towny.wild.block.106.destroy
- - towny.wild.block.111.destroy
- - towny.wild.block.115.destroy
+ - towny.chat.town
+ - towny.chat.nation
+ - towny.wild.build.6
+ - towny.wild.destroy.6
+ - towny.wild.destroy.14
+ - towny.wild.destroy.15
+ - towny.wild.destroy.16
+ - towny.wild.build.17
+ - towny.wild.destroy.17
+ - towny.wild.destroy.18
+ - towny.wild.destroy.21
+ - towny.wild.destroy.31
+ - towny.wild.destroy.37
+ - towny.wild.destroy.38
+ - towny.wild.destroy.39
+ - towny.wild.destroy.40
+ - towny.wild.destroy.50
+ - towny.wild.destroy.56
+ - towny.wild.destroy.73
+ - towny.wild.destroy.74
+ - towny.wild.destroy.78
+ - towny.wild.destroy.81
+ - towny.wild.destroy.82
+ - towny.wild.destroy.83
+ - towny.wild.destroy.86
+ - towny.wild.destroy.103
+ - towny.wild.destroy.106
+ - towny.wild.destroy.111
+ - towny.wild.destroy.115
g:towny_moderator:
permissions:
- towny.chat.mod
- - towny.wild.block.64.switch
- - towny.wild.block.83.build
- - towny.wild.block.86.build
- - towny.wild.block.103.build
- - towny.wild.block.111.build
- - towny.wild.block.115.build
+ - towny.wild.switch.64
+ - towny.wild.build.83
+ - towny.wild.build.86
+ - towny.wild.build.103
+ - towny.wild.build.111
+ - towny.wild.build.115
g:towny_admin:
permissions:
- towny.admin
- - -towny.wild.block.119.destroy
- - -towny.wild.block.120.destroy
- - towny.chat.admin
\ No newline at end of file + - -towny.wild.destroy.119
+ - -towny.wild.destroy.120
+ - towny.chat.admin
+
+# Permission nodes for VanishNoPacket by mbaxter
+# http://dev.bukkit.org/server-mods/vanish/
+
+ g:vanish_moderator:
+ permissions:
+ - -vanish.*
+ - vanish.vanish
+ - vanish.smokin
+ - vanish.nofollow
+ - vanish.nopickup
+ - vanish.preventincomingdamage
+ - vanish.hooks.dynmap.alwayshidden
+ - vanish.hooks.essentials.hide
+
+ g:vanish_admin:
+ permissions:
+ - vanish.silentjoin
+ - vanish.silentquit
+ - vanish.silentchests
diff --git a/EssentialsGroupManager/src/groups.yml b/EssentialsGroupManager/src/groups.yml index e50054c9f..9c63ffd94 100644 --- a/EssentialsGroupManager/src/groups.yml +++ b/EssentialsGroupManager/src/groups.yml @@ -1,10 +1,12 @@ # Group inheritance -# any inherited groups prefixed with a g: are global groups -# These groups are defined in the globalgroups.yml -# and can be inherited in any worlds groups/users.yml. +# +# Any inherited groups prefixed with a g: are global groups +# and are inherited from the GlobalGroups.yml. # # Groups without the g: prefix are groups local to this world -# and defined in the this groups.yml file. +# and are defined in the this groups.yml file. +# +# Local group inheritances define your promotion tree when using 'manpromote/mandemote' groups: Default: @@ -12,8 +14,10 @@ groups: permissions: - -bukkit.command.kill inheritance: - - g:essentials_default + - g:groupmanager_default - g:bukkit_default + - g:essentials_default + - g:towny_default info: prefix: '&e' build: false @@ -24,7 +28,7 @@ groups: inheritance: - default - g:essentials_builder - - g:towny_moderator + - g:towny_builder info: prefix: '&2' build: true @@ -34,9 +38,11 @@ groups: permissions: [] inheritance: - builder - - g:essentials_moderator + - g:groupmanager_moderator - g:bukkit_moderator + - g:essentials_moderator - g:towny_moderator + - g:vanish_moderator info: prefix: '&5' build: true @@ -46,9 +52,11 @@ groups: permissions: [] inheritance: - moderator - - g:essentials_admin + - g:groupmanager_admin - g:bukkit_admin + - g:essentials_admin - g:towny_admin + - g:vanish_admin info: prefix: '&c' build: true @@ -57,6 +65,7 @@ groups: default: false permissions: - '*' + - -vanish.* inheritance: - admin info: diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GMConfiguration.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GMConfiguration.java index 98ff075dd..0832000f2 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GMConfiguration.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GMConfiguration.java @@ -13,81 +13,89 @@ import org.anjocaido.groupmanager.utils.Tasks; import org.bukkit.configuration.file.YamlConfiguration; /** - * + * * @author gabrielcouto */ public class GMConfiguration { - private GroupManager plugin; - private File configFile; - private YamlConfiguration GMconfig; - - public GMConfiguration(GroupManager plugin) { - this.plugin = plugin; - load(); - } - - public void load() { - if (!plugin.getDataFolder().exists()) { - plugin.getDataFolder().mkdirs(); - } - configFile = new File(plugin.getDataFolder(), "config.yml"); - - if (!configFile.exists()) { - try { - Tasks.copy(plugin.getResourceAsStream("config.yml"), configFile); - } catch (IOException ex) { - GroupManager.logger.log(Level.SEVERE, null, ex); - } - } - - GMconfig = new YamlConfiguration(); - - try { - GMconfig.load(configFile); - } catch (Exception ex) { - throw new IllegalArgumentException("The following file couldn't pass on Parser.\n" + configFile.getPath(), ex); - } - - // Setup defaults - adjustLoggerLevel(); - plugin.setValidateOnlinePlayer(isToggleValidate()); - } - - public boolean isOpOverride() { - return GMconfig.getBoolean("settings.config.opOverrides", true); - } - public boolean isToggleValidate() { - return GMconfig.getBoolean("settings.config.validate_toggle", true); - } - - public Map<String, Object> getMirrorsMap() { - // Try to fetch the old mirror path first + private GroupManager plugin; + private File configFile; + private YamlConfiguration GMconfig; + + public GMConfiguration(GroupManager plugin) { + + this.plugin = plugin; + load(); + } + + public void load() { + + if (!plugin.getDataFolder().exists()) { + plugin.getDataFolder().mkdirs(); + } + configFile = new File(plugin.getDataFolder(), "config.yml"); + + if (!configFile.exists()) { + try { + Tasks.copy(plugin.getResourceAsStream("config.yml"), configFile); + } catch (IOException ex) { + GroupManager.logger.log(Level.SEVERE, null, ex); + } + } + + GMconfig = new YamlConfiguration(); + + try { + GMconfig.load(configFile); + } catch (Exception ex) { + throw new IllegalArgumentException("The following file couldn't pass on Parser.\n" + configFile.getPath(), ex); + } + + // Setup defaults + adjustLoggerLevel(); + plugin.setValidateOnlinePlayer(isToggleValidate()); + } + + public boolean isOpOverride() { + + return GMconfig.getBoolean("settings.config.opOverrides", true); + } + + public boolean isToggleValidate() { + + return GMconfig.getBoolean("settings.config.validate_toggle", true); + } + + public Map<String, Object> getMirrorsMap() { + + // Try to fetch the old mirror path first if (GMconfig.isConfigurationSection("settings.permission.world.mirror")) { return (Map<String, Object>) GMconfig.getConfigurationSection("settings.permission.world.mirror").getValues(false); - } else if (GMconfig.isConfigurationSection("settings.mirrors")){ + } else if (GMconfig.isConfigurationSection("settings.mirrors")) { return (Map<String, Object>) GMconfig.getConfigurationSection("settings.mirrors").getValues(false); } return null; - - } - - public Integer getSaveInterval() { - return GMconfig.getInt("settings.data.save.minutes", 10); - } - - public Integer getBackupDuration() { - return GMconfig.getInt("settings.data.save.hours", 24); - } - - public void adjustLoggerLevel() { - - try { - GroupManager.logger.setLevel(Level.parse(GMconfig.getString("settings.logging.level", "INFO"))); - return; - } catch (Exception e) { - } - - GroupManager.logger.setLevel(Level.INFO); - } + + } + + public Integer getSaveInterval() { + + return GMconfig.getInt("settings.data.save.minutes", 10); + } + + public Integer getBackupDuration() { + + return GMconfig.getInt("settings.data.save.hours", 24); + } + + public void adjustLoggerLevel() { + + try { + GroupManager.logger.setLevel(Level.parse(GMconfig.getString("settings.logging.level", "INFO"))); + return; + } catch (Exception e) { + } + + GroupManager.logger.setLevel(Level.INFO); + } }
\ No newline at end of file diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GlobalGroups.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GlobalGroups.java index d9715d4be..04d9e86be 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GlobalGroups.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GlobalGroups.java @@ -8,6 +8,7 @@ import java.io.OutputStreamWriter; import java.io.UnsupportedEncodingException;
import java.util.Collection;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -23,8 +24,6 @@ import org.bukkit.configuration.file.YamlConfiguration; import org.yaml.snakeyaml.DumperOptions;
import org.yaml.snakeyaml.Yaml;
-
-
/**
* @author ElgarL
*
@@ -41,6 +40,7 @@ public class GlobalGroups { protected File GlobalGroupsFile = null;
public GlobalGroups(GroupManager plugin) {
+
this.plugin = plugin;
load();
}
@@ -49,6 +49,7 @@ public class GlobalGroups { * @return the haveGroupsChanged
*/
public boolean haveGroupsChanged() {
+
if (this.haveGroupsChanged) {
return true;
}
@@ -64,20 +65,24 @@ public class GlobalGroups { * @return the timeStampGroups
*/
public long getTimeStampGroups() {
+
return timeStampGroups;
}
+
/**
* @param timeStampGroups the timeStampGroups to set
*/
protected void setTimeStampGroups(long timeStampGroups) {
+
this.timeStampGroups = timeStampGroups;
}
-
+
/**
* @param haveGroupsChanged
* the haveGroupsChanged to set
*/
public void setGroupsChanged(boolean haveGroupsChanged) {
+
this.haveGroupsChanged = haveGroupsChanged;
}
@@ -85,7 +90,7 @@ public class GlobalGroups { public void load() {
GGroups = new YamlConfiguration();
-
+
GroupManager.setLoaded(false);
// READ globalGroups FILE
@@ -109,58 +114,87 @@ public class GlobalGroups { // Clear out old groups
resetGlobalGroups();
-
+
if (!GGroups.getKeys(false).isEmpty()) {
// Read all global groups
- Map<String, Object> allGroups = (Map<String, Object>) GGroups.getConfigurationSection("groups").getValues(false);
-
+ Map<String, Object> allGroups = new HashMap<String, Object>();
+
+ try {
+ allGroups = (Map<String, Object>) GGroups.getConfigurationSection("groups").getValues(false);
+ } catch (Exception ex) {
+ // ex.printStackTrace();
+ throw new IllegalArgumentException("Your " + GlobalGroupsFile.getPath() + " file is invalid. See console for details.", ex);
+ }
+
// Load each groups permissions list.
if (allGroups != null) {
- for (String groupName : allGroups.keySet()) {
+
+ Iterator<String> groupItr = allGroups.keySet().iterator();
+ String groupName;
+ Integer groupCount = 0;
+
+ /*
+ * loop each group entry
+ * and read it's data.
+ */
+ while (groupItr.hasNext()) {
+ try {
+ groupCount++;
+ // Attempt to fetch the next group name.
+ groupName = groupItr.next();
+ } catch (Exception ex) {
+ throw new IllegalArgumentException("Invalid group name for GlobalGroup entry (" + groupCount + ") in file: " + GlobalGroupsFile.getPath(), ex);
+ }
+
+ /*
+ * Create a new group with this name.
+ */
Group newGroup = new Group(groupName.toLowerCase());
Object element;
-
+
// Permission nodes
element = GGroups.get("groups." + groupName + ".permissions");
-
+
if (element != null)
if (element instanceof List) {
try {
for (String node : (List<String>) element) {
- newGroup.addPermission(node);
+ if ((node != null) && !node.isEmpty())
+ newGroup.addPermission(node);
}
- } catch (ClassCastException e) {
- throw new IllegalArgumentException("Invalid permission node for global group: " + groupName);
+ } catch (ClassCastException ex) {
+ throw new IllegalArgumentException("Invalid permission node for global group: " + groupName, ex);
}
} else if (element instanceof String) {
+ if ((element != null) && !((String)element).isEmpty())
newGroup.addPermission((String) element);
} else
throw new IllegalArgumentException("Unknown type of permission node for global group: " + groupName);
-
+
// Info nodes
element = GGroups.get("groups." + groupName + ".info");
-
+
if (element != null)
if (element instanceof MemorySection) {
Map<String, Object> vars = new HashMap<String, Object>();
for (String key : ((MemorySection) element).getKeys(false)) {
- vars.put(key, ((MemorySection) element).get(key));
- }
+ vars.put(key, ((MemorySection) element).get(key));
+ }
newGroup.setVariables(vars);
} else
throw new IllegalArgumentException("Unknown type of info node for global group: " + groupName);
-
+
// Push a new group
addGroup(newGroup);
}
}
-
+
removeGroupsChangedFlag();
}
-
+
setTimeStampGroups(GlobalGroupsFile.lastModified());
GroupManager.setLoaded(true);
- //GlobalGroupsFile = null;
+ // GlobalGroupsFile = null;
}
/**
@@ -169,33 +203,33 @@ public class GlobalGroups { public void writeGroups(boolean overwrite) {
- //File GlobalGroupsFile = new File(plugin.getDataFolder(), "globalgroups.yml");
+ // File GlobalGroupsFile = new File(plugin.getDataFolder(), "globalgroups.yml");
if (haveGroupsChanged()) {
if (overwrite || (!overwrite && (getTimeStampGroups() >= GlobalGroupsFile.lastModified()))) {
Map<String, Object> root = new HashMap<String, Object>();
-
+
Map<String, Object> groupsMap = new HashMap<String, Object>();
root.put("groups", groupsMap);
for (String groupKey : groups.keySet()) {
Group group = groups.get(groupKey);
-
+
// Group header
Map<String, Object> aGroupMap = new HashMap<String, Object>();
groupsMap.put(group.getName(), aGroupMap);
-
+
// Info nodes
Map<String, Object> infoMap = new HashMap<String, Object>();
- aGroupMap.put("info", infoMap);
-
- for (String infoKey : group.getVariables().getVarKeyList()) {
- infoMap.put(infoKey, group.getVariables().getVarObject(infoKey));
- }
-
- // Permission nodes
+ aGroupMap.put("info", infoMap);
+
+ for (String infoKey : group.getVariables().getVarKeyList()) {
+ infoMap.put(infoKey, group.getVariables().getVarObject(infoKey));
+ }
+
+ // Permission nodes
aGroupMap.put("permissions", group.getPermissionList());
}
-
+
if (!root.isEmpty()) {
DumperOptions opt = new DumperOptions();
opt.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
@@ -208,53 +242,55 @@ public class GlobalGroups { }
setTimeStampGroups(GlobalGroupsFile.lastModified());
} else {
- // Newer file found.
- GroupManager.logger.log(Level.WARNING, "Newer GlobalGroups file found, but we have local changes!");
- throw new IllegalStateException("Unable to save unless you issue a '/mansave force'");
- }
+ // Newer file found.
+ GroupManager.logger.log(Level.WARNING, "Newer GlobalGroups file found, but we have local changes!");
+ throw new IllegalStateException("Unable to save unless you issue a '/mansave force'");
+ }
removeGroupsChangedFlag();
} else {
- //Check for newer file as no local changes.
- if (getTimeStampGroups() < GlobalGroupsFile.lastModified()) {
- System.out.print("Newer GlobalGroups file found (Loading changes)!");
- // Backup GlobalGroups file
- backupFile();
- load();
- }
- }
+ // Check for newer file as no local changes.
+ if (getTimeStampGroups() < GlobalGroupsFile.lastModified()) {
+ System.out.print("Newer GlobalGroups file found (Loading changes)!");
+ // Backup GlobalGroups file
+ backupFile();
+ load();
+ }
+ }
}
-
+
/**
- * Backup the BlobalGroups file
- * @param w
- */
- private void backupFile() {
-
- File backupFile = new File(plugin.getBackupFolder(), "bkp_ggroups_" + Tasks.getDateString() + ".yml");
- try {
- Tasks.copy(GlobalGroupsFile, backupFile);
- } catch (IOException ex) {
- GroupManager.logger.log(Level.SEVERE, null, ex);
- }
- }
-
+ * Backup the BlobalGroups file
+ *
+ * @param w
+ */
+ private void backupFile() {
+
+ File backupFile = new File(plugin.getBackupFolder(), "bkp_ggroups_" + Tasks.getDateString() + ".yml");
+ try {
+ Tasks.copy(GlobalGroupsFile, backupFile);
+ } catch (IOException ex) {
+ GroupManager.logger.log(Level.SEVERE, null, ex);
+ }
+ }
+
/**
* Adds a group, or replaces an existing one.
*
* @param groupToAdd
*/
public void addGroup(Group groupToAdd) {
+
// Create a new group if it already exists
if (hasGroup(groupToAdd.getName())) {
groupToAdd = groupToAdd.clone();
removeGroup(groupToAdd.getName());
}
-
+
newGroup(groupToAdd);
- haveGroupsChanged = true;
- if (GroupManager.isLoaded())
- GroupManagerEventHandler.callEvent(groupToAdd, GMGroupEvent.Action.GROUP_ADDED);
+ haveGroupsChanged = true;
+ if (GroupManager.isLoaded())
+ GroupManagerEventHandler.callEvent(groupToAdd, GMGroupEvent.Action.GROUP_ADDED);
}
/**
@@ -263,6 +299,7 @@ public class GlobalGroups { * @param newGroup
*/
public Group newGroup(Group newGroup) {
+
// Push a new group
if (!groups.containsKey(newGroup.getName().toLowerCase())) {
groups.put(newGroup.getName().toLowerCase(), newGroup);
@@ -278,6 +315,7 @@ public class GlobalGroups { * @param groupName
*/
public boolean removeGroup(String groupName) {
+
// Push a new group
if (groups.containsKey(groupName.toLowerCase())) {
groups.remove(groupName.toLowerCase());
@@ -296,6 +334,7 @@ public class GlobalGroups { * @return true if the group exists
*/
public boolean hasGroup(String groupName) {
+
return groups.containsKey(groupName.toLowerCase());
}
@@ -351,6 +390,7 @@ public class GlobalGroups { * @return List of all group names
*/
public List<String> getGroupsPermissions(String groupName) {
+
if (!hasGroup(groupName))
return null;
@@ -363,6 +403,7 @@ public class GlobalGroups { * @return Set containing all group names.
*/
public Set<String> getGlobalGroups() {
+
return groups.keySet();
}
@@ -370,14 +411,16 @@ public class GlobalGroups { * Resets GlobalGroups.
*/
public void resetGlobalGroups() {
+
this.groups = new HashMap<String, Group>();
}
-
+
/**
*
* @return a collection of the groups
*/
public Collection<Group> getGroupList() {
+
return groups.values();
}
@@ -388,6 +431,7 @@ public class GlobalGroups { * @return Group object
*/
public Group getGroup(String groupName) {
+
if (!hasGroup(groupName))
return null;
@@ -399,17 +443,19 @@ public class GlobalGroups { * @return the globalGroupsFile
*/
public File getGlobalGroupsFile() {
+
return GlobalGroupsFile;
}
-
+
/**
*
*/
- public void removeGroupsChangedFlag() {
- setGroupsChanged(false);
- for (Group g : groups.values()) {
- g.flagAsSaved();
- }
- }
+ public void removeGroupsChangedFlag() {
+
+ setGroupsChanged(false);
+ for (Group g : groups.values()) {
+ g.flagAsSaved();
+ }
+ }
}
\ No newline at end of file diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java index 00c71a41e..5f357641a 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java @@ -12,8 +12,8 @@ import org.anjocaido.groupmanager.data.Variables; import org.anjocaido.groupmanager.data.User; import org.anjocaido.groupmanager.data.Group; import org.anjocaido.groupmanager.dataholder.OverloadedWorldHolder; -import org.anjocaido.groupmanager.dataholder.WorldDataHolder; import java.io.File; +import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.Arrays; @@ -28,7 +28,6 @@ import org.anjocaido.groupmanager.dataholder.worlds.WorldsHolder; import org.anjocaido.groupmanager.events.GMSystemEvent; import org.anjocaido.groupmanager.events.GMWorldListener; import org.anjocaido.groupmanager.events.GroupManagerEventHandler; -import org.anjocaido.groupmanager.events.GMGroupEvent.Action; import org.anjocaido.groupmanager.utils.GMLoggerHandler; import org.anjocaido.groupmanager.utils.PermissionCheckResult; import org.anjocaido.groupmanager.utils.Tasks; @@ -39,20 +38,17 @@ import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.command.ConsoleCommandSender; import org.bukkit.entity.Player; -import org.bukkit.event.Event; import org.bukkit.plugin.PluginDescriptionFile; import org.bukkit.plugin.ServicePriority; import org.bukkit.plugin.java.JavaPlugin; -@SuppressWarnings("unused") /** * - * @author gabrielcouto + * @author gabrielcouto, ElgarL */ public class GroupManager extends JavaPlugin { - // private File configFile; private File backupFolder; private Runnable commiter; private ScheduledThreadPoolExecutor scheduler; @@ -60,21 +56,7 @@ public class GroupManager extends JavaPlugin { private Map<CommandSender, String> selectedWorlds = new HashMap<CommandSender, String>(); private WorldsHolder worldsHolder; private boolean validateOnlinePlayer = true; - /** - * @return the validateOnlinePlayer - */ - public boolean isValidateOnlinePlayer() { - return validateOnlinePlayer; - } - - /** - * @param validateOnlinePlayer the validateOnlinePlayer to set - */ - public void setValidateOnlinePlayer(boolean validateOnlinePlayer) { - this.validateOnlinePlayer = validateOnlinePlayer; - } - - private boolean isReady = false; + private static boolean isLoaded = false; protected GMConfiguration config; @@ -86,15 +68,31 @@ public class GroupManager extends JavaPlugin { public static final Logger logger = Logger.getLogger(GroupManager.class.getName()); // PERMISSIONS FOR COMMAND BEING LOADED - OverloadedWorldHolder dataHolder = null; - AnjoPermissionsHandler permissionHandler = null; + private OverloadedWorldHolder dataHolder = null; + private AnjoPermissionsHandler permissionHandler = null; + + private String lastError = ""; @Override public void onDisable() { - setLoaded(false); - // Un-register this service. - this.getServer().getServicesManager().unregister(this); + onDisable(false); + } + + @Override + public void onEnable() { + + onEnable(false); + } + + public void onDisable(boolean restarting) { + + setLoaded(false); + + if (!restarting) { + // Unregister this service if we are shutting down. + this.getServer().getServicesManager().unregister(this.worldsHolder); + } disableScheduler(); // Shutdown before we save, so it doesn't interfere. if (worldsHolder != null) { @@ -105,79 +103,206 @@ public class GroupManager extends JavaPlugin { } } - WorldEvents = null; - BukkitPermissions = null; + + + // Remove all attachments before clearing + if (BukkitPermissions != null) { + BukkitPermissions.removeAllAttachments(); + } + + if (!restarting) { + + if (WorldEvents != null) + WorldEvents = null; + + BukkitPermissions = null; + + } - // EXAMPLE: Custom code, here we just output some info so we can check - // all is well + // EXAMPLE: Custom code, here we just output some info so we can check that all is well PluginDescriptionFile pdfFile = this.getDescription(); System.out.println(pdfFile.getName() + " version " + pdfFile.getVersion() + " is disabled!"); - GroupManager.logger.removeHandler(ch); + + if (!restarting) + GroupManager.logger.removeHandler(ch); } + + public void onEnable(boolean restarting) { - @Override - public void onEnable() { - GroupManager.logger.setUseParentHandlers(false); - ch = new GMLoggerHandler(); - GroupManager.logger.addHandler(ch); - logger.setLevel(Level.ALL); + try { + /* + * reset local variables. + */ + overloadedUsers = new HashMap<String, ArrayList<User>>(); + selectedWorlds = new HashMap<CommandSender, String>(); + lastError = ""; + + /* + * Setup our logger if we are not restarting. + */ + if (!restarting) { + GroupManager.logger.setUseParentHandlers(false); + ch = new GMLoggerHandler(); + GroupManager.logger.addHandler(ch); + } + logger.setLevel(Level.ALL); + + // Create the backup folder, if it doesn't exist. + prepareFileFields(); + // Load the config.yml + prepareConfig(); + // Load the global groups + globalGroups = new GlobalGroups(this); + + /* + * Configure the worlds holder. + */ + if (!restarting) + worldsHolder = new WorldsHolder(this); + else + worldsHolder.resetWorldsHolder(); + + /* + * This should NEVER happen. No idea why it's still here. + */ + PluginDescriptionFile pdfFile = this.getDescription(); + if (worldsHolder == null) { + GroupManager.logger.severe("Can't enable " + pdfFile.getName() + " version " + pdfFile.getVersion() + ", bad loading!"); + this.getServer().getPluginManager().disablePlugin(this); + throw new IllegalStateException("An error ocurred while loading GroupManager"); + } - // Create the backup folder, if it doesn't exist. - prepareFileFields(); - // Load the config.yml - prepareConfig(); - // Load the global groups - globalGroups = new GlobalGroups(this); - worldsHolder = new WorldsHolder(this); + /* + * Prevent our registered events from triggering + * updates as we are not fully loaded. + */ + setLoaded(false); + + /* + * Initialize the world listener and bukkit permissions + * to handle events if this is a fresh start + * + * else + * + * Reset bukkit perms. + */ + if (!restarting) { + WorldEvents = new GMWorldListener(this); + BukkitPermissions = new BukkitPermissions(this); + } else { + BukkitPermissions.reset(); + } + /* + * Start the scheduler for data saving. + */ + enableScheduler(); + + /* + * Schedule a Bukkit Permissions update for 1 tick later. + * All plugins will be loaded by then + */ + + if (getServer().getScheduler().scheduleSyncDelayedTask(this, new BukkitPermsUpdateTask(), 1) == -1) { + GroupManager.logger.severe("Could not schedule superperms Update."); + /* + * Flag that we are now loaded and should start processing events. + */ + setLoaded(true); + } + + System.out.println(pdfFile.getName() + " version " + pdfFile.getVersion() + " is enabled!"); + + // Register as a service + if (!restarting) + this.getServer().getServicesManager().register(WorldsHolder.class, this.worldsHolder, this, ServicePriority.Lowest); + + } catch (Exception ex) { + + /* + * Store the error and write to the log. + */ + saveErrorLog(ex); + + /* + * Throw an error so Bukkit knows about it. + */ + throw new IllegalArgumentException(ex.getMessage(), ex); - PluginDescriptionFile pdfFile = this.getDescription(); - if (worldsHolder == null) { - GroupManager.logger.severe("Can't enable " + pdfFile.getName() + " version " + pdfFile.getVersion() + ", bad loading!"); - this.getServer().getPluginManager().disablePlugin(this); - throw new IllegalStateException("An error ocurred while loading GroupManager"); } + } - // Set a few defaults (reloads) - setLoaded(false); - - // Initialize the world listener and bukkit permissions to handle - // events. - WorldEvents = new GMWorldListener(this); - BukkitPermissions = new BukkitPermissions(this); + /** + * Write an error.log + * + * @param ex + */ + private void saveErrorLog(Exception ex) { + + if (!getDataFolder().exists()) { + getDataFolder().mkdirs(); + } - enableScheduler(); + lastError = ex.getMessage(); - /* - * Schedule a Bukiit Permissions update for 1 tick later. All plugins - * will be loaded by then - */ + GroupManager.logger.severe("==================================================="); + GroupManager.logger.severe("= ERROR REPORT START ="); + GroupManager.logger.severe("==================================================="); + GroupManager.logger.severe("=== PLEASE COPY AND PASTE THE ERROR.LOG FROM THE =="); + GroupManager.logger.severe("= GROUPMANAGER FOLDER TO AN ESSENTIALS DEVELOPER ="); + GroupManager.logger.severe("==================================================="); + GroupManager.logger.severe(lastError); + GroupManager.logger.severe("==================================================="); + GroupManager.logger.severe("= ERROR REPORT ENDED ="); + GroupManager.logger.severe("==================================================="); - if (getServer().getScheduler().scheduleSyncDelayedTask(this, new BukkitPermsUpdateTask(), 1) == -1) { - GroupManager.logger.severe("Could not schedule superperms Update."); - setLoaded(true); + // Append this error to the error log. + try { + String error = "=============================== GM ERROR LOG ===============================\n\n"; + error += Tasks.getStackTraceAsString(ex); + error += "\n============================================================================\n"; + + Tasks.appendStringToFile(error, (getDataFolder() + System.getProperty("file.separator") + "ERROR.LOG")); + } catch (IOException e) { + // Failed to write file. + e.printStackTrace(); } - System.out.println(pdfFile.getName() + " version " + pdfFile.getVersion() + " is enabled!"); - - // Register as a service - this.getServer().getServicesManager().register(WorldsHolder.class, this.worldsHolder, this, ServicePriority.Lowest); + } + + /** + * @return the validateOnlinePlayer + */ + public boolean isValidateOnlinePlayer() { + + return validateOnlinePlayer; + } + + /** + * @param validateOnlinePlayer the validateOnlinePlayer to set + */ + public void setValidateOnlinePlayer(boolean validateOnlinePlayer) { + + this.validateOnlinePlayer = validateOnlinePlayer; } public static boolean isLoaded() { + return isLoaded; } public static void setLoaded(boolean isLoaded) { + GroupManager.isLoaded = isLoaded; } public InputStream getResourceAsStream(String fileName) { + return this.getClassLoader().getResourceAsStream(fileName); } private void prepareFileFields() { - // configFile = new File(this.getDataFolder(), "config.yml"); + backupFolder = new File(this.getDataFolder(), "backup"); if (!backupFolder.exists()) { getBackupFolder().mkdirs(); @@ -185,16 +310,19 @@ public class GroupManager extends JavaPlugin { } private void prepareConfig() { + config = new GMConfiguration(this); } public void enableScheduler() { + if (worldsHolder != null) { disableScheduler(); commiter = new Runnable() { @Override public void run() { + try { worldsHolder.saveChanges(false); GroupManager.logger.log(Level.INFO, " Data files refreshed."); @@ -204,18 +332,19 @@ public class GroupManager extends JavaPlugin { } }; scheduler = new ScheduledThreadPoolExecutor(1); - long minutes = (long)getGMConfig().getSaveInterval(); + long minutes = (long) getGMConfig().getSaveInterval(); if (minutes > 0) { - scheduler.scheduleAtFixedRate(commiter, minutes, minutes, TimeUnit.MINUTES); + scheduler.scheduleAtFixedRate(commiter, minutes, minutes, TimeUnit.MINUTES); GroupManager.logger.info("Scheduled Data Saving is set for every " + minutes + " minutes!"); } else GroupManager.logger.info("Scheduled Data Saving is Disabled!"); - + GroupManager.logger.info("Backups will be retained for " + getGMConfig().getBackupDuration() + " hours!"); } } public void disableScheduler() { + if (scheduler != null) { try { scheduler.setContinueExistingPeriodicTasksAfterShutdownPolicy(false); @@ -228,57 +357,9 @@ public class GroupManager extends JavaPlugin { } } - /** - * Use the WorldsHolder saveChanges directly instead Saves the data on file - */ - @Deprecated - public void commit() { - if (worldsHolder != null) { - worldsHolder.saveChanges(); - } - } - - /** - * Use worlds holder to reload a specific world Reloads the data - */ - @Deprecated - public void reload() { - worldsHolder.reloadAll(); - } - public WorldsHolder getWorldsHolder() { - return worldsHolder; - } - /** - * The handler in the interface created by AnjoCaido - * - * @return AnjoPermissionsHandler - */ - @Deprecated - public AnjoPermissionsHandler getPermissionHandler() { - return worldsHolder.getDefaultWorld().getPermissionsHandler(); - } - - /** - * A simple interface, for ones that don't want to mess with overloading. - * Yet it is affected by overloading. But seamless. - * - * @return the dataholder with all information - */ - @Deprecated - public WorldDataHolder getData() { - return worldsHolder.getDefaultWorld(); - } - - /** - * Use this if you want to play with overloading. - * - * @return a dataholder with overloading interface - */ - @Deprecated - public OverloadedWorldHolder getOverloadedClassData() { - return worldsHolder.getDefaultWorld(); + return worldsHolder; } /** @@ -288,9 +369,9 @@ public class GroupManager extends JavaPlugin { * @param cmd * @param args */ - @SuppressWarnings({ "deprecation" }) @Override public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) { + boolean playerCanDo = false; boolean isConsole = false; Player senderPlayer = null, targetPlayer = null; @@ -301,15 +382,27 @@ public class GroupManager extends JavaPlugin { // DETERMINING PLAYER INFORMATION if (sender instanceof Player) { senderPlayer = (Player) sender; + + if (!lastError.isEmpty() && !commandLabel.equalsIgnoreCase("manload")) { + sender.sendMessage(ChatColor.RED + "All commands are locked due to an error. Check the log and then try a '/manload'.)"); + return true; + } + senderUser = worldsHolder.getWorldData(senderPlayer).getUser(senderPlayer.getName()); senderGroup = senderUser.getGroup(); - isOpOverride = (isOpOverride && senderPlayer.isOp()); + isOpOverride = (isOpOverride && (senderPlayer.isOp() || worldsHolder.getWorldPermissions(senderPlayer).has(senderPlayer, "groupmanager.op"))); System.out.println("[PLAYER_COMMAND] " + senderPlayer.getName() + ": /" + commandLabel + " " + Tasks.join(args, " ")); if (isOpOverride || worldsHolder.getWorldPermissions(senderPlayer).has(senderPlayer, "groupmanager." + cmd.getName())) { playerCanDo = true; } } else if (sender instanceof ConsoleCommandSender) { + + if (!lastError.isEmpty() && !commandLabel.equalsIgnoreCase("manload")) { + sender.sendMessage(ChatColor.RED + "All commands are locked due to an error. Check the log and then try a '/manload'.)"); + return true; + } + isConsole = true; } @@ -349,7 +442,7 @@ public class GroupManager extends JavaPlugin { GroupManager.logger.severe("==================================================="); GroupManager.logger.severe("= ERROR REPORT START ="); GroupManager.logger.severe("==================================================="); - GroupManager.logger.severe("= COPY AND PASTE THIS TO GROUPMANAGER DEVELOPER ="); + GroupManager.logger.severe("= COPY AND PASTE THIS TO A GROUPMANAGER DEVELOPER ="); GroupManager.logger.severe("==================================================="); GroupManager.logger.severe(this.getDescription().getName()); GroupManager.logger.severe(this.getDescription().getVersion()); @@ -374,20 +467,29 @@ public class GroupManager extends JavaPlugin { if (isConsole || playerCanDo) { switch (execCmd) { case manuadd: - // VALIDANDO ESTADO DO SENDER + + // Validating arguments + if ((args.length != 2) && (args.length != 3)) { + sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <player> <group> | optional [world])"); + return false; + } + + // Select the relevant world (if specified) + if (args.length == 3) { + dataHolder = worldsHolder.getWorldData(args[2]); + permissionHandler = dataHolder.getPermissionsHandler(); + } + + // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } - // VALIDANDO ARGUMENTOS - if (args.length != 2) { - sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <player> <group>)"); - return false; - } + if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) { - return false; + return false; } - + if (match != null) { auxUser = dataHolder.getUser(match.get(0)); } else { @@ -403,9 +505,9 @@ public class GroupManager extends JavaPlugin { return false; } - // VALIDANDO PERMISSAO + // Validating permissions if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getName(), senderGroup.getName()) : false)) { - sender.sendMessage(ChatColor.RED + "Can't modify player with same permissions than you, or higher."); + sender.sendMessage(ChatColor.RED + "Can't modify a player with the same permissions as you, or higher."); return false; } if (!isConsole && !isOpOverride && (permissionHandler.hasGroupInInheritance(auxGroup, senderGroup.getName()))) { @@ -413,47 +515,43 @@ public class GroupManager extends JavaPlugin { return false; } if (!isConsole && !isOpOverride && (!permissionHandler.inGroup(senderUser.getName(), auxUser.getGroupName()) || !permissionHandler.inGroup(senderUser.getName(), auxGroup.getName()))) { - sender.sendMessage(ChatColor.RED + "Can't modify player involving a group that you don't inherit."); + sender.sendMessage(ChatColor.RED + "You can't modify a player involving a group that you don't inherit."); return false; } - // PARECE OK + // Seems OK auxUser.setGroup(auxGroup); if (!sender.hasPermission("groupmanager.notify.other") || (isConsole)) - sender.sendMessage(ChatColor.YELLOW + "You changed player '" + auxUser.getName() + "' group to '" + auxGroup.getName() + "'."); - - //targetPlayer = this.getServer().getPlayer(auxUser.getName()); - //if (targetPlayer != null) - // BukkitPermissions.updatePermissions(targetPlayer); + sender.sendMessage(ChatColor.YELLOW + "You changed player '" + auxUser.getName() + "' group to '" + auxGroup.getName() + "' in world '" + dataHolder.getName() + "'."); return true; - // break; + case manudel: - // VALIDANDO ESTADO DO SENDER + // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } - // VALIDANDO ARGUMENTOS + // Validating arguments if (args.length != 1) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <player>)"); return false; } if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) { - return false; + return false; } - + if (match != null) { auxUser = dataHolder.getUser(match.get(0)); } else { auxUser = dataHolder.getUser(args[0]); } - // VALIDANDO PERMISSAO + // Validating permission if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getName(), senderGroup.getName()) : false)) { - sender.sendMessage(ChatColor.RED + "Can't modify player with same permissions than you, or higher."); + sender.sendMessage(ChatColor.RED + "You can't modify a player with same permissions as you, or higher."); return false; } - // PARECE OK + // Seems OK dataHolder.removeUser(auxUser.getName()); sender.sendMessage(ChatColor.YELLOW + "You changed player '" + auxUser.getName() + "' to default settings."); @@ -463,8 +561,9 @@ public class GroupManager extends JavaPlugin { BukkitPermissions.updatePermissions(targetPlayer); return true; + case manuaddsub: - // VALIDANDO ESTADO DO SENDER + // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) { sender.sendMessage(ChatColor.RED + "Couldn't retrieve your world. World selection is needed."); @@ -472,15 +571,15 @@ public class GroupManager extends JavaPlugin { return true; } } - // VALIDANDO ARGUMENTOS + // Validating arguments if (args.length != 2) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <player> <group>)"); return false; } if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) { - return false; + return false; } - + if (match != null) { auxUser = dataHolder.getUser(match.get(0)); } else { @@ -491,37 +590,34 @@ public class GroupManager extends JavaPlugin { sender.sendMessage(ChatColor.RED + "Group not found!"); return false; } - // VALIDANDO PERMISSAO + // Validating permission if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getName(), senderGroup.getName()) : false)) { - sender.sendMessage(ChatColor.RED + "Can't modify player with same permissions than you, or higher."); + sender.sendMessage(ChatColor.RED + "You can't modify a player with same permissions as you, or higher."); return false; } - // PARECE OK + // Seems OK if (auxUser.addSubGroup(auxGroup)) sender.sendMessage(ChatColor.YELLOW + "You added subgroup '" + auxGroup.getName() + "' to player '" + auxUser.getName() + "'."); else sender.sendMessage(ChatColor.RED + "The subgroup '" + auxGroup.getName() + "' is already available to '" + auxUser.getName() + "'."); - //targetPlayer = this.getServer().getPlayer(auxUser.getName()); - //if (targetPlayer != null) - // BukkitPermissions.updatePermissions(targetPlayer); - return true; + case manudelsub: - // VALIDANDO ESTADO DO SENDER + // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } - // VALIDANDO ARGUMENTOS + // Validating arguments if (args.length != 2) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/manudelsub <user> <group>)"); return false; } if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) { - return false; + return false; } - + if (match != null) { auxUser = dataHolder.getUser(match.get(0)); } else { @@ -533,27 +629,28 @@ public class GroupManager extends JavaPlugin { return false; } - // VALIDANDO PERMISSAO + // Validating permission if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getName(), senderGroup.getName()) : false)) { - sender.sendMessage(ChatColor.RED + "Can't modify player with same permissions than you, or higher."); + sender.sendMessage(ChatColor.RED + "You can't modify a player with same permissions as you, or higher."); return false; } - // PARECE OK + // Seems OK auxUser.removeSubGroup(auxGroup); sender.sendMessage(ChatColor.YELLOW + "You removed subgroup '" + auxGroup.getName() + "' from player '" + auxUser.getName() + "' list."); - //targetPlayer = this.getServer().getPlayer(auxUser.getName()); - //if (targetPlayer != null) - // BukkitPermissions.updatePermissions(targetPlayer); + // targetPlayer = this.getServer().getPlayer(auxUser.getName()); + // if (targetPlayer != null) + // BukkitPermissions.updatePermissions(targetPlayer); return true; + case mangadd: - // VALIDANDO ESTADO DO SENDER + // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } - // VALIDANDO ARGUMENTOS + // Validating arguments if (args.length != 1) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <group>)"); return false; @@ -563,18 +660,19 @@ public class GroupManager extends JavaPlugin { sender.sendMessage(ChatColor.RED + "Group already exists!"); return false; } - // PARECE OK + // Seems OK auxGroup = dataHolder.createGroup(args[0]); sender.sendMessage(ChatColor.YELLOW + "You created a group named: " + auxGroup.getName()); return true; + case mangdel: - // VALIDANDO ESTADO DO SENDER + // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } - // VALIDANDO ARGUMENTOS + // Validating arguments if (args.length != 1) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <group>)"); return false; @@ -584,44 +682,45 @@ public class GroupManager extends JavaPlugin { sender.sendMessage(ChatColor.RED + "Group not exists!"); return false; } - // PARECE OK + // Seems OK dataHolder.removeGroup(auxGroup.getName()); sender.sendMessage(ChatColor.YELLOW + "You deleted a group named " + auxGroup.getName() + ", it's users are default group now."); BukkitPermissions.updateAllPlayers(); return true; + case manuaddp: - // VALIDANDO ESTADO DO SENDER + // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } - // VALIDANDO ARGUMENTOS + // Validating arguments if (args.length != 2) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <player> <permission>)"); return false; } if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) { - return false; + return false; } - + if (match != null) { auxUser = dataHolder.getUser(match.get(0)); } else { auxUser = dataHolder.getUser(args[0]); } - // VALIDANDO SUA PERMISSAO + // Validating your permissions if (!isConsole && (senderGroup != null ? permissionHandler.inGroup(auxUser.getName(), senderGroup.getName()) : false)) { sender.sendMessage(ChatColor.RED + "Can't modify player with same group than you, or higher."); return false; } permissionResult = permissionHandler.checkFullUserPermission(senderUser, args[1]); if (!isConsole && !isOpOverride && (permissionResult.resultType.equals(PermissionCheckResult.Type.NOTFOUND) || permissionResult.resultType.equals(PermissionCheckResult.Type.NEGATION))) { - sender.sendMessage(ChatColor.RED + "Can't add a permission you don't have."); + sender.sendMessage(ChatColor.RED + "You can't add a permission you don't have."); return false; } - // VALIDANDO PERMISSAO DO DESTINO + // Validating permissions of user permissionResult = permissionHandler.checkUserOnlyPermission(auxUser, args[1]); if (args[1].startsWith("+")) { if (permissionResult.resultType.equals(PermissionCheckResult.Type.EXCEPTION)) { @@ -646,7 +745,7 @@ public class GroupManager extends JavaPlugin { return false; } } - // PARECE OK + // Seems OK auxUser.addPermission(args[1]); sender.sendMessage(ChatColor.YELLOW + "You added '" + args[1] + "' to player '" + auxUser.getName() + "' permissions."); @@ -655,38 +754,38 @@ public class GroupManager extends JavaPlugin { BukkitPermissions.updatePermissions(targetPlayer); return true; - // break; + case manudelp: - // VALIDANDO ESTADO DO SENDER + // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } - // VALIDANDO ARGUMENTOS + // Validating arguments if (args.length != 2) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <player> <permission>)"); return false; } if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) { - return false; + return false; } - + if (match != null) { auxUser = dataHolder.getUser(match.get(0)); } else { auxUser = dataHolder.getUser(args[0]); } - // VALIDANDO SUA PERMISSAO + // Validating your permissions if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getName(), senderGroup.getName()) : false)) { - sender.sendMessage(ChatColor.RED + "Can't modify player with same group than you, or higher."); + sender.sendMessage(ChatColor.RED + "You can't modify a player with same group as you, or higher."); return false; } permissionResult = permissionHandler.checkFullUserPermission(senderUser, args[1]); if (!isConsole && !isOpOverride && (permissionResult.resultType.equals(PermissionCheckResult.Type.NOTFOUND) || permissionResult.resultType.equals(PermissionCheckResult.Type.NEGATION))) { - sender.sendMessage(ChatColor.RED + "Can't remove a permission you don't have."); + sender.sendMessage(ChatColor.RED + "You can't remove a permission you don't have."); return false; } - // VALIDANDO PERMISSAO DO DESTINO + // Validating permissions of user permissionResult = permissionHandler.checkUserOnlyPermission(auxUser, args[1]); if (permissionResult.resultType.equals(PermissionCheckResult.Type.NOTFOUND)) { sender.sendMessage(ChatColor.RED + "The user doesn't have direct access to that permission."); @@ -697,7 +796,7 @@ public class GroupManager extends JavaPlugin { sender.sendMessage(ChatColor.RED + "But might match node: " + permissionResult.accessLevel); return false; } - // PARECE OK + // Seems OK auxUser.removePermission(args[1]); sender.sendMessage(ChatColor.YELLOW + "You removed '" + args[1] + "' from player '" + auxUser.getName() + "' permissions."); @@ -706,30 +805,30 @@ public class GroupManager extends JavaPlugin { BukkitPermissions.updatePermissions(targetPlayer); return true; - // break; + case manulistp: - // VALIDANDO ESTADO DO SENDER + // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } - // VALIDANDO ARGUMENTOS + // Validating arguments if ((args.length == 0) || (args.length > 2)) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <player> (+))"); return false; } - + if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) { - return false; + return false; } - + if (match != null) { auxUser = dataHolder.getUser(match.get(0)); } else { auxUser = dataHolder.getUser(args[0]); } - // VALIDANDO PERMISSAO - // PARECE OK + // Validating permission + // Seems OK auxString = ""; for (String perm : auxUser.getPermissionList()) { auxString += perm + ", "; @@ -771,35 +870,36 @@ public class GroupManager extends JavaPlugin { } return true; + case manucheckp: - // VALIDANDO ESTADO DO SENDER + // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } - // VALIDANDO ARGUMENTOS + // Validating arguments if (args.length != 2) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <player> <permission>)"); return false; } if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) { - return false; + return false; } - + if (match != null) { auxUser = dataHolder.getUser(match.get(0)); } else { auxUser = dataHolder.getUser(args[0]); } targetPlayer = this.getServer().getPlayer(auxUser.getName()); - // VALIDANDO PERMISSAO + // Validating permission permissionResult = permissionHandler.checkFullGMPermission(auxUser, args[1], false); if (permissionResult.resultType.equals(PermissionCheckResult.Type.NOTFOUND)) { - //No permissions found in GM so fall through and check Bukkit. + // No permissions found in GM so fall through and check Bukkit. sender.sendMessage(ChatColor.RED + "The player doesn't have access to that permission"); - + } else { // This permission was found in groupmanager. if (permissionResult.owner instanceof User) { @@ -821,33 +921,34 @@ public class GroupManager extends JavaPlugin { // superperms if (targetPlayer != null) { - sender.sendMessage(ChatColor.YELLOW + "SuperPerms reports Node: " + targetPlayer.hasPermission(args[1])); + sender.sendMessage(ChatColor.YELLOW + "SuperPerms reports Node: " + targetPlayer.hasPermission(args[1]) + ((!targetPlayer.hasPermission(args[1]) && targetPlayer.isPermissionSet(args[1])) ? " (Negated)": "")); } return true; + case mangaddp: - // VALIDANDO ESTADO DO SENDER + // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } - // VALIDANDO ARGUMENTOS + // Validating arguments if (args.length != 2) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <group> <permission>)"); return false; } auxGroup = dataHolder.getGroup(args[0]); if (auxGroup == null) { - sender.sendMessage(ChatColor.RED + "Group does not exists!"); + sender.sendMessage(ChatColor.RED + "The specified group does not exist!"); return false; } - // VALIDANDO SUA PERMISSAO + // Validating your permissions permissionResult = permissionHandler.checkFullUserPermission(senderUser, args[1]); if (!isConsole && (permissionResult.resultType.equals(PermissionCheckResult.Type.NOTFOUND) || permissionResult.resultType.equals(PermissionCheckResult.Type.NEGATION))) { - sender.sendMessage(ChatColor.RED + "Can't add a permission you don't have."); + sender.sendMessage(ChatColor.RED + "You can't add a permission you don't have."); return false; } - // VALIDANDO PERMISSAO DO DESTINO + // Validating permissions of user permissionResult = permissionHandler.checkGroupOnlyPermission(auxGroup, args[1]); if (args[1].startsWith("+")) { if (permissionResult.resultType.equals(PermissionCheckResult.Type.EXCEPTION)) { @@ -867,41 +968,42 @@ public class GroupManager extends JavaPlugin { } } else { if (permissionResult.resultType.equals(PermissionCheckResult.Type.FOUND)) { - sender.sendMessage(ChatColor.RED + "The user already has direct access to that permission."); + sender.sendMessage(ChatColor.RED + "The group already has direct access to that permission."); sender.sendMessage(ChatColor.RED + "Node: " + permissionResult.accessLevel); return false; } } - // PARECE OK + // Seems OK auxGroup.addPermission(args[1]); sender.sendMessage(ChatColor.YELLOW + "You added '" + args[1] + "' to group '" + auxGroup.getName() + "' permissions."); BukkitPermissions.updateAllPlayers(); return true; + case mangdelp: - // VALIDANDO ESTADO DO SENDER + // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } - // VALIDANDO ARGUMENTOS + // Validating arguments if (args.length != 2) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <group> <permission>)"); return false; } auxGroup = dataHolder.getGroup(args[0]); if (auxGroup == null) { - sender.sendMessage(ChatColor.RED + "Group does not exists!"); + sender.sendMessage(ChatColor.RED + "The specified group does not exist!"); return false; } - // VALIDANDO SUA PERMISSAO + // Validating your permissions permissionResult = permissionHandler.checkFullUserPermission(senderUser, args[1]); if (!isConsole && (permissionResult.resultType.equals(PermissionCheckResult.Type.NOTFOUND) || permissionResult.resultType.equals(PermissionCheckResult.Type.NEGATION))) { sender.sendMessage(ChatColor.RED + "Can't remove a permission you don't have."); return false; } - // VALIDANDO PERMISSAO DO DESTINO + // Validating permissions of user permissionResult = permissionHandler.checkGroupOnlyPermission(auxGroup, args[1]); if (permissionResult.resultType.equals(PermissionCheckResult.Type.NOTFOUND)) { sender.sendMessage(ChatColor.RED + "The group doesn't have direct access to that permission."); @@ -912,32 +1014,33 @@ public class GroupManager extends JavaPlugin { sender.sendMessage(ChatColor.RED + "But might match node: " + permissionResult.accessLevel); return false; } - // PARECE OK + // Seems OK auxGroup.removePermission(args[1]); sender.sendMessage(ChatColor.YELLOW + "You removed '" + args[1] + "' from group '" + auxGroup.getName() + "' permissions."); BukkitPermissions.updateAllPlayers(); return true; + case manglistp: - // VALIDANDO ESTADO DO SENDER + // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } - // VALIDANDO ARGUMENTOS + // Validating arguments if (args.length != 1) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <group>)"); return false; } auxGroup = dataHolder.getGroup(args[0]); if (auxGroup == null) { - sender.sendMessage(ChatColor.RED + "Group does not exists!"); + sender.sendMessage(ChatColor.RED + "The specified group does not exist!"); return false; } - // VALIDANDO PERMISSAO + // Validating permission - // PARECE OK + // Seems OK auxString = ""; for (String perm : auxGroup.getPermissionList()) { auxString += perm + ", "; @@ -967,31 +1070,31 @@ public class GroupManager extends JavaPlugin { } return true; + case mangcheckp: - // VALIDANDO ESTADO DO SENDER + // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } - // VALIDANDO ARGUMENTOS + // Validating arguments if (args.length != 2) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <group> <permission>)"); return false; } auxGroup = dataHolder.getGroup(args[0]); if (auxGroup == null) { - sender.sendMessage(ChatColor.RED + "Group does not exists!"); + sender.sendMessage(ChatColor.RED + "The specified group does not exist!"); return false; } - // VALIDANDO PERMISSAO + // Validating permission permissionResult = permissionHandler.checkGroupPermissionWithInheritance(auxGroup, args[1]); if (permissionResult.resultType.equals(PermissionCheckResult.Type.NOTFOUND)) { sender.sendMessage(ChatColor.RED + "The group doesn't have access to that permission"); return false; } - // PARECE OK - // auxString = - // permissionHandler.checkUserOnlyPermission(auxUser, args[1]); + // Seems OK + // auxString = permissionHandler.checkUserOnlyPermission(auxUser, args[1]); if (permissionResult.owner instanceof Group) { if (permissionResult.resultType.equals(PermissionCheckResult.Type.NEGATION)) { sender.sendMessage(ChatColor.RED + "The group inherits the a negation permission from group: " + permissionResult.owner.getName()); @@ -1002,72 +1105,74 @@ public class GroupManager extends JavaPlugin { } return true; + case mangaddi: - // VALIDANDO ESTADO DO SENDER + // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } - // VALIDANDO ARGUMENTOS + // Validating arguments if (args.length != 2) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <group1> <group2>)"); return false; } auxGroup = dataHolder.getGroup(args[0]); if (auxGroup == null) { - sender.sendMessage(ChatColor.RED + "Group 1 does not exists!"); + sender.sendMessage(ChatColor.RED + "Group 1 does not exist!"); return false; } auxGroup2 = dataHolder.getGroup(args[1]); if (auxGroup2 == null) { - sender.sendMessage(ChatColor.RED + "Group 2 does not exists!"); + sender.sendMessage(ChatColor.RED + "Group 2 does not exist!"); return false; } if (auxGroup.isGlobal()) { sender.sendMessage(ChatColor.RED + "GlobalGroups do NOT support inheritance."); return false; } - - // VALIDANDO PERMISSAO - if (permissionHandler.searchGroupInInheritance(auxGroup, auxGroup2.getName(), null)) { + + // Validating permission + if (permissionHandler.hasGroupInInheritance(auxGroup, auxGroup2.getName())) { sender.sendMessage(ChatColor.RED + "Group " + auxGroup.getName() + " already inherits " + auxGroup2.getName() + " (might not be directly)"); return false; } - // PARECE OK + // Seems OK auxGroup.addInherits(auxGroup2); sender.sendMessage(ChatColor.RED + "Group " + auxGroup2.getName() + " is now in " + auxGroup.getName() + " inheritance list."); BukkitPermissions.updateAllPlayers(); return true; + case mangdeli: - // VALIDANDO ESTADO DO SENDER + // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } - // VALIDANDO ARGUMENTOS + // Validating arguments if (args.length != 2) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <group1> <group2>)"); return false; } auxGroup = dataHolder.getGroup(args[0]); if (auxGroup == null) { - sender.sendMessage(ChatColor.RED + "Group 1 does not exists!"); + sender.sendMessage(ChatColor.RED + "Group 1 does not exist!"); return false; } auxGroup2 = dataHolder.getGroup(args[1]); if (auxGroup2 == null) { - sender.sendMessage(ChatColor.RED + "Group 2 does not exists!"); + sender.sendMessage(ChatColor.RED + "Group 2 does not exist!"); return false; } if (auxGroup.isGlobal()) { sender.sendMessage(ChatColor.RED + "GlobalGroups do NOT support inheritance."); return false; } - - // VALIDANDO PERMISSAO - if (!permissionHandler.searchGroupInInheritance(auxGroup, auxGroup2.getName(), null)) { + + // Validating permission + if (!permissionHandler.hasGroupInInheritance(auxGroup, auxGroup2.getName())) { sender.sendMessage(ChatColor.RED + "Group " + auxGroup.getName() + " does not inherits " + auxGroup2.getName() + "."); return false; } @@ -1075,35 +1180,36 @@ public class GroupManager extends JavaPlugin { sender.sendMessage(ChatColor.RED + "Group " + auxGroup.getName() + " does not inherits " + auxGroup2.getName() + " directly."); return false; } - // PARECE OK + // Seems OK auxGroup.removeInherits(auxGroup2.getName()); sender.sendMessage(ChatColor.RED + "Group " + auxGroup2.getName() + " was removed from " + auxGroup.getName() + " inheritance list."); BukkitPermissions.updateAllPlayers(); return true; + case manuaddv: - // VALIDANDO ESTADO DO SENDER + // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } - // VALIDANDO ARGUMENTOS + // Validating arguments if (args.length < 3) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <user> <variable> <value>)"); return false; } if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) { - return false; + return false; } - + if (match != null) { auxUser = dataHolder.getUser(match.get(0)); } else { auxUser = dataHolder.getUser(args[0]); } - // VALIDANDO PERMISSAO - // PARECE OK + // Validating permission + // Seems OK auxString = ""; for (int i = 2; i < args.length; i++) { auxString += args[i]; @@ -1113,56 +1219,60 @@ public class GroupManager extends JavaPlugin { } auxUser.getVariables().addVar(args[1], Variables.parseVariableValue(auxString)); sender.sendMessage(ChatColor.YELLOW + "Variable " + ChatColor.GOLD + args[1] + ChatColor.YELLOW + ":'" + ChatColor.GREEN + auxString + ChatColor.YELLOW + "' added to the user " + auxUser.getName()); + return true; + case manudelv: - // VALIDANDO ESTADO DO SENDER + // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } - // VALIDANDO ARGUMENTOS + // Validating arguments if (args.length != 2) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <user> <variable>)"); return false; } if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) { - return false; + return false; } - + if (match != null) { auxUser = dataHolder.getUser(match.get(0)); } else { auxUser = dataHolder.getUser(args[0]); } - // VALIDANDO PERMISSAO + // Validating permission if (!auxUser.getVariables().hasVar(args[1])) { sender.sendMessage(ChatColor.RED + "The user doesn't have directly that variable!"); } - // PARECE OK + // Seems OK auxUser.getVariables().removeVar(args[1]); sender.sendMessage(ChatColor.YELLOW + "Variable " + ChatColor.GOLD + args[1] + ChatColor.YELLOW + " removed from the user " + ChatColor.GREEN + auxUser.getName()); + return true; + case manulistv: - // VALIDANDO ESTADO DO SENDER + // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } - // VALIDANDO ARGUMENTOS + // Validating arguments if (args.length != 1) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <user>)"); return false; } if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) { - return false; + return false; } if (match != null) { auxUser = dataHolder.getUser(match.get(0)); } else { auxUser = dataHolder.getUser(args[0]); } - // VALIDANDO PERMISSAO - // PARECE OK + // Validating permission + // Seems OK auxString = ""; for (String varKey : auxUser.getVariables().getVarKeyList()) { Object o = auxUser.getVariables().getVarObject(varKey); @@ -1174,27 +1284,29 @@ public class GroupManager extends JavaPlugin { sender.sendMessage(ChatColor.YELLOW + "Variables of user " + auxUser.getName() + ": "); sender.sendMessage(auxString + "."); sender.sendMessage(ChatColor.YELLOW + "Plus all variables from group: " + auxUser.getGroupName()); + return true; + case manucheckv: - // VALIDANDO ESTADO DO SENDER + // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } - // VALIDANDO ARGUMENTOS + // Validating arguments if (args.length != 2) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <user> <variable>)"); return false; } if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) { - return false; + return false; } if (match != null) { auxUser = dataHolder.getUser(match.get(0)); } else { auxUser = dataHolder.getUser(args[0]); } - // VALIDANDO PERMISSAO + // Validating permission auxGroup = auxUser.getGroup(); auxGroup2 = permissionHandler.nextGroupWithVariable(auxGroup, args[1]); @@ -1203,14 +1315,15 @@ public class GroupManager extends JavaPlugin { if (!auxUser.isSubGroupsEmpty() && auxGroup2 == null) for (Group subGroup : auxUser.subGroupListCopy()) { auxGroup2 = permissionHandler.nextGroupWithVariable(subGroup, args[1]); - if (auxGroup2 != null) continue; + if (auxGroup2 != null) + continue; } if (auxGroup2 == null) { sender.sendMessage(ChatColor.RED + "The user doesn't have access to that variable!"); return false; } } - // PARECE OK + // Seems OK if (auxUser.getVariables().hasVar(auxString)) { sender.sendMessage(ChatColor.YELLOW + "The value of variable '" + ChatColor.GOLD + args[1] + ChatColor.YELLOW + "' is: '" + ChatColor.GREEN + auxUser.getVariables().getVarObject(args[1]).toString() + ChatColor.WHITE + "'"); sender.sendMessage(ChatColor.YELLOW + "This user own directly the variable"); @@ -1219,29 +1332,31 @@ public class GroupManager extends JavaPlugin { if (!auxGroup.equals(auxGroup2)) { sender.sendMessage(ChatColor.YELLOW + "And the value was inherited from group: " + ChatColor.GREEN + auxGroup2.getName()); } + return true; + case mangaddv: - // VALIDANDO ESTADO DO SENDER + // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } - // VALIDANDO ARGUMENTOS + // Validating arguments if (args.length < 3) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <group> <variable> <value>)"); return false; } auxGroup = dataHolder.getGroup(args[0]); if (auxGroup == null) { - sender.sendMessage(ChatColor.RED + "Group does not exists!"); + sender.sendMessage(ChatColor.RED + "The specified group does not exist!"); return false; } if (auxGroup.isGlobal()) { sender.sendMessage(ChatColor.RED + "GlobalGroups do NOT support Info Nodes."); return false; } - // VALIDANDO PERMISSAO - // PARECE OK + // Validating permission + // Seems OK auxString = ""; for (int i = 2; i < args.length; i++) { auxString += args[i]; @@ -1253,57 +1368,59 @@ public class GroupManager extends JavaPlugin { sender.sendMessage(ChatColor.YELLOW + "Variable " + ChatColor.GOLD + args[1] + ChatColor.YELLOW + ":'" + ChatColor.GREEN + auxString + ChatColor.YELLOW + "' added to the group " + auxGroup.getName()); return true; + case mangdelv: - // VALIDANDO ESTADO DO SENDER + // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } - // VALIDANDO ARGUMENTOS + // Validating arguments if (args.length != 2) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <group> <variable>)"); return false; } auxGroup = dataHolder.getGroup(args[0]); if (auxGroup == null) { - sender.sendMessage(ChatColor.RED + "Group does not exists!"); + sender.sendMessage(ChatColor.RED + "The specified group does not exist!"); return false; } if (auxGroup.isGlobal()) { sender.sendMessage(ChatColor.RED + "GlobalGroups do NOT support Info Nodes."); return false; } - // VALIDANDO PERMISSAO + // Validating permission if (!auxGroup.getVariables().hasVar(args[1])) { sender.sendMessage(ChatColor.RED + "The group doesn't have directly that variable!"); } - // PARECE OK + // Seems OK auxGroup.getVariables().removeVar(args[1]); sender.sendMessage(ChatColor.YELLOW + "Variable " + ChatColor.GOLD + args[1] + ChatColor.YELLOW + " removed from the group " + ChatColor.GREEN + auxGroup.getName()); return true; + case manglistv: - // VALIDANDO ESTADO DO SENDER + // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } - // VALIDANDO ARGUMENTOS + // Validating arguments if (args.length != 1) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <group>)"); return false; } auxGroup = dataHolder.getGroup(args[0]); if (auxGroup == null) { - sender.sendMessage(ChatColor.RED + "Group does not exists!"); + sender.sendMessage(ChatColor.RED + "The specified group does not exist!"); return false; } if (auxGroup.isGlobal()) { sender.sendMessage(ChatColor.RED + "GlobalGroups do NOT support Info Nodes."); return false; } - // VALIDANDO PERMISSAO - // PARECE OK + // Validating permission + // Seems OK auxString = ""; for (String varKey : auxGroup.getVariables().getVarKeyList()) { Object o = auxGroup.getVariables().getVarObject(varKey); @@ -1322,60 +1439,74 @@ public class GroupManager extends JavaPlugin { auxString = auxString.substring(0, auxString.lastIndexOf(",")); sender.sendMessage(ChatColor.YELLOW + "Plus all variables from groups: " + auxString); } + return true; + case mangcheckv: - // VALIDANDO ESTADO DO SENDER + // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } - // VALIDANDO ARGUMENTOS + // Validating arguments if (args.length != 2) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <group> <variable>)"); return false; } auxGroup = dataHolder.getGroup(args[0]); if (auxGroup == null) { - sender.sendMessage(ChatColor.RED + "Group does not exists!"); + sender.sendMessage(ChatColor.RED + "The specified group does not exist!"); return false; } if (auxGroup.isGlobal()) { sender.sendMessage(ChatColor.RED + "GlobalGroups do NOT support Info Nodes."); return false; } - // VALIDANDO PERMISSAO - auxGroup2 = permissionHandler.nextGroupWithVariable(auxGroup, args[1], null); + // Validating permission + auxGroup2 = permissionHandler.nextGroupWithVariable(auxGroup, args[1]); if (auxGroup2 == null) { sender.sendMessage(ChatColor.RED + "The group doesn't have access to that variable!"); } - // PARECE OK + // Seems OK sender.sendMessage(ChatColor.YELLOW + "The value of variable '" + ChatColor.GOLD + args[1] + ChatColor.YELLOW + "' is: '" + ChatColor.GREEN + auxGroup2.getVariables().getVarObject(args[1]).toString() + ChatColor.WHITE + "'"); if (!auxGroup.equals(auxGroup2)) { sender.sendMessage(ChatColor.YELLOW + "And the value was inherited from group: " + ChatColor.GREEN + auxGroup2.getName()); } + return true; + case manwhois: - // VALIDANDO ESTADO DO SENDER + // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } - // VALIDANDO ARGUMENTOS + // Validating arguments if (args.length != 1) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <player>)"); return false; } if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) { - return false; + return false; } if (match != null) { auxUser = dataHolder.getUser(match.get(0)); } else { auxUser = dataHolder.getUser(args[0]); } - // PARECE OK + // Seems OK sender.sendMessage(ChatColor.YELLOW + "Name: " + ChatColor.GREEN + auxUser.getName()); sender.sendMessage(ChatColor.YELLOW + "Group: " + ChatColor.GREEN + auxUser.getGroup().getName()); + // Compile a list of subgroups + auxString = ""; + for (String subGroup : auxUser.subGroupListStringCopy()) { + auxString += subGroup + ", "; + } + if (auxString.lastIndexOf(",") > 0) { + auxString = auxString.substring(0, auxString.lastIndexOf(",")); + sender.sendMessage(ChatColor.YELLOW + "subgroups: " + auxString); + } + sender.sendMessage(ChatColor.YELLOW + "Overloaded: " + ChatColor.GREEN + dataHolder.isOverloaded(auxUser.getName())); auxGroup = dataHolder.surpassOverload(auxUser.getName()).getGroup(); if (!auxGroup.equals(auxUser.getGroup())) { @@ -1383,32 +1514,32 @@ public class GroupManager extends JavaPlugin { } // victim.permissions.add(args[1]); return true; - // break; + case tempadd: - // VALIDANDO ESTADO DO SENDER + // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } - // VALIDANDO ARGUMENTOS + // Validating arguments if (args.length != 1) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <player>)"); return false; } if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) { - return false; + return false; } if (match != null) { auxUser = dataHolder.getUser(match.get(0)); } else { auxUser = dataHolder.getUser(args[0]); } - // VALIDANDO PERMISSAO + // Validating permission if (!isConsole && (senderGroup != null ? permissionHandler.inGroup(auxUser.getName(), senderGroup.getName()) : false)) { sender.sendMessage(ChatColor.RED + "Can't modify player with same permissions than you, or higher."); return false; } - // PARECE OK + // Seems OK if (overloadedUsers.get(dataHolder.getName().toLowerCase()) == null) { overloadedUsers.put(dataHolder.getName().toLowerCase(), new ArrayList<User>()); } @@ -1417,32 +1548,32 @@ public class GroupManager extends JavaPlugin { sender.sendMessage(ChatColor.YELLOW + "Player overloaded!"); return true; - // break; + case tempdel: - // VALIDANDO ESTADO DO SENDER + // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } - // VALIDANDO ARGUMENTOS + // Validating arguments if (args.length != 1) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <player>)"); return false; } if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) { - return false; + return false; } if (match != null) { auxUser = dataHolder.getUser(match.get(0)); } else { auxUser = dataHolder.getUser(args[0]); } - // VALIDANDO PERMISSAO + // Validating permission if (!isConsole && (senderGroup != null ? permissionHandler.inGroup(auxUser.getName(), senderGroup.getName()) : false)) { - sender.sendMessage(ChatColor.RED + "Can't modify player with same permissions than you, or higher."); + sender.sendMessage(ChatColor.RED + "You can't modify a player with same permissions as you, or higher."); return false; } - // PARECE OK + // Seems OK if (overloadedUsers.get(dataHolder.getName().toLowerCase()) == null) { overloadedUsers.put(dataHolder.getName().toLowerCase(), new ArrayList<User>()); } @@ -1450,12 +1581,12 @@ public class GroupManager extends JavaPlugin { if (overloadedUsers.get(dataHolder.getName().toLowerCase()).contains(auxUser)) { overloadedUsers.get(dataHolder.getName().toLowerCase()).remove(auxUser); } - sender.sendMessage(ChatColor.YELLOW + "You removed that player overload. He's back to normal!"); + sender.sendMessage(ChatColor.YELLOW + "You removed that player's overload. He's back to normal!"); return true; - // break; + case templist: - // VALIDANDO ESTADO DO SENDER + // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; @@ -1473,7 +1604,7 @@ public class GroupManager extends JavaPlugin { } } if (count == 0) { - sender.sendMessage(ChatColor.YELLOW + "There is no users in overload mode"); + sender.sendMessage(ChatColor.YELLOW + "There are no users in overload mode."); return true; } auxString = auxString.substring(0, auxString.lastIndexOf(",")); @@ -1482,9 +1613,11 @@ public class GroupManager extends JavaPlugin { } overloadedUsers.get(dataHolder.getName().toLowerCase()).removeAll(removeList); sender.sendMessage(ChatColor.YELLOW + " " + count + " Users in overload mode: " + ChatColor.WHITE + auxString); + return true; + case tempdelall: - // VALIDANDO ESTADO DO SENDER + // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; @@ -1499,23 +1632,24 @@ public class GroupManager extends JavaPlugin { } } if (count == 0) { - sender.sendMessage(ChatColor.YELLOW + "There is no users in overload mode"); + sender.sendMessage(ChatColor.YELLOW + "There are no users in overload mode."); return true; } if (overloadedUsers.get(dataHolder.getName().toLowerCase()) == null) { overloadedUsers.put(dataHolder.getName().toLowerCase(), new ArrayList<User>()); } overloadedUsers.get(dataHolder.getName().toLowerCase()).clear(); - sender.sendMessage(ChatColor.YELLOW + " " + count + " Users in overload mode. Now they are normal again."); + sender.sendMessage(ChatColor.YELLOW + " " + count + "All users in overload mode are now normal again."); return true; + case mansave: - + boolean forced = false; - + if ((args.length == 1) && (args[0].equalsIgnoreCase("force"))) forced = true; - + try { worldsHolder.saveChanges(forced); sender.sendMessage(ChatColor.YELLOW + " All changes were saved."); @@ -1525,10 +1659,17 @@ public class GroupManager extends JavaPlugin { return true; case manload: + /** * Attempt to reload a specific world */ if (args.length > 0) { + + if (!lastError.isEmpty()) { + sender.sendMessage(ChatColor.RED + "All commands are locked due to an error. Check the log and then try a '/manload'.)"); + return true; + } + auxString = ""; for (int i = 0; i < args.length; i++) { auxString += args[i]; @@ -1541,7 +1682,7 @@ public class GroupManager extends JavaPlugin { globalGroups.load(); worldsHolder.loadWorld(auxString); - + sender.sendMessage("The request to reload world '" + auxString + "' was attempted."); isLoaded = true; @@ -1549,24 +1690,30 @@ public class GroupManager extends JavaPlugin { BukkitPermissions.updateAllPlayers(); } else { - + /** * Reload all settings and data as no world was specified. */ - onDisable(); - onEnable(); + + /* + * Attempting a fresh load. + */ + onDisable(true); + onEnable(true); + + sender.sendMessage("All settings and worlds were reloaded!"); } - + /** * Fire an event as none will have been triggered in the reload. */ if (GroupManager.isLoaded()) - GroupManagerEventHandler.callEvent(GMSystemEvent.Action.RELOADED); + GroupManagerEventHandler.callEvent(GMSystemEvent.Action.RELOADED); return true; - + case listgroups: - // VALIDANDO ESTADO DO SENDER + // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; @@ -1583,20 +1730,22 @@ public class GroupManager extends JavaPlugin { auxString = auxString.substring(0, auxString.lastIndexOf(",")); } sender.sendMessage(ChatColor.YELLOW + " Groups Available: " + ChatColor.WHITE + auxString); + return true; + case manpromote: - // VALIDANDO ESTADO DO SENDER + // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } - // VALIDANDO ARGUMENTOS + // Validating arguments if (args.length != 2) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <player> <group>)"); return false; } if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) { - return false; + return false; } if (match != null) { auxUser = dataHolder.getUser(match.get(0)); @@ -1612,9 +1761,9 @@ public class GroupManager extends JavaPlugin { sender.sendMessage(ChatColor.RED + "Players may not be members of GlobalGroups directly."); return false; } - // VALIDANDO PERMISSAO + // Validating permission if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getName(), senderGroup.getName()) : false)) { - sender.sendMessage(ChatColor.RED + "Can't modify player with same permissions than you, or higher."); + sender.sendMessage(ChatColor.RED + "You can't modify a player with same permissions as you, or higher."); return false; } if (!isConsole && !isOpOverride && (permissionHandler.hasGroupInInheritance(auxGroup, senderGroup.getName()))) { @@ -1622,41 +1771,37 @@ public class GroupManager extends JavaPlugin { return false; } if (!isConsole && !isOpOverride && (!permissionHandler.inGroup(senderUser.getName(), auxUser.getGroupName()) || !permissionHandler.inGroup(senderUser.getName(), auxGroup.getName()))) { - sender.sendMessage(ChatColor.RED + "Can't modify player involving a group that you don't inherit."); + sender.sendMessage(ChatColor.RED + "You can't modify a player involving a group that you don't inherit."); return false; } if (!isConsole && !isOpOverride && (!permissionHandler.hasGroupInInheritance(auxUser.getGroup(), auxGroup.getName()) && !permissionHandler.hasGroupInInheritance(auxGroup, auxUser.getGroupName()))) { - sender.sendMessage(ChatColor.RED + "Can't modify player using groups with different heritage line."); + sender.sendMessage(ChatColor.RED + "You can't modify a player using groups with different heritage line."); return false; } if (!isConsole && !isOpOverride && (!permissionHandler.hasGroupInInheritance(auxGroup, auxUser.getGroupName()))) { sender.sendMessage(ChatColor.RED + "The new group must be a higher rank."); return false; } - // PARECE OK + // Seems OK auxUser.setGroup(auxGroup); if (!sender.hasPermission("groupmanager.notify.other") || (isConsole)) sender.sendMessage(ChatColor.YELLOW + "You changed " + auxUser.getName() + " group to " + auxGroup.getName() + "."); - //targetPlayer = this.getServer().getPlayer(auxUser.getName()); - //if (targetPlayer != null) - // BukkitPermissions.updatePermissions(targetPlayer); - return true; - // break; + case mandemote: - // VALIDANDO ESTADO DO SENDER + // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } - // VALIDANDO ARGUMENTOS + // Validating arguments if (args.length != 2) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <player> <group>)"); return false; } if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) { - return false; + return false; } if (match != null) { auxUser = dataHolder.getUser(match.get(0)); @@ -1672,9 +1817,9 @@ public class GroupManager extends JavaPlugin { sender.sendMessage(ChatColor.RED + "Players may not be members of GlobalGroups directly."); return false; } - // VALIDANDO PERMISSAO + // Validating permission if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getName(), senderGroup.getName()) : false)) { - sender.sendMessage(ChatColor.RED + "Can't modify player with same permissions than you, or higher."); + sender.sendMessage(ChatColor.RED + "You can't modify a player with same permissions as you, or higher."); return false; } if (!isConsole && !isOpOverride && (permissionHandler.hasGroupInInheritance(auxGroup, senderGroup.getName()))) { @@ -1682,28 +1827,24 @@ public class GroupManager extends JavaPlugin { return false; } if (!isConsole && !isOpOverride && (!permissionHandler.inGroup(senderUser.getName(), auxUser.getGroupName()) || !permissionHandler.inGroup(senderUser.getName(), auxGroup.getName()))) { - sender.sendMessage(ChatColor.RED + "Can't modify player involving a group that you don' inherit."); + sender.sendMessage(ChatColor.RED + "You can't modify a player involving a group that you don't inherit."); return false; } if (!isConsole && !isOpOverride && (!permissionHandler.hasGroupInInheritance(auxUser.getGroup(), auxGroup.getName()) && !permissionHandler.hasGroupInInheritance(auxGroup, auxUser.getGroupName()))) { - sender.sendMessage(ChatColor.RED + "Can't modify player using groups with different heritage line."); + sender.sendMessage(ChatColor.RED + "You can't modify a player using groups with different heritage line."); return false; } if (!isConsole && !isOpOverride && (permissionHandler.hasGroupInInheritance(auxGroup, auxUser.getGroupName()))) { sender.sendMessage(ChatColor.RED + "The new group must be a lower rank."); return false; } - // PARECE OK + // Seems OK auxUser.setGroup(auxGroup); if (!sender.hasPermission("groupmanager.notify.other") || (isConsole)) sender.sendMessage(ChatColor.YELLOW + "You changed " + auxUser.getName() + " group to " + auxGroup.getName() + "."); - //targetPlayer = this.getServer().getPlayer(auxUser.getName()); - //if (targetPlayer != null) - // BukkitPermissions.updatePermissions(targetPlayer); - return true; - // break; + case mantogglevalidate: validateOnlinePlayer = !validateOnlinePlayer; sender.sendMessage(ChatColor.YELLOW + "Validade if player is online, now set to: " + Boolean.toString(validateOnlinePlayer)); @@ -1734,7 +1875,9 @@ public class GroupManager extends JavaPlugin { sender.sendMessage(ChatColor.YELLOW + "Your world now uses permissions of world name: '" + dataHolder.getName() + "' "); } } + return true; + case manselect: if (args.length < 1) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/<command> <world>)"); @@ -1765,7 +1908,9 @@ public class GroupManager extends JavaPlugin { permissionHandler = dataHolder.getPermissionsHandler(); selectedWorlds.put(sender, dataHolder.getName()); sender.sendMessage(ChatColor.YELLOW + "You have selected world '" + dataHolder.getName() + "'."); + return true; + case manclear: if (args.length != 0) { sender.sendMessage(ChatColor.RED + "Review your arguments count!"); @@ -1773,7 +1918,9 @@ public class GroupManager extends JavaPlugin { } selectedWorlds.remove(sender); sender.sendMessage(ChatColor.YELLOW + "You have removed your world selection. Working with current world(if possible)."); + return true; + default: break; } @@ -1823,7 +1970,7 @@ public class GroupManager extends JavaPlugin { } } - + /** * Load a List of players matching the name given. If none online, check * Offline. @@ -1842,7 +1989,7 @@ public class GroupManager extends JavaPlugin { if (Arrays.asList(this.getServer().getOfflinePlayers()).contains(Bukkit.getOfflinePlayer(playerName))) { match.add(playerName); } else { - //look for partial matches + // look for partial matches for (OfflinePlayer offline : this.getServer().getOfflinePlayers()) { if (offline.getName().toLowerCase().startsWith(playerName.toLowerCase())) match.add(offline.getName()); @@ -1862,7 +2009,7 @@ public class GroupManager extends JavaPlugin { sender.sendMessage(ChatColor.RED + "Too many matches found! (" + match.toString() + ")"); return null; } - + return match; } @@ -1871,6 +2018,7 @@ public class GroupManager extends JavaPlugin { * @return the config */ public GMConfiguration getGMConfig() { + return config; } @@ -1878,10 +2026,12 @@ public class GroupManager extends JavaPlugin { * @return the backupFolder */ public File getBackupFolder() { + return backupFolder; } public static GlobalGroups getGlobalGroups() { + return globalGroups; } diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/Tasks/BukkitPermsUpdateTask.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/Tasks/BukkitPermsUpdateTask.java index f4b805c35..1a0fc2369 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/Tasks/BukkitPermsUpdateTask.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/Tasks/BukkitPermsUpdateTask.java @@ -5,24 +5,25 @@ import org.anjocaido.groupmanager.GroupManager; /*
*
* Created by ElgarL
- *
*/
public class BukkitPermsUpdateTask implements Runnable {
-
+
public BukkitPermsUpdateTask() {
- super();
+
+ super();
}
-
+
@Override
public void run() {
+
// Signal loaded and update BukkitPermissions.
GroupManager.setLoaded(true);
GroupManager.BukkitPermissions.collectPermissions();
GroupManager.BukkitPermissions.updateAllPlayers();
-
+
GroupManager.logger.info("Bukkit Permissions Updated!");
-
+
}
-
+
}
\ No newline at end of file diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/DataUnit.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/DataUnit.java index e3250a1c1..bb04fa3d7 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/DataUnit.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/DataUnit.java @@ -13,151 +13,169 @@ import org.anjocaido.groupmanager.dataholder.WorldDataHolder; import org.anjocaido.groupmanager.utils.StringPermissionComparator; /** - * + * * @author gabrielcouto */ public abstract class DataUnit { - private WorldDataHolder dataSource; - private String name; - private boolean changed, sorted = false; - private ArrayList<String> permissions = new ArrayList<String>(); + private WorldDataHolder dataSource; + private String name; + private boolean changed, sorted = false; + private ArrayList<String> permissions = new ArrayList<String>(); - public DataUnit(WorldDataHolder dataSource, String name) { - this.dataSource = dataSource; - this.name = name; - } + public DataUnit(WorldDataHolder dataSource, String name) { - public DataUnit(String name) { - this.name = name; + this.dataSource = dataSource; + this.name = name; + } + + public DataUnit(String name) { + + this.name = name; + } + + /** + * Every group is matched only by their names and DataSources names. + * + * @param o + * @return true if they are equal. false if not. + */ + @Override + public boolean equals(Object o) { + + if (o instanceof DataUnit) { + DataUnit go = (DataUnit) o; + if (this.getName().equalsIgnoreCase(go.getName())) { + // Global Group match. + if (this.dataSource == null && go.getDataSource() == null) + return true; + // This is a global group, the object to test isn't. + if (this.dataSource == null && go.getDataSource() != null) + return false; + // This is not a global group, but the object to test is. + if (this.dataSource != null && go.getDataSource() == null) + return false; + // Match on group name and world name. + if (this.dataSource.getName().equalsIgnoreCase(go.getDataSource().getName())) + return true; + } + } + return false; + } + + @Override + public int hashCode() { + + int hash = 5; + hash = 71 * hash + (this.name != null ? this.name.toLowerCase().hashCode() : 0); + return hash; + } + + /** + * Set the data source to point to a different worldDataHolder + * + * @param source + */ + public void setDataSource(WorldDataHolder source) { + + this.dataSource = source; + } + + /** + * Get the current worldDataHolder this object is pointing to + * + * @return the dataSource + */ + public WorldDataHolder getDataSource() { + + return dataSource; + } + + /** + * @return the name + */ + public String getName() { + + return name; + } + + public void flagAsChanged() { + + WorldDataHolder testSource = getDataSource(); + String source = ""; + + if (testSource == null) + source = "GlobalGroups"; + else + source = testSource.getName(); + + GroupManager.logger.finest("DataSource: " + source + " - DataUnit: " + getName() + " flagged as changed!"); + // for(StackTraceElement st: Thread.currentThread().getStackTrace()){ + // GroupManager.logger.finest(st.toString()); + // } + sorted = false; + changed = true; + } + + public boolean isChanged() { + + return changed; + } + + public void flagAsSaved() { + + WorldDataHolder testSource = getDataSource(); + String source = ""; + + if (testSource == null) + source = "GlobalGroups"; + else + source = testSource.getName(); + + GroupManager.logger.finest("DataSource: " + source + " - DataUnit: " + getName() + " flagged as saved!"); + changed = false; + } + + public boolean hasSamePermissionNode(String permission) { + + return permissions.contains(permission); + } + + public void addPermission(String permission) { + + if (!hasSamePermissionNode(permission)) { + permissions.add(permission); + } + flagAsChanged(); + } + + public boolean removePermission(String permission) { + + flagAsChanged(); + return permissions.remove(permission); } /** - * Every group is matched only by their names and DataSources names. - * @param o - * @return true if they are equal. false if not. - */ - @Override - public boolean equals(Object o) { - if (o instanceof DataUnit) { - DataUnit go = (DataUnit) o; - if (this.getName().equalsIgnoreCase(go.getName())) { - // Global Group match. - if (this.dataSource == null && go.getDataSource() == null) - return true; - // This is a global group, the object to test isn't. - if (this.dataSource == null && go.getDataSource() != null) - return false; - // This is not a global group, but the object to test is. - if (this.dataSource != null && go.getDataSource() == null) - return false; - // Match on group name and world name. - if (this.dataSource.getName().equalsIgnoreCase(go.getDataSource().getName())) - return true; - } - } - return false; - } - - @Override - public int hashCode() { - int hash = 5; - hash = 71 * hash + (this.name != null ? this.name.toLowerCase().hashCode() : 0); - return hash; - } - - /** - * Set the data source to point to a different worldDataHolder - * - * @param source - */ - public void setDataSource(WorldDataHolder source) { - this.dataSource = source; - } - - /** - * Get the current worldDataHolder this object is pointing to - * - * @return the dataSource - */ - public WorldDataHolder getDataSource() { - return dataSource; - } - - /** - * @return the name - */ - public String getName() { - return name; - } - - public void flagAsChanged() { - WorldDataHolder testSource = getDataSource(); - String source = ""; - - if (testSource == null) - source = "GlobalGroups"; - else - source = testSource.getName(); - - GroupManager.logger.finest("DataSource: " + source + " - DataUnit: " + getName() + " flagged as changed!"); -// for(StackTraceElement st: Thread.currentThread().getStackTrace()){ -// GroupManager.logger.finest(st.toString()); -// } - sorted = false; - changed = true; - } - - public boolean isChanged() { - return changed; - } - - public void flagAsSaved() { - WorldDataHolder testSource = getDataSource(); - String source = ""; - - if (testSource == null) - source = "GlobalGroups"; - else - source = testSource.getName(); - - GroupManager.logger.finest("DataSource: " + source + " - DataUnit: " + getName() + " flagged as saved!"); - changed = false; - } - - public boolean hasSamePermissionNode(String permission) { - return permissions.contains(permission); - } - - public void addPermission(String permission) { - if (!hasSamePermissionNode(permission)) { - permissions.add(permission); - } - flagAsChanged(); - } - - public boolean removePermission(String permission) { - flagAsChanged(); - return permissions.remove(permission); - } - - /** - * Use this only to list permissions. - * You can't edit the permissions using the returned ArrayList instance - * @return a copy of the permission list - */ - public List<String> getPermissionList() { - return Collections.unmodifiableList(permissions); - } - - public boolean isSorted() { - return this.sorted; - } - - public void sortPermissions() { - if (!isSorted()) { - Collections.sort(permissions, StringPermissionComparator.getInstance()); - sorted = true; - } - } + * Use this only to list permissions. + * You can't edit the permissions using the returned ArrayList instance + * + * @return a copy of the permission list + */ + public List<String> getPermissionList() { + + return Collections.unmodifiableList(permissions); + } + + public boolean isSorted() { + + return this.sorted; + } + + public void sortPermissions() { + + if (!isSorted()) { + Collections.sort(permissions, StringPermissionComparator.getInstance()); + sorted = true; + } + } }
\ No newline at end of file diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/Group.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/Group.java index 396240ec6..751dc8fd6 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/Group.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/Group.java @@ -15,160 +15,173 @@ import java.util.List; import java.util.Map; /** - * + * * @author gabrielcouto/ElgarL */ public class Group extends DataUnit implements Cloneable { - /** - * The group it inherits DIRECTLY! - */ - private ArrayList<String> inherits = new ArrayList<String>(); - /** - *This one holds the fields in INFO node. - * like prefix = 'c' - * or build = false - */ - private GroupVariables variables = new GroupVariables(this); - - /** - * Constructor for individual World Groups. - * - * @param name - */ - public Group(WorldDataHolder source, String name) { - super(source, name); - } - - /** - * Constructor for Global Groups. - * - * @param name - */ - public Group(String name) { - super(name); - } - - /** - * Is this a GlobalGroup - * - * @return - */ - public boolean isGlobal() { - return (getDataSource() == null); - } - - /** - * Clone this group - * @return a clone of this group - */ - @Override - public Group clone() { - Group clone; - - if (isGlobal()) { - clone = new Group(this.getName()); - } else { - clone = new Group(getDataSource(), this.getName()); - clone.inherits = new ArrayList<String>(this.getInherits()); - } - - for (String perm : this.getPermissionList()) { - clone.addPermission(perm); - } - clone.variables = ((GroupVariables) variables).clone(clone); - //clone.flagAsChanged(); - return clone; - } - - /** - * Use this to deliver a group from a different dataSource to another - * @param dataSource - * @return Null or Clone - */ - public Group clone(WorldDataHolder dataSource) { - if (dataSource.groupExists(this.getName())) { - return null; - } - - Group clone = dataSource.createGroup(this.getName()); - - // Don't add inheritance for GlobalGroups - if (!isGlobal()) { - clone.inherits = new ArrayList<String>(this.getInherits()); - } - for (String perm : this.getPermissionList()) { - clone.addPermission(perm); - } - clone.variables = variables.clone(clone); - clone.flagAsChanged(); //use this to make the new dataSource save the new group - return clone; - } - - /** - * an unmodifiable list of inherits list - * You can't manage the list by here - * Lol... version 0.6 had a problem because this. - * @return the inherits - */ - public List<String> getInherits() { - return Collections.unmodifiableList(inherits); - } - - /** - * @param inherit the inherits to set - */ - public void addInherits(Group inherit) { - if (!isGlobal()) { - if (!this.getDataSource().groupExists(inherit.getName())) { - getDataSource().addGroup(inherit); - } - if (!inherits.contains(inherit.getName().toLowerCase())) { - inherits.add(inherit.getName().toLowerCase()); - } - flagAsChanged(); - if (GroupManager.isLoaded()) { - GroupManager.BukkitPermissions.updateAllPlayers(); - GroupManagerEventHandler.callEvent(this, Action.GROUP_INHERITANCE_CHANGED); - } - } - } - - public boolean removeInherits(String inherit) { - if (!isGlobal()) { - if (this.inherits.contains(inherit.toLowerCase())) { - this.inherits.remove(inherit.toLowerCase()); - flagAsChanged(); - GroupManagerEventHandler.callEvent(this, Action.GROUP_INHERITANCE_CHANGED); - return true; - } - } - return false; - } - - /** - * @return the variables - */ - public GroupVariables getVariables() { - return variables; - } - - /** - * - * @param varList - */ - public void setVariables(Map<String, Object> varList) { - if (!isGlobal()) { - GroupVariables temp = new GroupVariables(this, varList); - variables.clearVars(); - for (String key : temp.getVarKeyList()) { - variables.addVar(key, temp.getVarObject(key)); - } - flagAsChanged(); - if (GroupManager.isLoaded()) { - GroupManager.BukkitPermissions.updateAllPlayers(); - GroupManagerEventHandler.callEvent(this, Action.GROUP_INFO_CHANGED); - } - } - } + /** + * The group it inherits DIRECTLY! + */ + private ArrayList<String> inherits = new ArrayList<String>(); + /** + * This one holds the fields in INFO node. + * like prefix = 'c' + * or build = false + */ + private GroupVariables variables = new GroupVariables(this); + + /** + * Constructor for individual World Groups. + * + * @param name + */ + public Group(WorldDataHolder source, String name) { + + super(source, name); + } + + /** + * Constructor for Global Groups. + * + * @param name + */ + public Group(String name) { + + super(name); + } + + /** + * Is this a GlobalGroup + * + * @return true if this is a global group + */ + public boolean isGlobal() { + + return (getDataSource() == null); + } + + /** + * Clone this group + * + * @return a clone of this group + */ + @Override + public Group clone() { + + Group clone; + + if (isGlobal()) { + clone = new Group(this.getName()); + } else { + clone = new Group(getDataSource(), this.getName()); + clone.inherits = new ArrayList<String>(this.getInherits()); + } + + for (String perm : this.getPermissionList()) { + clone.addPermission(perm); + } + clone.variables = ((GroupVariables) variables).clone(clone); + //clone.flagAsChanged(); + return clone; + } + + /** + * Use this to deliver a group from a different dataSource to another + * + * @param dataSource + * @return Null or Clone + */ + public Group clone(WorldDataHolder dataSource) { + + if (dataSource.groupExists(this.getName())) { + return null; + } + + Group clone = dataSource.createGroup(this.getName()); + + // Don't add inheritance for GlobalGroups + if (!isGlobal()) { + clone.inherits = new ArrayList<String>(this.getInherits()); + } + for (String perm : this.getPermissionList()) { + clone.addPermission(perm); + } + clone.variables = variables.clone(clone); + clone.flagAsChanged(); //use this to make the new dataSource save the new group + return clone; + } + + /** + * an unmodifiable list of inherits list + * You can't manage the list by here + * Lol... version 0.6 had a problem because this. + * + * @return the inherits + */ + public List<String> getInherits() { + + return Collections.unmodifiableList(inherits); + } + + /** + * @param inherit the inherits to set + */ + public void addInherits(Group inherit) { + + if (!isGlobal()) { + if (!this.getDataSource().groupExists(inherit.getName())) { + getDataSource().addGroup(inherit); + } + if (!inherits.contains(inherit.getName().toLowerCase())) { + inherits.add(inherit.getName().toLowerCase()); + } + flagAsChanged(); + if (GroupManager.isLoaded()) { + GroupManager.BukkitPermissions.updateAllPlayers(); + GroupManagerEventHandler.callEvent(this, Action.GROUP_INHERITANCE_CHANGED); + } + } + } + + public boolean removeInherits(String inherit) { + + if (!isGlobal()) { + if (this.inherits.contains(inherit.toLowerCase())) { + this.inherits.remove(inherit.toLowerCase()); + flagAsChanged(); + GroupManagerEventHandler.callEvent(this, Action.GROUP_INHERITANCE_CHANGED); + return true; + } + } + return false; + } + + /** + * @return the variables + */ + public GroupVariables getVariables() { + + return variables; + } + + /** + * + * @param varList + */ + public void setVariables(Map<String, Object> varList) { + + if (!isGlobal()) { + GroupVariables temp = new GroupVariables(this, varList); + variables.clearVars(); + for (String key : temp.getVarKeyList()) { + variables.addVar(key, temp.getVarObject(key)); + } + flagAsChanged(); + if (GroupManager.isLoaded()) { + GroupManager.BukkitPermissions.updateAllPlayers(); + GroupManagerEventHandler.callEvent(this, Action.GROUP_INFO_CHANGED); + } + } + } } diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/GroupVariables.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/GroupVariables.java index 19db58851..e08d1db7d 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/GroupVariables.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/GroupVariables.java @@ -7,81 +7,88 @@ package org.anjocaido.groupmanager.data; import java.util.Map; /** - * + * * @author gabrielcouto */ public class GroupVariables extends Variables implements Cloneable { - private Group owner; + private Group owner; - public GroupVariables(Group owner) { - super(owner); - this.owner = owner; - addVar("prefix", ""); - addVar("suffix", ""); - addVar("build", false); - } + public GroupVariables(Group owner) { - public GroupVariables(Group owner, Map<String, Object> varList) { - super(owner); - variables = varList; - if (variables.get("prefix") == null) { - variables.put("prefix", ""); - owner.flagAsChanged(); - } - //thisGrp.prefix = infoNode.get("prefix").toString(); + super(owner); + this.owner = owner; + addVar("prefix", ""); + addVar("suffix", ""); + addVar("build", false); + } - if (variables.get("suffix") == null) { - variables.put("suffix", ""); - owner.flagAsChanged(); - } - //thisGrp.suffix = infoNode.get("suffix").toString(); + public GroupVariables(Group owner, Map<String, Object> varList) { - if (variables.get("build") == null) { - variables.put("build", false); - owner.flagAsChanged(); - } - this.owner = owner; - } + super(owner); + variables = varList; + if (variables.get("prefix") == null) { + variables.put("prefix", ""); + owner.flagAsChanged(); + } + //thisGrp.prefix = infoNode.get("prefix").toString(); - /** - * A clone of all vars here. - * @return GroupVariables clone - */ - protected GroupVariables clone(Group newOwner) { - GroupVariables clone = new GroupVariables(newOwner); - for (String key : variables.keySet()) { - clone.variables.put(key, variables.get(key)); - } - newOwner.flagAsChanged(); - return clone; - } + if (variables.get("suffix") == null) { + variables.put("suffix", ""); + owner.flagAsChanged(); + } + //thisGrp.suffix = infoNode.get("suffix").toString(); - /** - * Remove a var from the list - * @param name - */ - @Override - public void removeVar(String name) { - try { - this.variables.remove(name); - } catch (Exception e) { - } - if (name.equals("prefix")) { - addVar("prefix", ""); - } else if (name.equals("suffix")) { - addVar("suffix", ""); - } else if (name.equals("build")) { - addVar("build", false); - } - owner.flagAsChanged(); - } + if (variables.get("build") == null) { + variables.put("build", false); + owner.flagAsChanged(); + } + this.owner = owner; + } - /** - * @return the owner - */ - @Override - public Group getOwner() { - return owner; - } + /** + * A clone of all vars here. + * + * @return GroupVariables clone + */ + protected GroupVariables clone(Group newOwner) { + + GroupVariables clone = new GroupVariables(newOwner); + for (String key : variables.keySet()) { + clone.variables.put(key, variables.get(key)); + } + newOwner.flagAsChanged(); + return clone; + } + + /** + * Remove a var from the list + * + * @param name + */ + @Override + public void removeVar(String name) { + + try { + this.variables.remove(name); + } catch (Exception e) { + } + if (name.equals("prefix")) { + addVar("prefix", ""); + } else if (name.equals("suffix")) { + addVar("suffix", ""); + } else if (name.equals("build")) { + addVar("build", false); + } + owner.flagAsChanged(); + } + + /** + * @return the owner + */ + @Override + public Group getOwner() { + + return owner; + } } diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java index 30fe3f709..6c74c2e50 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/User.java @@ -16,7 +16,6 @@ import java.util.Map; import org.bukkit.Bukkit; import org.bukkit.entity.Player; - /** * * @author gabrielcouto/ElgarL @@ -40,6 +39,7 @@ public class User extends DataUnit implements Cloneable { * @param name */ public User(WorldDataHolder source, String name) { + super(source, name); this.group = source.getDefaultGroup().getName(); } @@ -50,6 +50,7 @@ public class User extends DataUnit implements Cloneable { */ @Override public User clone() { + User clone = new User(getDataSource(), this.getName()); clone.group = this.group; for (String perm : this.getPermissionList()) { @@ -67,6 +68,7 @@ public class User extends DataUnit implements Cloneable { * @return null if given dataSource already contains the same user */ public User clone(WorldDataHolder dataSource) { + if (dataSource.isUserDeclared(this.getName())) { return null; } @@ -85,6 +87,7 @@ public class User extends DataUnit implements Cloneable { } public Group getGroup() { + Group result = getDataSource().getGroup(group); if (result == null) { this.setGroup(getDataSource().getDefaultGroup()); @@ -97,6 +100,7 @@ public class User extends DataUnit implements Cloneable { * @return the group */ public String getGroupName() { + Group result = getDataSource().getGroup(group); if (result == null) { group = getDataSource().getDefaultGroup().getName(); @@ -104,33 +108,23 @@ public class User extends DataUnit implements Cloneable { return group; } - /** - * @param group - * the group to set - */ - @Deprecated - public void setGroup(String group) { - this.group = group; - flagAsChanged(); - if (GroupManager.isLoaded()) - if (!GroupManager.BukkitPermissions.isPlayer_join()) - GroupManager.BukkitPermissions.updatePlayer(getBukkitPlayer()); - } /** * @param group * the group to set */ public void setGroup(Group group) { + setGroup(group, true); } - + /** * @param group the group to set * @param updatePerms if we are to trigger a superperms update. - * + * */ public void setGroup(Group group, Boolean updatePerms) { + if (!this.getDataSource().groupExists(group.getName())) { getDataSource().addGroup(group); } @@ -151,12 +145,13 @@ public class User extends DataUnit implements Cloneable { if (notify) GroupManager.notify(this.getName(), String.format(" moved to the group %s.", group.getName())); - + GroupManagerEventHandler.callEvent(this, Action.USER_GROUP_CHANGED); } } public boolean addSubGroup(Group subGroup) { + // Don't allow adding a subgroup if it's already set as the primary. if (this.group.equalsIgnoreCase(subGroup.getName())) { return false; @@ -164,12 +159,12 @@ public class User extends DataUnit implements Cloneable { // User already has this subgroup if (containsSubGroup(subGroup)) return false; - + // If the group doesn't exists add it if (!this.getDataSource().groupExists(subGroup.getName())) { getDataSource().addGroup(subGroup); } - + subGroups.add(subGroup.getName()); flagAsChanged(); if (GroupManager.isLoaded()) { @@ -178,25 +173,29 @@ public class User extends DataUnit implements Cloneable { GroupManagerEventHandler.callEvent(this, Action.USER_SUBGROUP_CHANGED); } return true; - + //subGroup = getDataSource().getGroup(subGroup.getName()); //removeSubGroup(subGroup); //subGroups.add(subGroup.getName()); } public int subGroupsSize() { + return subGroups.size(); } public boolean isSubGroupsEmpty() { + return subGroups.isEmpty(); } public boolean containsSubGroup(Group subGroup) { + return subGroups.contains(subGroup.getName()); } public boolean removeSubGroup(Group subGroup) { + try { if (subGroups.remove(subGroup.getName())) { flagAsChanged(); @@ -212,6 +211,7 @@ public class User extends DataUnit implements Cloneable { } public ArrayList<Group> subGroupListCopy() { + ArrayList<Group> val = new ArrayList<Group>(); for (String gstr : subGroups) { Group g = getDataSource().getGroup(gstr); @@ -225,6 +225,7 @@ public class User extends DataUnit implements Cloneable { } public ArrayList<String> subGroupListStringCopy() { + return new ArrayList<String>(subGroups); } @@ -232,6 +233,7 @@ public class User extends DataUnit implements Cloneable { * @return the variables */ public UserVariables getVariables() { + return variables; } @@ -240,10 +242,10 @@ public class User extends DataUnit implements Cloneable { * @param varList */ public void setVariables(Map<String, Object> varList) { + //UserVariables temp = new UserVariables(this, varList); variables.clearVars(); for (String key : varList.keySet()) { - System.out.print("Adding variable - " + key); variables.addVar(key, varList.get(key)); } flagAsChanged(); @@ -254,14 +256,15 @@ public class User extends DataUnit implements Cloneable { } } + public User updatePlayer(Player player) { - if (player != null) { - bukkitPlayer = player; - } + + bukkitPlayer = player; return this; } public Player getBukkitPlayer() { + if (bukkitPlayer == null) { bukkitPlayer = Bukkit.getPlayer(this.getName()); } diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/UserVariables.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/UserVariables.java index 0b3948cab..f994595c1 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/UserVariables.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/UserVariables.java @@ -7,42 +7,47 @@ package org.anjocaido.groupmanager.data; import java.util.Map; /** - * + * * @author gabrielcouto */ public class UserVariables extends Variables { - private User owner; - - public UserVariables(User owner) { - super(owner); - this.owner = owner; - } - - public UserVariables(User owner, Map<String, Object> varList) { - super(owner); - this.variables = varList; - this.owner = owner; - } - - /** - * A clone of all vars here. - * @return UserVariables clone - */ - protected UserVariables clone(User newOwner) { - UserVariables clone = new UserVariables(newOwner); - for (String key : variables.keySet()) { - clone.variables.put(key, variables.get(key)); - } - newOwner.flagAsChanged(); - return clone; - } - - /** - * @return the owner - */ - @Override - public User getOwner() { - return owner; - } + private User owner; + + public UserVariables(User owner) { + + super(owner); + this.owner = owner; + } + + public UserVariables(User owner, Map<String, Object> varList) { + + super(owner); + this.variables = varList; + this.owner = owner; + } + + /** + * A clone of all vars here. + * + * @return UserVariables clone + */ + protected UserVariables clone(User newOwner) { + + UserVariables clone = new UserVariables(newOwner); + for (String key : variables.keySet()) { + clone.variables.put(key, variables.get(key)); + } + newOwner.flagAsChanged(); + return clone; + } + + /** + * @return the owner + */ + @Override + public User getOwner() { + + return owner; + } } diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/Variables.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/Variables.java index 140d6626a..42ceba7e4 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/Variables.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/data/Variables.java @@ -9,178 +9,200 @@ import java.util.Map; import java.util.Set; /** - *A class that holds variables of a user/group. + * A class that holds variables of a user/group. * In groups, it holds the contents of INFO node. * Like: * prefix * suffix * build - * + * * @author gabrielcouto */ public abstract class Variables implements Cloneable { - private DataUnit owner; - protected Map<String, Object> variables = new HashMap<String, Object>(); - - public Variables(DataUnit owner) { - this.owner = owner; - } - - /** - * Add var to the the INFO node. - * examples: - * addVar("build",true); - * addVar("prefix","c"); - * @param name key name of the var - * @param o the object value of the var - */ - public void addVar(String name, Object o) { - if (o == null) { - return; - } - if (variables.containsKey(name)) { - variables.remove(name); - } - variables.put(name, o); - owner.flagAsChanged(); - } - - /** - * Returns the object inside the var - * @param name - * @return a Object if exists. null if doesn't exists - */ - public Object getVarObject(String name) { - return variables.get(name); - } - - /** - * Get the String value for the given var name - * @param name the var key name - * @return "" if null. or the toString() value of object - */ - public String getVarString(String name) { - Object o = variables.get(name); - try { - return o == null ? "" : o.toString(); - } catch (Exception e) { - return ""; - } - } - - /** - * - * @param name - * @return false if null. or a Boolean.parseBoolean of the string - */ - public Boolean getVarBoolean(String name) { - Object o = variables.get(name); - try { - return o == null ? false : Boolean.parseBoolean(o.toString()); - } catch (Exception e) { - return false; - } - } - - /** - * - * @param name - * @return -1 if null. or a parseInt of the string - */ - public Integer getVarInteger(String name) { - Object o = variables.get(name); - try { - return o == null ? -1 : Integer.parseInt(o.toString()); - } catch (Exception e) { - return -1; - } - } - - /** - * - * @param name - * @return -1 if null. or a parseDouble of the string - */ - public Double getVarDouble(String name) { - Object o = variables.get(name); - try { - return o == null ? -1.0D : Double.parseDouble(o.toString()); - } catch (Exception e) { - return -1.0D; - } - } - - /** - * All variable keys this is holding - * @return Set of all variable names. - */ - public Set<String> getVarKeyList() { - return variables.keySet(); - } - - /** - * verify is a var exists - * @param name the key name of the var - * @return true if that var exists - */ - public boolean hasVar(String name) { - return variables.containsKey(name); - } - - /** - * Returns the quantity of vars this is holding - * @return the number of vars - */ - public int getSize() { - return variables.size(); - } - - /** - * Remove a var from the list - * @param name - */ - public void removeVar(String name) { - try { - variables.remove(name); - } catch (Exception e) { - } - owner.flagAsChanged(); - } - - public static Object parseVariableValue(String value) { - try { - Integer i = Integer.parseInt(value); - return i; - } catch (NumberFormatException e) { - } - try { - Double d = Double.parseDouble(value); - return d; - } catch (NumberFormatException e) { - } - if (value.equalsIgnoreCase("true") || value.equalsIgnoreCase("yes") || value.equalsIgnoreCase("on")) { - return true; - } else if (value.equalsIgnoreCase("false") || value.equalsIgnoreCase("no") || value.equalsIgnoreCase("off")) { - return false; - } - return value; - - } - - public void clearVars() { - variables.clear(); - owner.flagAsChanged(); - } - - /** - * @return the owner - */ - public DataUnit getOwner() { - return owner; - } - - public boolean isEmpty() { - return variables.isEmpty(); - } + private DataUnit owner; + protected Map<String, Object> variables = new HashMap<String, Object>(); + + public Variables(DataUnit owner) { + + this.owner = owner; + } + + /** + * Add var to the the INFO node. + * examples: + * addVar("build",true); + * addVar("prefix","c"); + * + * @param name key name of the var + * @param o the object value of the var + */ + public void addVar(String name, Object o) { + + if (o == null) { + return; + } + if (variables.containsKey(name)) { + variables.remove(name); + } + variables.put(name, o); + owner.flagAsChanged(); + } + + /** + * Returns the object inside the var + * + * @param name + * @return a Object if exists. null if doesn't exists + */ + public Object getVarObject(String name) { + + return variables.get(name); + } + + /** + * Get the String value for the given var name + * + * @param name the var key name + * @return "" if null. or the toString() value of object + */ + public String getVarString(String name) { + + Object o = variables.get(name); + try { + return o == null ? "" : o.toString(); + } catch (Exception e) { + return ""; + } + } + + /** + * + * @param name + * @return false if null. or a Boolean.parseBoolean of the string + */ + public Boolean getVarBoolean(String name) { + + Object o = variables.get(name); + try { + return o == null ? false : Boolean.parseBoolean(o.toString()); + } catch (Exception e) { + return false; + } + } + + /** + * + * @param name + * @return -1 if null. or a parseInt of the string + */ + public Integer getVarInteger(String name) { + + Object o = variables.get(name); + try { + return o == null ? -1 : Integer.parseInt(o.toString()); + } catch (Exception e) { + return -1; + } + } + + /** + * + * @param name + * @return -1 if null. or a parseDouble of the string + */ + public Double getVarDouble(String name) { + + Object o = variables.get(name); + try { + return o == null ? -1.0D : Double.parseDouble(o.toString()); + } catch (Exception e) { + return -1.0D; + } + } + + /** + * All variable keys this is holding + * + * @return Set of all variable names. + */ + public Set<String> getVarKeyList() { + + return variables.keySet(); + } + + /** + * verify is a var exists + * + * @param name the key name of the var + * @return true if that var exists + */ + public boolean hasVar(String name) { + + return variables.containsKey(name); + } + + /** + * Returns the quantity of vars this is holding + * + * @return the number of vars + */ + public int getSize() { + + return variables.size(); + } + + /** + * Remove a var from the list + * + * @param name + */ + public void removeVar(String name) { + + try { + variables.remove(name); + } catch (Exception e) { + } + owner.flagAsChanged(); + } + + public static Object parseVariableValue(String value) { + + try { + Integer i = Integer.parseInt(value); + return i; + } catch (NumberFormatException e) { + } + try { + Double d = Double.parseDouble(value); + return d; + } catch (NumberFormatException e) { + } + if (value.equalsIgnoreCase("true") || value.equalsIgnoreCase("yes") || value.equalsIgnoreCase("on")) { + return true; + } else if (value.equalsIgnoreCase("false") || value.equalsIgnoreCase("no") || value.equalsIgnoreCase("off")) { + return false; + } + return value; + + } + + public void clearVars() { + + variables.clear(); + owner.flagAsChanged(); + } + + /** + * @return the owner + */ + public DataUnit getOwner() { + + return owner; + } + + public boolean isEmpty() { + + return variables.isEmpty(); + } } diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/GroupsDataHolder.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/GroupsDataHolder.java index 5d681013e..eaaaace74 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/GroupsDataHolder.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/GroupsDataHolder.java @@ -6,8 +6,6 @@ import java.util.Map; import org.anjocaido.groupmanager.data.Group;
-
-
/**
* This container holds all Groups loaded from the relevant groupsFile.
*
@@ -31,9 +29,11 @@ public class GroupsDataHolder { * Constructor
*/
protected GroupsDataHolder() {
+
}
-
+
public void setDataSource(WorldDataHolder dataSource) {
+
this.dataSource = dataSource;
//push this data source to the users, so they pull the correct groups data.
for (Group group : groups.values())
@@ -44,6 +44,7 @@ public class GroupsDataHolder { * @return the defaultGroup
*/
public Group getDefaultGroup() {
+
return defaultGroup;
}
@@ -51,6 +52,7 @@ public class GroupsDataHolder { * @param defaultGroup the defaultGroup to set
*/
public void setDefaultGroup(Group defaultGroup) {
+
this.defaultGroup = defaultGroup;
}
@@ -58,20 +60,23 @@ public class GroupsDataHolder { * @return the groups
*/
public Map<String, Group> getGroups() {
+
return groups;
}
-
+
/**
* @param groups the groups to set
*/
public void setGroups(Map<String, Group> groups) {
+
this.groups = groups;
}
-
+
/**
* @return the groupsFile
*/
public File getGroupsFile() {
+
return groupsFile;
}
@@ -79,6 +84,7 @@ public class GroupsDataHolder { * @param groupsFile the groupsFile to set
*/
public void setGroupsFile(File groupsFile) {
+
this.groupsFile = groupsFile;
}
@@ -86,6 +92,7 @@ public class GroupsDataHolder { * @return the haveGroupsChanged
*/
public boolean HaveGroupsChanged() {
+
return haveGroupsChanged;
}
@@ -93,6 +100,7 @@ public class GroupsDataHolder { * @param haveGroupsChanged the haveGroupsChanged to set
*/
public void setGroupsChanged(boolean haveGroupsChanged) {
+
this.haveGroupsChanged = haveGroupsChanged;
}
@@ -100,6 +108,7 @@ public class GroupsDataHolder { * @return the timeStampGroups
*/
public long getTimeStampGroups() {
+
return timeStampGroups;
}
@@ -107,6 +116,7 @@ public class GroupsDataHolder { * @param timeStampGroups the timeStampGroups to set
*/
public void setTimeStampGroups(long timeStampGroups) {
+
this.timeStampGroups = timeStampGroups;
}
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/OverloadedWorldHolder.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/OverloadedWorldHolder.java index b37c55e51..84561b6e5 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/OverloadedWorldHolder.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/OverloadedWorldHolder.java @@ -11,195 +11,204 @@ import java.util.Map; import org.anjocaido.groupmanager.data.User; /** - * + * * @author gabrielcouto */ public class OverloadedWorldHolder extends WorldDataHolder { - /** + /** * */ - protected Map<String, User> overloadedUsers = new HashMap<String, User>(); + protected Map<String, User> overloadedUsers = new HashMap<String, User>(); - /** - * - * @param ph - */ - public OverloadedWorldHolder(WorldDataHolder ph) { - super(ph.getName()); - this.setGroupsFile(ph.getGroupsFile()); - this.setUsersFile(ph.getUsersFile()); - //this.setDefaultGroup(ph.getDefaultGroup()); - this.groups = ph.groups; - this.users = ph.users; - } - - /** - * - * @param userName - * @return user object or a new user if none exists. - */ - @Override - public User getUser(String userName) { - //OVERLOADED CODE - String userNameLowered = userName.toLowerCase(); - if (overloadedUsers.containsKey(userNameLowered)) { - return overloadedUsers.get(userNameLowered); - } - //END CODE - if (getUsers().containsKey(userNameLowered)) { - return getUsers().get(userNameLowered); - } - User newUser = createUser(userName); - setUsersChanged(true); - return newUser; - } - - /** - * - * @param theUser - */ - @Override - public void addUser(User theUser) { - if (theUser.getDataSource() != this) { - theUser = theUser.clone(this); - } - if (theUser == null) { - return; - } - if ((theUser.getGroup() == null) || (!getGroups().containsKey(theUser.getGroupName().toLowerCase()))) { - theUser.setGroup(getDefaultGroup()); - } - //OVERLOADED CODE - if (overloadedUsers.containsKey(theUser.getName().toLowerCase())) { - overloadedUsers.remove(theUser.getName().toLowerCase()); - overloadedUsers.put(theUser.getName().toLowerCase(), theUser); - return; - } - //END CODE - removeUser(theUser.getName()); - getUsers().put(theUser.getName().toLowerCase(), theUser); - setUsersChanged(true); - } - - /** - * - * @param userName - * @return true if removed/false if not found. - */ - @Override - public boolean removeUser(String userName) { - //OVERLOADED CODE - if (overloadedUsers.containsKey(userName.toLowerCase())) { - overloadedUsers.remove(userName.toLowerCase()); - return true; - } - //END CODE - if (getUsers().containsKey(userName.toLowerCase())) { - getUsers().remove(userName.toLowerCase()); - setUsersChanged(true); - return true; - } - return false; - } - - @Override - public boolean removeGroup(String groupName) { - if (groupName.equals(getDefaultGroup())) { - return false; - } - for (String key : getGroups().keySet()) { - if (groupName.equalsIgnoreCase(key)) { - getGroups().remove(key); - for (String userKey : getUsers().keySet()) { - User user = getUsers().get(userKey); - if (user.getGroupName().equalsIgnoreCase(key)) { - user.setGroup(getDefaultGroup()); - } - - } - //OVERLOADED CODE - for (String userKey : overloadedUsers.keySet()) { - User user = overloadedUsers.get(userKey); - if (user.getGroupName().equalsIgnoreCase(key)) { - user.setGroup(getDefaultGroup()); - } - - } - //END OVERLOAD - setGroupsChanged(true); - return true; - } - } - return false; - } - - /** - * - * @return Collection of all users - */ - @Override - public Collection<User> getUserList() { - Collection<User> overloadedList = new ArrayList<User>(); - Collection<User> normalList = getUsers().values(); - for (User u : normalList) { - if (overloadedUsers.containsKey(u.getName().toLowerCase())) { - overloadedList.add(overloadedUsers.get(u.getName().toLowerCase())); - } else { - overloadedList.add(u); - } - } - return overloadedList; - } - - /** - * - * @param userName - * @return true if user is overloaded. - */ - public boolean isOverloaded(String userName) { - return overloadedUsers.containsKey(userName.toLowerCase()); - } + /** + * + * @param ph + */ + public OverloadedWorldHolder(WorldDataHolder ph) { - /** - * - * @param userName - */ - public void overloadUser(String userName) { - if (!isOverloaded(userName)) { - User theUser = getUser(userName); - theUser = theUser.clone(); - if (overloadedUsers.containsKey(theUser.getName().toLowerCase())) { - overloadedUsers.remove(theUser.getName().toLowerCase()); - } - overloadedUsers.put(theUser.getName().toLowerCase(), theUser); - } - } - - /** - * - * @param userName - */ - public void removeOverload(String userName) { - overloadedUsers.remove(userName.toLowerCase()); - } - - /** - * Gets the user in normal state. Surpassing the overload state. - * It doesn't affect permissions. But it enables plugins change the - * actual user permissions even in overload mode. - * - * @param userName - * @return user object - */ - public User surpassOverload(String userName) { - if (!isOverloaded(userName)) { - return getUser(userName); - } - if (getUsers().containsKey(userName.toLowerCase())) { - return getUsers().get(userName.toLowerCase()); - } - User newUser = createUser(userName); - return newUser; - } + super(ph.getName()); + this.setGroupsFile(ph.getGroupsFile()); + this.setUsersFile(ph.getUsersFile()); + this.groups = ph.groups; + this.users = ph.users; + } + + /** + * + * @param userName + * @return user object or a new user if none exists. + */ + @Override + public User getUser(String userName) { + + //OVERLOADED CODE + String userNameLowered = userName.toLowerCase(); + if (overloadedUsers.containsKey(userNameLowered)) { + return overloadedUsers.get(userNameLowered); + } + //END CODE + if (getUsers().containsKey(userNameLowered)) { + return getUsers().get(userNameLowered); + } + User newUser = createUser(userName); + setUsersChanged(true); + return newUser; + } + + /** + * + * @param theUser + */ + @Override + public void addUser(User theUser) { + + if (theUser.getDataSource() != this) { + theUser = theUser.clone(this); + } + if (theUser == null) { + return; + } + if ((theUser.getGroup() == null) || (!getGroups().containsKey(theUser.getGroupName().toLowerCase()))) { + theUser.setGroup(getDefaultGroup()); + } + //OVERLOADED CODE + if (overloadedUsers.containsKey(theUser.getName().toLowerCase())) { + overloadedUsers.remove(theUser.getName().toLowerCase()); + overloadedUsers.put(theUser.getName().toLowerCase(), theUser); + return; + } + //END CODE + removeUser(theUser.getName()); + getUsers().put(theUser.getName().toLowerCase(), theUser); + setUsersChanged(true); + } + + /** + * + * @param userName + * @return true if removed/false if not found. + */ + @Override + public boolean removeUser(String userName) { + + //OVERLOADED CODE + if (overloadedUsers.containsKey(userName.toLowerCase())) { + overloadedUsers.remove(userName.toLowerCase()); + return true; + } + //END CODE + if (getUsers().containsKey(userName.toLowerCase())) { + getUsers().remove(userName.toLowerCase()); + setUsersChanged(true); + return true; + } + return false; + } + + @Override + public boolean removeGroup(String groupName) { + + if (groupName.equals(getDefaultGroup())) { + return false; + } + for (String key : getGroups().keySet()) { + if (groupName.equalsIgnoreCase(key)) { + getGroups().remove(key); + for (String userKey : getUsers().keySet()) { + User user = getUsers().get(userKey); + if (user.getGroupName().equalsIgnoreCase(key)) { + user.setGroup(getDefaultGroup()); + } + + } + //OVERLOADED CODE + for (String userKey : overloadedUsers.keySet()) { + User user = overloadedUsers.get(userKey); + if (user.getGroupName().equalsIgnoreCase(key)) { + user.setGroup(getDefaultGroup()); + } + + } + //END OVERLOAD + setGroupsChanged(true); + return true; + } + } + return false; + } + + /** + * + * @return Collection of all users + */ + @Override + public Collection<User> getUserList() { + + Collection<User> overloadedList = new ArrayList<User>(); + Collection<User> normalList = getUsers().values(); + for (User u : normalList) { + if (overloadedUsers.containsKey(u.getName().toLowerCase())) { + overloadedList.add(overloadedUsers.get(u.getName().toLowerCase())); + } else { + overloadedList.add(u); + } + } + return overloadedList; + } + + /** + * + * @param userName + * @return true if user is overloaded. + */ + public boolean isOverloaded(String userName) { + + return overloadedUsers.containsKey(userName.toLowerCase()); + } + + /** + * + * @param userName + */ + public void overloadUser(String userName) { + + if (!isOverloaded(userName)) { + User theUser = getUser(userName); + theUser = theUser.clone(); + if (overloadedUsers.containsKey(theUser.getName().toLowerCase())) { + overloadedUsers.remove(theUser.getName().toLowerCase()); + } + overloadedUsers.put(theUser.getName().toLowerCase(), theUser); + } + } + + /** + * + * @param userName + */ + public void removeOverload(String userName) { + + overloadedUsers.remove(userName.toLowerCase()); + } + + /** + * Gets the user in normal state. Surpassing the overload state. + * It doesn't affect permissions. But it enables plugins change the + * actual user permissions even in overload mode. + * + * @param userName + * @return user object + */ + public User surpassOverload(String userName) { + + if (!isOverloaded(userName)) { + return getUser(userName); + } + if (getUsers().containsKey(userName.toLowerCase())) { + return getUsers().get(userName.toLowerCase()); + } + User newUser = createUser(userName); + return newUser; + } }
\ No newline at end of file diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/UsersDataHolder.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/UsersDataHolder.java index fa2ccaf84..665fe227d 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/UsersDataHolder.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/UsersDataHolder.java @@ -6,8 +6,6 @@ import java.util.Map; import org.anjocaido.groupmanager.data.User;
-
-
/**
* This container holds all Users loaded from the relevant usersFile.
*
@@ -30,27 +28,31 @@ public class UsersDataHolder { * Constructor
*/
protected UsersDataHolder() {
+
}
-
+
public void setDataSource(WorldDataHolder dataSource) {
+
this.dataSource = dataSource;
//push this data source to the users, so they pull the correct groups data.
for (User user : users.values())
user.setDataSource(this.dataSource);
-
+
}
/**
* @return the users
*/
public Map<String, User> getUsers() {
+
return users;
}
-
+
/**
* @param users the users to set
*/
public void setUsers(Map<String, User> users) {
+
this.users = users;
}
@@ -58,6 +60,7 @@ public class UsersDataHolder { * @return the usersFile
*/
public File getUsersFile() {
+
return usersFile;
}
@@ -65,6 +68,7 @@ public class UsersDataHolder { * @param usersFile the usersFile to set
*/
public void setUsersFile(File usersFile) {
+
this.usersFile = usersFile;
}
@@ -72,6 +76,7 @@ public class UsersDataHolder { * @return the haveUsersChanged
*/
public boolean HaveUsersChanged() {
+
return haveUsersChanged;
}
@@ -79,6 +84,7 @@ public class UsersDataHolder { * @param haveUsersChanged the haveUsersChanged to set
*/
public void setUsersChanged(boolean haveUsersChanged) {
+
this.haveUsersChanged = haveUsersChanged;
}
@@ -86,6 +92,7 @@ public class UsersDataHolder { * @return the timeStampUsers
*/
public long getTimeStampUsers() {
+
return timeStampUsers;
}
@@ -93,6 +100,7 @@ public class UsersDataHolder { * @param timeStampUsers the timeStampUsers to set
*/
public void setTimeStampUsers(long timeStampUsers) {
+
this.timeStampUsers = timeStampUsers;
}
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java index e766b6c78..fefc698f9 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/WorldDataHolder.java @@ -14,6 +14,7 @@ import java.io.UnsupportedEncodingException; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; +import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.logging.Level; @@ -44,339 +45,371 @@ import org.yaml.snakeyaml.reader.UnicodeReader; */ public class WorldDataHolder { - /** - * World name - */ - protected String name; - /** - * The actual groups holder - */ - protected GroupsDataHolder groups = new GroupsDataHolder(); /** - * The actual users holder - */ - protected UsersDataHolder users = new UsersDataHolder(); - /** + * World name + */ + protected String name; + /** + * The actual groups holder + */ + protected GroupsDataHolder groups = new GroupsDataHolder(); + /** + * The actual users holder + */ + protected UsersDataHolder users = new UsersDataHolder(); + /** * */ - protected AnjoPermissionsHandler permissionsHandler; + protected AnjoPermissionsHandler permissionsHandler; - /** - * Prevent direct instantiation - * @param worldName - */ - public WorldDataHolder(String worldName) { - name = worldName; - } - - /** - * The main constructor for a new WorldDataHolder - * @param worldName - * @param groups - * @param users - */ - public WorldDataHolder(String worldName, GroupsDataHolder groups, UsersDataHolder users) { - this.name = worldName; - this.groups = groups; - this.users = users; - - //this.defaultGroup = defaultGroup; - } - - /** - * update the dataSource to point to this object. - * - * This should be called whenever a set of world data is fetched. - */ - public void updateDataSource() { - this.groups.setDataSource(this); - this.users.setDataSource(this); - } - - /** - * Search for a user. If it doesn't exist, create a new one with - * default group. - * - * @param userName the name of the user - * @return class that manage that user permission - */ - public User getUser(String userName) { - if (getUsers().containsKey(userName.toLowerCase())) { - return getUsers().get(userName.toLowerCase()); - } - User newUser = createUser(userName); - return newUser; - } - - /** - * Add a user to the list. If it already exists, overwrite the old. - * @param theUser the user you want to add to the permission list - */ - public void addUser(User theUser) { - if (theUser.getDataSource() != this) { - theUser = theUser.clone(this); - } - if (theUser == null) { - return; - } - if ((theUser.getGroup() == null)) { - theUser.setGroup(groups.getDefaultGroup()); - } - removeUser(theUser.getName()); - getUsers().put(theUser.getName().toLowerCase(), theUser); - setUsersChanged(true); - if (GroupManager.isLoaded()) - GroupManagerEventHandler.callEvent(theUser, Action.USER_ADDED); - } - - /** - * Removes the user from the list. (he might become a default user) - * @param userName the username from the user to remove - * @return true if it had something to remove - */ - public boolean removeUser(String userName) { - if (getUsers().containsKey(userName.toLowerCase())) { - getUsers().remove(userName.toLowerCase()); - setUsersChanged(true); - if (GroupManager.isLoaded()) - GroupManagerEventHandler.callEvent(userName, GMUserEvent.Action.USER_REMOVED); - return true; - } - return false; - } - - /** - * - * @param userName - * @return true if we have data for this player. - */ - public boolean isUserDeclared(String userName) { - return getUsers().containsKey(userName.toLowerCase()); - } + * Prevent direct instantiation + * + * @param worldName + */ + public WorldDataHolder(String worldName) { - /** - * Change the default group of the file. - * @param group the group you want make default. - */ - public void setDefaultGroup(Group group) { - if (!getGroups().containsKey(group.getName().toLowerCase()) || (group.getDataSource() != this)) { - addGroup(group); - } - groups.setDefaultGroup(getGroup(group.getName())); - setGroupsChanged(true); - if (GroupManager.isLoaded()) - GroupManagerEventHandler.callEvent(GMSystemEvent.Action.DEFAULT_GROUP_CHANGED); - } - - /** - * Returns the default group of the file - * @return the default group - */ - public Group getDefaultGroup() { - return groups.getDefaultGroup(); - } - - /** - * Returns a group of the given name - * @param groupName the name of the group - * @return a group if it is found. null if not found. - */ - public Group getGroup(String groupName) { - if (groupName.toLowerCase().startsWith("g:")) - return GroupManager.getGlobalGroups().getGroup(groupName); - else - return getGroups().get(groupName.toLowerCase()); - } - - /** - * Check if a group exists. - * Its the same of getGroup, but check if it is null. - * @param groupName the name of the group - * @return true if exists. false if not. - */ - public boolean groupExists(String groupName) { - if (groupName.toLowerCase().startsWith("g:")) - return GroupManager.getGlobalGroups().hasGroup(groupName); - else - return getGroups().containsKey(groupName.toLowerCase()); - } - - /** - * Add a group to the list - * @param groupToAdd - */ - public void addGroup(Group groupToAdd) { - if (groupToAdd.getName().toLowerCase().startsWith("g:")) { - GroupManager.getGlobalGroups().addGroup(groupToAdd); - GroupManagerEventHandler.callEvent(groupToAdd, GMGroupEvent.Action.GROUP_ADDED); - return; - } - - if (groupToAdd.getDataSource() != this) { - groupToAdd = groupToAdd.clone(this); - } - removeGroup(groupToAdd.getName()); - getGroups().put(groupToAdd.getName().toLowerCase(), groupToAdd); - setGroupsChanged(true); - if (GroupManager.isLoaded()) - GroupManagerEventHandler.callEvent(groupToAdd, GMGroupEvent.Action.GROUP_ADDED); - } - - /** - * Remove the group from the list - * @param groupName - * @return true if had something to remove. false the group was default or non-existant - */ - public boolean removeGroup(String groupName) { - if (groupName.toLowerCase().startsWith("g:")) { - return GroupManager.getGlobalGroups().removeGroup(groupName); - } - - if (getDefaultGroup() != null && groupName.equalsIgnoreCase(getDefaultGroup().getName())) { - return false; - } - if (getGroups().containsKey(groupName.toLowerCase())) { - getGroups().remove(groupName.toLowerCase()); - setGroupsChanged(true); - if (GroupManager.isLoaded()) - GroupManagerEventHandler.callEvent(groupName.toLowerCase(), GMGroupEvent.Action.GROUP_REMOVED); - return true; - } - return false; - - } - - /** - * Creates a new User with the given name - * and adds it to this holder. - * @param userName the username you want - * @return null if user already exists. or new User - */ - public User createUser(String userName) { - if (getUsers().containsKey(userName.toLowerCase())) { - return null; - } - User newUser = new User(this, userName); - newUser.setGroup(groups.getDefaultGroup(), false); - addUser(newUser); - setUsersChanged(true); - return newUser; - } - - /** - * Creates a new Group with the given name - * and adds it to this holder - * @param groupName the groupname you want - * @return null if group already exists. or new Group - */ - public Group createGroup(String groupName) { - if (groupName.toLowerCase().startsWith("g:")) { - Group newGroup = new Group(groupName); - return GroupManager.getGlobalGroups().newGroup(newGroup); - } - - if (getGroups().containsKey(groupName.toLowerCase())) { - return null; - } - - Group newGroup = new Group(this, groupName); - addGroup(newGroup); - setGroupsChanged(true); - return newGroup; - } - - /** - * - * @return a collection of the groups - */ - public Collection<Group> getGroupList() { - return getGroups().values(); - } + name = worldName; + } - /** - * - * @return a collection of the users - */ - public Collection<User> getUserList() { - return getUsers().values(); - } + /** + * The main constructor for a new WorldDataHolder + * + * @param worldName + * @param groups + * @param users + */ + public WorldDataHolder(String worldName, GroupsDataHolder groups, UsersDataHolder users) { - /** - * reads the file again - */ - public void reload() { - try { - reloadGroups(); - reloadUsers(); - } catch (Exception ex) { - Logger.getLogger(WorldDataHolder.class.getName()).log(Level.SEVERE, null, ex); - } - } - - /** - * Refresh Group data from file - */ - public void reloadGroups() { - GroupManager.setLoaded(false); - try { - // temporary holder in case the load fails. - WorldDataHolder ph = new WorldDataHolder(this.getName()); - - loadGroups(ph, getGroupsFile()); - // transfer new data - resetGroups(); - for (Group tempGroup : ph.getGroupList()) { - tempGroup.clone(this); - } - this.setDefaultGroup(getGroup(ph.getDefaultGroup().getName())); - this.removeGroupsChangedFlag(); - this.setTimeStampGroups(getGroupsFile().lastModified()); - - ph = null; - } catch (Exception ex) { - Logger.getLogger(WorldDataHolder.class.getName()).log(Level.WARNING, null, ex); - } - GroupManager.setLoaded(true); - GroupManagerEventHandler.callEvent(GMSystemEvent.Action.RELOADED); - } - - /** - * Refresh Users data from file - */ - public void reloadUsers() { - GroupManager.setLoaded(false); - try { - // temporary holder in case the load fails. - WorldDataHolder ph = new WorldDataHolder(this.getName()); - // copy groups for reference - for (Group tempGroup : this.getGroupList()) { - tempGroup.clone(ph); - } - // setup the default group before loading user data. - ph.setDefaultGroup(ph.getGroup(getDefaultGroup().getName())); - loadUsers(ph, getUsersFile()); - // transfer new data - resetUsers(); - for (User tempUser : ph.getUserList()) { - tempUser.clone(this); - } - this.removeUsersChangedFlag(); - this.setTimeStampUsers(getUsersFile().lastModified()); - - ph = null; - } catch (Exception ex) { - Logger.getLogger(WorldDataHolder.class.getName()).log(Level.WARNING, null, ex); - } - GroupManager.setLoaded(true); - GroupManagerEventHandler.callEvent(GMSystemEvent.Action.RELOADED); - } - - public void loadGroups(File groupsFile) { - - GroupManager.setLoaded(false); - try { - setGroupsFile(groupsFile); + this.name = worldName; + this.groups = groups; + this.users = users; + + // this.defaultGroup = defaultGroup; + } + + /** + * update the dataSource to point to this object. + * + * This should be called whenever a set of world data is fetched. + */ + public void updateDataSource() { + + this.groups.setDataSource(this); + this.users.setDataSource(this); + } + + /** + * Search for a user. If it doesn't exist, create a new one with + * default group. + * + * @param userName the name of the user + * @return class that manage that user permission + */ + public User getUser(String userName) { + + if (getUsers().containsKey(userName.toLowerCase())) { + return getUsers().get(userName.toLowerCase()); + } + User newUser = createUser(userName); + return newUser; + } + + /** + * Add a user to the list. If it already exists, overwrite the old. + * + * @param theUser the user you want to add to the permission list + */ + public void addUser(User theUser) { + + if (theUser.getDataSource() != this) { + theUser = theUser.clone(this); + } + if (theUser == null) { + return; + } + if ((theUser.getGroup() == null)) { + theUser.setGroup(groups.getDefaultGroup()); + } + removeUser(theUser.getName()); + getUsers().put(theUser.getName().toLowerCase(), theUser); + setUsersChanged(true); + if (GroupManager.isLoaded()) + GroupManagerEventHandler.callEvent(theUser, Action.USER_ADDED); + } + + /** + * Removes the user from the list. (he might become a default user) + * + * @param userName the username from the user to remove + * @return true if it had something to remove + */ + public boolean removeUser(String userName) { + + if (getUsers().containsKey(userName.toLowerCase())) { + getUsers().remove(userName.toLowerCase()); + setUsersChanged(true); + if (GroupManager.isLoaded()) + GroupManagerEventHandler.callEvent(userName, GMUserEvent.Action.USER_REMOVED); + return true; + } + return false; + } + + /** + * + * @param userName + * @return true if we have data for this player. + */ + public boolean isUserDeclared(String userName) { + + return getUsers().containsKey(userName.toLowerCase()); + } + + /** + * Change the default group of the file. + * + * @param group the group you want make default. + */ + public void setDefaultGroup(Group group) { + + if (!getGroups().containsKey(group.getName().toLowerCase()) || (group.getDataSource() != this)) { + addGroup(group); + } + groups.setDefaultGroup(getGroup(group.getName())); + setGroupsChanged(true); + if (GroupManager.isLoaded()) + GroupManagerEventHandler.callEvent(GMSystemEvent.Action.DEFAULT_GROUP_CHANGED); + } + + /** + * Returns the default group of the file + * + * @return the default group + */ + public Group getDefaultGroup() { + + return groups.getDefaultGroup(); + } + + /** + * Returns a group of the given name + * + * @param groupName the name of the group + * @return a group if it is found. null if not found. + */ + public Group getGroup(String groupName) { + + if (groupName.toLowerCase().startsWith("g:")) + return GroupManager.getGlobalGroups().getGroup(groupName); + else + return getGroups().get(groupName.toLowerCase()); + } + + /** + * Check if a group exists. + * Its the same of getGroup, but check if it is null. + * + * @param groupName the name of the group + * @return true if exists. false if not. + */ + public boolean groupExists(String groupName) { + + if (groupName.toLowerCase().startsWith("g:")) + return GroupManager.getGlobalGroups().hasGroup(groupName); + else + return getGroups().containsKey(groupName.toLowerCase()); + } + + /** + * Add a group to the list + * + * @param groupToAdd + */ + public void addGroup(Group groupToAdd) { + + if (groupToAdd.getName().toLowerCase().startsWith("g:")) { + GroupManager.getGlobalGroups().addGroup(groupToAdd); + GroupManagerEventHandler.callEvent(groupToAdd, GMGroupEvent.Action.GROUP_ADDED); + return; + } + + if (groupToAdd.getDataSource() != this) { + groupToAdd = groupToAdd.clone(this); + } + removeGroup(groupToAdd.getName()); + getGroups().put(groupToAdd.getName().toLowerCase(), groupToAdd); + setGroupsChanged(true); + if (GroupManager.isLoaded()) + GroupManagerEventHandler.callEvent(groupToAdd, GMGroupEvent.Action.GROUP_ADDED); + } + + /** + * Remove the group from the list + * + * @param groupName + * @return true if had something to remove. false the group was default or + * non-existant + */ + public boolean removeGroup(String groupName) { + + if (groupName.toLowerCase().startsWith("g:")) { + return GroupManager.getGlobalGroups().removeGroup(groupName); + } + + if (getDefaultGroup() != null && groupName.equalsIgnoreCase(getDefaultGroup().getName())) { + return false; + } + if (getGroups().containsKey(groupName.toLowerCase())) { + getGroups().remove(groupName.toLowerCase()); + setGroupsChanged(true); + if (GroupManager.isLoaded()) + GroupManagerEventHandler.callEvent(groupName.toLowerCase(), GMGroupEvent.Action.GROUP_REMOVED); + return true; + } + return false; + + } + + /** + * Creates a new User with the given name + * and adds it to this holder. + * + * @param userName the username you want + * @return null if user already exists. or new User + */ + public User createUser(String userName) { + + if (getUsers().containsKey(userName.toLowerCase())) { + return null; + } + User newUser = new User(this, userName); + newUser.setGroup(groups.getDefaultGroup(), false); + addUser(newUser); + setUsersChanged(true); + return newUser; + } + + /** + * Creates a new Group with the given name + * and adds it to this holder + * + * @param groupName the groupname you want + * @return null if group already exists. or new Group + */ + public Group createGroup(String groupName) { + + if (groupName.toLowerCase().startsWith("g:")) { + Group newGroup = new Group(groupName); + return GroupManager.getGlobalGroups().newGroup(newGroup); + } + + if (getGroups().containsKey(groupName.toLowerCase())) { + return null; + } + + Group newGroup = new Group(this, groupName); + addGroup(newGroup); + setGroupsChanged(true); + return newGroup; + } + + /** + * + * @return a collection of the groups + */ + public Collection<Group> getGroupList() { + + return getGroups().values(); + } + + /** + * + * @return a collection of the users + */ + public Collection<User> getUserList() { + + return getUsers().values(); + } + + /** + * reads the file again + */ + public void reload() { + + try { + reloadGroups(); + reloadUsers(); + } catch (Exception ex) { + Logger.getLogger(WorldDataHolder.class.getName()).log(Level.SEVERE, null, ex); + } + } + + /** + * Refresh Group data from file + */ + public void reloadGroups() { + + GroupManager.setLoaded(false); + try { + // temporary holder in case the load fails. + WorldDataHolder ph = new WorldDataHolder(this.getName()); + + loadGroups(ph, getGroupsFile()); + // transfer new data + resetGroups(); + for (Group tempGroup : ph.getGroupList()) { + tempGroup.clone(this); + } + this.setDefaultGroup(getGroup(ph.getDefaultGroup().getName())); + this.removeGroupsChangedFlag(); + this.setTimeStampGroups(getGroupsFile().lastModified()); + + ph = null; + } catch (Exception ex) { + Logger.getLogger(WorldDataHolder.class.getName()).log(Level.WARNING, null, ex); + } + GroupManager.setLoaded(true); + GroupManagerEventHandler.callEvent(GMSystemEvent.Action.RELOADED); + } + + /** + * Refresh Users data from file + */ + public void reloadUsers() { + + GroupManager.setLoaded(false); + try { + // temporary holder in case the load fails. + WorldDataHolder ph = new WorldDataHolder(this.getName()); + // copy groups for reference + for (Group tempGroup : this.getGroupList()) { + tempGroup.clone(ph); + } + // setup the default group before loading user data. + ph.setDefaultGroup(ph.getGroup(getDefaultGroup().getName())); + loadUsers(ph, getUsersFile()); + // transfer new data + resetUsers(); + for (User tempUser : ph.getUserList()) { + tempUser.clone(this); + } + this.removeUsersChangedFlag(); + this.setTimeStampUsers(getUsersFile().lastModified()); + + ph = null; + } catch (Exception ex) { + Logger.getLogger(WorldDataHolder.class.getName()).log(Level.WARNING, null, ex); + } + GroupManager.setLoaded(true); + GroupManagerEventHandler.callEvent(GMSystemEvent.Action.RELOADED); + } + + public void loadGroups(File groupsFile) { + + GroupManager.setLoaded(false); + try { + setGroupsFile(groupsFile); loadGroups(this, groupsFile); } catch (FileNotFoundException e) { e.printStackTrace(); @@ -386,14 +419,14 @@ public class WorldDataHolder { throw new IllegalArgumentException("Error access the groups file!\n" + groupsFile.getPath()); } - GroupManager.setLoaded(true); - } - - public void loadUsers(File usersFile) { + GroupManager.setLoaded(true); + } + + public void loadUsers(File usersFile) { - GroupManager.setLoaded(false); - try { - setUsersFile(usersFile); + GroupManager.setLoaded(false); + try { + setUsersFile(usersFile); loadUsers(this, usersFile); } catch (FileNotFoundException e) { e.printStackTrace(); @@ -403,641 +436,888 @@ public class WorldDataHolder { throw new IllegalArgumentException("Error access the users file!\n" + usersFile.getPath()); } - GroupManager.setLoaded(true); - } - /** - * Returns a NEW data holder containing data read from the files - * - * @param worldName - * @param groupsFile - * @param usersFile - * - * @throws FileNotFoundException - * @throws IOException - */ - public static WorldDataHolder load(String worldName, File groupsFile, File usersFile) throws FileNotFoundException, IOException { - WorldDataHolder ph = new WorldDataHolder(worldName); - - GroupManager.setLoaded(false); - if (groupsFile != null) loadGroups(ph, groupsFile); - if (usersFile != null) loadUsers(ph, usersFile); - GroupManager.setLoaded(true); - - return ph; - } - - /** - * Updates the WorldDataHolder from the Groups file - * - * @param ph - * @param groupsFile - * - * @throws FileNotFoundException - * @throws IOException - */ - @SuppressWarnings({"rawtypes", "unchecked"}) - protected static void loadGroups(WorldDataHolder ph, File groupsFile) throws FileNotFoundException, IOException { - - //READ GROUPS FILE - Yaml yamlGroups = new Yaml(new SafeConstructor()); - Map<String, Object> groupsRootDataNode; - if (!groupsFile.exists()) { - throw new IllegalArgumentException("The file which should contain groups does not exist!\n" + groupsFile.getPath()); - } - FileInputStream groupsInputStream = new FileInputStream(groupsFile); - try { - groupsRootDataNode = (Map<String, Object>) yamlGroups.load(new UnicodeReader(groupsInputStream)); - if (groupsRootDataNode == null) { - throw new NullPointerException(); - } - } catch (Exception ex) { - throw new IllegalArgumentException("The following file couldn't pass on Parser.\n" + groupsFile.getPath(), ex); - } finally { - groupsInputStream.close(); - } - - //PROCESS GROUPS FILE - Map<String, List<String>> inheritance = new HashMap<String, List<String>>(); - try { - Map<String, Object> allGroupsNode = (Map<String, Object>) groupsRootDataNode.get("groups"); - for (String groupKey : allGroupsNode.keySet()) { - Map<String, Object> thisGroupNode = (Map<String, Object>) allGroupsNode.get(groupKey); - Group thisGrp = ph.createGroup(groupKey); - if (thisGrp == null) { - throw new IllegalArgumentException("I think this Group was declared more than once: " + groupKey + " in file: " + groupsFile.getPath()); - } - if (thisGroupNode.get("default") == null) { - thisGroupNode.put("default", false); - } - if ((Boolean.parseBoolean(thisGroupNode.get("default").toString()))) { - if (ph.getDefaultGroup() != null) { - GroupManager.logger.warning("The group " + thisGrp.getName() + " is claiming to be default where" + ph.getDefaultGroup().getName() + " already was."); - GroupManager.logger.warning("Overriding first request for file: " + groupsFile.getPath()); - } - ph.setDefaultGroup(thisGrp); - } - - //PERMISSIONS NODE - try { - if (thisGroupNode.get("permissions") == null) { - thisGroupNode.put("permissions", new ArrayList<String>()); - } else { - if (thisGroupNode.get("permissions") instanceof List) { - for (Object o : ((List) thisGroupNode.get("permissions"))) { - try { - thisGrp.addPermission(o.toString()); - } catch (NullPointerException e) { - // Ignore this entry as it's null. - //throw new IllegalArgumentException("Invalid permission node in group: " + thisGrp.getName() + " in file: " + groupsFile.getPath()); - } - } - } else if (thisGroupNode.get("permissions") instanceof String) { - thisGrp.addPermission((String) thisGroupNode.get("permissions")); - } else { - throw new IllegalArgumentException("Unknown type of permissions node(Should be String or List<String>) for group: " + thisGrp.getName() + " in file: " + groupsFile.getPath()); - } - thisGrp.sortPermissions(); - } - } catch (Exception e) { - throw new IllegalArgumentException("Invalid formatting found in permissions section for group: " + thisGrp.getName() + " in file: " + groupsFile.getPath()); - } - - //INFO NODE - try { - if (thisGroupNode.get("info") instanceof Map) { - Map<String, Object> infoNode = (Map<String, Object>) thisGroupNode.get("info"); - if (infoNode != null) { - thisGrp.setVariables(infoNode); - } - } else - throw new IllegalArgumentException("Unknown entry found in Info section for group: " + thisGrp.getName() + " in file: " + groupsFile.getPath()); - } catch (Exception e1) { - throw new IllegalArgumentException("Invalid formatting found in info section for group: " + thisGrp.getName() + " in file: " + groupsFile.getPath()); - } - - //END INFO NODE - - try { - if (thisGroupNode.get("inheritance") == null || thisGroupNode.get("inheritance") instanceof List) { - Object inheritNode = thisGroupNode.get("inheritance"); - if (inheritNode == null) { - thisGroupNode.put("inheritance", new ArrayList<String>()); - } else if (inheritNode instanceof List) { - List<String> groupsInh = (List<String>) inheritNode; - for (String grp : groupsInh) { - if (inheritance.get(groupKey) == null) { - List<String> thisInherits = new ArrayList<String>(); - inheritance.put(groupKey, thisInherits); - } - inheritance.get(groupKey).add(grp); - - } - } - }else - throw new IllegalArgumentException("Unknown entry found in inheritance section for group: " + thisGrp.getName() + " in file: " + groupsFile.getPath()); - } catch (Exception e2) { - throw new IllegalArgumentException("Invalid formatting found in inheritance section for group: " + thisGrp.getName() + " in file: " + groupsFile.getPath()); - } - } - } catch (Exception ex) { - ex.printStackTrace(); - throw new IllegalArgumentException("Your " + groupsFile.getPath() + " file is invalid. See console for details."); - } - - if (ph.getDefaultGroup() == null) { - throw new IllegalArgumentException("There was no Default Group declared in file: " + groupsFile.getPath()); - } - for (String groupKey : inheritance.keySet()) { - List<String> inheritedList = inheritance.get(groupKey); - Group thisGroup = ph.getGroup(groupKey); - for (String inheritedKey : inheritedList) { - Group inheritedGroup = ph.getGroup(inheritedKey); - if (thisGroup != null && inheritedGroup != null) { - thisGroup.addInherits(inheritedGroup); - } - } - } - - ph.removeGroupsChangedFlag(); - // Update the LastModified time. - ph.setGroupsFile(groupsFile); - ph.setTimeStampGroups(groupsFile.lastModified()); - - //return ph; - } - - /** - * Updates the WorldDataHolder from the Users file - * - * @param ph - * @param usersFile - * - * @throws FileNotFoundException - * @throws IOException - */ - @SuppressWarnings({"rawtypes", "unchecked"}) - protected static void loadUsers(WorldDataHolder ph, File usersFile) throws FileNotFoundException, IOException { - - //READ USERS FILE - Yaml yamlUsers = new Yaml(new SafeConstructor()); - Map<String, Object> usersRootDataNode; - if (!usersFile.exists()) { - throw new IllegalArgumentException("The file which should contain users does not exist!\n" + usersFile.getPath()); - } - FileInputStream usersInputStream = new FileInputStream(usersFile); - try { - usersRootDataNode = (Map<String, Object>) yamlUsers.load(new UnicodeReader(usersInputStream)); - if (usersRootDataNode == null) { - throw new NullPointerException(); - } - } catch (Exception ex) { - throw new IllegalArgumentException("The following file couldn't pass on Parser.\n" + usersFile.getPath(), ex); - } finally { - usersInputStream.close(); - } - - // PROCESS USERS FILE - Map<String, Object> allUsersNode = (Map<String, Object>) usersRootDataNode.get("users"); - - // Load users if the file is NOT empty - if (allUsersNode != null) - for (String usersKey : allUsersNode.keySet()) { - Map<String, Object> thisUserNode = (Map<String, Object>) allUsersNode.get(usersKey); - User thisUser = ph.createUser(usersKey); - if (thisUser == null) { - throw new IllegalArgumentException("I think this user was declared more than once: " + usersKey + " in file: " + usersFile.getPath()); - } - if (thisUserNode.get("permissions") == null) { - thisUserNode.put("permissions", new ArrayList<String>()); - } else { - if (thisUserNode.get("permissions") instanceof List) { - for (Object o : ((List) thisUserNode.get("permissions"))) { - thisUser.addPermission(o.toString()); - } - } else if (thisUserNode.get("permissions") instanceof String) { - try { - thisUser.addPermission(thisUserNode.get("permissions").toString()); - } catch (NullPointerException e) { - // Ignore this entry as it's null. - //throw new IllegalArgumentException("Invalid permission node for user: " + thisUser.getName() + " in file: " + UserFile.getPath()); - } - } - thisUser.sortPermissions(); - } - - //SUBGROUPS LOADING - if (thisUserNode.get("subgroups") == null) { - thisUserNode.put("subgroups", new ArrayList<String>()); - } - if (thisUserNode.get("subgroups") instanceof List) { - for (Object o : ((List) thisUserNode.get("subgroups"))) { - Group subGrp = ph.getGroup(o.toString()); - if (subGrp != null) { - thisUser.addSubGroup(subGrp); - } else { - GroupManager.logger.warning("Subgroup " + o.toString() + " not found for user " + thisUser.getName() + ". Ignoring entry in file: " + usersFile.getPath()); - } - } - } else if (thisUserNode.get("subgroups") instanceof String) { - Group subGrp = ph.getGroup(thisUserNode.get("subgroups").toString()); - if (subGrp != null) { - thisUser.addSubGroup(subGrp); - } else { - GroupManager.logger.warning("Subgroup " + thisUserNode.get("subgroups").toString() + " not found for user " + thisUser.getName() + ". Ignoring entry in file: " + usersFile.getPath()); - } - } - - - //USER INFO NODE - - //INFO NODE - if (thisUserNode.get("info") instanceof Map) { - Map<String, Object> infoNode = (Map<String, Object>) thisUserNode.get("info"); - if (infoNode != null) { - thisUser.setVariables(infoNode); - } - } else if (thisUserNode.get("info") != null) - throw new IllegalArgumentException("Unknown entry found in Info section for user: " + thisUser.getName() + " in file: " + usersFile.getPath()); - - //END INFO NODE - - - if (thisUserNode.get("group") != null) { - Group hisGroup = ph.getGroup(thisUserNode.get("group").toString()); - if (hisGroup == null) { - GroupManager.logger.warning("There is no group " + thisUserNode.get("group").toString() + ", as stated for player " + thisUser.getName() + ": Set to '" + ph.getDefaultGroup().getName() + "' for file: " + usersFile.getPath()); - hisGroup = ph.getDefaultGroup(); - //throw new IllegalArgumentException("There is no group " + thisUserNode.get("group").toString() + ", as stated for player " + thisUser.getName()); - } - thisUser.setGroup(hisGroup); - } else { - thisUser.setGroup(ph.getDefaultGroup()); - } - } - - ph.removeUsersChangedFlag(); - // Update the LastModified time. - ph.setUsersFile(usersFile); - ph.setTimeStampUsers(usersFile.lastModified()); - } - - /** - * Write a dataHolder in a specified file - * @param ph - * @param groupsFile - */ - public static void writeGroups(WorldDataHolder ph, File groupsFile) { - Map<String, Object> root = new HashMap<String, Object>(); - - Map<String, Object> groupsMap = new HashMap<String, Object>(); - - root.put("groups", groupsMap); - for (String groupKey : ph.getGroups().keySet()) { - Group group = ph.getGroups().get(groupKey); - - Map<String, Object> aGroupMap = new HashMap<String, Object>(); - groupsMap.put(group.getName(), aGroupMap); - - if (ph.getDefaultGroup() == null) { - GroupManager.logger.severe("There is no default group for world: " + ph.getName()); - } - aGroupMap.put("default", group.equals(ph.getDefaultGroup())); - - Map<String, Object> infoMap = new HashMap<String, Object>(); - aGroupMap.put("info", infoMap); - - for (String infoKey : group.getVariables().getVarKeyList()) { - infoMap.put(infoKey, group.getVariables().getVarObject(infoKey)); - } - - aGroupMap.put("inheritance", group.getInherits()); - - aGroupMap.put("permissions", group.getPermissionList()); - } - - if (!root.isEmpty()) { - DumperOptions opt = new DumperOptions(); - opt.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK); - final Yaml yaml = new Yaml(opt); - try { - OutputStreamWriter out = new OutputStreamWriter(new FileOutputStream(groupsFile), "UTF-8"); - - String newLine = System.getProperty("line.separator"); - - out.write("# Group inheritance" + newLine); - out.write("# any inherited groups prefixed with a g: are global groups" + newLine); - out.write("# These groups are defined in the globalgroups.yml" + newLine); - out.write("# and can be inherited in any worlds groups/users.yml." + newLine); - out.write("#" + newLine); - out.write("# Groups without the g: prefix are groups local to this world" + newLine); - out.write("# and defined in the this groups.yml file." + newLine); - out.write(newLine); - - yaml.dump(root, out); - out.close(); - } catch (UnsupportedEncodingException ex) { - } catch (FileNotFoundException ex) { - } catch (IOException e) { + GroupManager.setLoaded(true); + } + + /** + * Returns a NEW data holder containing data read from the files + * + * @param worldName + * @param groupsFile + * @param usersFile + * + * @throws FileNotFoundException + * @throws IOException + */ + public static WorldDataHolder load(String worldName, File groupsFile, File usersFile) throws FileNotFoundException, IOException { + + WorldDataHolder ph = new WorldDataHolder(worldName); + + GroupManager.setLoaded(false); + if (groupsFile != null) + loadGroups(ph, groupsFile); + if (usersFile != null) + loadUsers(ph, usersFile); + GroupManager.setLoaded(true); + + return ph; + } + + /** + * Updates the WorldDataHolder from the Groups file + * + * @param ph + * @param groupsFile + * + * @throws FileNotFoundException + * @throws IOException + */ + @SuppressWarnings({ "rawtypes", "unchecked" }) + protected static void loadGroups(WorldDataHolder ph, File groupsFile) throws FileNotFoundException, IOException { + + // READ GROUPS FILE + + Yaml yamlGroups = new Yaml(new SafeConstructor()); + Map<String, Object> groupsRootDataNode; + + if (!groupsFile.exists()) { + throw new IllegalArgumentException("The file which should contain groups does not exist!\n" + groupsFile.getPath()); + } + FileInputStream groupsInputStream = new FileInputStream(groupsFile); + try { + groupsRootDataNode = (Map<String, Object>) yamlGroups.load(new UnicodeReader(groupsInputStream)); + if (groupsRootDataNode == null) { + throw new NullPointerException(); } - } - - // Update the LastModified time. - ph.setGroupsFile(groupsFile); - ph.setTimeStampGroups(groupsFile.lastModified()); - ph.removeGroupsChangedFlag(); - - if (GroupManager.isLoaded()) - GroupManagerEventHandler.callEvent(GMSystemEvent.Action.SAVED); - - /*FileWriter tx = null; - try { - tx = new FileWriter(groupsFile, false); - tx.write(yaml.dump(root)); - tx.flush(); - } catch (Exception e) { - } finally { - try { - tx.close(); - } catch (IOException ex) { - } - }*/ - } - - /** - * Write a dataHolder in a specified file - * @param ph - * @param usersFile - */ - public static void writeUsers(WorldDataHolder ph, File usersFile) { - Map<String, Object> root = new HashMap<String, Object>(); - - Map<String, Object> usersMap = new HashMap<String, Object>(); - root.put("users", usersMap); - for (String userKey : ph.getUsers().keySet()) { - User user = ph.getUsers().get(userKey); - if ((user.getGroup() == null || user.getGroup().equals(ph.getDefaultGroup())) && user.getPermissionList().isEmpty() && user.getVariables().isEmpty() && user.isSubGroupsEmpty()) { - continue; - } - - Map<String, Object> aUserMap = new HashMap<String, Object>(); - usersMap.put(user.getName(), aUserMap); - - if (user.getGroup() == null) { - aUserMap.put("group", ph.getDefaultGroup().getName()); - } else { - aUserMap.put("group", user.getGroup().getName()); - } - //USER INFO NODE - BETA - if (user.getVariables().getSize() > 0) { - Map<String, Object> infoMap = new HashMap<String, Object>(); - aUserMap.put("info", infoMap); - for (String infoKey : user.getVariables().getVarKeyList()) { - infoMap.put(infoKey, user.getVariables().getVarObject(infoKey)); - } - } - //END USER INFO NODE - BETA - aUserMap.put("permissions", user.getPermissionList()); - - //SUBGROUPS NODE - BETA - aUserMap.put("subgroups", user.subGroupListStringCopy()); - //END SUBGROUPS NODE - BETA - } - - if (!root.isEmpty()) { - DumperOptions opt = new DumperOptions(); - opt.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK); - final Yaml yaml = new Yaml(opt); - try { - OutputStreamWriter out = new OutputStreamWriter(new FileOutputStream(usersFile), "UTF-8"); - yaml.dump(root, out); - out.close(); - } catch (UnsupportedEncodingException ex) { - } catch (FileNotFoundException ex) { - } catch (IOException e) { + } catch (Exception ex) { + throw new IllegalArgumentException("The following file couldn't pass on Parser.\n" + groupsFile.getPath(), ex); + } finally { + groupsInputStream.close(); + } + + // PROCESS GROUPS FILE + + Map<String, List<String>> inheritance = new HashMap<String, List<String>>(); + Map<String, Object> allGroupsNode = null; + + /* + * Fetch all groups under the 'groups' entry. + */ + try { + allGroupsNode = (Map<String, Object>) groupsRootDataNode.get("groups"); + } catch (Exception ex) { + throw new IllegalArgumentException("Your " + groupsFile.getPath() + " file is invalid. See console for details.", ex); + } + + Iterator<String> groupItr = allGroupsNode.keySet().iterator(); + String groupKey; + Integer groupCount = 0; + + /* + * loop each group entry + * and process it's data. + */ + while (groupItr.hasNext()) { + + try { + groupCount++; + // Attempt to fetch the next group name. + groupKey = groupItr.next(); + } catch (Exception ex) { + throw new IllegalArgumentException("Invalid group name for group entry (" + groupCount + ") in file: " + groupsFile.getPath(), ex); } - } - - // Update the LastModified time. - ph.setUsersFile(usersFile); - ph.setTimeStampUsers(usersFile.lastModified()); - ph.removeUsersChangedFlag(); - - if (GroupManager.isLoaded()) - GroupManagerEventHandler.callEvent(GMSystemEvent.Action.SAVED); - - /*FileWriter tx = null; - try { - tx = new FileWriter(usersFile, false); - tx.write(yaml.dump(root)); - tx.flush(); - } catch (Exception e) { - } finally { - try { - tx.close(); - } catch (IOException ex) { - } - }*/ - } - - /** - * Don't use this. Unless you want to make this plugin to interact with original Nijikokun Permissions - * This method is supposed to make the original one reload the file, and propagate the changes made here. - * - * Prefer to use the AnjoCaido's fake version of Nijikokun's Permission plugin. - * The AnjoCaido's Permission can propagate the changes made on this plugin instantly, - * without need to save the file. - * - * @param server the server that holds the plugin - * @deprecated it is not used anymore... unless if you use original Permissions - */ - @Deprecated - public static void reloadOldPlugins(Server server) { - // Only reload permissions - PluginManager pm = server.getPluginManager(); - Plugin[] plugins = pm.getPlugins(); - for (int i = 0; i < plugins.length; i++) { - //plugins[i].getConfiguration().load(); - try { - plugins[i].getClass().getMethod("setupPermissions").invoke(plugins[i]); - } catch (Exception ex) { - continue; - } - } - } - - /** - * @return the permissionsHandler - */ - public AnjoPermissionsHandler getPermissionsHandler() { - if (permissionsHandler == null) { - permissionsHandler = new AnjoPermissionsHandler(this); - } - return permissionsHandler; - } - - /** + + /* + * Fetch this groups child nodes + */ + Map<String, Object> thisGroupNode = null; + + try { + thisGroupNode = (Map<String, Object>) allGroupsNode.get(groupKey); + } catch (Exception ex) { + throw new IllegalArgumentException("Invalid child nodes for group '" + groupKey + "' in file: " + groupsFile.getPath(), ex); + } + + /* + * Create a new group with this name + * in the assigned data source. + */ + Group thisGrp = ph.createGroup(groupKey); + + if (thisGrp == null) { + throw new IllegalArgumentException("I think this Group was declared more than once: " + groupKey + " in file: " + groupsFile.getPath()); + } + + // DEFAULT NODE + + Object nodeData = null; + try { + nodeData = thisGroupNode.get("default"); + } catch (Exception ex) { + throw new IllegalArgumentException("Bad format found in 'permissions' for group: " + groupKey + " in file: " + groupsFile.getPath()); + } + + if (nodeData == null) { + /* + * If no 'default' node is found do nothing. + */ + } else if ((Boolean.parseBoolean(nodeData.toString()))) { + /* + * Set this as the default group. + * Warn if some other group has already claimed that position. + */ + if (ph.getDefaultGroup() != null) { + GroupManager.logger.warning("The group '" + thisGrp.getName() + "' is claiming to be default where '" + ph.getDefaultGroup().getName() + "' already was."); + GroupManager.logger.warning("Overriding first default request in file: " + groupsFile.getPath()); + } + ph.setDefaultGroup(thisGrp); + } + + // PERMISSIONS NODE + + nodeData = null; + try { + nodeData = thisGroupNode.get("permissions"); + } catch (Exception ex) { + throw new IllegalArgumentException("Bad format found in 'permissions' for '" + groupKey + "' in file: " + groupsFile.getPath()); + } + + if (nodeData == null) { + /* + * If no permissions node is found, or it's empty + * do nothing. + */ + } else { + /* + * There is a permission list Which seems to hold some data + */ + if (nodeData instanceof List) { + /* + * Check each entry and add it as a new permission. + */ + try { + for (Object o : ((List) nodeData)) { + try { + /* + * Only add this permission if it's not empty. + */ + if (!o.toString().isEmpty()) + thisGrp.addPermission(o.toString()); + + } catch (NullPointerException ex) { + // Ignore this entry as it's null. It can be + // safely dropped + } + } + } catch (Exception ex) { + throw new IllegalArgumentException("Invalid formatting found in 'permissions' section for group: " + thisGrp.getName() + " in file: " + groupsFile.getPath(), ex); + } + + } else if (nodeData instanceof String) { + /* + * Only add this permission if it's not empty. + */ + if (!nodeData.toString().isEmpty()) + thisGrp.addPermission((String) nodeData); + + } else { + throw new IllegalArgumentException("Unknown type of 'permissions' node(Should be String or List<String>) for group: " + thisGrp.getName() + " in file: " + groupsFile.getPath()); + } + /* + * Sort all permissions so they are in the correct order for + * checking. + */ + thisGrp.sortPermissions(); + } + + // INFO NODE + + nodeData = null; + try { + nodeData = thisGroupNode.get("info"); + } catch (Exception ex) { + throw new IllegalArgumentException("Bad format found in 'info' section for group: " + groupKey + " in file: " + groupsFile.getPath()); + } + + if (nodeData == null) { + /* + * No info section was found, so leave all variables as + * defaults. + */ + GroupManager.logger.warning("The group '" + thisGrp.getName() + "' has no 'info' section!"); + GroupManager.logger.warning("Using default values: " + groupsFile.getPath()); + + } else if (nodeData instanceof Map) { + try { + if (nodeData != null) { + thisGrp.setVariables((Map<String, Object>) nodeData); + } + } catch (Exception ex) { + throw new IllegalArgumentException("Invalid formatting found in 'info' section for group: " + thisGrp.getName() + " in file: " + groupsFile.getPath(), ex); + } + + } else + throw new IllegalArgumentException("Unknown entry found in 'info' section for group: " + thisGrp.getName() + " in file: " + groupsFile.getPath()); + + // INHERITANCE NODE + + nodeData = null; + try { + nodeData = thisGroupNode.get("inheritance"); + } catch (Exception ex) { + throw new IllegalArgumentException("Bad format found in 'inheritance' section for group: " + groupKey + " in file: " + groupsFile.getPath()); + } + + if (nodeData == null || nodeData instanceof List) { + if (nodeData == null) { + /* + * If no inheritance node is found, or it's empty + * do nothing. + */ + } else if (nodeData instanceof List) { + + try { + for (String grp : (List<String>) nodeData) { + if (inheritance.get(groupKey) == null) { + inheritance.put(groupKey, new ArrayList<String>()); + } + inheritance.get(groupKey).add(grp); + } + + } catch (Exception ex) { + throw new IllegalArgumentException("Invalid formatting found in 'inheritance' section for group: " + thisGrp.getName() + " in file: " + groupsFile.getPath(), ex); + } + + } + } else + throw new IllegalArgumentException("Unknown entry found in 'inheritance' section for group: " + thisGrp.getName() + " in file: " + groupsFile.getPath()); + + // END GROUP + + } + + if (ph.getDefaultGroup() == null) { + throw new IllegalArgumentException("There was no Default Group declared in file: " + groupsFile.getPath()); + } + + /* + * Build the inheritance map and recored any errors + */ + for (String group : inheritance.keySet()) { + List<String> inheritedList = inheritance.get(group); + Group thisGroup = ph.getGroup(group); + if (thisGroup != null) + for (String inheritedKey : inheritedList) { + if (inheritedKey != null) { + Group inheritedGroup = ph.getGroup(inheritedKey); + if (inheritedGroup != null) { + thisGroup.addInherits(inheritedGroup); + } else + GroupManager.logger.warning("Inherited group '" + inheritedKey + "' not found for group " + thisGroup.getName() + ". Ignoring entry in file: " + groupsFile.getPath()); + } + } + } + + ph.removeGroupsChangedFlag(); + // Update the LastModified time. + ph.setGroupsFile(groupsFile); + ph.setTimeStampGroups(groupsFile.lastModified()); + + // return ph; + } + + /** + * Updates the WorldDataHolder from the Users file + * + * @param ph + * @param usersFile + * + * @throws FileNotFoundException + * @throws IOException + */ + @SuppressWarnings({ "rawtypes", "unchecked" }) + protected static void loadUsers(WorldDataHolder ph, File usersFile) throws FileNotFoundException, IOException { + + // READ USERS FILE + Yaml yamlUsers = new Yaml(new SafeConstructor()); + Map<String, Object> usersRootDataNode; + if (!usersFile.exists()) { + throw new IllegalArgumentException("The file which should contain users does not exist!\n" + usersFile.getPath()); + } + FileInputStream usersInputStream = new FileInputStream(usersFile); + try { + usersRootDataNode = (Map<String, Object>) yamlUsers.load(new UnicodeReader(usersInputStream)); + if (usersRootDataNode == null) { + throw new NullPointerException(); + } + } catch (Exception ex) { + throw new IllegalArgumentException("The following file couldn't pass on Parser.\n" + usersFile.getPath(), ex); + } finally { + usersInputStream.close(); + } + + // PROCESS USERS FILE + + Map<String, Object> allUsersNode = null; + + /* + * Fetch all child nodes under the 'users' entry. + */ + try { + allUsersNode = (Map<String, Object>) usersRootDataNode.get("users"); + } catch (Exception ex) { + throw new IllegalArgumentException("Your " + usersFile.getPath() + " file is invalid. See console for details.", ex); + } + + // Load users if the file is NOT empty + + if (allUsersNode != null) { + + Iterator<String> usersItr = allUsersNode.keySet().iterator(); + String usersKey; + Integer userCount = 0; + + while (usersItr.hasNext()) { + try { + userCount++; + // Attempt to fetch the next user name. + usersKey = usersItr.next(); + } catch (Exception ex) { + throw new IllegalArgumentException("Invalid node type for user entry (" + userCount + ") in file: " + usersFile.getPath(), ex); + } + + Map<String, Object> thisUserNode = null; + try { + thisUserNode = (Map<String, Object>) allUsersNode.get(usersKey); + } catch (Exception ex) { + throw new IllegalArgumentException("Bad format found for user: " + usersKey + " in file: " + usersFile.getPath()); + } + + User thisUser = ph.createUser(usersKey); + if (thisUser == null) { + throw new IllegalArgumentException("I think this user was declared more than once: " + usersKey + " in file: " + usersFile.getPath()); + } + + // USER PERMISSIONS NODES + + Object nodeData = null; + try { + nodeData = thisUserNode.get("permissions"); + } catch (Exception ex) { + throw new IllegalArgumentException("Bad format found in 'permissions' for user: " + usersKey + " in file: " + usersFile.getPath()); + } + + if (nodeData == null) { + /* + * If no permissions node is found, or it's empty + * do nothing. + */ + } else { + if (nodeData instanceof List) { + for (Object o : ((List) nodeData)) { + /* + * Only add this permission if it's not empty + */ + if (!o.toString().isEmpty()) + thisUser.addPermission(o.toString()); + } + } else if (nodeData instanceof String) { + try { + /* + * Only add this permission if it's not empty + */ + if (!nodeData.toString().isEmpty()) + thisUser.addPermission(nodeData.toString()); + } catch (NullPointerException e) { + // Ignore this entry as it's null. + } + } + thisUser.sortPermissions(); + } + + // SUBGROUPS NODES + + nodeData = null; + try { + nodeData = thisUserNode.get("subgroups"); + } catch (Exception ex) { + throw new IllegalArgumentException("Bad format found in 'subgroups' for user: " + usersKey + " in file: " + usersFile.getPath()); + } + + if (nodeData == null) { + /* + * If no subgroups node is found, or it's empty + * do nothing. + */ + } else if (nodeData instanceof List) { + for (Object o : ((List) nodeData)) { + Group subGrp = ph.getGroup(o.toString()); + if (subGrp != null) { + thisUser.addSubGroup(subGrp); + } else { + GroupManager.logger.warning("Subgroup '" + o.toString() + "' not found for user: " + thisUser.getName() + ". Ignoring entry in file: " + usersFile.getPath()); + } + } + } else if (nodeData instanceof String) { + Group subGrp = ph.getGroup(nodeData.toString()); + if (subGrp != null) { + thisUser.addSubGroup(subGrp); + } else { + GroupManager.logger.warning("Subgroup '" + nodeData.toString() + "' not found for user: " + thisUser.getName() + ". Ignoring entry in file: " + usersFile.getPath()); + } + } + + // USER INFO NODE + + nodeData = null; + try { + nodeData = thisUserNode.get("info"); + } catch (Exception ex) { + throw new IllegalArgumentException("Bad format found in 'info' section for user: " + usersKey + " in file: " + usersFile.getPath()); + } + + if (nodeData == null) { + /* + * If no info node is found, or it's empty + * do nothing. + */ + } else if (nodeData instanceof Map) { + thisUser.setVariables((Map<String, Object>) nodeData); + + } else + throw new IllegalArgumentException("Unknown entry found in 'info' section for user: " + thisUser.getName() + " in file: " + usersFile.getPath()); + + // END INFO NODE + + // PRIMARY GROUP + + nodeData = null; + try { + nodeData = thisUserNode.get("group"); + } catch (Exception ex) { + throw new IllegalArgumentException("Bad format found in 'group' section for user: " + usersKey + " in file: " + usersFile.getPath()); + } + + if (nodeData != null) { + Group hisGroup = ph.getGroup(nodeData.toString()); + if (hisGroup == null) { + GroupManager.logger.warning("There is no group " + thisUserNode.get("group").toString() + ", as stated for player " + thisUser.getName() + ": Set to '" + ph.getDefaultGroup().getName() + "' for file: " + usersFile.getPath()); + hisGroup = ph.getDefaultGroup(); + } + thisUser.setGroup(hisGroup); + } else { + thisUser.setGroup(ph.getDefaultGroup()); + } + } + } + + ph.removeUsersChangedFlag(); + // Update the LastModified time. + ph.setUsersFile(usersFile); + ph.setTimeStampUsers(usersFile.lastModified()); + } + + /** + * Write a dataHolder in a specified file + * + * @param ph + * @param groupsFile + */ + public static void writeGroups(WorldDataHolder ph, File groupsFile) { + + Map<String, Object> root = new HashMap<String, Object>(); + + Map<String, Object> groupsMap = new HashMap<String, Object>(); + + root.put("groups", groupsMap); + for (String groupKey : ph.getGroups().keySet()) { + Group group = ph.getGroups().get(groupKey); + + Map<String, Object> aGroupMap = new HashMap<String, Object>(); + groupsMap.put(group.getName(), aGroupMap); + + if (ph.getDefaultGroup() == null) { + GroupManager.logger.severe("There is no default group for world: " + ph.getName()); + } + aGroupMap.put("default", group.equals(ph.getDefaultGroup())); + + Map<String, Object> infoMap = new HashMap<String, Object>(); + aGroupMap.put("info", infoMap); + + for (String infoKey : group.getVariables().getVarKeyList()) { + infoMap.put(infoKey, group.getVariables().getVarObject(infoKey)); + } + + aGroupMap.put("inheritance", group.getInherits()); + + aGroupMap.put("permissions", group.getPermissionList()); + } + + if (!root.isEmpty()) { + DumperOptions opt = new DumperOptions(); + opt.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK); + final Yaml yaml = new Yaml(opt); + try { + OutputStreamWriter out = new OutputStreamWriter(new FileOutputStream(groupsFile), "UTF-8"); + + String newLine = System.getProperty("line.separator"); + + out.write("# Group inheritance" + newLine); + out.write("#" + newLine); + out.write("# Any inherited groups prefixed with a g: are global groups" + newLine); + out.write("# and are inherited from the GlobalGroups.yml." + newLine); + out.write("#" + newLine); + out.write("# Groups without the g: prefix are groups local to this world" + newLine); + out.write("# and are defined in the this groups.yml file." + newLine); + out.write("#" + newLine); + out.write("# Local group inheritances define your promotion tree when using 'manpromote/mandemote'" + newLine); + out.write(newLine); + + yaml.dump(root, out); + out.close(); + } catch (UnsupportedEncodingException ex) { + } catch (FileNotFoundException ex) { + } catch (IOException e) { + } + } + + // Update the LastModified time. + ph.setGroupsFile(groupsFile); + ph.setTimeStampGroups(groupsFile.lastModified()); + ph.removeGroupsChangedFlag(); + + if (GroupManager.isLoaded()) + GroupManagerEventHandler.callEvent(GMSystemEvent.Action.SAVED); + + /* + * FileWriter tx = null; + * try { + * tx = new FileWriter(groupsFile, false); + * tx.write(yaml.dump(root)); + * tx.flush(); + * } catch (Exception e) { + * } finally { + * try { + * tx.close(); + * } catch (IOException ex) { + * } + * } + */ + } + + /** + * Write a dataHolder in a specified file + * + * @param ph + * @param usersFile + */ + public static void writeUsers(WorldDataHolder ph, File usersFile) { + + Map<String, Object> root = new HashMap<String, Object>(); + + Map<String, Object> usersMap = new HashMap<String, Object>(); + root.put("users", usersMap); + for (String userKey : ph.getUsers().keySet()) { + User user = ph.getUsers().get(userKey); + if ((user.getGroup() == null || user.getGroup().equals(ph.getDefaultGroup())) && user.getPermissionList().isEmpty() && user.getVariables().isEmpty() && user.isSubGroupsEmpty()) { + continue; + } + + Map<String, Object> aUserMap = new HashMap<String, Object>(); + usersMap.put(user.getName(), aUserMap); + + if (user.getGroup() == null) { + aUserMap.put("group", ph.getDefaultGroup().getName()); + } else { + aUserMap.put("group", user.getGroup().getName()); + } + // USER INFO NODE - BETA + if (user.getVariables().getSize() > 0) { + Map<String, Object> infoMap = new HashMap<String, Object>(); + aUserMap.put("info", infoMap); + for (String infoKey : user.getVariables().getVarKeyList()) { + infoMap.put(infoKey, user.getVariables().getVarObject(infoKey)); + } + } + // END USER INFO NODE - BETA + aUserMap.put("permissions", user.getPermissionList()); + + // SUBGROUPS NODE - BETA + aUserMap.put("subgroups", user.subGroupListStringCopy()); + // END SUBGROUPS NODE - BETA + } + + if (!root.isEmpty()) { + DumperOptions opt = new DumperOptions(); + opt.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK); + final Yaml yaml = new Yaml(opt); + try { + OutputStreamWriter out = new OutputStreamWriter(new FileOutputStream(usersFile), "UTF-8"); + yaml.dump(root, out); + out.close(); + } catch (UnsupportedEncodingException ex) { + } catch (FileNotFoundException ex) { + } catch (IOException e) { + } + } + + // Update the LastModified time. + ph.setUsersFile(usersFile); + ph.setTimeStampUsers(usersFile.lastModified()); + ph.removeUsersChangedFlag(); + + if (GroupManager.isLoaded()) + GroupManagerEventHandler.callEvent(GMSystemEvent.Action.SAVED); + + /* + * FileWriter tx = null; + * try { + * tx = new FileWriter(usersFile, false); + * tx.write(yaml.dump(root)); + * tx.flush(); + * } catch (Exception e) { + * } finally { + * try { + * tx.close(); + * } catch (IOException ex) { + * } + * } + */ + } + + /** + * Don't use this. Unless you want to make this plugin to interact with + * original Nijikokun Permissions + * This method is supposed to make the original one reload the file, and + * propagate the changes made here. + * + * Prefer to use the AnjoCaido's fake version of Nijikokun's Permission + * plugin. + * The AnjoCaido's Permission can propagate the changes made on this plugin + * instantly, + * without need to save the file. + * + * @param server the server that holds the plugin + * @deprecated it is not used anymore... unless if you use original + * Permissions + */ + @Deprecated + public static void reloadOldPlugins(Server server) { + + // Only reload permissions + PluginManager pm = server.getPluginManager(); + Plugin[] plugins = pm.getPlugins(); + for (int i = 0; i < plugins.length; i++) { + // plugins[i].getConfiguration().load(); + try { + plugins[i].getClass().getMethod("setupPermissions").invoke(plugins[i]); + } catch (Exception ex) { + continue; + } + } + } + + /** + * @return the permissionsHandler + */ + public AnjoPermissionsHandler getPermissionsHandler() { + + if (permissionsHandler == null) { + permissionsHandler = new AnjoPermissionsHandler(this); + } + return permissionsHandler; + } + + /** * @param haveUsersChanged the haveUsersChanged to set */ public void setUsersChanged(boolean haveUsersChanged) { + users.setUsersChanged(haveUsersChanged); } - /** - * - * @return true if any user data has changed - */ - public boolean haveUsersChanged() { - if (users.HaveUsersChanged()) { - return true; - } - for (User u : users.getUsers().values()) { - if (u.isChanged()) { - return true; - } - } - return false; - } - - /** + /** + * + * @return true if any user data has changed + */ + public boolean haveUsersChanged() { + + if (users.HaveUsersChanged()) { + return true; + } + for (User u : users.getUsers().values()) { + if (u.isChanged()) { + return true; + } + } + return false; + } + + /** * @param setGroupsChanged the haveGroupsChanged to set */ public void setGroupsChanged(boolean setGroupsChanged) { + groups.setGroupsChanged(setGroupsChanged); } - - /** - * - * @return true if any group data has changed. - */ - public boolean haveGroupsChanged() { - if (groups.HaveGroupsChanged()) { - return true; - } - for (Group g : groups.getGroups().values()) { - if (g.isChanged()) { - return true; - } - } - return false; - } - - /** + + /** + * + * @return true if any group data has changed. + */ + public boolean haveGroupsChanged() { + + if (groups.HaveGroupsChanged()) { + return true; + } + for (Group g : groups.getGroups().values()) { + if (g.isChanged()) { + return true; + } + } + return false; + } + + /** * */ - public void removeUsersChangedFlag() { - setUsersChanged(false); - for (User u : getUsers().values()) { - u.flagAsSaved(); - } - } - - /** + public void removeUsersChangedFlag() { + + setUsersChanged(false); + for (User u : getUsers().values()) { + u.flagAsSaved(); + } + } + + /** * */ - public void removeGroupsChangedFlag() { - setGroupsChanged(false); - for (Group g : getGroups().values()) { - g.flagAsSaved(); - } - } - - /** - * @return the usersFile - */ - public File getUsersFile() { - return users.getUsersFile(); - } - - /** - * @param file the usersFile to set - */ - public void setUsersFile(File file) { - users.setUsersFile(file); - } + public void removeGroupsChangedFlag() { - /** - * @return the groupsFile - */ - public File getGroupsFile() { - return groups.getGroupsFile(); - } - - /** - * @param file the groupsFile to set - */ - public void setGroupsFile(File file) { - groups.setGroupsFile(file); - } + setGroupsChanged(false); + for (Group g : getGroups().values()) { + g.flagAsSaved(); + } + } - /** - * @return the name - */ - public String getName() { - return name; - } - - /** + /** + * @return the usersFile + */ + public File getUsersFile() { + + return users.getUsersFile(); + } + + /** + * @param file the usersFile to set + */ + public void setUsersFile(File file) { + + users.setUsersFile(file); + } + + /** + * @return the groupsFile + */ + public File getGroupsFile() { + + return groups.getGroupsFile(); + } + + /** + * @param file the groupsFile to set + */ + public void setGroupsFile(File file) { + + groups.setGroupsFile(file); + } + + /** + * @return the name + */ + public String getName() { + + return name; + } + + /** * Resets Groups. */ public void resetGroups() { - //setDefaultGroup(null); + + // setDefaultGroup(null); groups.setGroups(new HashMap<String, Group>()); } - /** + + /** * Resets Users */ public void resetUsers() { + users.setUsers(new HashMap<String, User>()); } - - /** + + /** * @return the groups */ public Map<String, Group> getGroups() { + return groups.getGroups(); } - /** + + /** * @return the users */ public Map<String, User> getUsers() { + return users.getUsers(); } - + /** * @return the groups */ public GroupsDataHolder getGroupsObject() { + return groups; } + /** * @param groupsDataHolder the GroupsDataHolder to set */ public void setGroupsObject(GroupsDataHolder groupsDataHolder) { + groups = groupsDataHolder; } - /** + + /** * @return the users */ public UsersDataHolder getUsersObject() { + return users; } + /** * @param usersDataHolder the UsersDataHolder to set */ public void setUsersObject(UsersDataHolder usersDataHolder) { + users = usersDataHolder; } - - /** + + /** * @return the timeStampGroups */ public long getTimeStampGroups() { + return groups.getTimeStampGroups(); } - /** + + /** * @return the timeStampUsers */ public long getTimeStampUsers() { + return users.getTimeStampUsers(); } @@ -1045,20 +1325,24 @@ public class WorldDataHolder { * @param timeStampGroups the timeStampGroups to set */ protected void setTimeStampGroups(long timeStampGroups) { + groups.setTimeStampGroups(timeStampGroups); } - /** + + /** * @param timeStampUsers the timeStampUsers to set */ protected void setTimeStampUsers(long timeStampUsers) { + users.setTimeStampUsers(timeStampUsers); } - + public void setTimeStamps() { + if (getGroupsFile() != null) setTimeStampGroups(getGroupsFile().lastModified()); if (getUsersFile() != null) setTimeStampUsers(getUsersFile().lastModified()); - } - + } + } diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java index e72118468..27a7d9a59 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java @@ -26,459 +26,484 @@ import org.bukkit.configuration.MemorySection; import org.bukkit.entity.Player; /** - * + * * @author gabrielcouto */ public class WorldsHolder { - /** - * Map with instances of loaded worlds. - */ - private Map<String, OverloadedWorldHolder> worldsData = new HashMap<String, OverloadedWorldHolder>(); - - /** - * Map of mirrors: <nonExistingWorldName, existingAndLoadedWorldName> - * The key is the mirror. - * The object is the mirrored. - * - * Mirror shows the same data of mirrored. - */ - private Map<String, String> mirrorsGroup = new HashMap<String, String>(); - private Map<String, String> mirrorsUser = new HashMap<String, String>(); - - //private OverloadedWorldHolder defaultWorld; - private String serverDefaultWorldName; - private GroupManager plugin; - private File worldsFolder; - - /** - * - * @param plugin - */ - public WorldsHolder(GroupManager plugin) { - this.plugin = plugin; - // Setup folders and check files exist for the primary world - verifyFirstRun(); - initialLoad(); - if (serverDefaultWorldName == null) { - throw new IllegalStateException("There is no default group! OMG!"); - } - } - - private void initialLoad() { - // load the initial world - initialWorldLoading(); - // Configure and load any mirrors and additional worlds as defined in config.yml - mirrorSetUp(); - // search the worlds folder for any manually created worlds (not listed in config.yml) - loadAllSearchedWorlds(); - } - - private void initialWorldLoading() { - //Load the default world - loadWorld(serverDefaultWorldName); - //defaultWorld = getUpdatedWorldData(serverDefaultWorldName); - } - - private void loadAllSearchedWorlds() { - - /* - * Read all known worlds from Bukkit - * Create the data files if they don't already exist, - * and they are not mirrored. - */ - for (World world: plugin.getServer().getWorlds()) - if ((!worldsData.containsKey(world.getName().toLowerCase())) - && ((!mirrorsGroup.containsKey(world.getName().toLowerCase())) || (!mirrorsUser.containsKey(world.getName().toLowerCase())))) - setupWorldFolder(world.getName()); - /* - * Loop over all folders within the worlds folder - * and attempt to load the world data - */ - for (File folder : worldsFolder.listFiles()) { - if (folder.isDirectory()) { - GroupManager.logger.info("World Found: " + folder.getName()); - - /* - * don't load any worlds which are already loaded - * or fully mirrored worlds that don't need data. - */ - if (!worldsData.containsKey(folder.getName().toLowerCase()) - && ((!mirrorsGroup.containsKey(folder.getName().toLowerCase())) - || (!mirrorsUser.containsKey(folder.getName().toLowerCase())))) { - loadWorld(folder.getName()); - } - - } - } - } - - @SuppressWarnings("rawtypes") - public void mirrorSetUp() { - mirrorsGroup.clear(); - mirrorsUser.clear(); - Map<String, Object> mirrorsMap = plugin.getGMConfig().getMirrorsMap(); - - HashSet<String> mirroredWorlds = new HashSet<String>(); - - if (mirrorsMap != null) { - for (String source : mirrorsMap.keySet()) { - // Make sure all non mirrored worlds have a set of data files. - setupWorldFolder(source); - // Load the world data - if (!worldsData.containsKey(source.toLowerCase())) - loadWorld(source); - - if (mirrorsMap.get(source) instanceof ArrayList) { - ArrayList mirrorList = (ArrayList) mirrorsMap.get(source); - - // These worlds fully mirror their parent - for (Object o : mirrorList) { - String world = o.toString().toLowerCase(); - if (world != serverDefaultWorldName) { - try { - mirrorsGroup.remove(world); - mirrorsUser.remove(world); - } catch (Exception e) { - } - mirrorsGroup.put(world, getWorldData(source).getName()); - mirrorsUser.put(world, getWorldData(source).getName()); - - // Track this world so we can create a datasource for it later - mirroredWorlds.add(o.toString()); - - } else - GroupManager.logger.log(Level.WARNING, "Mirroring error with " + o.toString() + ". Recursive loop detected!"); - } - } else if (mirrorsMap.get(source) instanceof MemorySection) { - MemorySection subSection = (MemorySection) mirrorsMap.get(source); - - for (String key : subSection.getKeys(true)) { - - if (key.toLowerCase() != serverDefaultWorldName) { - - if (subSection.get(key) instanceof ArrayList) { - ArrayList mirrorList = (ArrayList) subSection.get(key); - - // These worlds have defined mirroring - for (Object o : mirrorList) { - String type = o.toString().toLowerCase(); - try { - if (type.equals("groups")) - mirrorsGroup.remove(key.toLowerCase()); - - if (type.equals("users")) - mirrorsUser.remove(key.toLowerCase()); - - } catch (Exception e) { - } - if (type.equals("groups")) - mirrorsGroup.put(key.toLowerCase(), getWorldData(source).getName()); - - if (type.equals("users")) - mirrorsUser.put(key.toLowerCase(), getWorldData(source).getName()); - } - - // Track this world so we can create a datasource for it later - mirroredWorlds.add(key); - - } else - GroupManager.logger.log(Level.WARNING, "Mirroring error with " + key + ". Recursive loop detected!"); - - } else { - throw new IllegalStateException("Unknown mirroring format for " + key); - } - - } - } - } - - // Create a datasource for any worlds not already loaded - for (String world : mirroredWorlds){ - if (!worldsData.containsKey(world.toLowerCase())) { - setupWorldFolder(world); - loadWorld(world, true); - } - } - } - } - - /** - * - */ - public void reloadAll() { - // Load global groups - GroupManager.getGlobalGroups().load(); - - ArrayList<WorldDataHolder> alreadyDone = new ArrayList<WorldDataHolder>(); - for (WorldDataHolder w : worldsData.values()) { - if (alreadyDone.contains(w)) { - continue; - } - if (!mirrorsGroup.containsKey(w.getName().toLowerCase())) - w.reloadGroups(); - if (!mirrorsUser.containsKey(w.getName().toLowerCase())) - w.reloadUsers(); - - alreadyDone.add(w); - } - - } - - /** - * - * @param worldName - */ - public void reloadWorld(String worldName) { - if (!mirrorsGroup.containsKey(worldName.toLowerCase())) - getWorldData(worldName).reloadGroups(); - if (!mirrorsUser.containsKey(worldName.toLowerCase())) - getWorldData(worldName).reloadUsers(); - } - - /** - * Wrapper to retain backwards compatibility - * (call this function to auto overwrite files) - */ - public void saveChanges() { - saveChanges(true); - } + /** + * Map with instances of loaded worlds. + */ + private Map<String, OverloadedWorldHolder> worldsData = new HashMap<String, OverloadedWorldHolder>(); + + /** + * Map of mirrors: <nonExistingWorldName, existingAndLoadedWorldName> + * The key is the mirror. + * The object is the mirrored. + * + * Mirror shows the same data of mirrored. + */ + private Map<String, String> mirrorsGroup = new HashMap<String, String>(); + private Map<String, String> mirrorsUser = new HashMap<String, String>(); + + private String serverDefaultWorldName; + private GroupManager plugin; + private File worldsFolder; + + /** + * + * @param plugin + */ + public WorldsHolder(GroupManager plugin) { + + this.plugin = plugin; + resetWorldsHolder(); + } + + public void resetWorldsHolder() { + + worldsData = new HashMap<String, OverloadedWorldHolder>(); + mirrorsGroup = new HashMap<String, String>(); + mirrorsUser = new HashMap<String, String>(); + + // Setup folders and check files exist for the primary world + verifyFirstRun(); + initialLoad(); + if (serverDefaultWorldName == null) + throw new IllegalStateException("There is no default group! OMG!"); + } + + private void initialLoad() { + + // load the initial world + initialWorldLoading(); + // Configure and load any mirrors and additional worlds as defined in config.yml + mirrorSetUp(); + // search the worlds folder for any manually created worlds (not listed in config.yml) + loadAllSearchedWorlds(); + } + + private void initialWorldLoading() { + + //Load the default world + loadWorld(serverDefaultWorldName); + //defaultWorld = getUpdatedWorldData(serverDefaultWorldName); + } + + private void loadAllSearchedWorlds() { + + /* + * Read all known worlds from Bukkit + * Create the data files if they don't already exist, + * and they are not mirrored. + */ + for (World world : plugin.getServer().getWorlds()) + if ((!worldsData.containsKey(world.getName().toLowerCase())) && ((!mirrorsGroup.containsKey(world.getName().toLowerCase())) || (!mirrorsUser.containsKey(world.getName().toLowerCase())))) + setupWorldFolder(world.getName()); + /* + * Loop over all folders within the worlds folder + * and attempt to load the world data + */ + for (File folder : worldsFolder.listFiles()) { + if (folder.isDirectory()) { + GroupManager.logger.info("World Found: " + folder.getName()); + + /* + * don't load any worlds which are already loaded + * or fully mirrored worlds that don't need data. + */ + if (!worldsData.containsKey(folder.getName().toLowerCase()) && ((!mirrorsGroup.containsKey(folder.getName().toLowerCase())) || (!mirrorsUser.containsKey(folder.getName().toLowerCase())))) { + /* + * Call setupWorldFolder to check case sensitivity + * and convert to lower case, before we attempt to load this + * world. + */ + setupWorldFolder(folder.getName()); + loadWorld(folder.getName().toLowerCase()); + } + + } + } + } + + @SuppressWarnings("rawtypes") + public void mirrorSetUp() { + + mirrorsGroup.clear(); + mirrorsUser.clear(); + Map<String, Object> mirrorsMap = plugin.getGMConfig().getMirrorsMap(); + + HashSet<String> mirroredWorlds = new HashSet<String>(); + + if (mirrorsMap != null) { + for (String source : mirrorsMap.keySet()) { + // Make sure all non mirrored worlds have a set of data files. + setupWorldFolder(source); + // Load the world data + if (!worldsData.containsKey(source.toLowerCase())) + loadWorld(source); + + if (mirrorsMap.get(source) instanceof ArrayList) { + ArrayList mirrorList = (ArrayList) mirrorsMap.get(source); + + // These worlds fully mirror their parent + for (Object o : mirrorList) { + String world = o.toString().toLowerCase(); + if (world != serverDefaultWorldName) { + try { + mirrorsGroup.remove(world); + mirrorsUser.remove(world); + } catch (Exception e) { + } + mirrorsGroup.put(world, getWorldData(source).getName()); + mirrorsUser.put(world, getWorldData(source).getName()); + + // Track this world so we can create a datasource for it later + mirroredWorlds.add(o.toString()); + + } else + GroupManager.logger.log(Level.WARNING, "Mirroring error with " + o.toString() + ". Recursive loop detected!"); + } + } else if (mirrorsMap.get(source) instanceof MemorySection) { + MemorySection subSection = (MemorySection) mirrorsMap.get(source); + + for (String key : subSection.getKeys(true)) { + + if (key.toLowerCase() != serverDefaultWorldName) { + + if (subSection.get(key) instanceof ArrayList) { + ArrayList mirrorList = (ArrayList) subSection.get(key); + + // These worlds have defined mirroring + for (Object o : mirrorList) { + String type = o.toString().toLowerCase(); + try { + if (type.equals("groups")) + mirrorsGroup.remove(key.toLowerCase()); + + if (type.equals("users")) + mirrorsUser.remove(key.toLowerCase()); + + } catch (Exception e) { + } + if (type.equals("groups")) + mirrorsGroup.put(key.toLowerCase(), getWorldData(source).getName()); + + if (type.equals("users")) + mirrorsUser.put(key.toLowerCase(), getWorldData(source).getName()); + } + + // Track this world so we can create a datasource for it later + mirroredWorlds.add(key); + + } else + GroupManager.logger.log(Level.WARNING, "Mirroring error with " + key + ". Recursive loop detected!"); + + } else { + throw new IllegalStateException("Unknown mirroring format for " + key); + } + + } + } + } - /** + // Create a datasource for any worlds not already loaded + for (String world : mirroredWorlds) { + if (!worldsData.containsKey(world.toLowerCase())) { + setupWorldFolder(world); + loadWorld(world, true); + } + } + } + } + + /** * */ - public void saveChanges(boolean overwrite) { - ArrayList<WorldDataHolder> alreadyDone = new ArrayList<WorldDataHolder>(); - Tasks.removeOldFiles(plugin, plugin.getBackupFolder()); - - // Write Global Groups - if (GroupManager.getGlobalGroups().haveGroupsChanged()) { - GroupManager.getGlobalGroups().writeGroups(overwrite); - } else { - if (GroupManager.getGlobalGroups().getTimeStampGroups() < GroupManager.getGlobalGroups().getGlobalGroupsFile().lastModified()) { - System.out.print("Newer GlobalGroups file found (Loading changes)!"); - GroupManager.getGlobalGroups().load(); - } - } - - for (OverloadedWorldHolder w : worldsData.values()) { - if (alreadyDone.contains(w)) { - continue; - } - if (w == null) { - GroupManager.logger.severe("WHAT HAPPENED?"); - continue; - } - if (!mirrorsGroup.containsKey(w.getName().toLowerCase())) - if (w.haveGroupsChanged()) { - if (overwrite || (!overwrite && (w.getTimeStampGroups() >= w.getGroupsFile().lastModified()))) { - // Backup Groups file - backupFile(w,true); - - WorldDataHolder.writeGroups(w, w.getGroupsFile()); - //w.removeGroupsChangedFlag(); - } else { - // Newer file found. - GroupManager.logger.log(Level.WARNING, "Newer Groups file found for " + w.getName() + ", but we have local changes!"); - throw new IllegalStateException("Unable to save unless you issue a '/mansave force'"); - } - } else { - //Check for newer file as no local changes. - if (w.getTimeStampGroups() < w.getGroupsFile().lastModified()) { - System.out.print("Newer Groups file found (Loading changes)!"); - // Backup Groups file - backupFile(w,true); - w.reloadGroups(); - } - } - if (!mirrorsUser.containsKey(w.getName().toLowerCase())) - if (w.haveUsersChanged()) { - if (overwrite || (!overwrite && (w.getTimeStampUsers() >= w.getUsersFile().lastModified()))) { - // Backup Users file - backupFile(w,false); - - WorldDataHolder.writeUsers(w, w.getUsersFile()); - //w.removeUsersChangedFlag(); - } else { - // Newer file found. - GroupManager.logger.log(Level.WARNING, "Newer Users file found for " + w.getName() + ", but we have local changes!"); - throw new IllegalStateException("Unable to save unless you issue a '/mansave force'"); - } - } else { - //Check for newer file as no local changes. - if (w.getTimeStampUsers() < w.getUsersFile().lastModified()) { - System.out.print("Newer Users file found (Loading changes)!"); - // Backup Users file - backupFile(w,false); - w.reloadUsers(); - } - } - alreadyDone.add(w); - } - } - - /** - * Backup the Groups/Users file - * @param w - * @param groups - */ - private void backupFile(OverloadedWorldHolder w, Boolean groups) { - - File backupFile = new File(plugin.getBackupFolder(), "bkp_" + w.getName() + (groups ? "_g_" : "_u_") + Tasks.getDateString() + ".yml"); - try { - Tasks.copy((groups ? w.getGroupsFile() : w.getUsersFile()), backupFile); - } catch (IOException ex) { - GroupManager.logger.log(Level.SEVERE, null, ex); - } - } - - /** - * Returns the dataHolder for the given world. - * If the world is not on the worlds list, returns the default world - * holder. - * - * Mirrors return their parent world data. - * If no mirroring data it returns the default world. + public void reloadAll() { + + // Load global groups + GroupManager.getGlobalGroups().load(); + + ArrayList<WorldDataHolder> alreadyDone = new ArrayList<WorldDataHolder>(); + for (WorldDataHolder w : worldsData.values()) { + if (alreadyDone.contains(w)) { + continue; + } + if (!mirrorsGroup.containsKey(w.getName().toLowerCase())) + w.reloadGroups(); + if (!mirrorsUser.containsKey(w.getName().toLowerCase())) + w.reloadUsers(); + + alreadyDone.add(w); + } + + } + + /** + * + * @param worldName + */ + public void reloadWorld(String worldName) { + + if (!mirrorsGroup.containsKey(worldName.toLowerCase())) + getWorldData(worldName).reloadGroups(); + if (!mirrorsUser.containsKey(worldName.toLowerCase())) + getWorldData(worldName).reloadUsers(); + } + + /** + * Wrapper to retain backwards compatibility + * (call this function to auto overwrite files) + */ + public void saveChanges() { + + saveChanges(true); + } + + /** * - * @param worldName - * @return OverloadedWorldHolder - */ - public OverloadedWorldHolder getWorldData(String worldName) { - String worldNameLowered = worldName.toLowerCase(); - - // Find this worlds data - if (worldsData.containsKey(worldNameLowered)) { - - String usersMirror = mirrorsUser.get(worldNameLowered); - String groupsMirror = mirrorsGroup.get(worldNameLowered); - - if (usersMirror != null) { - - // If both are mirrored - if (groupsMirror != null) { - - // if the data sources are the same, return the parent - if (usersMirror == groupsMirror) - return getUpdatedWorldData(usersMirror.toLowerCase()); - - // Both data sources are mirrors, but they are from different parents - // so we return the actual data object. - return getUpdatedWorldData(worldNameLowered); - } - - // Groups isn't a mirror so return this this worlds data source - return getUpdatedWorldData(worldNameLowered); - } - - // users isn't mirrored so we need to return this worlds data source - return getUpdatedWorldData(worldNameLowered); - } - - // Oddly no data source was found for this world so return the default. - GroupManager.logger.finest("Requested world " + worldName + " not found or badly mirrored. Returning default world..."); - return getDefaultWorld(); - } - - /** - * Get the requested world data and update it's dataSource to be relevant for this world - * - * @param worldName - * @return updated world holder */ - private OverloadedWorldHolder getUpdatedWorldData(String worldName) { - - if (worldsData.containsKey(worldName.toLowerCase())) { - OverloadedWorldHolder data = worldsData.get(worldName.toLowerCase()); - data.updateDataSource(); - return data; - } - return null; - - } - - /** - * Do a matching of playerName, if its found only one player, do - * getWorldData(player) - * - * @param playerName - * @return null if matching returned no player, or more than one. - */ - public OverloadedWorldHolder getWorldDataByPlayerName(String playerName) { - List<Player> matchPlayer = plugin.getServer().matchPlayer(playerName); - if (matchPlayer.size() == 1) { - return getWorldData(matchPlayer.get(0)); - } - return null; - } - - /** - * Retrieves the field player.getWorld().getName() and do - * getWorld(worldName) - * - * @param player - * @return OverloadedWorldHolder - */ - public OverloadedWorldHolder getWorldData(Player player) { - return getWorldData(player.getWorld().getName()); - } - - /** - * It does getWorld(worldName).getPermissionsHandler() - * @param worldName - * @return AnjoPermissionsHandler - */ - public AnjoPermissionsHandler getWorldPermissions(String worldName) { - return getWorldData(worldName).getPermissionsHandler(); - } - - /** - * Returns the PermissionsHandler for this player data - * @param player - * @return AnjoPermissionsHandler - */ - public AnjoPermissionsHandler getWorldPermissions(Player player) { - return getWorldData(player).getPermissionsHandler(); - } - - /** - * Id does getWorldDataByPlayerName(playerName). - * If it doesnt return null, it will return result.getPermissionsHandler() - * @param playerName - * @return null if the player matching gone wrong. - */ - public AnjoPermissionsHandler getWorldPermissionsByPlayerName(String playerName) { - WorldDataHolder dh = getWorldDataByPlayerName(playerName); - if (dh != null) { - return dh.getPermissionsHandler(); - } - return null; - } - - private void verifyFirstRun() { - - Properties server = new Properties(); - try { - server.load(new FileInputStream(new File("server.properties"))); - serverDefaultWorldName = server.getProperty("level-name").toLowerCase(); - setupWorldFolder(serverDefaultWorldName); - } catch (IOException ex) { - GroupManager.logger.log(Level.SEVERE, null, ex); - } - - } - + public void saveChanges(boolean overwrite) { + + ArrayList<WorldDataHolder> alreadyDone = new ArrayList<WorldDataHolder>(); + Tasks.removeOldFiles(plugin, plugin.getBackupFolder()); + + // Write Global Groups + if (GroupManager.getGlobalGroups().haveGroupsChanged()) { + GroupManager.getGlobalGroups().writeGroups(overwrite); + } else { + if (GroupManager.getGlobalGroups().getTimeStampGroups() < GroupManager.getGlobalGroups().getGlobalGroupsFile().lastModified()) { + System.out.print("Newer GlobalGroups file found (Loading changes)!"); + GroupManager.getGlobalGroups().load(); + } + } + + for (OverloadedWorldHolder w : worldsData.values()) { + if (alreadyDone.contains(w)) { + continue; + } + if (w == null) { + GroupManager.logger.severe("WHAT HAPPENED?"); + continue; + } + if (!mirrorsGroup.containsKey(w.getName().toLowerCase())) + if (w.haveGroupsChanged()) { + if (overwrite || (!overwrite && (w.getTimeStampGroups() >= w.getGroupsFile().lastModified()))) { + // Backup Groups file + backupFile(w, true); + + WorldDataHolder.writeGroups(w, w.getGroupsFile()); + //w.removeGroupsChangedFlag(); + } else { + // Newer file found. + GroupManager.logger.log(Level.WARNING, "Newer Groups file found for " + w.getName() + ", but we have local changes!"); + throw new IllegalStateException("Unable to save unless you issue a '/mansave force'"); + } + } else { + //Check for newer file as no local changes. + if (w.getTimeStampGroups() < w.getGroupsFile().lastModified()) { + System.out.print("Newer Groups file found (Loading changes)!"); + // Backup Groups file + backupFile(w, true); + w.reloadGroups(); + } + } + if (!mirrorsUser.containsKey(w.getName().toLowerCase())) + if (w.haveUsersChanged()) { + if (overwrite || (!overwrite && (w.getTimeStampUsers() >= w.getUsersFile().lastModified()))) { + // Backup Users file + backupFile(w, false); + + WorldDataHolder.writeUsers(w, w.getUsersFile()); + //w.removeUsersChangedFlag(); + } else { + // Newer file found. + GroupManager.logger.log(Level.WARNING, "Newer Users file found for " + w.getName() + ", but we have local changes!"); + throw new IllegalStateException("Unable to save unless you issue a '/mansave force'"); + } + } else { + //Check for newer file as no local changes. + if (w.getTimeStampUsers() < w.getUsersFile().lastModified()) { + System.out.print("Newer Users file found (Loading changes)!"); + // Backup Users file + backupFile(w, false); + w.reloadUsers(); + } + } + alreadyDone.add(w); + } + } + + /** + * Backup the Groups/Users file + * + * @param w + * @param groups + */ + private void backupFile(OverloadedWorldHolder w, Boolean groups) { + + File backupFile = new File(plugin.getBackupFolder(), "bkp_" + w.getName() + (groups ? "_g_" : "_u_") + Tasks.getDateString() + ".yml"); + try { + Tasks.copy((groups ? w.getGroupsFile() : w.getUsersFile()), backupFile); + } catch (IOException ex) { + GroupManager.logger.log(Level.SEVERE, null, ex); + } + } + + /** + * Returns the dataHolder for the given world. + * If the world is not on the worlds list, returns the default world + * holder. + * + * Mirrors return their parent world data. + * If no mirroring data it returns the default world. + * + * @param worldName + * @return OverloadedWorldHolder + */ + public OverloadedWorldHolder getWorldData(String worldName) { + + String worldNameLowered = worldName.toLowerCase(); + + // Find this worlds data + if (worldsData.containsKey(worldNameLowered)) + return getUpdatedWorldData(worldNameLowered); + + // Oddly no data source was found for this world so return the default. + GroupManager.logger.finest("Requested world " + worldName + " not found or badly mirrored. Returning default world..."); + return getDefaultWorld(); + } + + /** + * Get the requested world data and update it's dataSource to be relevant + * for this world + * + * @param worldName + * @return updated world holder + */ + private OverloadedWorldHolder getUpdatedWorldData(String worldName) { + + String worldNameLowered = worldName.toLowerCase(); + + if (worldsData.containsKey(worldNameLowered)) { + OverloadedWorldHolder data = worldsData.get(worldNameLowered); + data.updateDataSource(); + return data; + } + return null; + + } + + /** + * Do a matching of playerName, if its found only one player, do + * getWorldData(player) + * + * @param playerName + * @return null if matching returned no player, or more than one. + */ + public OverloadedWorldHolder getWorldDataByPlayerName(String playerName) { + + List<Player> matchPlayer = plugin.getServer().matchPlayer(playerName); + if (matchPlayer.size() == 1) { + return getWorldData(matchPlayer.get(0)); + } + return null; + } + + /** + * Retrieves the field player.getWorld().getName() and do + * getWorld(worldName) + * + * @param player + * @return OverloadedWorldHolder + */ + public OverloadedWorldHolder getWorldData(Player player) { + + return getWorldData(player.getWorld().getName()); + } + + /** + * It does getWorld(worldName).getPermissionsHandler() + * + * @param worldName + * @return AnjoPermissionsHandler + */ + public AnjoPermissionsHandler getWorldPermissions(String worldName) { + + return getWorldData(worldName).getPermissionsHandler(); + } + + /** + * Returns the PermissionsHandler for this player data + * + * @param player + * @return AnjoPermissionsHandler + */ + public AnjoPermissionsHandler getWorldPermissions(Player player) { + + return getWorldData(player).getPermissionsHandler(); + } + + /** + * Id does getWorldDataByPlayerName(playerName). + * If it doesnt return null, it will return result.getPermissionsHandler() + * + * @param playerName + * @return null if the player matching gone wrong. + */ + public AnjoPermissionsHandler getWorldPermissionsByPlayerName(String playerName) { + + WorldDataHolder dh = getWorldDataByPlayerName(playerName); + if (dh != null) { + return dh.getPermissionsHandler(); + } + return null; + } + + private void verifyFirstRun() { + + Properties server = new Properties(); + try { + server.load(new FileInputStream(new File("server.properties"))); + serverDefaultWorldName = server.getProperty("level-name").toLowerCase(); + setupWorldFolder(serverDefaultWorldName); + } catch (IOException ex) { + GroupManager.logger.log(Level.SEVERE, null, ex); + } + + } + public void setupWorldFolder(String worldName) { + + String worldNameLowered = worldName.toLowerCase(); + worldsFolder = new File(plugin.getDataFolder(), "worlds"); if (!worldsFolder.exists()) { worldsFolder.mkdirs(); } - File defaultWorldFolder = new File(worldsFolder, worldName); - if ((!defaultWorldFolder.exists()) && ((!mirrorsGroup.containsKey(worldName.toLowerCase()))) || (!mirrorsUser.containsKey(worldName.toLowerCase()))) { - defaultWorldFolder.mkdirs(); + File defaultWorldFolder = new File(worldsFolder, worldNameLowered); + if ((!defaultWorldFolder.exists()) && ((!mirrorsGroup.containsKey(worldNameLowered))) || (!mirrorsUser.containsKey(worldNameLowered))) { + + /* + * check and convert all old case sensitive folders to lower case + */ + File casedWorldFolder = new File(worldsFolder, worldName); + if ((casedWorldFolder.exists()) && (casedWorldFolder.getName().toLowerCase().equals(worldNameLowered))) { + /* + * Rename the old folder to the new lower cased format + */ + casedWorldFolder.renameTo(new File(worldsFolder, worldNameLowered)); + } else { + /* + * Else we just create the folder + */ + defaultWorldFolder.mkdirs(); + } } if (defaultWorldFolder.exists()) { - if (!mirrorsGroup.containsKey(worldName.toLowerCase())) { + if (!mirrorsGroup.containsKey(worldNameLowered)) { File groupsFile = new File(defaultWorldFolder, "groups.yml"); if (!groupsFile.exists() || groupsFile.length() == 0) { @@ -491,7 +516,7 @@ public class WorldsHolder { } } - if (!mirrorsUser.containsKey(worldName.toLowerCase())) { + if (!mirrorsUser.containsKey(worldNameLowered)) { File usersFile = new File(defaultWorldFolder, "users.yml"); if (!usersFile.exists() || usersFile.length() == 0) { @@ -507,176 +532,188 @@ public class WorldsHolder { } } - /** - * Copies the specified world data to another world - * @param fromWorld - * @param toWorld - * @return true if successfully copied. - */ - public boolean cloneWorld(String fromWorld, String toWorld) { - File fromWorldFolder = new File(worldsFolder, fromWorld); - File toWorldFolder = new File(worldsFolder, toWorld); - if (toWorldFolder.exists() || !fromWorldFolder.exists()) { - return false; - } - File fromWorldGroups = new File(fromWorldFolder, "groups.yml"); - File fromWorldUsers = new File(fromWorldFolder, "users.yml"); - if (!fromWorldGroups.exists() || !fromWorldUsers.exists()) { - return false; - } - File toWorldGroups = new File(toWorldFolder, "groups.yml"); - File toWorldUsers = new File(toWorldFolder, "users.yml"); - toWorldFolder.mkdirs(); - try { - Tasks.copy(fromWorldGroups, toWorldGroups); - Tasks.copy(fromWorldUsers, toWorldUsers); - } catch (IOException ex) { - Logger.getLogger(WorldsHolder.class.getName()).log(Level.SEVERE, null, ex); - return false; - } - return true; - } - - /** - * Wrapper for LoadWorld(String,Boolean) for backwards compatibility - * - * Load a world from file. - * If it already been loaded, summon reload method from dataHolder. - * @param worldName - */ - public void loadWorld(String worldName) { - loadWorld(worldName, false); - } - - /** - * Load a world from file. - * If it already been loaded, summon reload method from dataHolder. - * @param worldName - */ - public void loadWorld(String worldName, Boolean isMirror) { - if (worldsData.containsKey(worldName.toLowerCase())) { - worldsData.get(worldName.toLowerCase()).reload(); - return; - } - GroupManager.logger.finest("Trying to load world " + worldName + "..."); - File thisWorldFolder = new File(worldsFolder, worldName); - if ((isMirror) || (thisWorldFolder.exists() && thisWorldFolder.isDirectory())) { - - // Setup file handles, if not mirrored - File groupsFile = (mirrorsGroup.containsKey(worldName.toLowerCase()))? null : new File(thisWorldFolder, "groups.yml"); - File usersFile = (mirrorsUser.containsKey(worldName.toLowerCase()))? null : new File(thisWorldFolder, "users.yml"); - - if ((groupsFile != null) && (!groupsFile.exists())) { - throw new IllegalArgumentException("Groups file for world '" + worldName + "' doesnt exist: " + groupsFile.getPath()); - } - if ((usersFile != null) && (!usersFile.exists())) { - throw new IllegalArgumentException("Users file for world '" + worldName + "' doesnt exist: " + usersFile.getPath()); - } - - WorldDataHolder tempHolder = new WorldDataHolder(worldName); - - // Map the group object for any mirror - if (mirrorsGroup.containsKey(worldName.toLowerCase())) - tempHolder.setGroupsObject(this.getWorldData(mirrorsGroup.get(worldName.toLowerCase())).getGroupsObject()); - else - tempHolder.loadGroups(groupsFile); - - // Map the user object for any mirror - if (mirrorsUser.containsKey(worldName.toLowerCase())) - tempHolder.setUsersObject(this.getWorldData(mirrorsUser.get(worldName.toLowerCase())).getUsersObject()); - else - tempHolder.loadUsers(usersFile); - - OverloadedWorldHolder thisWorldData = new OverloadedWorldHolder(tempHolder); - - // null the object so we don't keep file handles open where we shouldn't - tempHolder = null; - - // Set the file TimeStamps as it will be default from the initial load. - thisWorldData.setTimeStamps(); - - if (thisWorldData != null) { - GroupManager.logger.finest("Successful load of world " + worldName + "..."); - worldsData.put(worldName.toLowerCase(), thisWorldData); - return; - } - - //GroupManager.logger.severe("Failed to load world " + worldName + "..."); - } - } - - /** - * Tells if the such world has been mapped. - * - * It will return true if world is a mirror. - * - * @param worldName - * @return true if world is loaded or mirrored. false if not listed - */ - public boolean isInList(String worldName) { - if (worldsData.containsKey(worldName.toLowerCase()) || mirrorsGroup.containsKey(worldName.toLowerCase()) || mirrorsUser.containsKey(worldName.toLowerCase())) { - return true; - } - return false; - } - - /** - * Verify if world has it's own file permissions. - * - * @param worldName - * @return true if it has its own holder. false if not. - */ - public boolean hasOwnData(String worldName) { - if (worldsData.containsKey(worldName.toLowerCase()) && (!mirrorsGroup.containsKey(worldName.toLowerCase()) || !mirrorsUser.containsKey(worldName.toLowerCase()))) { - return true; - } - return false; - } - - /** - * @return the defaultWorld - */ - public OverloadedWorldHolder getDefaultWorld() { - return getUpdatedWorldData(serverDefaultWorldName); - } - - /** - * Returns all physically loaded worlds which have at least - * one of their own data sets for users or groups. - * - * @return ArrayList<OverloadedWorldHolder> of all loaded worlds - */ - public ArrayList<OverloadedWorldHolder> allWorldsDataList() { - ArrayList<OverloadedWorldHolder> list = new ArrayList<OverloadedWorldHolder>(); - for (OverloadedWorldHolder data : worldsData.values()) { - if ((!list.contains(data)) && (!mirrorsGroup.containsKey(data.getName().toLowerCase()) || !mirrorsUser.containsKey(data.getName().toLowerCase()))) { - - String worldNameLowered = data.getName().toLowerCase(); - String usersMirror = mirrorsUser.get(worldNameLowered); - String groupsMirror = mirrorsGroup.get(worldNameLowered); - - // is users mirrored? - if (usersMirror != null) { - - // If both are mirrored - if (groupsMirror != null) { - - // if the data sources are the same, return the parent - if (usersMirror == groupsMirror) { - if (!list.contains(usersMirror.toLowerCase())) - list.add(worldsData.get(usersMirror.toLowerCase())); - continue; - } - // Both data sources are mirrors, but they are from different parents - // so fall through to add the actual data object. - } - // Groups isn't a mirror so fall through to add this this worlds data source - } - - // users isn't mirrored so we need to add this worlds data source - list.add(data); - } - } - return list; - } + /** + * Copies the specified world data to another world + * + * @param fromWorld + * @param toWorld + * @return true if successfully copied. + */ + public boolean cloneWorld(String fromWorld, String toWorld) { + + File fromWorldFolder = new File(worldsFolder, fromWorld.toLowerCase()); + File toWorldFolder = new File(worldsFolder, toWorld.toLowerCase()); + if (toWorldFolder.exists() || !fromWorldFolder.exists()) { + return false; + } + File fromWorldGroups = new File(fromWorldFolder, "groups.yml"); + File fromWorldUsers = new File(fromWorldFolder, "users.yml"); + if (!fromWorldGroups.exists() || !fromWorldUsers.exists()) { + return false; + } + File toWorldGroups = new File(toWorldFolder, "groups.yml"); + File toWorldUsers = new File(toWorldFolder, "users.yml"); + toWorldFolder.mkdirs(); + try { + Tasks.copy(fromWorldGroups, toWorldGroups); + Tasks.copy(fromWorldUsers, toWorldUsers); + } catch (IOException ex) { + Logger.getLogger(WorldsHolder.class.getName()).log(Level.SEVERE, null, ex); + return false; + } + return true; + } + + /** + * Wrapper for LoadWorld(String,Boolean) for backwards compatibility + * + * Load a world from file. + * If it already been loaded, summon reload method from dataHolder. + * + * @param worldName + */ + public void loadWorld(String worldName) { + + loadWorld(worldName, false); + } + + /** + * Load a world from file. + * If it already been loaded, summon reload method from dataHolder. + * + * @param worldName + */ + public void loadWorld(String worldName, Boolean isMirror) { + + String worldNameLowered = worldName.toLowerCase(); + + if (worldsData.containsKey(worldNameLowered)) { + worldsData.get(worldNameLowered).reload(); + return; + } + GroupManager.logger.finest("Trying to load world " + worldName + "..."); + File thisWorldFolder = new File(worldsFolder, worldNameLowered); + if ((isMirror) || (thisWorldFolder.exists() && thisWorldFolder.isDirectory())) { + + // Setup file handles, if not mirrored + File groupsFile = (mirrorsGroup.containsKey(worldNameLowered)) ? null : new File(thisWorldFolder, "groups.yml"); + File usersFile = (mirrorsUser.containsKey(worldNameLowered)) ? null : new File(thisWorldFolder, "users.yml"); + + if ((groupsFile != null) && (!groupsFile.exists())) { + throw new IllegalArgumentException("Groups file for world '" + worldName + "' doesnt exist: " + groupsFile.getPath()); + } + if ((usersFile != null) && (!usersFile.exists())) { + throw new IllegalArgumentException("Users file for world '" + worldName + "' doesnt exist: " + usersFile.getPath()); + } + + WorldDataHolder tempHolder = new WorldDataHolder(worldName); + + // Map the group object for any mirror + if (mirrorsGroup.containsKey(worldNameLowered)) + tempHolder.setGroupsObject(this.getWorldData(mirrorsGroup.get(worldNameLowered)).getGroupsObject()); + else + tempHolder.loadGroups(groupsFile); + + // Map the user object for any mirror + if (mirrorsUser.containsKey(worldNameLowered)) + tempHolder.setUsersObject(this.getWorldData(mirrorsUser.get(worldNameLowered)).getUsersObject()); + else + tempHolder.loadUsers(usersFile); + + OverloadedWorldHolder thisWorldData = new OverloadedWorldHolder(tempHolder); + + // null the object so we don't keep file handles open where we shouldn't + tempHolder = null; + + // Set the file TimeStamps as it will be default from the initial load. + thisWorldData.setTimeStamps(); + + if (thisWorldData != null) { + GroupManager.logger.finest("Successful load of world " + worldName + "..."); + worldsData.put(worldNameLowered, thisWorldData); + return; + } + + //GroupManager.logger.severe("Failed to load world " + worldName + "..."); + } + } + + /** + * Tells if the such world has been mapped. + * + * It will return true if world is a mirror. + * + * @param worldName + * @return true if world is loaded or mirrored. false if not listed + */ + public boolean isInList(String worldName) { + + if (worldsData.containsKey(worldName.toLowerCase()) || mirrorsGroup.containsKey(worldName.toLowerCase()) || mirrorsUser.containsKey(worldName.toLowerCase())) { + return true; + } + return false; + } + + /** + * Verify if world has it's own file permissions. + * + * @param worldName + * @return true if it has its own holder. false if not. + */ + public boolean hasOwnData(String worldName) { + + if (worldsData.containsKey(worldName.toLowerCase()) && (!mirrorsGroup.containsKey(worldName.toLowerCase()) || !mirrorsUser.containsKey(worldName.toLowerCase()))) { + return true; + } + return false; + } + + /** + * @return the defaultWorld + */ + public OverloadedWorldHolder getDefaultWorld() { + + return getUpdatedWorldData(serverDefaultWorldName); + } + + /** + * Returns all physically loaded worlds which have at least + * one of their own data sets for users or groups. + * + * @return ArrayList<OverloadedWorldHolder> of all loaded worlds + */ + public ArrayList<OverloadedWorldHolder> allWorldsDataList() { + + ArrayList<OverloadedWorldHolder> list = new ArrayList<OverloadedWorldHolder>(); + for (OverloadedWorldHolder data : worldsData.values()) { + if ((!list.contains(data)) && (!mirrorsGroup.containsKey(data.getName().toLowerCase()) || !mirrorsUser.containsKey(data.getName().toLowerCase()))) { + + String worldNameLowered = data.getName().toLowerCase(); + String usersMirror = mirrorsUser.get(worldNameLowered); + String groupsMirror = mirrorsGroup.get(worldNameLowered); + + // is users mirrored? + if (usersMirror != null) { + + // If both are mirrored + if (groupsMirror != null) { + + // if the data sources are the same, return the parent + if (usersMirror == groupsMirror) { + if (!list.contains(usersMirror.toLowerCase())) + list.add(worldsData.get(usersMirror.toLowerCase())); + continue; + } + // Both data sources are mirrors, but they are from different parents + // so fall through to add the actual data object. + } + // Groups isn't a mirror so fall through to add this this worlds data source + } + + // users isn't mirrored so we need to add this worlds data source + list.add(data); + } + } + return list; + } } diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMGroupEvent.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMGroupEvent.java index fc9b8433b..af3fb6135 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMGroupEvent.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMGroupEvent.java @@ -6,79 +6,82 @@ import org.bukkit.Bukkit; import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
-
/**
* @author ElgarL
- *
+ *
*/
public class GMGroupEvent extends Event {
- /**
+ /**
*
*/
private static final HandlerList handlers = new HandlerList();
@Override
public HandlerList getHandlers() {
- return handlers;
- }
-
- public static HandlerList getHandlerList() {
- return handlers;
- }
- //////////////////////////////
+ return handlers;
+ }
+
+ public static HandlerList getHandlerList() {
+
+ return handlers;
+ }
+
+ //////////////////////////////
protected Group group;
-
+
protected String groupName;
-
- protected Action action;
-
- public GMGroupEvent(Group group, Action action) {
- super();
-
- this.group = group;
- this.action = action;
- this.groupName = group.getName();
- }
-
- public GMGroupEvent(String groupName, Action action) {
- super();
-
- this.groupName = groupName;
- this.action = action;
- }
-
- public Action getAction(){
- return this.action;
- }
-
- public Group getGroup() {
- return group;
- }
-
- public String getGroupName() {
- return groupName;
- }
-
- public enum Action {
- GROUP_PERMISSIONS_CHANGED,
- GROUP_INHERITANCE_CHANGED,
- GROUP_INFO_CHANGED,
- GROUP_ADDED,
- GROUP_REMOVED,
- }
-
- public void schedule(final GMGroupEvent event) {
+
+ protected Action action;
+
+ public GMGroupEvent(Group group, Action action) {
+
+ super();
+
+ this.group = group;
+ this.action = action;
+ this.groupName = group.getName();
+ }
+
+ public GMGroupEvent(String groupName, Action action) {
+
+ super();
+
+ this.groupName = groupName;
+ this.action = action;
+ }
+
+ public Action getAction() {
+
+ return this.action;
+ }
+
+ public Group getGroup() {
+
+ return group;
+ }
+
+ public String getGroupName() {
+
+ return groupName;
+ }
+
+ public enum Action {
+ GROUP_PERMISSIONS_CHANGED, GROUP_INHERITANCE_CHANGED, GROUP_INFO_CHANGED, GROUP_ADDED, GROUP_REMOVED,
+ }
+
+ public void schedule(final GMGroupEvent event) {
if (Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Bukkit.getPluginManager().getPlugin("GroupManager"), new Runnable() {
@Override
public void run() {
+
Bukkit.getServer().getPluginManager().callEvent(event);
}
}, 1) == -1)
GroupManager.logger.warning("Could not schedule GM Event.");
- }
+ }
}
\ No newline at end of file diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMSystemEvent.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMSystemEvent.java index 210960876..d11581356 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMSystemEvent.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMSystemEvent.java @@ -5,57 +5,58 @@ import org.bukkit.Bukkit; import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
-
/**
* @author ElgarL
- *
+ *
*/
public class GMSystemEvent extends Event {
- /**
+ /**
*
*/
private static final HandlerList handlers = new HandlerList();
@Override
public HandlerList getHandlers() {
- return handlers;
- }
-
- public static HandlerList getHandlerList() {
- return handlers;
- }
-
- //////////////////////////////
-
+
+ return handlers;
+ }
+
+ public static HandlerList getHandlerList() {
+
+ return handlers;
+ }
+
+ //////////////////////////////
+
protected Action action;
-
- public GMSystemEvent(Action action) {
- super();
-
- this.action = action;
- }
-
- public Action getAction(){
- return this.action;
- }
-
- public enum Action {
- RELOADED,
- SAVED,
- DEFAULT_GROUP_CHANGED,
- VALIDATE_TOGGLE,
- }
-
- public void schedule(final GMSystemEvent event) {
+
+ public GMSystemEvent(Action action) {
+
+ super();
+
+ this.action = action;
+ }
+
+ public Action getAction() {
+
+ return this.action;
+ }
+
+ public enum Action {
+ RELOADED, SAVED, DEFAULT_GROUP_CHANGED, VALIDATE_TOGGLE,
+ }
+
+ public void schedule(final GMSystemEvent event) {
if (Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Bukkit.getPluginManager().getPlugin("GroupManager"), new Runnable() {
@Override
public void run() {
+
Bukkit.getServer().getPluginManager().callEvent(event);
}
}, 1) == -1)
GroupManager.logger.warning("Could not schedule GM Event.");
- }
+ }
}
\ No newline at end of file diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMUserEvent.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMUserEvent.java index 206de8c86..361e7d4cc 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMUserEvent.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMUserEvent.java @@ -6,81 +6,82 @@ import org.bukkit.Bukkit; import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
-
/**
* @author ElgarL
- *
+ *
*/
public class GMUserEvent extends Event {
- /**
+ /**
*
*/
private static final HandlerList handlers = new HandlerList();
@Override
public HandlerList getHandlers() {
- return handlers;
- }
-
- public static HandlerList getHandlerList() {
- return handlers;
- }
- //////////////////////////////
+ return handlers;
+ }
+
+ public static HandlerList getHandlerList() {
+
+ return handlers;
+ }
+
+ //////////////////////////////
protected User user;
-
+
protected String userName;
-
- protected Action action;
-
- public GMUserEvent(User user, Action action) {
- super();
-
- this.user = user;
- this.action = action;
- this.userName = user.getName();
- }
-
- public GMUserEvent(String userName, Action action) {
- super();
-
- this.userName = userName;
- this.action = action;
- }
-
- public Action getAction(){
- return this.action;
- }
-
- public User getUser() {
- return user;
- }
-
- public String getUserName() {
- return userName;
- }
-
- public enum Action {
- USER_PERMISSIONS_CHANGED,
- USER_INHERITANCE_CHANGED,
- USER_INFO_CHANGED,
- USER_GROUP_CHANGED,
- USER_SUBGROUP_CHANGED,
- USER_ADDED,
- USER_REMOVED,
- }
-
- public void schedule(final GMUserEvent event) {
+
+ protected Action action;
+
+ public GMUserEvent(User user, Action action) {
+
+ super();
+
+ this.user = user;
+ this.action = action;
+ this.userName = user.getName();
+ }
+
+ public GMUserEvent(String userName, Action action) {
+
+ super();
+
+ this.userName = userName;
+ this.action = action;
+ }
+
+ public Action getAction() {
+
+ return this.action;
+ }
+
+ public User getUser() {
+
+ return user;
+ }
+
+ public String getUserName() {
+
+ return userName;
+ }
+
+ public enum Action {
+ USER_PERMISSIONS_CHANGED, USER_INHERITANCE_CHANGED, USER_INFO_CHANGED, USER_GROUP_CHANGED, USER_SUBGROUP_CHANGED, USER_ADDED, USER_REMOVED,
+ }
+
+ public void schedule(final GMUserEvent event) {
if (Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Bukkit.getPluginManager().getPlugin("GroupManager"), new Runnable() {
@Override
public void run() {
+
Bukkit.getServer().getPluginManager().callEvent(event);
}
}, 1) == -1)
GroupManager.logger.warning("Could not schedule GM Event.");
- }
+ }
}
\ No newline at end of file diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMWorldListener.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMWorldListener.java index fd1a9d7ff..f7a7109ab 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMWorldListener.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GMWorldListener.java @@ -6,31 +6,33 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.Listener;
import org.bukkit.event.world.WorldInitEvent;
-
/**
* @author ElgarL
*
- * Handle new world creation from other plugins
- *
+ * Handle new world creation from other plugins
+ *
*/
public class GMWorldListener implements Listener {
-
+
private final GroupManager plugin;
public GMWorldListener(GroupManager instance) {
+
plugin = instance;
registerEvents();
}
-
+
private void registerEvents() {
- plugin.getServer().getPluginManager().registerEvents(this, plugin);
- }
-
+
+ plugin.getServer().getPluginManager().registerEvents(this, plugin);
+ }
+
@EventHandler(priority = EventPriority.LOWEST)
public void onWorldInit(WorldInitEvent event) {
- String worldName = event.getWorld().getName();
-
- if (GroupManager.isLoaded() && !plugin.getWorldsHolder().isInList(worldName)) {
+
+ String worldName = event.getWorld().getName();
+
+ if (GroupManager.isLoaded() && !plugin.getWorldsHolder().isInList(worldName)) {
GroupManager.logger.info("New world detected...");
GroupManager.logger.info("Creating data for: " + worldName);
plugin.getWorldsHolder().setupWorldFolder(worldName);
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GroupManagerEventHandler.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GroupManagerEventHandler.java index 3a4d8d266..5fc555cc4 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GroupManagerEventHandler.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/events/GroupManagerEventHandler.java @@ -3,40 +3,51 @@ package org.anjocaido.groupmanager.events; import org.anjocaido.groupmanager.data.Group;
import org.anjocaido.groupmanager.data.User;
-
/**
* @author ElgarL
*
- * Handles all Event generation.
- *
+ * Handles all Event generation.
+ *
*/
public class GroupManagerEventHandler {
-
+
protected static void callEvent(GMGroupEvent event) {
+
event.schedule(event);
}
+
protected static void callEvent(GMUserEvent event) {
+
event.schedule(event);
}
+
protected static void callEvent(GMSystemEvent event) {
+
event.schedule(event);
}
public static void callEvent(Group group, GMGroupEvent.Action action) {
+
callEvent(new GMGroupEvent(group, action));
}
+
public static void callEvent(String groupName, GMGroupEvent.Action action) {
+
callEvent(new GMGroupEvent(groupName, action));
}
-
+
public static void callEvent(User user, GMUserEvent.Action action) {
+
callEvent(new GMUserEvent(user, action));
}
+
public static void callEvent(String userName, GMUserEvent.Action action) {
+
callEvent(new GMUserEvent(userName, action));
}
-
+
public static void callEvent(GMSystemEvent.Action action) {
+
callEvent(new GMSystemEvent(action));
}
}
\ No newline at end of file diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java index bd2829f38..efad11df4 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java @@ -16,10 +16,7 @@ import org.anjocaido.groupmanager.data.Group; import org.anjocaido.groupmanager.dataholder.WorldDataHolder; import org.anjocaido.groupmanager.data.User; import org.anjocaido.groupmanager.utils.PermissionCheckResult; -import org.anjocaido.groupmanager.utils.PermissionCheckResult.Type; -import org.bukkit.Bukkit; import org.bukkit.entity.Player; -import org.bukkit.permissions.Permission; /** * Everything here maintains the model created by Nijikokun @@ -29,7 +26,7 @@ import org.bukkit.permissions.Permission; * * It holds permissions only for one single world. * - * @author gabrielcouto + * @author gabrielcouto, ElgarL */ public class AnjoPermissionsHandler extends PermissionsReaderInterface { @@ -41,6 +38,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { * @param holder */ public AnjoPermissionsHandler(WorldDataHolder holder) { + ph = holder; } @@ -53,6 +51,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { */ @Override public boolean has(Player player, String permission) { + return permission(player, permission); } @@ -65,6 +64,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { */ @Override public boolean permission(Player player, String permission) { + return checkUserPermission(ph.getUser(player.getName()).updatePlayer(player), permission); } @@ -76,6 +76,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { * @return true if the player has the permission */ public boolean permission(String playerName, String permission) { + return checkUserPermission(ph.getUser(playerName), permission); } @@ -87,6 +88,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { */ @Override public String getGroup(String userName) { + return ph.getUser(userName).getGroup().getName(); } @@ -99,10 +101,11 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { */ @Override public List<String> getAllPlayersPermissions(String userName) { + List<String> perms = new ArrayList<String>(); - + perms.addAll(getAllPlayersPermissions(userName, true)); - + return perms; } @@ -120,33 +123,32 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { // Add the players own permissions. playerPermArray.addAll(populatePerms(ph.getUser(userName).getPermissionList(), includeChildren)); - + ArrayList<String> alreadyProcessed = new ArrayList<String>(); - + // fetch all group permissions for (String group : getGroups(userName)) { // Don't process a group more than once. if (!alreadyProcessed.contains(group)) { alreadyProcessed.add(group); - + Set<String> groupPermArray = new HashSet<String>(); - + if (group.startsWith("g:") && GroupManager.getGlobalGroups().hasGroup(group)) { // GlobalGroups groupPermArray = populatePerms(GroupManager.getGlobalGroups().getGroupsPermissions(group), includeChildren); - + } else { // World Groups groupPermArray = populatePerms(ph.getGroup(group).getPermissionList(), includeChildren); } - + // Add all group permissions, unless negated by earlier permissions. for (String perm : groupPermArray) { boolean negated = (perm.startsWith("-")); // Perm doesn't already exists and there is no negation for it // or It's a negated perm where a normal perm doesn't exists (don't allow inheritance to negate higher perms) - if ((!negated && !playerPermArray.contains(perm) && !playerPermArray.contains("-" + perm)) - || (negated && !playerPermArray.contains(perm.substring(1)))) + if ((!negated && !playerPermArray.contains(perm) && !playerPermArray.contains("-" + perm)) || (negated && !playerPermArray.contains(perm.substring(1)) && !playerPermArray.contains("-" + perm))) playerPermArray.add(perm); } } @@ -156,69 +158,69 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { return playerPermArray; } - - private Set<String> populatePerms (List<String> perms, boolean includeChildren) { - + + private Set<String> populatePerms(List<String> permsList, boolean includeChildren) { + + // Create a new array so it's modifiable. + List<String> perms = new ArrayList<String>(permsList); Set<String> permArray = new HashSet<String>(); Boolean allPerms = false; - + // Allow * node to populate ALL permissions to Bukkit. if (perms.contains("*")) { permArray.addAll(GroupManager.BukkitPermissions.getAllRegisteredPermissions(includeChildren)); allPerms = true; + perms.remove("*"); } - + for (String perm : perms) { - if (!perm.equalsIgnoreCase("*")) { - + /** + * all permission sets are passed here pre-sorted, alphabetically. + * This means negated nodes will be processed before all permissions + * other than *. + */ + boolean negated = perm.startsWith("-"); + + if (!permArray.contains(perm)) { + permArray.add(perm); + + if ((negated) && (permArray.contains(perm.substring(1)))) + permArray.remove(perm.substring(1)); + /** - * all permission sets are passed here pre-sorted, alphabetically. - * This means negated nodes will be processed before all permissions - * other than *. + * Process child nodes if required, + * or this is a negated node AND we used * to include all + * permissions, + * in which case we need to remove all children of that node. */ - boolean negated = false; - if (perm.startsWith("-")) - negated = true; - - if (!permArray.contains(perm)) { - permArray.add(perm); - - if ((negated) && (permArray.contains(perm.substring(1)))) - permArray.remove(perm.substring(1)); - - /** - * Process child nodes if required, - * or this is a negated node AND we used * to include all permissions, - * in which case we need to remove all children of that node. - */ - if ((includeChildren) || (negated && allPerms)) { - - Map<String, Boolean> children = GroupManager.BukkitPermissions.getAllChildren((negated ? perm.substring(1) : perm), new HashSet<String>()); - - if (children != null) { - if (negated || (negated && allPerms)) { - + if ((includeChildren) || (negated && allPerms)) { + + Map<String, Boolean> children = GroupManager.BukkitPermissions.getAllChildren((negated ? perm.substring(1) : perm), new HashSet<String>()); + + if (children != null) { + if (negated) + if (allPerms) { + // Remove children of negated nodes for (String child : children.keySet()) if (children.get(child)) if (permArray.contains(child)) permArray.remove(child); - - } else if (!negated){ - + + } else { + // Add child nodes for (String child : children.keySet()) if (children.get(child)) if ((!permArray.contains(child)) && (!permArray.contains("-" + child))) permArray.add(child); } - } } } } } - + return permArray; } @@ -239,6 +241,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { */ @Override public boolean inGroup(String name, String group) { + if (hasGroupInInheritance(ph.getUser(name).getGroup(), group)) { return true; } @@ -329,6 +332,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { */ @Override public String getGroupPrefix(String groupName) { + Group g = ph.getGroup(groupName); if (g == null) { return ""; @@ -344,6 +348,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { */ @Override public String getGroupSuffix(String groupName) { + Group g = ph.getGroup(groupName); if (g == null) { return ""; @@ -360,6 +365,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { */ @Override public boolean canGroupBuild(String groupName) { + Group g = ph.getGroup(groupName); if (g == null) { return false; @@ -377,6 +383,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { */ @Override public String getGroupPermissionString(String groupName, String variable) { + Group start = ph.getGroup(groupName); if (start == null) { return null; @@ -398,6 +405,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { */ @Override public int getGroupPermissionInteger(String groupName, String variable) { + Group start = ph.getGroup(groupName); if (start == null) { return -1; @@ -419,6 +427,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { */ @Override public boolean getGroupPermissionBoolean(String group, String variable) { + Group start = ph.getGroup(group); if (start == null) { return false; @@ -440,6 +449,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { */ @Override public double getGroupPermissionDouble(String group, String variable) { + Group start = ph.getGroup(group); if (start == null) { return -1; @@ -460,6 +470,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { */ @Override public String getUserPermissionString(String user, String variable) { + User auser = ph.getUser(user); if (auser == null) { return ""; @@ -476,6 +487,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { */ @Override public int getUserPermissionInteger(String user, String variable) { + User auser = ph.getUser(user); if (auser == null) { return -1; @@ -492,6 +504,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { */ @Override public boolean getUserPermissionBoolean(String user, String variable) { + User auser = ph.getUser(user); if (auser == null) { return false; @@ -508,6 +521,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { */ @Override public double getUserPermissionDouble(String user, String variable) { + User auser = ph.getUser(user); if (auser == null) { return -1; @@ -526,6 +540,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { */ @Override public String getPermissionString(String user, String variable) { + User auser = ph.getUser(user); if (auser == null) { return ""; @@ -565,6 +580,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { */ @Override public int getPermissionInteger(String user, String variable) { + User auser = ph.getUser(user); if (auser == null) { return -1; @@ -604,6 +620,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { */ @Override public boolean getPermissionBoolean(String user, String variable) { + User auser = ph.getUser(user); if (auser == null) { return false; @@ -643,6 +660,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { */ @Override public double getPermissionDouble(String user, String variable) { + User auser = ph.getUser(user); if (auser == null) { return -1.0D; @@ -679,6 +697,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { * @return PermissionCheckResult */ public PermissionCheckResult checkUserOnlyPermission(User user, String permission) { + user.sortPermissions(); PermissionCheckResult result = new PermissionCheckResult(); result.askedPermission = permission; @@ -702,6 +721,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { * @return the node if permission is found. if not found, return null */ public PermissionCheckResult checkGroupOnlyPermission(Group group, String permission) { + group.sortPermissions(); PermissionCheckResult result = new PermissionCheckResult(); result.owner = group; @@ -724,6 +744,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { * @return true if permission was found. false if not, or was negated. */ public boolean checkUserPermission(User user, String permission) { + PermissionCheckResult result = checkFullGMPermission(user, permission, true); if (result.resultType == PermissionCheckResult.Type.EXCEPTION || result.resultType == PermissionCheckResult.Type.FOUND) { return true; @@ -755,6 +776,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { * @return PermissionCheckResult */ public PermissionCheckResult checkFullGMPermission(User user, String targetPermission, Boolean checkBukkit) { + PermissionCheckResult result = new PermissionCheckResult(); result.accessLevel = targetPermission; result.resultType = PermissionCheckResult.Type.NOTFOUND; @@ -767,9 +789,9 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { // Check Bukkit perms to support plugins which add perms via code // (Heroes). final Player player = user.getBukkitPlayer(); - final Permission bukkitPerm = Bukkit.getPluginManager().getPermission(targetPermission); - if (player != null && bukkitPerm != null) { - result.resultType = player.hasPermission(bukkitPerm) ? PermissionCheckResult.Type.FOUND : PermissionCheckResult.Type.NEGATION; + //final Permission bukkitPerm = Bukkit.getPluginManager().getPermission(targetPermission); + if ((player != null) && player.hasPermission(targetPermission)) { + result.resultType = PermissionCheckResult.Type.FOUND; result.owner = user; return result; } @@ -802,36 +824,17 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { } /** - * Verifies if a given group has a variable. Including it's inheritance. - * - * it redirects to the other method now. This one was deprecated, and will - * be gone in a future release. - * - * @param start - * @param variable - * @param alreadyChecked - * @return returns the closest inherited group with the variable. - * @deprecated use now nextGroupWithVariable(Group start, String - * targetVariable) - */ - @Deprecated - public Group nextGroupWithVariable(Group start, String variable, List<Group> alreadyChecked) { - return nextGroupWithVariable(start, variable); - } - - /** * Returns the next group, including inheritance, which contains that * variable name. * * It does Breadth-first search * - * @param start - * the starting group to look for - * @param targetVariable - * the variable name + * @param start the starting group to look for + * @param targetVariable the variable name * @return The group if found. Null if not. */ public Group nextGroupWithVariable(Group start, String targetVariable) { + if (start == null || targetVariable == null) { return null; } @@ -855,39 +858,18 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { return null; } - /** - * Check if given group inherits another group. - * - * redirected to the other method. this is deprecated now. and will be gone - * in the future releases. - * - * @param start - * The group to start the search. - * @param askedGroup - * Name of the group you're looking for - * @param alreadyChecked - * groups to ignore(pass null on it, please) - * @return true if it inherits the group. - * @deprecated prefer using hasGroupInInheritance(Group start, String - * askedGroup) - */ - @Deprecated - public boolean searchGroupInInheritance(Group start, String askedGroup, List<Group> alreadyChecked) { - return hasGroupInInheritance(start, askedGroup); - } /** * Check if given group inherits another group. * * It does Breadth-first search * - * @param start - * The group to start the search. - * @param askedGroup - * Name of the group you're looking for + * @param start The group to start the search. + * @param askedGroup Name of the group you're looking for * @return true if it inherits the group. */ public boolean hasGroupInInheritance(Group start, String askedGroup) { + if (start == null || askedGroup == null) { return false; } @@ -912,25 +894,6 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { } /** - * Check if the group has given permission. Including it's inheritance - * - * @param start - * @param permission - * @param alreadyChecked - * @return true if PermissionCheckResult is EXCEPTION or FOUND - * @deprecated use the other checkGroupPermissionWithInheritance for - * everything - */ - @Deprecated - public boolean checkGroupPermissionWithInheritance(Group start, String permission, List<Group> alreadyChecked) { - PermissionCheckResult result = checkGroupPermissionWithInheritance(start, permission); - if (result.resultType.equals(Type.EXCEPTION) || result.resultType.equals(Type.FOUND)) { - return true; - } - return false; - } - - /** * Returns the result of permission check. Including inheritance. If found * anything, the PermissionCheckResult that retuns will include the Group * name, and the result type. Result types will be EXCEPTION, NEGATION, @@ -945,6 +908,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { * @return PermissionCheckResult */ public PermissionCheckResult checkGroupPermissionWithInheritance(Group start, String targetPermission) { + if (start == null || targetPermission == null) { return null; } @@ -961,7 +925,8 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { for (String sonName : now.getInherits()) { Group son = ph.getGroup(sonName); if (son != null && !alreadyVisited.contains(son)) { - stack.push(son); + // Add rather than push to retain inheritance order. + stack.add(son); alreadyVisited.add(son); } } @@ -973,42 +938,6 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { } /** - * It uses checkGroupPermissionWithInheritance and cast the owner to Group - * type if result type was EXCEPTION or FOUND. - * - * @param start - * @param permission - * @param alreadyChecked - * @return the group that passed on test. null if no group passed. - * @deprecated use checkGroupPermissionWithInheritance for everything now. - */ - @Deprecated - public Group nextGroupWithPermission(Group start, String permission, List<Group> alreadyChecked) { - PermissionCheckResult result = checkGroupPermissionWithInheritance(start, permission); - if (result.resultType.equals(Type.EXCEPTION) || result.resultType.equals(Type.FOUND)) { - return (Group) checkGroupPermissionWithInheritance(start, permission).owner; - } - return null; - } - - /** - * Return whole list of names of groups in a inheritance chain. Including a - * starting group. - * - * it now redirects to the other method. but get away from this one, it will - * disappear in a future release. - * - * @param start - * @param alreadyChecked - * @return the group that passed on test. null if no group passed. - * @deprecated use the other method with same name, instead - */ - @Deprecated - public ArrayList<String> listAllGroupsInherited(Group start, ArrayList<String> alreadyChecked) { - return listAllGroupsInherited(start); - } - - /** * Return whole list of names of groups in a inheritance chain. Including a * starting group. * @@ -1018,6 +947,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { * @return the group that passed on test. null if no group passed. */ public ArrayList<String> listAllGroupsInherited(Group start) { + if (start == null) { return null; } @@ -1057,6 +987,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { * @return PermissionCheckResult.Type */ public PermissionCheckResult.Type comparePermissionString(String userAccessLevel, String fullPermissionName) { + int userAccessLevelLength; if (userAccessLevel == null || fullPermissionName == null || fullPermissionName.length() == 0 || (userAccessLevelLength = userAccessLevel.length()) == 0) { return PermissionCheckResult.Type.NOTFOUND; @@ -1082,12 +1013,9 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { } if (userAccessLevel.charAt(userAccessLevel.length() - 1) == '*') { - return userAccessLevel.regionMatches(true, userAccessLevelOffset, fullPermissionName, fullPermissionNameOffset, userAccessLevelLength - userAccessLevelOffset - 1) ? - result : PermissionCheckResult.Type.NOTFOUND; + return userAccessLevel.regionMatches(true, userAccessLevelOffset, fullPermissionName, fullPermissionNameOffset, userAccessLevelLength - userAccessLevelOffset - 1) ? result : PermissionCheckResult.Type.NOTFOUND; } else { - return userAccessLevel.regionMatches(true, userAccessLevelOffset, fullPermissionName, fullPermissionNameOffset, - Math.max(userAccessLevelLength - userAccessLevelOffset, fullPermissionName.length() - fullPermissionNameOffset)) ? - result : PermissionCheckResult.Type.NOTFOUND; + return userAccessLevel.regionMatches(true, userAccessLevelOffset, fullPermissionName, fullPermissionNameOffset, Math.max(userAccessLevelLength - userAccessLevelOffset, fullPermissionName.length() - fullPermissionNameOffset)) ? result : PermissionCheckResult.Type.NOTFOUND; } } @@ -1101,6 +1029,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { */ @Override public String[] getGroups(String userName) { + ArrayList<String> allGroups = listAllGroupsInherited(ph.getUser(userName).getGroup()); for (Group subg : ph.getUser(userName).subGroupListCopy()) { allGroups.addAll(listAllGroupsInherited(subg)); @@ -1122,6 +1051,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { */ @SuppressWarnings("unused") private Group breadthFirstSearch(Group start, String targerPermission) { + if (start == null || targerPermission == null) { return null; } @@ -1151,11 +1081,13 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { @Override public Group getDefaultGroup() { + return ph.getDefaultGroup(); } @Override public String getInfoString(String entryName, String path, boolean isGroup) { + if (isGroup) { Group data = ph.getGroup(entryName); if (data == null) { @@ -1173,6 +1105,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { @Override public int getInfoInteger(String entryName, String path, boolean isGroup) { + if (isGroup) { Group data = ph.getGroup(entryName); if (data == null) { @@ -1190,6 +1123,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { @Override public double getInfoDouble(String entryName, String path, boolean isGroup) { + if (isGroup) { Group data = ph.getGroup(entryName); if (data == null) { @@ -1208,6 +1142,7 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { @Override public boolean getInfoBoolean(String entryName, String path, boolean isGroup) { + if (isGroup) { Group data = ph.getGroup(entryName); if (data == null) { @@ -1225,21 +1160,25 @@ public class AnjoPermissionsHandler extends PermissionsReaderInterface { @Override public void addUserInfo(String name, String path, Object data) { + ph.getUser(name).getVariables().addVar(path, data); } @Override public void removeUserInfo(String name, String path) { + ph.getUser(name).getVariables().removeVar(path); } @Override public void addGroupInfo(String name, String path, Object data) { + ph.getGroup(name).getVariables().addVar(path, data); } @Override public void removeGroupInfo(String name, String path) { + ph.getGroup(name).getVariables().removeVar(path); } } diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java index 0b6148900..05e152286 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/BukkitPermissions.java @@ -1,18 +1,19 @@ /*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License
-* as published by the Free Software Foundation; either version 2
-* 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 General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program; if not, write to the Free Software
-* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*/
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+ * USA.
+ */
package org.anjocaido.groupmanager.permissions;
@@ -20,14 +21,17 @@ import java.lang.reflect.Field; import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
+import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
import java.util.Set;
+import java.util.WeakHashMap;
import org.anjocaido.groupmanager.GroupManager;
+import org.anjocaido.groupmanager.data.User;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
@@ -45,7 +49,6 @@ import org.bukkit.permissions.PermissionAttachment; import org.bukkit.permissions.PermissionAttachmentInfo;
import org.bukkit.plugin.PluginManager;
-
/**
*
* BukkitPermissions overrides to force GM reponses to Superperms
@@ -54,17 +57,18 @@ import org.bukkit.plugin.PluginManager; */
public class BukkitPermissions {
- protected Map<Player, PermissionAttachment> attachments = new HashMap<Player, PermissionAttachment>();
+ protected WeakHashMap<Player, PermissionAttachment> attachments = new WeakHashMap<Player, PermissionAttachment>();
protected LinkedHashMap<String, Permission> registeredPermissions = new LinkedHashMap<String, Permission>();
protected GroupManager plugin;
protected boolean dumpAllPermissions = true;
protected boolean dumpMatchedPermissions = true;
private boolean player_join = false;
-
+
/**
* @return the player_join
*/
public boolean isPlayer_join() {
+
return player_join;
}
@@ -72,6 +76,7 @@ public class BukkitPermissions { * @param player_join the player_join to set
*/
public void setPlayer_join(boolean player_join) {
+
this.player_join = player_join;
}
@@ -90,47 +95,61 @@ public class BukkitPermissions { }
public BukkitPermissions(GroupManager plugin) {
+
this.plugin = plugin;
- this.collectPermissions();
+ this.reset();
this.registerEvents();
- this.updateAllPlayers();
+
GroupManager.logger.info("Superperms support enabled.");
}
+
+ public void reset() {
+ this.collectPermissions();
+ this.updateAllPlayers();
+ }
private void registerEvents() {
+
PluginManager manager = plugin.getServer().getPluginManager();
manager.registerEvents(new PlayerEvents(), plugin);
manager.registerEvents(new BukkitEvents(), plugin);
}
-
public void collectPermissions() {
+
registeredPermissions.clear();
for (Permission perm : Bukkit.getPluginManager().getPermissions()) {
- registeredPermissions.put(perm.getName().toLowerCase(), perm);
+ registeredPermissions.put(perm.getName().toLowerCase(), perm);
}
-
+
}
public void updatePermissions(Player player) {
+
this.updatePermissions(player, null);
}
-
/**
- * Push all permissions which are registered with GM for this player, on this world to Bukkit
+ * Push all permissions which are registered with GM for this player, on
+ * this world to Bukkit
* and make it update for the child nodes.
*
* @param player
* @param world
*/
public void updatePermissions(Player player, String world) {
+
if (player == null || !GroupManager.isLoaded()) {
return;
}
+
+ // Reset the User objects player reference.
+ User user = plugin.getWorldsHolder().getWorldData(player.getWorld().getName()).getUser(player.getName());
+ if (user != null)
+ user.updatePlayer(player);
PermissionAttachment attachment;
@@ -153,17 +172,18 @@ public class BukkitPermissions { // Sort the perm list by parent/child, so it will push to superperms correctly.
playerPermArray = sort(playerPermArray);
-
+
Boolean value = false;
- for (String permission : playerPermArray) {
+ for (String permission : playerPermArray) {
value = (!permission.startsWith("-"));
- newPerms.put((value? permission : permission.substring(1)), value);
+ newPerms.put((value ? permission : permission.substring(1)), value);
}
/**
- * This is put in place until such a time as Bukkit pull 466 is implemented
- * https://github.com/Bukkit/Bukkit/pull/466
- */
+ * This is put in place until such a time as Bukkit pull 466 is
+ * implemented
+ * https://github.com/Bukkit/Bukkit/pull/466
+ */
try { // Codename_B source
@SuppressWarnings("unchecked")
Map<String, Boolean> orig = (Map<String, Boolean>) permissions.get(attachment);
@@ -180,7 +200,7 @@ public class BukkitPermissions { e.printStackTrace();
}
}
-
+
/**
* Sort a permission node list by parent/child
*
@@ -188,20 +208,20 @@ public class BukkitPermissions { * @return List sorted for priority
*/
private List<String> sort(List<String> permList) {
-
+
List<String> result = new ArrayList<String>();
-
+
for (String key : permList) {
- String a = key.charAt(0) == '-'? key.substring(1):key;
+ String a = key.charAt(0) == '-' ? key.substring(1) : key;
Map<String, Boolean> allchildren = GroupManager.BukkitPermissions.getAllChildren(a, new HashSet<String>());
if (allchildren != null) {
ListIterator<String> itr = result.listIterator();
-
- while (itr.hasNext()){
+
+ while (itr.hasNext()) {
String node = (String) itr.next();
- String b = node.charAt(0) == '-'? node.substring(1):node;
-
+ String b = node.charAt(0) == '-' ? node.substring(1) : node;
+
// Insert the parent node before the child
if (allchildren.containsKey(b)) {
itr.set(key);
@@ -213,11 +233,10 @@ public class BukkitPermissions { if (!result.contains(key))
result.add(key);
}
-
+
return result;
}
-
/**
* Fetch all permissions which are registered with superperms.
* {can include child nodes)
@@ -226,13 +245,13 @@ public class BukkitPermissions { * @return List of all permission nodes
*/
public List<String> getAllRegisteredPermissions(boolean includeChildren) {
-
+
List<String> perms = new ArrayList<String>();
-
+
for (String key : registeredPermissions.keySet()) {
if (!perms.contains(key)) {
perms.add(key);
-
+
if (includeChildren) {
Map<String, Boolean> children = getAllChildren(key, new HashSet<String>());
if (children != null) {
@@ -242,32 +261,33 @@ public class BukkitPermissions { }
}
}
-
+
}
return perms;
}
-
+
/**
* Returns a map of ALL child permissions registered with bukkit
* null is empty
*
* @param node
- * @param playerPermArray current list of perms to check against for negations
+ * @param playerPermArray current list of perms to check against for
+ * negations
* @return Map of child permissions
*/
public Map<String, Boolean> getAllChildren(String node, Set<String> playerPermArray) {
-
+
LinkedList<String> stack = new LinkedList<String>();
Map<String, Boolean> alreadyVisited = new HashMap<String, Boolean>();
stack.push(node);
alreadyVisited.put(node, true);
-
+
while (!stack.isEmpty()) {
String now = stack.pop();
-
+
Map<String, Boolean> children = getChildren(now);
-
- if ((children != null) && (!playerPermArray.contains("-"+now))) {
+
+ if ((children != null) && (!playerPermArray.contains("-" + now))) {
for (String childName : children.keySet()) {
if (!alreadyVisited.containsKey(childName)) {
stack.push(childName);
@@ -277,24 +297,26 @@ public class BukkitPermissions { }
}
alreadyVisited.remove(node);
- if (!alreadyVisited.isEmpty()) return alreadyVisited;
-
+ if (!alreadyVisited.isEmpty())
+ return alreadyVisited;
+
return null;
}
-
+
/**
- * Returns a map of the child permissions (1 node deep) as registered with Bukkit.
+ * Returns a map of the child permissions (1 node deep) as registered with
+ * Bukkit.
* null is empty
*
* @param node
* @return Map of child permissions
*/
public Map<String, Boolean> getChildren(String node) {
-
+
Permission perm = registeredPermissions.get(node.toLowerCase());
if (perm == null)
return null;
-
+
return perm.getChildren();
}
@@ -306,6 +328,7 @@ public class BukkitPermissions { * @return List<String> of permissions
*/
public List<String> listPerms(Player player) {
+
List<String> perms = new ArrayList<String>();
/*
@@ -330,31 +353,81 @@ public class BukkitPermissions { * force Bukkit to update every OnlinePlayers permissions.
*/
public void updateAllPlayers() {
+
for (Player player : Bukkit.getServer().getOnlinePlayers()) {
updatePermissions(player);
}
}
-
+
/**
* force Bukkit to update this Players permissions.
*/
public void updatePlayer(Player player) {
+
if (player != null)
this.updatePermissions(player, null);
}
/**
+ * Force remove any attachments
+ *
+ * @param player
+ */
+ private void removeAttachment(Player player) {
+
+ if (attachments.containsKey(player)) {
+ try {
+ player.removeAttachment(attachments.get(player));
+ } catch (IllegalArgumentException e) {
+ /*
+ * Failed to remove attachment
+ * This usually means Bukkit no longer knows of it.
+ */
+ }
+ attachments.remove(player);
+ }
+ }
+
+ /**
+ * Remove all attachments in case of a restart or reload.
+ */
+ public void removeAllAttachments() {
+
+ Iterator<Player> itr = attachments.keySet().iterator();
+
+ while (itr.hasNext()) {
+ Player player = itr.next();
+ try {
+ player.removeAttachment(attachments.get(player));
+ } catch (IllegalArgumentException e) {
+ /*
+ * Failed to remove attachment
+ * This usually means Bukkit no longer knows of it.
+ */
+ }
+ }
+ attachments.clear();
+ }
+
+ /**
* Player events tracked to cause Superperms updates
*
* @author ElgarL
- *
+ *
*/
protected class PlayerEvents implements Listener {
@EventHandler(priority = EventPriority.LOWEST)
public void onPlayerJoin(PlayerJoinEvent event) {
+
setPlayer_join(true);
Player player = event.getPlayer();
+
+ /*
+ * Tidy up any lose ends
+ */
+ removeAttachment(player);
+
// force GM to create the player if they are not already listed.
if (plugin.getWorldsHolder().getWorldData(player.getWorld().getName()).getUser(player.getName()) != null) {
setPlayer_join(false);
@@ -362,23 +435,36 @@ public class BukkitPermissions { }
setPlayer_join(false);
}
-
+
@EventHandler(priority = EventPriority.LOWEST)
public void onPlayerChangeWorld(PlayerChangedWorldEvent event) { // has changed worlds
+
updatePermissions(event.getPlayer(), event.getPlayer().getWorld().getName());
}
@EventHandler(priority = EventPriority.LOWEST)
+ public void onPlayerKick(PlayerKickEvent event) {
+
+ Player player = event.getPlayer();
+
+ /*
+ * force remove any attachments as bukkit may not
+ */
+ removeAttachment(player);
+ }
+
+ @EventHandler(priority = EventPriority.LOWEST)
public void onPlayerQuit(PlayerQuitEvent event) {
+
if (!GroupManager.isLoaded())
return;
- attachments.remove(event.getPlayer());
- }
+ Player player = event.getPlayer();
- @EventHandler(priority = EventPriority.LOWEST)
- public void onPlayerKick(PlayerKickEvent event) {
- attachments.remove(event.getPlayer());
+ /*
+ * force remove any attachments as bukkit may not
+ */
+ removeAttachment(player);
}
}
@@ -386,6 +472,7 @@ public class BukkitPermissions { @EventHandler(priority = EventPriority.NORMAL)
public void onPluginEnable(PluginEnableEvent event) {
+
if (!GroupManager.isLoaded())
return;
@@ -395,6 +482,7 @@ public class BukkitPermissions { @EventHandler(priority = EventPriority.NORMAL)
public void onPluginDisable(PluginDisableEvent event) {
+
collectPermissions();
// updateAllPlayers();
}
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/PermissionsReaderInterface.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/PermissionsReaderInterface.java index 3f49757e2..69f098949 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/PermissionsReaderInterface.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/PermissionsReaderInterface.java @@ -12,227 +12,239 @@ import org.bukkit.entity.Player; /** * Made by Nijikokun. Changed by Gabriel Couto - * + * * This class is intended to *read* permissions from a single world. - * + * * @author Nijikokun * @author Gabriel Couto * @author ElgarL */ public abstract class PermissionsReaderInterface { - /** - * - * @param player - * @param string - * @return true if has permission - */ - public abstract boolean has(Player player, String string); - - /** - * - * @param player - * @param string - * @return true if has permission - */ - public abstract boolean permission(Player player, String string); - - /** - * - * @param userName - * @return group name for this player. - */ - public abstract String getGroup(String userName); - - /** - * - * @param userName - * @param groupName - * @return true if in group - */ - public abstract boolean inGroup(String userName, String groupName); - - /** - * - * @param groupName - * @return String of prefix - */ - public abstract String getGroupPrefix(String groupName); - - /** - * - * @param groupName - * @return String of suffix - */ - public abstract String getGroupSuffix(String groupName); - - /** - * - * @param groupName - * @return true if can build - */ - public abstract boolean canGroupBuild(String groupName); - - /** - * - * @param groupName - * @param node - * @return String value - */ - public abstract String getGroupPermissionString(String groupName, String node); - - /** - * - * @param groupName - * @param node - * @return integer value - */ - public abstract int getGroupPermissionInteger(String groupName, String node); - - /** - * - * @param groupName - * @param node - * @return boolean value - */ - public abstract boolean getGroupPermissionBoolean(String groupName, String node); - - /** - * - * @param groupName - * @param node - * @return double value - */ - public abstract double getGroupPermissionDouble(String groupName, String node); - - /** - * - * @param userName - * @param node - * @return String value - */ - public abstract String getUserPermissionString(String userName, String node); - - /** - * - * @param userName - * @param node - * @return integer value - */ - public abstract int getUserPermissionInteger(String userName, String node); - - /** - * - * @param userName - * @param node - * @return boolean value - */ - public abstract boolean getUserPermissionBoolean(String userName, String node); - - /** - * - * @param userName - * @param node - * @return double value - */ - public abstract double getUserPermissionDouble(String userName, String node); - - /** - * - * @param userName - * @param node - * @return String value - */ - public abstract String getPermissionString(String userName, String node); - - /** - * - * @param userName - * @param node - * @return integer value - */ - public abstract int getPermissionInteger(String userName, String node); - - /** - * - * @param userName - * @param node - * @return boolean value - */ - public abstract boolean getPermissionBoolean(String userName, String node); - - /** - * - * @param userName - * @param node - * @return double value - */ - public abstract double getPermissionDouble(String userName, String node); - -///////////////////////////// - /** - * Gets the appropriate prefix for the user. - * This method is a utility method for chat plugins to get the user's prefix - * without having to look at every one of the user's ancestors. - * Returns an empty string if user has no parent groups. - * - * @param user Player's name - * @return Player's prefix - */ - public abstract String getUserPrefix(String user); - - /** - * Gets the appropriate suffix for the user. - * This method is a utility method for chat plugins to get the user's suffix - * without having to look at every one of the user's ancestors. - * Returns an empty string if user has no parent groups. - * - * @param user Player's name - * @return Player's suffix - */ - public abstract String getUserSuffix(String user); - - /** - * Returns the group object representing the default group of the given world. - * This method will return null if the object does not exist or the world has no default group. - * @return Group object representing default world, or null if it doesn't exist or is not defined. - */ - public abstract Group getDefaultGroup(); - - /** - * Gets a array of the names of all parent groups in the same world. - * @param name Target user's name - * @return An array containing the names of all parent groups (including ancestors) that are in the same world - */ - public abstract String[] getGroups(String name); - - public abstract String getInfoString(String entryName, String path, boolean isGroup); - //public abstract String getInfoString(String entryName, String path, boolean isGroup, Comparator<String> comparator); - - public abstract int getInfoInteger(String entryName, String path, boolean isGroup); - //public abstract int getInfoInteger(String entryName, String path, boolean isGroup, Comparator<Integer> comparator); - - /** - * Gets a double from the Info node without inheritance. - * @param entryName - * @param path - * @param isGroup - * @return -1 if not found - */ - public abstract double getInfoDouble(String entryName, String path, boolean isGroup); - //public abstract double getInfoDouble(String entryName, String path, boolean isGroup, Comparator<Double> comparator); - - public abstract boolean getInfoBoolean(String entryName, String path, boolean isGroup); - //public abstract boolean getInfoBoolean(String entryName, String path, boolean isGroup, Comparator<Boolean> comparator); - - public abstract void addUserInfo(String name, String path, Object data); - - public abstract void removeUserInfo(String name, String path); - - public abstract void addGroupInfo(String name, String path, Object data); - - public abstract void removeGroupInfo(String name, String path); -////////////////////////////// + /** + * + * @param player + * @param string + * @return true if has permission + */ + public abstract boolean has(Player player, String string); + + /** + * + * @param player + * @param string + * @return true if has permission + */ + public abstract boolean permission(Player player, String string); + + /** + * + * @param userName + * @return group name for this player. + */ + public abstract String getGroup(String userName); + + /** + * + * @param userName + * @param groupName + * @return true if in group + */ + public abstract boolean inGroup(String userName, String groupName); + + /** + * + * @param groupName + * @return String of prefix + */ + public abstract String getGroupPrefix(String groupName); + + /** + * + * @param groupName + * @return String of suffix + */ + public abstract String getGroupSuffix(String groupName); + + /** + * + * @param groupName + * @return true if can build + */ + public abstract boolean canGroupBuild(String groupName); + + /** + * + * @param groupName + * @param node + * @return String value + */ + public abstract String getGroupPermissionString(String groupName, String node); + + /** + * + * @param groupName + * @param node + * @return integer value + */ + public abstract int getGroupPermissionInteger(String groupName, String node); + + /** + * + * @param groupName + * @param node + * @return boolean value + */ + public abstract boolean getGroupPermissionBoolean(String groupName, String node); + + /** + * + * @param groupName + * @param node + * @return double value + */ + public abstract double getGroupPermissionDouble(String groupName, String node); + + /** + * + * @param userName + * @param node + * @return String value + */ + public abstract String getUserPermissionString(String userName, String node); + + /** + * + * @param userName + * @param node + * @return integer value + */ + public abstract int getUserPermissionInteger(String userName, String node); + + /** + * + * @param userName + * @param node + * @return boolean value + */ + public abstract boolean getUserPermissionBoolean(String userName, String node); + + /** + * + * @param userName + * @param node + * @return double value + */ + public abstract double getUserPermissionDouble(String userName, String node); + + /** + * + * @param userName + * @param node + * @return String value + */ + public abstract String getPermissionString(String userName, String node); + + /** + * + * @param userName + * @param node + * @return integer value + */ + public abstract int getPermissionInteger(String userName, String node); + + /** + * + * @param userName + * @param node + * @return boolean value + */ + public abstract boolean getPermissionBoolean(String userName, String node); + + /** + * + * @param userName + * @param node + * @return double value + */ + public abstract double getPermissionDouble(String userName, String node); + + ///////////////////////////// + /** + * Gets the appropriate prefix for the user. + * This method is a utility method for chat plugins to get the user's prefix + * without having to look at every one of the user's ancestors. + * Returns an empty string if user has no parent groups. + * + * @param user Player's name + * @return Player's prefix + */ + public abstract String getUserPrefix(String user); + + /** + * Gets the appropriate suffix for the user. + * This method is a utility method for chat plugins to get the user's suffix + * without having to look at every one of the user's ancestors. + * Returns an empty string if user has no parent groups. + * + * @param user Player's name + * @return Player's suffix + */ + public abstract String getUserSuffix(String user); + + /** + * Returns the group object representing the default group of the given + * world. + * This method will return null if the object does not exist or the world + * has no default group. + * + * @return Group object representing default world, or null if it doesn't + * exist or is not defined. + */ + public abstract Group getDefaultGroup(); + + /** + * Gets a array of the names of all parent groups in the same world. + * + * @param name Target user's name + * @return An array containing the names of all parent groups (including + * ancestors) that are in the same world + */ + public abstract String[] getGroups(String name); + + public abstract String getInfoString(String entryName, String path, boolean isGroup); + + //public abstract String getInfoString(String entryName, String path, boolean isGroup, Comparator<String> comparator); + + public abstract int getInfoInteger(String entryName, String path, boolean isGroup); + + //public abstract int getInfoInteger(String entryName, String path, boolean isGroup, Comparator<Integer> comparator); + + /** + * Gets a double from the Info node without inheritance. + * + * @param entryName + * @param path + * @param isGroup + * @return -1 if not found + */ + public abstract double getInfoDouble(String entryName, String path, boolean isGroup); + + //public abstract double getInfoDouble(String entryName, String path, boolean isGroup, Comparator<Double> comparator); + + public abstract boolean getInfoBoolean(String entryName, String path, boolean isGroup); + + //public abstract boolean getInfoBoolean(String entryName, String path, boolean isGroup, Comparator<Boolean> comparator); + + public abstract void addUserInfo(String name, String path, Object data); + + public abstract void removeUserInfo(String name, String path); + + public abstract void addGroupInfo(String name, String path, Object data); + + public abstract void removeGroupInfo(String name, String path); + + ////////////////////////////// public abstract List<String> getAllPlayersPermissions(String userName); diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/GMLoggerHandler.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/GMLoggerHandler.java index 87b6806ab..de5348b17 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/GMLoggerHandler.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/GMLoggerHandler.java @@ -9,18 +9,19 @@ import java.util.logging.Level; import java.util.logging.LogRecord; /** - * + * * @author gabrielcouto */ public class GMLoggerHandler extends ConsoleHandler { - @Override - public void publish(LogRecord record) { - String message = "GroupManager - " + record.getLevel() + " - " + record.getMessage(); - if (record.getLevel().equals(Level.SEVERE) || record.getLevel().equals(Level.WARNING)) { - System.err.println(message); - } else { - System.out.println(message); - } - } + @Override + public void publish(LogRecord record) { + + String message = "GroupManager - " + record.getLevel() + " - " + record.getMessage(); + if (record.getLevel().equals(Level.SEVERE) || record.getLevel().equals(Level.WARNING)) { + System.err.println(message); + } else { + System.out.println(message); + } + } } diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/GroupManagerPermissions.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/GroupManagerPermissions.java index 0262bb33e..4a7298b9c 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/GroupManagerPermissions.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/GroupManagerPermissions.java @@ -6,47 +6,48 @@ package org.anjocaido.groupmanager.utils; /** * Just a list of commands for this plugin + * * @author gabrielcouto */ public enum GroupManagerPermissions { - manuadd, - manudel, - manuaddsub, - manudelsub, - mangadd, - mangdel, - manuaddp, - manudelp, - manulistp, - manucheckp, - mangaddp, - mangdelp, - manglistp, - mangcheckp, - mangaddi, - mangdeli, - manuaddv, - manudelv, - manulistv, - manucheckv, - mangaddv, - mangdelv, - manglistv, - mangcheckv, - manwhois, - tempadd, - tempdel, - templist, - tempdelall, - mansave, - manload, - listgroups, - manpromote, - mandemote, - mantogglevalidate, - mantogglesave, - manworld, - manselect, - manclear + manuadd, + manudel, + manuaddsub, + manudelsub, + mangadd, + mangdel, + manuaddp, + manudelp, + manulistp, + manucheckp, + mangaddp, + mangdelp, + manglistp, + mangcheckp, + mangaddi, + mangdeli, + manuaddv, + manudelv, + manulistv, + manucheckv, + mangaddv, + mangdelv, + manglistv, + mangcheckv, + manwhois, + tempadd, + tempdel, + templist, + tempdelall, + mansave, + manload, + listgroups, + manpromote, + mandemote, + mantogglevalidate, + mantogglesave, + manworld, + manselect, + manclear } diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/PermissionCheckResult.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/PermissionCheckResult.java index 88ac48427..eb6633863 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/PermissionCheckResult.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/PermissionCheckResult.java @@ -7,61 +7,61 @@ package org.anjocaido.groupmanager.utils; import org.anjocaido.groupmanager.data.DataUnit; /** - * + * * @author gabrielcouto */ public class PermissionCheckResult { - /** - * It should be the owner of the access level found. - * - * Use instanceof to find the owner type - */ - public DataUnit owner; - /** - * The permission node found in the DataUnit. - */ - public String accessLevel; - /** - * The full name of the permission you are looking for - */ - public String askedPermission; - /** - * The result conclusion of the search. - * It determines if the owner can do, or not. - * - * It even determines if it has an owner. - */ - public Type resultType = Type.NOTFOUND; + /** + * It should be the owner of the access level found. + * + * Use instanceof to find the owner type + */ + public DataUnit owner; + /** + * The permission node found in the DataUnit. + */ + public String accessLevel; + /** + * The full name of the permission you are looking for + */ + public String askedPermission; + /** + * The result conclusion of the search. + * It determines if the owner can do, or not. + * + * It even determines if it has an owner. + */ + public Type resultType = Type.NOTFOUND; - /** - * The type of result the search can give. - */ - public enum Type { + /** + * The type of result the search can give. + */ + public enum Type { - /** - * If found a matching node starting with '+'. - * It means the user CAN do the permission. - */ - EXCEPTION, - /** - * If found a matching node starting with '-'. - * It means the user CANNOT do the permission. - */ - NEGATION, - /** - * If just found a common matching node. - * IT means the user CAN do the permission. - */ - FOUND, - /** - * If no matchin node was found. - * It means the user CANNOT do the permission. - * - * owner field and accessLevel field should not be considered, - * when type is - * NOTFOUND - */ - NOTFOUND - } + /** + * If found a matching node starting with '+'. + * It means the user CAN do the permission. + */ + EXCEPTION, + /** + * If found a matching node starting with '-'. + * It means the user CANNOT do the permission. + */ + NEGATION, + /** + * If just found a common matching node. + * IT means the user CAN do the permission. + */ + FOUND, + /** + * If no matchin node was found. + * It means the user CANNOT do the permission. + * + * owner field and accessLevel field should not be considered, + * when type is + * NOTFOUND + */ + NOTFOUND + } } diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/StringPermissionComparator.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/StringPermissionComparator.java index ab2fd605b..5a56cd9fc 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/StringPermissionComparator.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/StringPermissionComparator.java @@ -7,43 +7,46 @@ package org.anjocaido.groupmanager.utils; import java.util.Comparator; /** - * + * * @author gabrielcouto */ public class StringPermissionComparator implements Comparator<String> { - @Override - public int compare(String permA, String permB) { - boolean ap = permA.startsWith("+"); - boolean bp = permB.startsWith("+"); - boolean am = permA.startsWith("-"); - boolean bm = permB.startsWith("-"); - if (ap && bp) { - return 0; - } - if (ap && !bp) { - return -1; - } - if (!ap && bp) { - return 1; - } - if (am && bm) { - return 0; - } - if (am && !bm) { - return -1; - } - if (!am && bm) { - return 1; - } - return permA.compareToIgnoreCase(permB); - } - private static StringPermissionComparator instance; + @Override + public int compare(String permA, String permB) { - public static StringPermissionComparator getInstance() { - if (instance == null) { - instance = new StringPermissionComparator(); - } - return instance; - } + boolean ap = permA.startsWith("+"); + boolean bp = permB.startsWith("+"); + boolean am = permA.startsWith("-"); + boolean bm = permB.startsWith("-"); + if (ap && bp) { + return 0; + } + if (ap && !bp) { + return -1; + } + if (!ap && bp) { + return 1; + } + if (am && bm) { + return 0; + } + if (am && !bm) { + return -1; + } + if (!am && bm) { + return 1; + } + return permA.compareToIgnoreCase(permB); + } + + private static StringPermissionComparator instance; + + public static StringPermissionComparator getInstance() { + + if (instance == null) { + instance = new StringPermissionComparator(); + } + return instance; + } } diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/Tasks.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/Tasks.java index f3defd94a..d75737c66 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/Tasks.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/utils/Tasks.java @@ -4,12 +4,17 @@ */ package org.anjocaido.groupmanager.utils; +import java.io.BufferedWriter; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; +import java.io.FileWriter; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.GregorianCalendar; import java.util.List; @@ -18,109 +23,153 @@ import org.anjocaido.groupmanager.GroupManager; import org.anjocaido.groupmanager.data.Group; /** - * + * * @author gabrielcouto */ public abstract class Tasks { - public static void copy(InputStream src, File dst) throws IOException { - InputStream in = src; - OutputStream out = new FileOutputStream(dst); - - // Transfer bytes from in to out - byte[] buf = new byte[1024]; - int len; - while ((len = in.read(buf)) > 0) { - out.write(buf, 0, len); - } - out.close(); - try { - in.close(); - } catch (Exception e) { - } - } - - public static void copy(File src, File dst) throws IOException { - InputStream in = new FileInputStream(src); - copy(in, dst); - } - - public static void removeOldFiles(GroupManager gm, File folder) { - if (folder.isDirectory()) { - long oldTime = System.currentTimeMillis() - (((long)gm.getGMConfig().getBackupDuration()*60*60)*1000); - for (File olds : folder.listFiles()) { - if (olds.isFile()) { - if (olds.lastModified() < oldTime) { - try { - olds.delete(); - } catch (Exception e) { - } - } - } - } - } - } - - public static String getDateString() { - GregorianCalendar now = new GregorianCalendar(); - String date = ""; - date += now.get(Calendar.DAY_OF_MONTH); - date += "-"; - date += now.get(Calendar.HOUR); - date += "-"; - date += now.get(Calendar.MINUTE); - return date; - } - - public static String getStringListInString(List<String> list) { - if (list == null) { - return ""; - } - String result = ""; - for (int i = 0; i < list.size(); i++) { - result += list.get(i); - if (i < list.size() - 1) { - result += ", "; - } - } - return result; - } - - public static String getStringArrayInString(String[] list) { - if (list == null) { - return ""; - } - String result = ""; - for (int i = 0; i < list.length; i++) { - result += list[i]; - if (i < ((list.length) - 1)) { - result += ", "; - } - } - return result; - } - - public static String getGroupListInString(List<Group> list) { - if (list == null) { - return ""; - } - String result = ""; - for (int i = 0; i < list.size(); i++) { - result += list.get(i).getName(); - if (i < list.size() - 1) { - result += ", "; - } - } - return result; - } - - public static String join(String[] arr, String separator) { - if (arr.length == 0) - return ""; - String out = arr[0].toString(); - for (int i = 1; i < arr.length; i++) - out += separator + arr[i]; - return out; - } + /** + * Gets the exception stack trace as a string. + * + * @param exception + * @return stack trace as a string + */ + public static String getStackTraceAsString(Exception exception) { + + StringWriter sw = new StringWriter(); + PrintWriter pw = new PrintWriter(sw); + exception.printStackTrace(pw); + return sw.toString(); + } + + public static void copy(InputStream src, File dst) throws IOException { + + InputStream in = src; + OutputStream out = new FileOutputStream(dst); + + // Transfer bytes from in to out + byte[] buf = new byte[1024]; + int len; + while ((len = in.read(buf)) > 0) { + out.write(buf, 0, len); + } + out.close(); + try { + in.close(); + } catch (Exception e) { + } + } + + public static void copy(File src, File dst) throws IOException { + + InputStream in = new FileInputStream(src); + copy(in, dst); + } + + /** + * Appends a string to a file + * + * @param data + * @param file + */ + public static void appendStringToFile(String data, String file) throws IOException { + + FileWriter outStream = new FileWriter("." + System.getProperty("file.separator") + file, true); + + BufferedWriter out = new BufferedWriter(outStream); + + data.replaceAll("\n", System.getProperty("line.separator")); + + out.append(new SimpleDateFormat("yyyy-MM-dd HH-mm").format(System.currentTimeMillis())); + out.append(System.getProperty("line.separator")); + out.append(data); + out.append(System.getProperty("line.separator")); + + out.close(); + } + + public static void removeOldFiles(GroupManager gm, File folder) { + + if (folder.isDirectory()) { + long oldTime = System.currentTimeMillis() - (((long) gm.getGMConfig().getBackupDuration() * 60 * 60) * 1000); + for (File olds : folder.listFiles()) { + if (olds.isFile()) { + if (olds.lastModified() < oldTime) { + try { + olds.delete(); + } catch (Exception e) { + } + } + } + } + } + } + + public static String getDateString() { + + GregorianCalendar now = new GregorianCalendar(); + String date = ""; + date += now.get(Calendar.DAY_OF_MONTH); + date += "-"; + date += now.get(Calendar.HOUR); + date += "-"; + date += now.get(Calendar.MINUTE); + return date; + } + + public static String getStringListInString(List<String> list) { + + if (list == null) { + return ""; + } + String result = ""; + for (int i = 0; i < list.size(); i++) { + result += list.get(i); + if (i < list.size() - 1) { + result += ", "; + } + } + return result; + } + + public static String getStringArrayInString(String[] list) { + + if (list == null) { + return ""; + } + String result = ""; + for (int i = 0; i < list.length; i++) { + result += list[i]; + if (i < ((list.length) - 1)) { + result += ", "; + } + } + return result; + } + + public static String getGroupListInString(List<Group> list) { + + if (list == null) { + return ""; + } + String result = ""; + for (int i = 0; i < list.size(); i++) { + result += list.get(i).getName(); + if (i < list.size() - 1) { + result += ", "; + } + } + return result; + } + + public static String join(String[] arr, String separator) { + + if (arr.length == 0) + return ""; + String out = arr[0].toString(); + for (int i = 1; i < arr.length; i++) + out += separator + arr[i]; + return out; + } } diff --git a/EssentialsGroupManager/src/plugin.yml b/EssentialsGroupManager/src/plugin.yml index 65a5d4e95..f7faa5896 100644 --- a/EssentialsGroupManager/src/plugin.yml +++ b/EssentialsGroupManager/src/plugin.yml @@ -10,7 +10,7 @@ authors: commands: manuadd: description: Move a player to desired group.(Adds to the file if not exists) - usage: /<command> <player> <group> + usage: /<command> <player> <group> | optional [world] permissions: groupmanager.manuadd manudel: description: Remove any user specific configuration. Make him default group. @@ -163,4 +163,9 @@ commands: manclear: description: Clear world selection. Next commands will work on your world. usage: /<command> - permissions: groupmanager.manclear
\ No newline at end of file + permissions: groupmanager.manclear + +Permissions: + groupmanager.op: + description: User is treated as an op when using the GroupManager commands. + default: false
\ No newline at end of file diff --git a/EssentialsProtect/pom.xml b/EssentialsProtect/pom.xml index db885d3f7..973e08bbc 100644 --- a/EssentialsProtect/pom.xml +++ b/EssentialsProtect/pom.xml @@ -29,7 +29,7 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-shade-plugin</artifactId> - <version>1.5</version> + <version>1.7</version> <executions> <execution> <goals> @@ -41,6 +41,7 @@ <include>c3p0:c3p0</include> </includes> </artifactSet> + <minimizeJar>true</minimizeJar> </configuration> </execution> </executions> diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/ProtectConfig.java b/EssentialsProtect/src/com/earth2me/essentials/protect/ProtectConfig.java deleted file mode 100644 index feeeb19df..000000000 --- a/EssentialsProtect/src/com/earth2me/essentials/protect/ProtectConfig.java +++ /dev/null @@ -1,121 +0,0 @@ -package com.earth2me.essentials.protect; - - -/*public enum ProtectConfig -{ - datatype("protect.datatype", "sqlite"), - mysqlDB("protect.mysqlDb", "jdbc:mysql://localhost:3306/minecraft"), - dbUsername("protect.username", "root"), - dbPassword("protect.password", ""), - memstore("protect.memstore", false), - disable_contactdmg("protect.disable.contactdmg", false), - disable_lavadmg("protect.disable.lavadmg", false), - disable_build("protect.disable.build", true), - disable_use("protect.disable.use", true), - disable_pvp("protect.disable.pvp", false), - disable_projectiles("protect.disable.projectiles", false), - disable_fall("protect.disable.fall", false), - disable_suffocate("protect.disable.suffocate", false), - disable_firedmg("protect.disable.firedmg", false), - disable_lightning("protect.disable.lightning", false), - disable_drown("protect.disable.drown", false), - disable_weather_storm("protect.disable.weather.storm", false), - disable_weather_lightning("protect.disable.weather.lightning", false), - disable_weather_thunder("protect.disable.weather.thunder", false), - prevent_fire_spread("protect.prevent.fire-spread", true), - prevent_flint_fire("protect.prevent.flint-fire", false), - prevent_lava_fire_spread("protect.prevent.lava-fire-spread", true), - prevent_lightning_fire_spread("protect.prevent.lightning-fire-spread", true), - prevent_water_flow("protect.prevent.water-flow", false), - prevent_lava_flow("protect.prevent.lava-flow", false), - prevent_water_bucket_flow("protect.prevent.water-bucket-flow", false), - prevent_portal_creation("protect.prevent.portal-creation", false), - prevent_block_on_rail("protect.protect.prevent-block-on-rails", false), - prevent_tnt_explosion("protect.prevent.tnt-explosion", false), - prevent_tnt_playerdmg("protect.prevent.tnt-playerdamage", false), - prevent_fireball_explosion("protect.prevent.fireball-explosion", false), - prevent_fireball_fire("protect.prevent.fireball-fire", false), - prevent_fireball_playerdmg("protect.prevent.fireball-playerdamage", false), - prevent_creeper_explosion("protect.prevent.creeper-explosion", true), - prevent_creeper_playerdmg("protect.prevent.creeper-playerdamage", false), - prevent_creeper_blockdmg("protect.prevent.creeper-blockdamage", false), - prevent_enderman_pickup("protect.prevent.enderman-pickup", false), - prevent_villager_death("protect.prevent.villager-death", false), - prevent_enderdragon_blockdmg("protect.prevent.enderdragon-blockdamage", true), - prevent_entitytarget("protect.prevent.entitytarget", false), - protect_rails("protect.protect.rails", true), - protect_below_rails("protect.protect.block-below", true), - protect_signs("protect.protect.signs", true), - protect_against_signs("protect.protect.block-below", true), - enderdragon_fakeexplosions("protect.enderdragon-fakeexplosions", false), - alert_on_placement("protect.alert.on-placement"), - alert_on_use("protect.alert.on-use"), - alert_on_break("protect.alert.on-break"), - blacklist_placement("protect.blacklist.placement"), - blacklist_usage("protect.blacklist.usage"), - blacklist_break("protect.blacklist.break"), - blacklist_piston("protect.blacklist.piston"); - private final String configName; - private final String defValueString; - private final boolean defValueBoolean; - private final boolean isList; - private final boolean isString; - - private ProtectConfig(final String configName) - { - this(configName, null, false, true, false); - } - - private ProtectConfig(final String configName, final String defValueString) - { - this(configName, defValueString, false, false, true); - } - - private ProtectConfig(final String configName, final boolean defValueBoolean) - { - this(configName, null, defValueBoolean, false, false); - } - - private ProtectConfig(final String configName, final String defValueString, final boolean defValueBoolean, final boolean isList, final boolean isString) - { - this.configName = configName; - this.defValueString = defValueString; - this.defValueBoolean = defValueBoolean; - this.isList = isList; - this.isString = isString; - } - - /** - * @return the configName - *//* - public String getConfigName() - { - return configName; - } - - /** - * @return the default value String - *//* - public String getDefaultValueString() - { - return defValueString; - } - - /** - * @return the default value boolean - *//* - public boolean getDefaultValueBoolean() - { - return defValueBoolean; - } - - public boolean isString() - { - return isString; - } - - public boolean isList() - { - return isList; - } -}*/ diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/BlockBreakPermissions.java b/EssentialsProtect/src/net/ess3/protect/BlockBreakPermissions.java index 50be5dadb..1a07588e8 100644 --- a/EssentialsProtect/src/com/earth2me/essentials/protect/BlockBreakPermissions.java +++ b/EssentialsProtect/src/net/ess3/protect/BlockBreakPermissions.java @@ -1,4 +1,4 @@ -package com.earth2me.essentials.protect; +package net.ess3.protect; import net.ess3.api.IPermission; import net.ess3.permissions.AbstractSuperpermsPermission; @@ -8,26 +8,30 @@ import java.util.Map; import org.bukkit.Material; import org.bukkit.permissions.PermissionDefault; -public class BlockBreakPermissions extends AbstractSuperpermsPermission{ - private static Map<Material,IPermission> permissions = new EnumMap<Material, IPermission>(Material.class); + +public final class BlockBreakPermissions extends AbstractSuperpermsPermission +{ + private static Map<Material, IPermission> permissions = new EnumMap<Material, IPermission>(Material.class); private static final String base = "essentials.protect.blockbreak."; private final String permission; - - public static IPermission getPermission(Material mat) + + public static IPermission getPermission(final Material mat) { IPermission perm = permissions.get(mat); - if (perm == null) { + if (perm == null) + { perm = new BlockBreakPermissions(mat.toString().toLowerCase(Locale.ENGLISH)); permissions.put(mat, perm); } return perm; } - private BlockBreakPermissions(String matName) + private BlockBreakPermissions(final String matName) { + super(); this.permission = base + matName; } - + @Override public String getPermission() { @@ -40,4 +44,3 @@ public class BlockBreakPermissions extends AbstractSuperpermsPermission{ return PermissionDefault.TRUE; } } - diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/BlockPlacePermissions.java b/EssentialsProtect/src/net/ess3/protect/BlockPlacePermissions.java index 0e553a243..87e771e73 100644 --- a/EssentialsProtect/src/com/earth2me/essentials/protect/BlockPlacePermissions.java +++ b/EssentialsProtect/src/net/ess3/protect/BlockPlacePermissions.java @@ -1,4 +1,4 @@ -package com.earth2me.essentials.protect; +package net.ess3.protect; import net.ess3.api.IPermission; import net.ess3.permissions.AbstractSuperpermsPermission; @@ -8,26 +8,30 @@ import java.util.Map; import org.bukkit.Material; import org.bukkit.permissions.PermissionDefault; -public class BlockPlacePermissions extends AbstractSuperpermsPermission{ - private static Map<Material,IPermission> permissions = new EnumMap<Material, IPermission>(Material.class); + +public class BlockPlacePermissions extends AbstractSuperpermsPermission +{ + private static Map<Material, IPermission> permissions = new EnumMap<Material, IPermission>(Material.class); private static final String base = "essentials.protect.blockplace."; private final String permission; - - public static IPermission getPermission(Material mat) + + public static IPermission getPermission(final Material mat) { IPermission perm = permissions.get(mat); - if (perm == null) { + if (perm == null) + { perm = new BlockPlacePermissions(mat.toString().toLowerCase(Locale.ENGLISH)); permissions.put(mat, perm); } return perm; } - private BlockPlacePermissions(String matName) + private BlockPlacePermissions(final String matName) { + super(); this.permission = base + matName; } - + @Override public String getPermission() { diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EmergencyListener.java b/EssentialsProtect/src/net/ess3/protect/EmergencyListener.java index 5f9253c55..2d70ee698 100644 --- a/EssentialsProtect/src/com/earth2me/essentials/protect/EmergencyListener.java +++ b/EssentialsProtect/src/net/ess3/protect/EmergencyListener.java @@ -1,4 +1,4 @@ -package com.earth2me.essentials.protect; +package net.ess3.protect; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsConnect.java b/EssentialsProtect/src/net/ess3/protect/EssentialsConnect.java index 67993175d..c3fcfe441 100644 --- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsConnect.java +++ b/EssentialsProtect/src/net/ess3/protect/EssentialsConnect.java @@ -1,11 +1,11 @@ -package com.earth2me.essentials.protect; +package net.ess3.protect; import static net.ess3.I18n._; import net.ess3.api.IEssentials; import net.ess3.api.IReload; import net.ess3.api.IUser; -import com.earth2me.essentials.protect.data.ProtectedBlockMySQL; -import com.earth2me.essentials.protect.data.ProtectedBlockSQLite; +import net.ess3.protect.data.ProtectedBlockMySQL; +import net.ess3.protect.data.ProtectedBlockSQLite; import java.beans.PropertyVetoException; import java.util.logging.Level; import java.util.logging.Logger; @@ -20,7 +20,7 @@ public class EssentialsConnect private final transient IEssentials ess; private final transient IProtect protect; - public EssentialsConnect(Plugin essPlugin, Plugin essProtect) + public EssentialsConnect(final Plugin essPlugin, final Plugin essProtect) { if (!essProtect.getDescription().getVersion().equals(essPlugin.getDescription().getVersion())) { @@ -29,15 +29,11 @@ public class EssentialsConnect ess = (IEssentials)essPlugin; protect = (IProtect)essProtect; protect.setSettings(new ProtectHolder(ess)); - ProtectReloader pr = new ProtectReloader(); + final ProtectReloader pr = new ProtectReloader(); pr.onReload(); ess.addReloadListener(pr); } - public void onDisable() - { - } - public IEssentials getEssentials() { return ess; @@ -84,7 +80,7 @@ public class EssentialsConnect * } */ - ProtectHolder settings = protect.getSettings(); + final ProtectHolder settings = protect.getSettings(); settings.acquireReadLock(); try { @@ -106,7 +102,7 @@ public class EssentialsConnect { try { - protect.setStorage(new ProtectedBlockSQLite("jdbc:sqlite:plugins/Essentials/EssentialsProtect.db")); + protect.setStorage(new ProtectedBlockSQLite("jdbc:sqlite:" + ess.getDataFolder() + "/EssentialsProtect.db")); } catch (PropertyVetoException ex) { @@ -114,9 +110,9 @@ public class EssentialsConnect } } /*if (protect.getSettingBool(ProtectConfig.memstore)) - { - protect.setStorage(new ProtectedBlockMemory(protect.getStorage(), protect)); - }*/ + { + protect.setStorage(new ProtectedBlockMemory(protect.getStorage(), protect)); + }*/ } finally diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java b/EssentialsProtect/src/net/ess3/protect/EssentialsProtect.java index 72000eeba..9f1e58e10 100644 --- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java +++ b/EssentialsProtect/src/net/ess3/protect/EssentialsProtect.java @@ -1,10 +1,11 @@ -package com.earth2me.essentials.protect; +package net.ess3.protect; -import com.earth2me.essentials.protect.data.IProtectedBlock; +import net.ess3.protect.data.IProtectedBlock; import java.util.logging.Filter; import java.util.logging.Level; import java.util.logging.LogRecord; import java.util.logging.Logger; + import org.bukkit.entity.Player; import org.bukkit.plugin.Plugin; import org.bukkit.plugin.PluginManager; @@ -21,6 +22,7 @@ public class EssentialsProtect extends JavaPlugin implements IProtect private transient IProtectedBlock storage = null; private transient EssentialsConnect ess = null; private transient ProtectHolder settings = null; + private transient com.mchange.v2.c3p0.management.ActiveManagementCoordinator temp; // leave this here for maven @Override public void onLoad() @@ -28,17 +30,18 @@ public class EssentialsProtect extends JavaPlugin implements IProtect C3P0logger = com.mchange.v2.log.MLog.getLogger(com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.class); C3P0logger.setFilter(new Filter() { - public boolean isLoggable(LogRecord lr) + public boolean isLoggable(final LogRecord lr) { return lr.getLevel() != Level.INFO; } }); } + @Override public void onEnable() { final PluginManager pm = this.getServer().getPluginManager(); - final Plugin essPlugin = pm.getPlugin("Essentials3"); + final Plugin essPlugin = pm.getPlugin("Essentials-3"); if (essPlugin == null || !essPlugin.isEnabled()) { enableEmergencyMode(pm); @@ -72,12 +75,11 @@ public class EssentialsProtect extends JavaPlugin implements IProtect } /*@Override - public boolean checkProtectionItems(final ProtectConfig list, final int id) - { - final List<Integer> itemList = settingsList.get(list); - return itemList != null && !itemList.isEmpty() && itemList.contains(id); - }*/ - + public boolean checkProtectionItems(final ProtectConfig list, final int id) + { + final List<Integer> itemList = settingsList.get(list); + return itemList != null && !itemList.isEmpty() && itemList.contains(id); + }*/ @Override public IProtectedBlock getStorage() { @@ -85,45 +87,46 @@ public class EssentialsProtect extends JavaPlugin implements IProtect } @Override - public void setStorage(IProtectedBlock pb) + public void setStorage(final IProtectedBlock pb) { storage = pb; } + @Override public EssentialsConnect getEssentialsConnect() { return ess; } - - /*public Map<ProtectConfig, Boolean> getSettingsBoolean() - { - return settingsBoolean; - } - - public Map<ProtectConfig, String> getSettingsString() - { - return settingsString; - } - - public Map<ProtectConfig, List<Integer>> getSettingsList() - { - return settingsList; - } - - @Override - public boolean getSettingBool(final ProtectConfig protectConfig) - { - final Boolean bool = settingsBoolean.get(protectConfig); - return bool == null ? protectConfig.getDefaultValueBoolean() : bool; - } + /*public Map<ProtectConfig, Boolean> getSettingsBoolean() + { + return settingsBoolean; + } + + public Map<ProtectConfig, String> getSettingsString() + { + return settingsString; + } + + public Map<ProtectConfig, List<Integer>> getSettingsList() + { + return settingsList; + } + + @Override + public boolean getSettingBool(final ProtectConfig protectConfig) + { + final Boolean bool = settingsBoolean.get(protectConfig); + return bool == null ? protectConfig.getDefaultValueBoolean() : bool; + } + + @Override + public String getSettingString(final ProtectConfig protectConfig) + { + final String str = settingsString.get(protectConfig); + return str == null ? protectConfig.getDefaultValueString() : str; + }*/ @Override - public String getSettingString(final ProtectConfig protectConfig) - { - final String str = settingsString.get(protectConfig); - return str == null ? protectConfig.getDefaultValueString() : str; - }*/ - public void onDisable() { if (storage != null) @@ -140,11 +143,13 @@ public class EssentialsProtect extends JavaPlugin implements IProtect } } + @Override public ProtectHolder getSettings() { return settings; } + @Override public void setSettings(final ProtectHolder settings) { this.settings = settings; diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectBlockListener.java b/EssentialsProtect/src/net/ess3/protect/EssentialsProtectBlockListener.java index 1a711bd8d..77bb472c7 100644 --- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectBlockListener.java +++ b/EssentialsProtect/src/net/ess3/protect/EssentialsProtectBlockListener.java @@ -1,10 +1,11 @@ -package com.earth2me.essentials.protect; +package net.ess3.protect; import static net.ess3.I18n._; import net.ess3.api.IEssentials; import com.earth2me.essentials.protect.data.IProtectedBlock; import java.util.ArrayList; import java.util.List; + import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; @@ -18,22 +19,15 @@ import org.bukkit.event.block.*; public class EssentialsProtectBlockListener implements Listener { final private transient IProtect prot; - final private transient IEssentials ess; public EssentialsProtectBlockListener(final IProtect parent) { this.prot = parent; - this.ess = prot.getEssentialsConnect().getEssentials(); } - @EventHandler(priority = EventPriority.HIGHEST) + @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onBlockPlace(final BlockPlaceEvent event) { - if (event.isCancelled()) - { - return; - } - final Player user = event.getPlayer(); final ProtectHolder settings = prot.getSettings(); settings.acquireReadLock(); @@ -46,7 +40,6 @@ public class EssentialsProtectBlockListener implements Listener } final Block blockPlaced = event.getBlockPlaced(); - final int id = blockPlaced.getTypeId(); if (!BlockPlacePermissions.getPermission(blockPlaced.getType()).isAuthorized(user)) { @@ -54,8 +47,8 @@ public class EssentialsProtectBlockListener implements Listener return; } - if (!Permissions.ALERTS_NOTRIGGER.isAuthorized(user) && - settings.getData().getAlertOnPlacement().contains(blockPlaced.getType())) + if (!Permissions.ALERTS_NOTRIGGER.isAuthorized(user) + && settings.getData().getAlertOnPlacement().contains(blockPlaced.getType())) { prot.getEssentialsConnect().alert(user, blockPlaced.getType().toString(), _("alertPlaced")); } @@ -82,18 +75,18 @@ public class EssentialsProtectBlockListener implements Listener } } /*if ((blockPlaced.getType() == Material.SIGN_POST || blockPlaced.getType() == Material.WALL_SIGN) - && settings.getData().getSignsAndRails().isProtectSigns() - && user.isAuthorized("essentials.protect")) - { - protect.add(blockPlaced); - if (settings.getData().getSignsAndRails().isBlockBelow() - && event.getBlockAgainst().getType() != Material.SIGN_POST - && event.getBlockAgainst().getType() != Material.WALL_SIGN - && !isProtected(event.getBlockAgainst(), user, settings)) - { - protect.add(event.getBlockAgainst()); - } - }*/ + && settings.getData().getSignsAndRails().isProtectSigns() + && user.isAuthorized("essentials.protect")) + { + protect.add(blockPlaced); + if (settings.getData().getSignsAndRails().isBlockBelow() + && event.getBlockAgainst().getType() != Material.SIGN_POST + && event.getBlockAgainst().getType() != Material.WALL_SIGN + && !isProtected(event.getBlockAgainst(), user, settings)) + { + protect.add(event.getBlockAgainst()); + } + }*/ for (Block block : protect) { prot.getStorage().protectBlock(block, user.getName()); @@ -105,13 +98,9 @@ public class EssentialsProtectBlockListener implements Listener } } - @EventHandler(priority = EventPriority.HIGHEST) + @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onBlockIgnite(BlockIgniteEvent event) { - if (event.isCancelled()) - { - return; - } final ProtectHolder settings = prot.getSettings(); settings.acquireReadLock(); try @@ -165,13 +154,9 @@ public class EssentialsProtectBlockListener implements Listener } } - @EventHandler(priority = EventPriority.HIGHEST) + @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onBlockFromTo(final BlockFromToEvent event) { - if (event.isCancelled()) - { - return; - } final ProtectHolder settings = prot.getSettings(); settings.acquireReadLock(); try @@ -214,13 +199,9 @@ public class EssentialsProtectBlockListener implements Listener } } - @EventHandler(priority = EventPriority.HIGHEST) + @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onBlockBurn(final BlockBurnEvent event) { - if (event.isCancelled()) - { - return; - } final ProtectHolder settings = prot.getSettings(); settings.acquireReadLock(); try @@ -260,13 +241,9 @@ public class EssentialsProtectBlockListener implements Listener BlockFace.SELF }; - @EventHandler(priority = EventPriority.HIGHEST) + @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onBlockBreak(final BlockBreakEvent event) { - if (event.isCancelled()) - { - return; - } final Player user = event.getPlayer(); if (!Permissions.BUILD.isAuthorized(user)) @@ -275,7 +252,6 @@ public class EssentialsProtectBlockListener implements Listener return; } final Block block = event.getBlock(); - final int typeId = block.getTypeId(); if (!BlockBreakPermissions.getPermission(block.getType()).isAuthorized(user)) { @@ -366,13 +342,9 @@ public class EssentialsProtectBlockListener implements Listener } } - @EventHandler(priority = EventPriority.HIGHEST) + @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onBlockPistonExtend(final BlockPistonExtendEvent event) { - if (event.isCancelled()) - { - return; - } final ProtectHolder settings = prot.getSettings(); settings.acquireReadLock(); try @@ -428,10 +400,10 @@ public class EssentialsProtectBlockListener implements Listener } } - @EventHandler(priority = EventPriority.HIGHEST) + @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onBlockPistonRetract(final BlockPistonRetractEvent event) { - if (event.isCancelled() || !event.isSticky()) + if (!event.isSticky()) { return; } @@ -482,7 +454,6 @@ public class EssentialsProtectBlockListener implements Listener } } } - finally { settings.unlock(); @@ -499,31 +470,31 @@ public class EssentialsProtectBlockListener implements Listener return prot.getStorage().isProtected(block, user.getName()); } - final Block up = block.getRelative(BlockFace.UP); - if (up != null && up.getType() == Material.SIGN_POST) - { - return prot.getStorage().isProtected(block, user.getName()); - } - final BlockFace[] directions = new BlockFace[] - { - BlockFace.NORTH, - BlockFace.EAST, - BlockFace.SOUTH, - BlockFace.WEST - }; - for (BlockFace blockFace : directions) + final Block up = block.getRelative(BlockFace.UP); + if (up != null && up.getType() == Material.SIGN_POST) + { + return prot.getStorage().isProtected(block, user.getName()); + } + final BlockFace[] directions = new BlockFace[] + { + BlockFace.NORTH, + BlockFace.EAST, + BlockFace.SOUTH, + BlockFace.WEST + }; + for (BlockFace blockFace : directions) + { + final Block signblock = block.getRelative(blockFace); + if (signblock.getType() == Material.WALL_SIGN) { - final Block signblock = block.getRelative(blockFace); - if (signblock.getType() == Material.WALL_SIGN) + final org.bukkit.material.Sign signMat = (org.bukkit.material.Sign)signblock.getState().getData(); + if (signMat != null && signMat.getFacing() == blockFace) { - final org.bukkit.material.Sign signMat = (org.bukkit.material.Sign)signblock.getState().getData(); - if (signMat != null && signMat.getFacing() == blockFace) - { - return prot.getStorage().isProtected(block, user.getName()); - } + return prot.getStorage().isProtected(block, user.getName()); } } - + } + } if (settings.getData().getSignsAndRails().isProtectRails()) { diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java b/EssentialsProtect/src/net/ess3/protect/EssentialsProtectEntityListener.java index dabf2b0a0..f4146c5bb 100644 --- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectEntityListener.java +++ b/EssentialsProtect/src/net/ess3/protect/EssentialsProtectEntityListener.java @@ -1,7 +1,6 @@ -package com.earth2me.essentials.protect; +package net.ess3.protect; import net.ess3.api.IEssentials; -import net.ess3.craftbukkit.FakeExplosion; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; @@ -9,30 +8,24 @@ import org.bukkit.entity.*; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; +import org.bukkit.event.entity.*; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityTargetEvent.TargetReason; -import org.bukkit.event.entity.*; public class EssentialsProtectEntityListener implements Listener { private final transient IProtect prot; - private final transient IEssentials ess; public EssentialsProtectEntityListener(final IProtect prot) { super(); this.prot = prot; - this.ess = prot.getEssentialsConnect().getEssentials(); } - @EventHandler(priority = EventPriority.HIGHEST) + @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onEntityDamage(final EntityDamageEvent event) { - if (event.isCancelled()) - { - return; - } final ProtectHolder settings = prot.getSettings(); settings.acquireReadLock(); try @@ -172,13 +165,9 @@ public class EssentialsProtectEntityListener implements Listener } } - @EventHandler(priority = EventPriority.HIGHEST) + @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onEntityExplode(final EntityExplodeEvent event) { - if (event.isCancelled()) - { - return; - } final ProtectHolder settings = prot.getSettings(); settings.acquireReadLock(); try @@ -196,9 +185,8 @@ public class EssentialsProtectEntityListener implements Listener || settings.getData().getPrevent().isCreeperBlockdamage() || (maxHeight >= 0 && event.getLocation().getBlockY() > maxHeight))) { - //Nicccccccccce plaaacccccccccce.. - FakeExplosion.createExplosion(event, ess.getServer(), ess.getServer().getOnlinePlayers()); event.setCancelled(true); + event.getLocation().getWorld().createExplosion(event.getLocation(), 0F); return; } else if (event.getEntity() instanceof TNTPrimed @@ -249,57 +237,23 @@ public class EssentialsProtectEntityListener implements Listener } } - @EventHandler(priority = EventPriority.HIGHEST) - public void onCreatureSpawn(final CreatureSpawnEvent event) + @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) + public void onEntityTarget(final EntityTargetEvent event) { - if (event.getEntity() instanceof Player) - { - return; - } - if (event.isCancelled()) - { - return; - } - final CreatureType creature = event.getCreatureType(); - if (creature == null) + if (event.getTarget().getType() == EntityType.PLAYER) { - return; - } - final ProtectHolder settings = prot.getSettings(); - settings.acquireReadLock(); - try - { - final Boolean prevent = settings.getData().getPrevent().getSpawn().get(creature); - if (prevent != null && prevent) + final Player user = (Player)event.getTarget(); + if ((event.getReason() == TargetReason.CLOSEST_PLAYER + || event.getReason() == TargetReason.TARGET_ATTACKED_ENTITY + || event.getReason() == TargetReason.PIG_ZOMBIE_TARGET + || event.getReason() == TargetReason.RANDOM_TARGET + || event.getReason() == TargetReason.TARGET_ATTACKED_OWNER + || event.getReason() == TargetReason.OWNER_ATTACKED_TARGET) + && Permissions.ENTITYTARGET.isAuthorized(user)) { event.setCancelled(true); } } - finally - { - settings.unlock(); - } - } - - @EventHandler(priority = EventPriority.HIGHEST) - public void onEntityTarget(final EntityTargetEvent event) - { - if (event.isCancelled() || !(event.getTarget() instanceof Player)) - { - return; - } - final Player user = (Player)event.getTarget(); - if ((event.getReason() == TargetReason.CLOSEST_PLAYER - || event.getReason() == TargetReason.TARGET_ATTACKED_ENTITY - || event.getReason() == TargetReason.PIG_ZOMBIE_TARGET - || event.getReason() == TargetReason.RANDOM_TARGET - || event.getReason() == TargetReason.TARGET_ATTACKED_OWNER - || event.getReason() == TargetReason.OWNER_ATTACKED_TARGET) - && Permissions.ENTITYTARGET.isAuthorized(user)) - { - event.setCancelled(true); - return; - } } @EventHandler(priority = EventPriority.HIGHEST) @@ -321,13 +275,9 @@ public class EssentialsProtectEntityListener implements Listener } } - @EventHandler(priority = EventPriority.HIGHEST) + @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onEntityChangeBlock(final EntityChangeBlockEvent event) { - if (event.isCancelled()) - { - return; - } final ProtectHolder settings = prot.getSettings(); settings.acquireReadLock(); try diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectPlayerListener.java b/EssentialsProtect/src/net/ess3/protect/EssentialsProtectPlayerListener.java index d92265442..8022df16d 100644 --- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectPlayerListener.java +++ b/EssentialsProtect/src/net/ess3/protect/EssentialsProtectPlayerListener.java @@ -1,4 +1,4 @@ -package com.earth2me.essentials.protect; +package net.ess3.protect; import static net.ess3.I18n._; import net.ess3.api.IEssentials; @@ -16,12 +16,10 @@ import org.bukkit.inventory.ItemStack; public class EssentialsProtectPlayerListener implements Listener { private final transient IProtect prot; - private final transient IEssentials ess; public EssentialsProtectPlayerListener(final IProtect prot) { this.prot = prot; - this.ess = prot.getEssentialsConnect().getEssentials(); } @EventHandler(priority = EventPriority.LOW) diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectWeatherListener.java b/EssentialsProtect/src/net/ess3/protect/EssentialsProtectWeatherListener.java index babebac71..6f08bdd13 100644 --- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectWeatherListener.java +++ b/EssentialsProtect/src/net/ess3/protect/EssentialsProtectWeatherListener.java @@ -1,4 +1,4 @@ -package com.earth2me.essentials.protect; +package net.ess3.protect; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/IProtect.java b/EssentialsProtect/src/net/ess3/protect/IProtect.java index d25661bf8..df2a454a0 100644 --- a/EssentialsProtect/src/com/earth2me/essentials/protect/IProtect.java +++ b/EssentialsProtect/src/net/ess3/protect/IProtect.java @@ -1,6 +1,6 @@ -package com.earth2me.essentials.protect; +package net.ess3.protect; -import com.earth2me.essentials.protect.data.IProtectedBlock; +import net.ess3.protect.data.IProtectedBlock; import org.bukkit.plugin.Plugin; diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/ItemUsePermissions.java b/EssentialsProtect/src/net/ess3/protect/ItemUsePermissions.java index e623fe003..d9ecf9bc0 100644 --- a/EssentialsProtect/src/com/earth2me/essentials/protect/ItemUsePermissions.java +++ b/EssentialsProtect/src/net/ess3/protect/ItemUsePermissions.java @@ -1,4 +1,4 @@ -package com.earth2me.essentials.protect; +package net.ess3.protect; import net.ess3.api.IPermission; import net.ess3.permissions.AbstractSuperpermsPermission; @@ -8,26 +8,29 @@ import java.util.Map; import org.bukkit.Material; import org.bukkit.permissions.PermissionDefault; -public class ItemUsePermissions extends AbstractSuperpermsPermission{ - private static Map<Material,IPermission> permissions = new EnumMap<Material, IPermission>(Material.class); + +public class ItemUsePermissions extends AbstractSuperpermsPermission +{ + private static Map<Material, IPermission> permissions = new EnumMap<Material, IPermission>(Material.class); private static final String base = "essentials.protect.itemuse."; private final String permission; - - public static IPermission getPermission(Material mat) + + public static IPermission getPermission(final Material mat) { IPermission perm = permissions.get(mat); - if (perm == null) { + if (perm == null) + { perm = new ItemUsePermissions(mat.toString().toLowerCase(Locale.ENGLISH)); permissions.put(mat, perm); } return perm; } - private ItemUsePermissions(String matName) + private ItemUsePermissions(final String matName) { this.permission = base + matName; } - + @Override public String getPermission() { diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/Permissions.java b/EssentialsProtect/src/net/ess3/protect/Permissions.java index 0cb2d49ef..37042618b 100644 --- a/EssentialsProtect/src/com/earth2me/essentials/protect/Permissions.java +++ b/EssentialsProtect/src/net/ess3/protect/Permissions.java @@ -1,7 +1,7 @@ -package com.earth2me.essentials.protect; +package net.ess3.protect; -import net.ess3.utils.Util; import net.ess3.api.IPermission; +import net.ess3.utils.Util; import java.util.Locale; import org.bukkit.command.CommandSender; import org.bukkit.permissions.Permission; @@ -74,7 +74,7 @@ public enum Permissions implements IPermission } @Override - public boolean isAuthorized(CommandSender sender) + public boolean isAuthorized(final CommandSender sender) { return sender.hasPermission(getBukkitPermission()); } diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/ProtectHolder.java b/EssentialsProtect/src/net/ess3/protect/ProtectHolder.java index d9df03bbf..145a5e97e 100644 --- a/EssentialsProtect/src/com/earth2me/essentials/protect/ProtectHolder.java +++ b/EssentialsProtect/src/net/ess3/protect/ProtectHolder.java @@ -1,4 +1,4 @@ -package com.earth2me.essentials.protect; +package net.ess3.protect; import net.ess3.api.IEssentials; import net.ess3.settings.protect.Protect; @@ -9,7 +9,7 @@ import java.io.IOException; public class ProtectHolder extends AsyncStorageObjectHolder<Protect> { - public ProtectHolder(IEssentials ess) + public ProtectHolder(final IEssentials ess) { super(ess, Protect.class); } @@ -19,4 +19,14 @@ public class ProtectHolder extends AsyncStorageObjectHolder<Protect> { return new File(ess.getDataFolder(), "protect.yml"); } + + @Override + public void finishRead() + { + } + + @Override + public void finishWrite() + { + } } diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/data/IProtectedBlock.java b/EssentialsProtect/src/net/ess3/protect/data/IProtectedBlock.java index 755baface..a27adfb3c 100644 --- a/EssentialsProtect/src/com/earth2me/essentials/protect/data/IProtectedBlock.java +++ b/EssentialsProtect/src/net/ess3/protect/data/IProtectedBlock.java @@ -1,4 +1,4 @@ -package com.earth2me.essentials.protect.data; +package net.ess3.protect.data; import java.util.List; import org.bukkit.block.Block; diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/data/OwnedBlock.java b/EssentialsProtect/src/net/ess3/protect/data/OwnedBlock.java index dc28feae8..cac1826e9 100644 --- a/EssentialsProtect/src/com/earth2me/essentials/protect/data/OwnedBlock.java +++ b/EssentialsProtect/src/net/ess3/protect/data/OwnedBlock.java @@ -1,4 +1,4 @@ -package com.earth2me.essentials.protect.data; +package net.ess3.protect.data; public class OwnedBlock diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/data/ProtectedBlockJDBC.java b/EssentialsProtect/src/net/ess3/protect/data/ProtectedBlockJDBC.java index e24a71b80..70475c6f5 100644 --- a/EssentialsProtect/src/com/earth2me/essentials/protect/data/ProtectedBlockJDBC.java +++ b/EssentialsProtect/src/net/ess3/protect/data/ProtectedBlockJDBC.java @@ -1,4 +1,4 @@ -package com.earth2me.essentials.protect.data; +package net.ess3.protect.data; import com.mchange.v2.c3p0.ComboPooledDataSource; import java.beans.PropertyVetoException; @@ -34,12 +34,12 @@ public abstract class ProtectedBlockJDBC implements IProtectedBlock protected abstract PreparedStatement getStatementAllBlocks(Connection conn) throws SQLException; - public ProtectedBlockJDBC(String driver, String url) throws PropertyVetoException + public ProtectedBlockJDBC(final String driver, final String url) throws PropertyVetoException { this(driver, url, null, null); } - public ProtectedBlockJDBC(String driver, String url, String username, String password) throws PropertyVetoException + public ProtectedBlockJDBC(final String driver, final String url, final String username, final String password) throws PropertyVetoException { cpds = new ComboPooledDataSource(); cpds.setDriverClass(driver); @@ -97,6 +97,7 @@ public abstract class ProtectedBlockJDBC implements IProtectedBlock } } + @Override public void clearProtections() { Connection conn = null; @@ -138,7 +139,8 @@ public abstract class ProtectedBlockJDBC implements IProtectedBlock } } - public void importProtections(List<OwnedBlock> blocks) + @Override + public void importProtections(final List<OwnedBlock> blocks) { for (OwnedBlock ownedBlock : blocks) { @@ -150,6 +152,7 @@ public abstract class ProtectedBlockJDBC implements IProtectedBlock } } + @Override public List<OwnedBlock> exportProtections() { Connection conn = null; @@ -216,12 +219,13 @@ public abstract class ProtectedBlockJDBC implements IProtectedBlock } } - public void protectBlock(Block block, String playerName) + @Override + public void protectBlock(final Block block, final String playerName) { protectBlock(block.getWorld().getName(), block.getX(), block.getY(), block.getZ(), playerName); } - private void protectBlock(String world, int x, int y, int z, String playerName) + private void protectBlock(final String world, final int x, final int y, final int z, final String playerName) { Connection conn = null; PreparedStatement ps = null; @@ -262,7 +266,8 @@ public abstract class ProtectedBlockJDBC implements IProtectedBlock } } - public boolean isProtected(Block block, String playerName) + @Override + public boolean isProtected(final Block block, final String playerName) { Connection conn = null; PreparedStatement ps = null; @@ -317,7 +322,8 @@ public abstract class ProtectedBlockJDBC implements IProtectedBlock } } - public List<String> getOwners(Block block) + @Override + public List<String> getOwners(final Block block) { Connection conn = null; PreparedStatement ps = null; @@ -377,7 +383,8 @@ public abstract class ProtectedBlockJDBC implements IProtectedBlock } } - public int unprotectBlock(Block block) + @Override + public int unprotectBlock(final Block block) { Connection conn = null; PreparedStatement ps = null; @@ -419,6 +426,7 @@ public abstract class ProtectedBlockJDBC implements IProtectedBlock } } + @Override public void onPluginDeactivation() { cpds.close(); diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/data/ProtectedBlockMemory.java b/EssentialsProtect/src/net/ess3/protect/data/ProtectedBlockMemory.java index 876c8a575..10c825154 100644 --- a/EssentialsProtect/src/com/earth2me/essentials/protect/data/ProtectedBlockMemory.java +++ b/EssentialsProtect/src/net/ess3/protect/data/ProtectedBlockMemory.java @@ -1,13 +1,13 @@ -package com.earth2me.essentials.protect.data; +package net.ess3.protect.data; -import java.util.Map.Entry; import java.util.*; +import java.util.Map.Entry; import org.bukkit.World; import org.bukkit.block.Block; import org.bukkit.plugin.Plugin; -public class ProtectedBlockMemory implements IProtectedBlock +public final class ProtectedBlockMemory implements IProtectedBlock { private final transient List<String> worlds = new ArrayList<String>(); private final transient List<String> playerNames = new ArrayList<String>(); @@ -123,12 +123,14 @@ public class ProtectedBlockMemory implements IProtectedBlock importProtections(storage.exportProtections()); } + @Override public void clearProtections() { blocks.clear(); } - public final void importProtections(final List<OwnedBlock> blocks) + @Override + public void importProtections(final List<OwnedBlock> blocks) { for (OwnedBlock ownedBlock : blocks) { @@ -141,6 +143,7 @@ public class ProtectedBlockMemory implements IProtectedBlock } } + @Override public List<OwnedBlock> exportProtections() { final List<OwnedBlock> blockList = new ArrayList<OwnedBlock>(blocks.size()); @@ -160,12 +163,14 @@ public class ProtectedBlockMemory implements IProtectedBlock return blockList; } + @Override public void protectBlock(final Block block, final String playerName) { final ProtectedLocation pl = new ProtectedLocation(block, getWorldId(block.getWorld())); protectBlock(pl, playerName); plugin.getServer().getScheduler().scheduleAsyncDelayedTask(plugin, new Runnable() { + @Override public void run() { storage.protectBlock(block, playerName); @@ -173,9 +178,9 @@ public class ProtectedBlockMemory implements IProtectedBlock }); } - private final void protectBlock(ProtectedLocation pl, String playerName) + private void protectBlock(final ProtectedLocation pl, final String playerName) { - int playerId = getPlayerId(playerName); + final int playerId = getPlayerId(playerName); ProtectedBy pb = blocks.get(pl); if (pb == null) { @@ -185,27 +190,31 @@ public class ProtectedBlockMemory implements IProtectedBlock pb.add(playerId); } - public boolean isProtected(Block block, String playerName) + @Override + public boolean isProtected(final Block block, final String playerName) { - int playerId = getPlayerId(playerName); - ProtectedLocation pl = new ProtectedLocation(block, getWorldId(block.getWorld())); - ProtectedBy pb = blocks.get(pl); + final int playerId = getPlayerId(playerName); + final ProtectedLocation pl = new ProtectedLocation(block, getWorldId(block.getWorld())); + final ProtectedBy pb = blocks.get(pl); return !pb.contains(playerId); } - public List<String> getOwners(Block block) + @Override + public List<String> getOwners(final Block block) { ProtectedLocation pl = new ProtectedLocation(block, getWorldId(block.getWorld())); ProtectedBy pb = blocks.get(pl); return pb.getPlayers(playerNames); } + @Override public int unprotectBlock(final Block block) { - ProtectedLocation pl = new ProtectedLocation(block, getWorldId(block.getWorld())); - ProtectedBy pb = blocks.remove(pl); + final ProtectedLocation pl = new ProtectedLocation(block, getWorldId(block.getWorld())); + final ProtectedBy pb = blocks.remove(pl); plugin.getServer().getScheduler().scheduleAsyncDelayedTask(plugin, new Runnable() { + @Override public void run() { storage.unprotectBlock(block); @@ -214,7 +223,7 @@ public class ProtectedBlockMemory implements IProtectedBlock return pb.size(); } - private int getPlayerId(String playername) + private int getPlayerId(final String playername) { int id = playerNames.indexOf(playername); if (id < 0) @@ -225,12 +234,12 @@ public class ProtectedBlockMemory implements IProtectedBlock return id; } - private int getWorldId(World world) + private int getWorldId(final World world) { return getWorldId(world.getName()); } - private int getWorldId(String name) + private int getWorldId(final String name) { int id = worlds.indexOf(name); if (id < 0) @@ -241,6 +250,7 @@ public class ProtectedBlockMemory implements IProtectedBlock return id; } + @Override public void onPluginDeactivation() { storage.onPluginDeactivation(); diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/data/ProtectedBlockMySQL.java b/EssentialsProtect/src/net/ess3/protect/data/ProtectedBlockMySQL.java index 2a0077698..9fd17d0a7 100644 --- a/EssentialsProtect/src/com/earth2me/essentials/protect/data/ProtectedBlockMySQL.java +++ b/EssentialsProtect/src/net/ess3/protect/data/ProtectedBlockMySQL.java @@ -1,4 +1,4 @@ -package com.earth2me.essentials.protect.data; +package net.ess3.protect.data; import java.beans.PropertyVetoException; import java.sql.Connection; @@ -11,7 +11,7 @@ import java.util.logging.Logger; public class ProtectedBlockMySQL extends ProtectedBlockJDBC { - public ProtectedBlockMySQL(String url, String username, String password) throws PropertyVetoException + public ProtectedBlockMySQL(final String url, final String username, final String password) throws PropertyVetoException { super("com.mysql.jdbc.Driver", url, username, password); } @@ -24,7 +24,7 @@ public class ProtectedBlockMySQL extends ProtectedBlockJDBC + ") ENGINE=MyISAM DEFAULT CHARSET=utf8"; @Override - protected PreparedStatement getStatementCreateTable(Connection conn) throws SQLException + protected PreparedStatement getStatementCreateTable(final Connection conn) throws SQLException { return conn.prepareStatement(QueryCreateTable); } @@ -40,7 +40,7 @@ public class ProtectedBlockMySQL extends ProtectedBlockJDBC + "DROP PRIMARY KEY ;"; @Override - protected PreparedStatement getStatementUpdateFrom2_0Table(Connection conn) throws SQLException + protected PreparedStatement getStatementUpdateFrom2_0Table(final Connection conn) throws SQLException { PreparedStatement testPS = null; ResultSet testRS = null; @@ -86,7 +86,7 @@ public class ProtectedBlockMySQL extends ProtectedBlockJDBC private static final String QueryDeleteAll = "DELETE FROM EssentialsProtect;"; @Override - protected PreparedStatement getStatementDeleteAll(Connection conn) throws SQLException + protected PreparedStatement getStatementDeleteAll(final Connection conn) throws SQLException { return conn.prepareStatement(QueryDeleteAll); } @@ -94,9 +94,10 @@ public class ProtectedBlockMySQL extends ProtectedBlockJDBC "INSERT INTO EssentialsProtect (worldName, x, y, z, playerName) VALUES (?, ?, ?, ?, ?);"; @Override - protected PreparedStatement getStatementInsert(Connection conn, String world, int x, int y, int z, String playerName) throws SQLException + protected PreparedStatement getStatementInsert(final Connection conn, final String world, final int x, final int y, final int z, + final String playerName) throws SQLException { - PreparedStatement ps = conn.prepareStatement(QueryInsert); + final PreparedStatement ps = conn.prepareStatement(QueryInsert); ps.setString(1, world); ps.setInt(2, x); ps.setInt(3, y); @@ -109,9 +110,10 @@ public class ProtectedBlockMySQL extends ProtectedBlockJDBC + "WHERE worldName = ? AND x = ? AND y = ? AND z = ? GROUP BY x;"; @Override - protected PreparedStatement getStatementPlayerCountByLocation(Connection conn, String world, int x, int y, int z, String playerName) throws SQLException + protected PreparedStatement getStatementPlayerCountByLocation(final Connection conn, final String world, final int x, final int y, final int z, + final String playerName) throws SQLException { - PreparedStatement ps = conn.prepareStatement(QueryCountByPlayer); + final PreparedStatement ps = conn.prepareStatement(QueryCountByPlayer); ps.setString(1, playerName); ps.setString(2, world); ps.setInt(3, x); @@ -123,9 +125,10 @@ public class ProtectedBlockMySQL extends ProtectedBlockJDBC "SELECT playerName FROM EssentialsProtect WHERE worldname = ? AND x = ? AND y = ? AND z = ?;"; @Override - protected PreparedStatement getStatementPlayersByLocation(Connection conn, String world, int x, int y, int z) throws SQLException + protected PreparedStatement getStatementPlayersByLocation(final Connection conn, final String world, + final int x, final int y, final int z) throws SQLException { - PreparedStatement ps = conn.prepareStatement(QueryPlayersByLocation); + final PreparedStatement ps = conn.prepareStatement(QueryPlayersByLocation); ps.setString(1, world); ps.setInt(2, x); ps.setInt(3, y); @@ -136,9 +139,10 @@ public class ProtectedBlockMySQL extends ProtectedBlockJDBC "DELETE FROM EssentialsProtect WHERE worldName = ? AND x = ? AND y = ? AND z = ?;"; @Override - protected PreparedStatement getStatementDeleteByLocation(Connection conn, String world, int x, int y, int z) throws SQLException + protected PreparedStatement getStatementDeleteByLocation(final Connection conn, final String world, + final int x, final int y, final int z) throws SQLException { - PreparedStatement ps = conn.prepareStatement(QueryDeleteByLocation); + final PreparedStatement ps = conn.prepareStatement(QueryDeleteByLocation); ps.setString(1, world); ps.setInt(2, x); ps.setInt(3, y); @@ -149,7 +153,7 @@ public class ProtectedBlockMySQL extends ProtectedBlockJDBC "SELECT worldName, x, y, z, playerName FROM EssentialsProtect;"; @Override - protected PreparedStatement getStatementAllBlocks(Connection conn) throws SQLException + protected PreparedStatement getStatementAllBlocks(final Connection conn) throws SQLException { return conn.prepareStatement(QueryAllBlocks); } diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/data/ProtectedBlockSQLite.java b/EssentialsProtect/src/net/ess3/protect/data/ProtectedBlockSQLite.java index cf256f1ec..65dbac213 100644 --- a/EssentialsProtect/src/com/earth2me/essentials/protect/data/ProtectedBlockSQLite.java +++ b/EssentialsProtect/src/net/ess3/protect/data/ProtectedBlockSQLite.java @@ -1,4 +1,4 @@ -package com.earth2me.essentials.protect.data; +package net.ess3.protect.data; import java.beans.PropertyVetoException; import java.sql.Connection; @@ -8,7 +8,7 @@ import java.sql.SQLException; public class ProtectedBlockSQLite extends ProtectedBlockJDBC { - public ProtectedBlockSQLite(String url) throws PropertyVetoException + public ProtectedBlockSQLite(final String url) throws PropertyVetoException { super("org.sqlite.JDBC", url); } @@ -18,7 +18,7 @@ public class ProtectedBlockSQLite extends ProtectedBlockJDBC + "x NUMERIC, y NUMERIC, z NUMERIC)"; @Override - protected PreparedStatement getStatementCreateTable(Connection conn) throws SQLException + protected PreparedStatement getStatementCreateTable(final Connection conn) throws SQLException { return conn.prepareStatement(QueryCreateTable); } @@ -27,14 +27,14 @@ public class ProtectedBlockSQLite extends ProtectedBlockJDBC + "worldName, x, z, y)"; @Override - protected PreparedStatement getStatementUpdateFrom2_0Table(Connection conn) throws SQLException + protected PreparedStatement getStatementUpdateFrom2_0Table(final Connection conn) throws SQLException { return conn.prepareStatement(QueryUpdateFrom2_0Table); } private static final String QueryDeleteAll = "DELETE FROM EssentialsProtect;"; @Override - protected PreparedStatement getStatementDeleteAll(Connection conn) throws SQLException + protected PreparedStatement getStatementDeleteAll(final Connection conn) throws SQLException { return conn.prepareStatement(QueryDeleteAll); } @@ -42,9 +42,10 @@ public class ProtectedBlockSQLite extends ProtectedBlockJDBC "INSERT INTO EssentialsProtect (worldName, x, y, z, playerName) VALUES (?, ?, ?, ?, ?);"; @Override - protected PreparedStatement getStatementInsert(Connection conn, String world, int x, int y, int z, String playerName) throws SQLException + protected PreparedStatement getStatementInsert(final Connection conn, final String world, + final int x, final int y, final int z, final String playerName) throws SQLException { - PreparedStatement ps = conn.prepareStatement(QueryInsert); + final PreparedStatement ps = conn.prepareStatement(QueryInsert); ps.setString(1, world); ps.setInt(2, x); ps.setInt(3, y); @@ -57,9 +58,10 @@ public class ProtectedBlockSQLite extends ProtectedBlockJDBC + "WHERE worldName = ? AND x = ? AND y = ? AND z = ? GROUP BY x;"; @Override - protected PreparedStatement getStatementPlayerCountByLocation(Connection conn, String world, int x, int y, int z, String playerName) throws SQLException + protected PreparedStatement getStatementPlayerCountByLocation(final Connection conn, final String world, + final int x, final int y, final int z, final String playerName) throws SQLException { - PreparedStatement ps = conn.prepareStatement(QueryPlayerCountByLocation); + final PreparedStatement ps = conn.prepareStatement(QueryPlayerCountByLocation); ps.setString(1, playerName); ps.setString(2, world); ps.setInt(3, x); @@ -71,9 +73,10 @@ public class ProtectedBlockSQLite extends ProtectedBlockJDBC "SELECT playerName FROM EssentialsProtect WHERE worldname = ? AND x = ? AND y = ? AND z = ?;"; @Override - protected PreparedStatement getStatementPlayersByLocation(Connection conn, String world, int x, int y, int z) throws SQLException + protected PreparedStatement getStatementPlayersByLocation(final Connection conn, final String world, + final int x, final int y, final int z) throws SQLException { - PreparedStatement ps = conn.prepareStatement(QueryPlayersByLocation); + final PreparedStatement ps = conn.prepareStatement(QueryPlayersByLocation); ps.setString(1, world); ps.setInt(2, x); ps.setInt(3, y); @@ -84,9 +87,10 @@ public class ProtectedBlockSQLite extends ProtectedBlockJDBC "DELETE FROM EssentialsProtect WHERE worldName = ? AND x = ? AND y = ? AND z = ?;"; @Override - protected PreparedStatement getStatementDeleteByLocation(Connection conn, String world, int x, int y, int z) throws SQLException + protected PreparedStatement getStatementDeleteByLocation(final Connection conn, final String world, + final int x, final int y, final int z) throws SQLException { - PreparedStatement ps = conn.prepareStatement(QueryDeleteByLocation); + final PreparedStatement ps = conn.prepareStatement(QueryDeleteByLocation); ps.setString(1, world); ps.setInt(2, x); ps.setInt(3, y); @@ -97,7 +101,7 @@ public class ProtectedBlockSQLite extends ProtectedBlockJDBC "SELECT worldName, x, y, z, playerName FROM EssentialsProtect;"; @Override - protected PreparedStatement getStatementAllBlocks(Connection conn) throws SQLException + protected PreparedStatement getStatementAllBlocks(final Connection conn) throws SQLException { return conn.prepareStatement(QueryAllBlocks); } diff --git a/EssentialsProtect/src/plugin.yml b/EssentialsProtect/src/plugin.yml index f87cdc7c7..1510a4fa1 100644 --- a/EssentialsProtect/src/plugin.yml +++ b/EssentialsProtect/src/plugin.yml @@ -1,9 +1,9 @@ # This determines the command prefix when there are conflicts (/name:home, /name:help, etc.) name: EssentialsProtect -main: com.earth2me.essentials.protect.EssentialsProtect +main: net.ess3.protect.EssentialsProtect # Note to developers: This next line cannot change, or the automatic versioning system will break. version: ${build.number} website: http://tiny.cc/EssentialsWiki description: Provides protection for various parts of the world. authors: [Zenexer, ementalo, Aelux, Brettflan, KimKandor, snowleo, ceulemans, Xeology, KHobbits] -softdepend: [Essentials3]
\ No newline at end of file +softdepend: [Essentials-3]
\ No newline at end of file diff --git a/EssentialsSigns/src/com/earth2me/essentials/signs/ISignsPlugin.java b/EssentialsSigns/src/com/earth2me/essentials/signs/ISignsPlugin.java deleted file mode 100644 index a7d8c24cb..000000000 --- a/EssentialsSigns/src/com/earth2me/essentials/signs/ISignsPlugin.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.earth2me.essentials.signs; - -import net.ess3.api.IEssentialsModule; - -public interface ISignsPlugin extends IEssentialsModule { - SignsConfigHolder getSettings(); -} diff --git a/EssentialsSigns/src/com/earth2me/essentials/signs/EssentialsSign.java b/EssentialsSigns/src/net/ess3/signs/EssentialsSign.java index 4992eb795..59c733981 100644 --- a/EssentialsSigns/src/com/earth2me/essentials/signs/EssentialsSign.java +++ b/EssentialsSigns/src/net/ess3/signs/EssentialsSign.java @@ -1,4 +1,8 @@ +<<<<<<< HEAD:EssentialsSigns/src/com/earth2me/essentials/signs/EssentialsSign.java package com.earth2me.essentials.signs; +======= +package net.ess3.signs; +>>>>>>> master:EssentialsSigns/src/net/ess3/signs/EssentialsSign.java import net.ess3.api.ChargeException; import static net.ess3.I18n._; @@ -22,12 +26,12 @@ public class EssentialsSign { private static final Set<Material> EMPTY_SET = new HashSet<Material>(); protected transient final String signName; - + public EssentialsSign(final String signName) { this.signName = signName; } - + public final boolean onSignCreate(final SignChangeEvent event, final IEssentials ess) { final ISign sign = new EventSign(event); @@ -59,22 +63,22 @@ public class EssentialsSign // Return true, so the player sees the wrong sign. return true; } - + public String getSuccessName() { return _("signFormatSuccess", this.signName); } - + public String getTemplateName() { return _("signFormatTemplate", this.signName); } - + private String getUsername(final IUser user) { return user.getName().substring(0, user.getName().length() > 13 ? 13 : user.getName().length()); } - + public final boolean onSignInteract(final Block block, final Player player, final IEssentials ess) { final ISign sign = new BlockSign(block); @@ -86,7 +90,7 @@ public class EssentialsSign } catch (ChargeException ex) { - ess.getCommandHandler().showCommandError(user,signName, ex); + ess.getCommandHandler().showCommandError(user, signName, ex); return false; } catch (SignException ex) @@ -95,7 +99,7 @@ public class EssentialsSign return false; } } - + public final boolean onSignBreak(final Block block, final Player player, final IEssentials ess) { final ISign sign = new BlockSign(block); @@ -111,25 +115,25 @@ public class EssentialsSign return false; } } - + protected boolean onSignCreate(final ISign sign, final IUser player, final String username, final IEssentials ess) throws SignException, ChargeException { return true; } - + protected boolean onSignInteract(final ISign sign, final IUser player, final String username, final IEssentials ess) throws SignException, ChargeException { return true; } - + protected boolean onSignBreak(final ISign sign, final IUser player, final String username, final IEssentials ess) throws SignException { return true; } - + public final boolean onBlockPlace(final Block block, final Player player, final IEssentials ess) { - IUser user = ess.getUser(player); + final IUser user = ess.getUser(player); try { return onBlockPlace(block, user, getUsername(user), ess); @@ -144,10 +148,10 @@ public class EssentialsSign } return false; } - + public final boolean onBlockInteract(final Block block, final Player player, final IEssentials ess) { - IUser user = ess.getUser(player); + final IUser user = ess.getUser(player); try { return onBlockInteract(block, user, getUsername(user), ess); @@ -162,10 +166,10 @@ public class EssentialsSign } return false; } - + public final boolean onBlockBreak(final Block block, final Player player, final IEssentials ess) { - IUser user = ess.getUser(player); + final IUser user = ess.getUser(player); try { return onBlockBreak(block, user, getUsername(user), ess); @@ -176,32 +180,32 @@ public class EssentialsSign } return false; } - + public boolean onBlockBreak(final Block block, final IEssentials ess) { return true; } - + public boolean onBlockExplode(final Block block, final IEssentials ess) { return true; } - + public boolean onBlockBurn(final Block block, final IEssentials ess) { return true; } - + public boolean onBlockIgnite(final Block block, final IEssentials ess) { return true; } - + public boolean onBlockPush(final Block block, final IEssentials ess) { return true; } - + public static boolean checkIfBlockBreaksSigns(final Block block) { final Block sign = block.getRelative(BlockFace.UP); @@ -230,32 +234,32 @@ public class EssentialsSign } return false; } - + public static boolean isValidSign(final ISign sign) { return sign.getLine(0).matches("ยง1\\[.*\\]"); } - + protected boolean onBlockPlace(final Block block, final IUser player, final String username, final IEssentials ess) throws SignException, ChargeException { return true; } - + protected boolean onBlockInteract(final Block block, final IUser player, final String username, final IEssentials ess) throws SignException, ChargeException { return true; } - + protected boolean onBlockBreak(final Block block, final IUser player, final String username, final IEssentials ess) throws SignException { return true; } - + public Set<Material> getBlocks() { return EMPTY_SET; } - + protected final void validateTrade(final ISign sign, final int index, final IEssentials ess) throws SignException { final String line = sign.getLine(index).trim(); @@ -270,7 +274,7 @@ public class EssentialsSign sign.setLine(index, Util.shortCurrency(money, ess)); } } - + protected final void validateTrade(final ISign sign, final int amountIndex, final int itemIndex, final IUser player, final IEssentials ess) throws SignException { @@ -286,7 +290,7 @@ public class EssentialsSign sign.setLine(amountIndex, Integer.toString(item.getAmount())); sign.setLine(itemIndex, sign.getLine(itemIndex).trim()); } - + protected final Trade getTrade(final ISign sign, final int amountIndex, final int itemIndex, final IUser player, final IEssentials ess) throws SignException { @@ -304,7 +308,7 @@ public class EssentialsSign item.setAmount(amount); return new Trade(item, ess); } - + protected final void validateInteger(final ISign sign, final int index) throws SignException { final String line = sign.getLine(index).trim(); @@ -315,7 +319,7 @@ public class EssentialsSign final int quantity = getIntegerPositive(line); sign.setLine(index, Integer.toString(quantity)); } - + protected final int getIntegerPositive(final String line) throws SignException { final int quantity = getInteger(line); @@ -325,13 +329,13 @@ public class EssentialsSign } return quantity; } - + protected final int getInteger(final String line) throws SignException { try { final int quantity = Integer.parseInt(line); - + return quantity; } catch (NumberFormatException ex) @@ -339,7 +343,7 @@ public class EssentialsSign throw new SignException("Invalid sign", ex); } } - + protected final ItemStack getItemStack(final String itemName, final int quantity, final IEssentials ess) throws SignException { try @@ -353,13 +357,13 @@ public class EssentialsSign throw new SignException(ex.getMessage(), ex); } } - + protected final Double getMoney(final String line) throws SignException { final boolean isMoney = line.matches("^[^0-9-\\.][\\.0-9]+$"); return isMoney ? getDoublePositive(line.substring(1)) : null; } - + protected final Double getDoublePositive(final String line) throws SignException { final double quantity = getDouble(line); @@ -369,7 +373,7 @@ public class EssentialsSign } return quantity; } - + protected final Double getDouble(final String line) throws SignException { try @@ -381,12 +385,12 @@ public class EssentialsSign throw new SignException(ex.getMessage(), ex); } } - + protected final Trade getTrade(final ISign sign, final int index, final IEssentials ess) throws SignException { return getTrade(sign, index, 1, ess); } - + protected final Trade getTrade(final ISign sign, final int index, final int decrement, final IEssentials ess) throws SignException { final String line = sign.getLine(index).trim(); @@ -394,7 +398,7 @@ public class EssentialsSign { return new Trade(signName.toLowerCase(Locale.ENGLISH) + "sign", ess); } - + final Double money = getMoney(line); if (money == null) { @@ -404,7 +408,7 @@ public class EssentialsSign throw new SignException(_("invalidCharge")); } final int quantity = getIntegerPositive(split[0]); - + final String item = split[1].toLowerCase(Locale.ENGLISH); if (item.equalsIgnoreCase("times")) { @@ -428,89 +432,89 @@ public class EssentialsSign return new Trade(money, ess); } } - - + + static class EventSign implements ISign { private final transient SignChangeEvent event; private final transient Block block; - + public EventSign(final SignChangeEvent event) { this.event = event; this.block = event.getBlock(); } - + @Override public final String getLine(final int index) { return event.getLine(index); } - + @Override public final void setLine(final int index, final String text) { event.setLine(index, text); } - + @Override public Block getBlock() { return block; } - + @Override public void updateSign() { } } - - + + static class BlockSign implements ISign { private final transient Sign sign; private final transient Block block; - + public BlockSign(final Block block) { this.block = block; this.sign = (Sign)block.getState(); } - + @Override public final String getLine(final int index) { return sign.getLine(index); } - + @Override public final void setLine(final int index, final String text) { sign.setLine(index, text); } - + @Override public final Block getBlock() { return block; } - + @Override public final void updateSign() { sign.update(); } } - - + + public interface ISign { String getLine(final int index); - + void setLine(final int index, final String text); - + public Block getBlock(); - + void updateSign(); } } diff --git a/EssentialsSigns/src/com/earth2me/essentials/signs/EssentialsSignsPlugin.java b/EssentialsSigns/src/net/ess3/signs/EssentialsSignsPlugin.java index f0e33f9cd..d2f615d52 100644 --- a/EssentialsSigns/src/com/earth2me/essentials/signs/EssentialsSignsPlugin.java +++ b/EssentialsSigns/src/net/ess3/signs/EssentialsSignsPlugin.java @@ -1,4 +1,4 @@ -package com.earth2me.essentials.signs; +package net.ess3.signs; import static net.ess3.I18n._; import net.ess3.api.IEssentials; @@ -12,14 +12,13 @@ import org.bukkit.plugin.java.JavaPlugin; public class EssentialsSignsPlugin extends JavaPlugin implements ISignsPlugin { private static final transient Logger LOGGER = Bukkit.getLogger(); - private transient IEssentials ess; private transient SignsConfigHolder config; @Override public void onEnable() { final PluginManager pluginManager = getServer().getPluginManager(); - ess = (IEssentials)pluginManager.getPlugin("Essentials3"); + final IEssentials ess = (IEssentials)pluginManager.getPlugin("Essentials-3"); if (!this.getDescription().getVersion().equals(ess.getDescription().getVersion())) { LOGGER.log(Level.WARNING, _("versionMismatchAll")); @@ -38,8 +37,8 @@ public class EssentialsSignsPlugin extends JavaPlugin implements ISignsPlugin final SignEntityListener signEntityListener = new SignEntityListener(ess, this); pluginManager.registerEvents(signEntityListener, this); - - config = new SignsConfigHolder(ess, this); + + config = new SignsConfigHolder(ess, this); } @Override diff --git a/EssentialsSigns/src/net/ess3/signs/ISignsPlugin.java b/EssentialsSigns/src/net/ess3/signs/ISignsPlugin.java new file mode 100644 index 000000000..9a6d14a61 --- /dev/null +++ b/EssentialsSigns/src/net/ess3/signs/ISignsPlugin.java @@ -0,0 +1,9 @@ +package net.ess3.signs; + +import net.ess3.api.IEssentialsModule; + + +public interface ISignsPlugin extends IEssentialsModule +{ + SignsConfigHolder getSettings(); +} diff --git a/EssentialsSigns/src/com/earth2me/essentials/signs/SignBalance.java b/EssentialsSigns/src/net/ess3/signs/SignBalance.java index 52fdbb336..35a1648ae 100644 --- a/EssentialsSigns/src/com/earth2me/essentials/signs/SignBalance.java +++ b/EssentialsSigns/src/net/ess3/signs/SignBalance.java @@ -1,8 +1,9 @@ -package com.earth2me.essentials.signs; +package net.ess3.signs; import static net.ess3.I18n._; import net.ess3.api.IEssentials; import net.ess3.api.IUser; +import net.ess3.utils.Util; public class SignBalance extends EssentialsSign @@ -15,7 +16,7 @@ public class SignBalance extends EssentialsSign @Override protected boolean onSignInteract(final ISign sign, final IUser player, final String username, final IEssentials ess) throws SignException { - player.sendMessage(_("balance", player.getMoney())); + player.sendMessage(_("balance", Util.displayCurrency(player.getMoney(), ess))); return true; } } diff --git a/EssentialsSigns/src/com/earth2me/essentials/signs/SignBlockListener.java b/EssentialsSigns/src/net/ess3/signs/SignBlockListener.java index 3d9315249..31cdfc970 100644 --- a/EssentialsSigns/src/com/earth2me/essentials/signs/SignBlockListener.java +++ b/EssentialsSigns/src/net/ess3/signs/SignBlockListener.java @@ -1,7 +1,9 @@ -package com.earth2me.essentials.signs; +package net.ess3.signs; import net.ess3.api.IEssentials; +import net.ess3.api.ISettings; import net.ess3.api.IUser; +import net.ess3.utils.Util; import java.util.logging.Level; import java.util.logging.Logger; import org.bukkit.Material; @@ -19,6 +21,8 @@ public class SignBlockListener implements Listener private final transient IEssentials ess; private final transient ISignsPlugin plugin; private final static Logger LOGGER = Logger.getLogger("Minecraft"); + private final static int WALL_SIGN = Material.WALL_SIGN.getId(); + private final static int SIGN_POST = Material.SIGN_POST.getId(); public SignBlockListener(final IEssentials ess, final ISignsPlugin plugin) { @@ -26,10 +30,12 @@ public class SignBlockListener implements Listener this.plugin = plugin; } - @EventHandler(priority = EventPriority.HIGHEST) + @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onBlockBreak(final BlockBreakEvent event) { - if (event.isCancelled()) + ISettings settings = ess.getSettings(); + settings.acquireReadLock(); + if (plugin.getSettings().areSignsDisabled()) { return; } @@ -43,7 +49,7 @@ public class SignBlockListener implements Listener public boolean protectSignsAndBlocks(final Block block, final Player player) { final int mat = block.getTypeId(); - if (mat == Material.SIGN_POST.getId() || mat == Material.WALL_SIGN.getId()) + if (mat == SIGN_POST || mat == WALL_SIGN) { final Sign csign = (Sign)block.getState(); @@ -56,15 +62,13 @@ public class SignBlockListener implements Listener } } } - else + // prevent any signs be broken by destroying the block they are attached to + if (EssentialsSign.checkIfBlockBreaksSigns(block)) { - // prevent any signs be broken by destroying the block they are attached to - if (EssentialsSign.checkIfBlockBreaksSigns(block)) - { - LOGGER.log(Level.INFO, "Prevented that a block was broken next to a sign."); - return true; - } - for (EssentialsSign sign : plugin.getSettings().getEnabledSigns()) + LOGGER.log(Level.INFO, "Prevented that a block was broken next to a sign."); + return true; + } + for (EssentialsSign sign : plugin.getSettings().getEnabledSigns()) { if (sign.getBlocks().contains(block.getType()) && !sign.onBlockBreak(block, player, ess)) @@ -72,26 +76,24 @@ public class SignBlockListener implements Listener LOGGER.log(Level.INFO, "A block was protected by a sign."); return true; } - } - } + } return false; } - @EventHandler(priority = EventPriority.HIGHEST) + @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onSignChange(final SignChangeEvent event) { - if (event.isCancelled()) + if (plugin.getSettings().areSignsDisabled()) { return; } IUser user = ess.getUser(event.getPlayer()); - if (SignsPermissions.COLOR.isAuthorized(user)) + + for (int i = 0; i < 4; i++) { - for (int i = 0; i < 4; i++) - { - event.setLine(i, event.getLine(i).replaceAll("&([0-9a-f])", "ยง$1")); - } + event.setLine(i, Util.formatString(user, "essentials.signs", event.getLine(i))); } + for (Signs signs : Signs.values()) { final EssentialsSign sign = signs.getSign(); @@ -109,25 +111,25 @@ public class SignBlockListener implements Listener } } - @EventHandler(priority = EventPriority.LOW) + @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) public void onBlockPlace(final BlockPlaceEvent event) { - if (event.isCancelled()) + if (plugin.getSettings().areSignsDisabled()) { return; } final Block against = event.getBlockAgainst(); - if ((against.getType() == Material.WALL_SIGN - || against.getType() == Material.SIGN_POST) + if ((against.getTypeId() == WALL_SIGN + || against.getTypeId() == SIGN_POST) && EssentialsSign.isValidSign(new EssentialsSign.BlockSign(against))) { event.setCancelled(true); return; } final Block block = event.getBlock(); - if (block.getType() == Material.WALL_SIGN - || block.getType() == Material.SIGN_POST) + if (block.getTypeId() == WALL_SIGN + || block.getTypeId() == SIGN_POST) { return; } @@ -143,17 +145,17 @@ public class SignBlockListener implements Listener } } - @EventHandler(priority = EventPriority.LOW) + @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) public void onBlockBurn(final BlockBurnEvent event) { - if (event.isCancelled()) + if (plugin.getSettings().areSignsDisabled()) { return; } final Block block = event.getBlock(); - if (((block.getType() == Material.WALL_SIGN - || block.getType() == Material.SIGN_POST) + if (((block.getTypeId() == WALL_SIGN + || block.getTypeId() == SIGN_POST) && EssentialsSign.isValidSign(new EssentialsSign.BlockSign(block))) || EssentialsSign.checkIfBlockBreaksSigns(block)) { @@ -171,17 +173,17 @@ public class SignBlockListener implements Listener } } - @EventHandler(priority = EventPriority.LOW) + @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) public void onBlockIgnite(final BlockIgniteEvent event) { - if (event.isCancelled()) + if (plugin.getSettings().areSignsDisabled()) { return; } final Block block = event.getBlock(); - if (((block.getType() == Material.WALL_SIGN - || block.getType() == Material.SIGN_POST) + if (((block.getTypeId() == WALL_SIGN + || block.getTypeId() == SIGN_POST) && EssentialsSign.isValidSign(new EssentialsSign.BlockSign(block))) || EssentialsSign.checkIfBlockBreaksSigns(block)) { @@ -202,10 +204,15 @@ public class SignBlockListener implements Listener @EventHandler(priority = EventPriority.LOW) public void onBlockPistonExtend(final BlockPistonExtendEvent event) { + if (plugin.getSettings().areSignsDisabled()) + { + return; + } + for (Block block : event.getBlocks()) { - if (((block.getType() == Material.WALL_SIGN - || block.getType() == Material.SIGN_POST) + if (((block.getTypeId() == WALL_SIGN + || block.getTypeId() == SIGN_POST) && EssentialsSign.isValidSign(new EssentialsSign.BlockSign(block))) || EssentialsSign.checkIfBlockBreaksSigns(block)) { @@ -227,11 +234,16 @@ public class SignBlockListener implements Listener @EventHandler(priority = EventPriority.LOW) public void onBlockPistonRetract(final BlockPistonRetractEvent event) { + if (plugin.getSettings().areSignsDisabled()) + { + return; + } + if (event.isSticky()) { final Block block = event.getBlock(); - if (((block.getType() == Material.WALL_SIGN - || block.getType() == Material.SIGN_POST) + if (((block.getTypeId() == WALL_SIGN + || block.getTypeId() == SIGN_POST) && EssentialsSign.isValidSign(new EssentialsSign.BlockSign(block))) || EssentialsSign.checkIfBlockBreaksSigns(block)) { diff --git a/EssentialsSigns/src/com/earth2me/essentials/signs/SignBuy.java b/EssentialsSigns/src/net/ess3/signs/SignBuy.java index 252ac76cf..ff08cdbc1 100644 --- a/EssentialsSigns/src/com/earth2me/essentials/signs/SignBuy.java +++ b/EssentialsSigns/src/net/ess3/signs/SignBuy.java @@ -1,9 +1,9 @@ -package com.earth2me.essentials.signs; +package net.ess3.signs; import net.ess3.api.ChargeException; -import net.ess3.economy.Trade; import net.ess3.api.IEssentials; import net.ess3.api.IUser; +import net.ess3.economy.Trade; public class SignBuy extends EssentialsSign diff --git a/EssentialsSigns/src/com/earth2me/essentials/signs/SignDisposal.java b/EssentialsSigns/src/net/ess3/signs/SignDisposal.java index f56a2ede6..01775e18c 100644 --- a/EssentialsSigns/src/com/earth2me/essentials/signs/SignDisposal.java +++ b/EssentialsSigns/src/net/ess3/signs/SignDisposal.java @@ -1,4 +1,4 @@ -package com.earth2me.essentials.signs; +package net.ess3.signs; import net.ess3.api.IEssentials; import net.ess3.api.IUser; diff --git a/EssentialsSigns/src/com/earth2me/essentials/signs/SignEnchant.java b/EssentialsSigns/src/net/ess3/signs/SignEnchant.java index 6463ab5de..6004d9f38 100644 --- a/EssentialsSigns/src/com/earth2me/essentials/signs/SignEnchant.java +++ b/EssentialsSigns/src/net/ess3/signs/SignEnchant.java @@ -1,11 +1,11 @@ -package com.earth2me.essentials.signs; +package net.ess3.signs; -import net.ess3.api.ChargeException; -import net.ess3.bukkit.Enchantments; import static net.ess3.I18n._; -import net.ess3.economy.Trade; +import net.ess3.api.ChargeException; import net.ess3.api.IEssentials; import net.ess3.api.IUser; +import net.ess3.bukkit.Enchantments; +import net.ess3.economy.Trade; import java.util.Locale; import org.bukkit.enchantments.Enchantment; import org.bukkit.inventory.ItemStack; @@ -39,7 +39,7 @@ public class SignEnchant extends EssentialsSign } catch (NumberFormatException ex) { - throw new SignException(ex.getMessage()); + throw new SignException(ex.getMessage(), ex); } if (level < 1 || level > enchantment.getMaxLevel()) { @@ -55,7 +55,7 @@ public class SignEnchant extends EssentialsSign } catch (Throwable ex) { - throw new SignException(ex.getMessage()); + throw new SignException(ex.getMessage(), ex); } getTrade(sign, 3, ess); return true; diff --git a/EssentialsSigns/src/com/earth2me/essentials/signs/SignEntityListener.java b/EssentialsSigns/src/net/ess3/signs/SignEntityListener.java index 077c54813..1c316478d 100644 --- a/EssentialsSigns/src/com/earth2me/essentials/signs/SignEntityListener.java +++ b/EssentialsSigns/src/net/ess3/signs/SignEntityListener.java @@ -1,4 +1,4 @@ -package com.earth2me.essentials.signs; +package net.ess3.signs; import net.ess3.api.IEssentials; import org.bukkit.Material; @@ -24,10 +24,15 @@ public class SignEntityListener implements Listener @EventHandler(priority = EventPriority.LOW) public void onEntityExplode(final EntityExplodeEvent event) { + if (plugin.getSettings().areSignsDisabled()) + { + return; + } + for (Block block : event.blockList()) { - if (((block.getType() == Material.WALL_SIGN - || block.getType() == Material.SIGN_POST) + if (((block.getTypeId() == Material.WALL_SIGN.getId() + || block.getTypeId() == Material.SIGN_POST.getId()) && EssentialsSign.isValidSign(new EssentialsSign.BlockSign(block))) || EssentialsSign.checkIfBlockBreaksSigns(block)) { @@ -45,17 +50,17 @@ public class SignEntityListener implements Listener } } - @EventHandler(priority = EventPriority.LOW) + @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) public void onEntityChangeBlock(final EntityChangeBlockEvent event) { - if (event.isCancelled()) + if (plugin.getSettings().areSignsDisabled()) { return; } final Block block = event.getBlock(); - if (((block.getType() == Material.WALL_SIGN - || block.getType() == Material.SIGN_POST) + if (((block.getTypeId() == Material.WALL_SIGN.getId() + || block.getTypeId() == Material.SIGN_POST.getId()) && EssentialsSign.isValidSign(new EssentialsSign.BlockSign(block))) || EssentialsSign.checkIfBlockBreaksSigns(block)) { diff --git a/EssentialsSigns/src/com/earth2me/essentials/signs/SignException.java b/EssentialsSigns/src/net/ess3/signs/SignException.java index 9c9ab44a2..7ca73e4e5 100644 --- a/EssentialsSigns/src/com/earth2me/essentials/signs/SignException.java +++ b/EssentialsSigns/src/net/ess3/signs/SignException.java @@ -1,4 +1,4 @@ -package com.earth2me.essentials.signs; +package net.ess3.signs; public class SignException extends Exception diff --git a/EssentialsSigns/src/com/earth2me/essentials/signs/SignFree.java b/EssentialsSigns/src/net/ess3/signs/SignFree.java index a96045a2f..2cf049346 100644 --- a/EssentialsSigns/src/com/earth2me/essentials/signs/SignFree.java +++ b/EssentialsSigns/src/net/ess3/signs/SignFree.java @@ -1,10 +1,10 @@ -package com.earth2me.essentials.signs; +package net.ess3.signs; import static net.ess3.I18n._; -import net.ess3.economy.Trade; import net.ess3.api.IEssentials; import net.ess3.api.IUser; import net.ess3.craftbukkit.InventoryWorkaround; +import net.ess3.economy.Trade; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; diff --git a/EssentialsSigns/src/com/earth2me/essentials/signs/SignGameMode.java b/EssentialsSigns/src/net/ess3/signs/SignGameMode.java index 217d8da77..a8ef5a881 100644 --- a/EssentialsSigns/src/com/earth2me/essentials/signs/SignGameMode.java +++ b/EssentialsSigns/src/net/ess3/signs/SignGameMode.java @@ -1,10 +1,10 @@ -package com.earth2me.essentials.signs; +package net.ess3.signs; -import net.ess3.api.ChargeException; import static net.ess3.I18n._; -import net.ess3.economy.Trade; +import net.ess3.api.ChargeException; import net.ess3.api.IEssentials; import net.ess3.api.IUser; +import net.ess3.economy.Trade; import java.util.Locale; import org.bukkit.GameMode; diff --git a/EssentialsSigns/src/com/earth2me/essentials/signs/SignHeal.java b/EssentialsSigns/src/net/ess3/signs/SignHeal.java index 09f1f9cc7..787e7b166 100644 --- a/EssentialsSigns/src/com/earth2me/essentials/signs/SignHeal.java +++ b/EssentialsSigns/src/net/ess3/signs/SignHeal.java @@ -1,10 +1,10 @@ -package com.earth2me.essentials.signs; +package net.ess3.signs; -import net.ess3.api.ChargeException; import static net.ess3.I18n._; -import net.ess3.economy.Trade; +import net.ess3.api.ChargeException; import net.ess3.api.IEssentials; import net.ess3.api.IUser; +import net.ess3.economy.Trade; public class SignHeal extends EssentialsSign diff --git a/EssentialsSigns/src/com/earth2me/essentials/signs/SignKit.java b/EssentialsSigns/src/net/ess3/signs/SignKit.java index 6270baf8f..9c478ccad 100644 --- a/EssentialsSigns/src/com/earth2me/essentials/signs/SignKit.java +++ b/EssentialsSigns/src/net/ess3/signs/SignKit.java @@ -1,4 +1,4 @@ -package com.earth2me.essentials.signs; +package net.ess3.signs; import net.ess3.api.ChargeException; import net.ess3.economy.Trade; @@ -32,7 +32,7 @@ public class SignKit extends EssentialsSign { try { - ess.getKits().getKit(kitName); + ess.getKits().getKit(kitName); } catch (Exception ex) { @@ -58,11 +58,10 @@ public class SignKit extends EssentialsSign final Trade charge = getTrade(sign, 3, ess); charge.isAffordableFor(player); try - { - final Kit kit = ess.getKits().getKit(kitName); + {; + final Kit kit = ess.getKits().getKit(kitName); + ess.getKits().checkTime(player, kit); ess.getKits().sendKit(player, kit); - - //TODO: Implement Kits from 2.9 charge.charge(player); } catch (Exception ex) diff --git a/EssentialsSigns/src/com/earth2me/essentials/signs/SignMail.java b/EssentialsSigns/src/net/ess3/signs/SignMail.java index 483964bf2..6acf14bb1 100644 --- a/EssentialsSigns/src/com/earth2me/essentials/signs/SignMail.java +++ b/EssentialsSigns/src/net/ess3/signs/SignMail.java @@ -1,4 +1,4 @@ -package com.earth2me.essentials.signs; +package net.ess3.signs; import static net.ess3.I18n._; import net.ess3.api.IEssentials; diff --git a/EssentialsSigns/src/com/earth2me/essentials/signs/SignPlayerListener.java b/EssentialsSigns/src/net/ess3/signs/SignPlayerListener.java index 4dd8db93f..eabf5423b 100644 --- a/EssentialsSigns/src/com/earth2me/essentials/signs/SignPlayerListener.java +++ b/EssentialsSigns/src/net/ess3/signs/SignPlayerListener.java @@ -1,4 +1,4 @@ -package com.earth2me.essentials.signs; +package net.ess3.signs; import net.ess3.api.IEssentials; import org.bukkit.Material; @@ -22,26 +22,22 @@ public class SignPlayerListener implements Listener this.plugin = plugin; } - @EventHandler(priority = EventPriority.LOW) + @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) public void onPlayerInteract(final PlayerInteractEvent event) { - if (event.isCancelled()) + if (plugin.getSettings().areSignsDisabled() || event.getAction() != Action.RIGHT_CLICK_BLOCK) { return; } - final Block block = event.getClickedBlock(); if (block == null) { return; } + final int mat = block.getTypeId(); if (mat == Material.SIGN_POST.getId() || mat == Material.WALL_SIGN.getId()) { - if (event.getAction() != Action.RIGHT_CLICK_BLOCK) - { - return; - } final Sign csign = (Sign)block.getState(); for (EssentialsSign sign : plugin.getSettings().getEnabledSigns()) { @@ -62,7 +58,6 @@ public class SignPlayerListener implements Listener { event.setCancelled(true); return; - } } } diff --git a/EssentialsSigns/src/com/earth2me/essentials/signs/SignProtection.java b/EssentialsSigns/src/net/ess3/signs/SignProtection.java index 7986e5ca2..e87002fd4 100644 --- a/EssentialsSigns/src/com/earth2me/essentials/signs/SignProtection.java +++ b/EssentialsSigns/src/net/ess3/signs/SignProtection.java @@ -1,11 +1,11 @@ -package com.earth2me.essentials.signs; +package net.ess3.signs; -import net.ess3.api.ChargeException; import static net.ess3.I18n._; -import net.ess3.economy.Trade; -import net.ess3.utils.Util; +import net.ess3.api.ChargeException; import net.ess3.api.IEssentials; import net.ess3.api.IUser; +import net.ess3.economy.Trade; +import net.ess3.utils.Util; import java.util.*; import org.bukkit.Location; import org.bukkit.Material; @@ -147,7 +147,7 @@ public class SignProtection extends EssentialsSign { return SignProtectionState.OWNER; } - if (Util.stripColor(sign.getLine(3)).equalsIgnoreCase(username)) + if (Util.stripFormat(sign.getLine(3)).equalsIgnoreCase(username)) { return SignProtectionState.OWNER; } diff --git a/EssentialsSigns/src/com/earth2me/essentials/signs/SignSell.java b/EssentialsSigns/src/net/ess3/signs/SignSell.java index 8b1eac2c8..9a48e4948 100644 --- a/EssentialsSigns/src/com/earth2me/essentials/signs/SignSell.java +++ b/EssentialsSigns/src/net/ess3/signs/SignSell.java @@ -1,9 +1,9 @@ -package com.earth2me.essentials.signs; +package net.ess3.signs; import net.ess3.api.ChargeException; -import net.ess3.economy.Trade; import net.ess3.api.IEssentials; import net.ess3.api.IUser; +import net.ess3.economy.Trade; public class SignSell extends EssentialsSign diff --git a/EssentialsSigns/src/com/earth2me/essentials/signs/SignSpawnmob.java b/EssentialsSigns/src/net/ess3/signs/SignSpawnmob.java index 057614372..47961a96e 100644 --- a/EssentialsSigns/src/com/earth2me/essentials/signs/SignSpawnmob.java +++ b/EssentialsSigns/src/net/ess3/signs/SignSpawnmob.java @@ -1,10 +1,10 @@ -package com.earth2me.essentials.signs; +package net.ess3.signs; import net.ess3.api.ChargeException; -import net.ess3.economy.Trade; import net.ess3.api.IEssentials; import net.ess3.api.IUser; import net.ess3.commands.Commandspawnmob; +import net.ess3.economy.Trade; public class SignSpawnmob extends EssentialsSign @@ -22,14 +22,13 @@ public class SignSpawnmob extends EssentialsSign return true; } - //TODO: This should call a method not a command @Override protected boolean onSignInteract(ISign sign, IUser player, String username, IEssentials ess) throws SignException, ChargeException { final Trade charge = getTrade(sign, 3, ess); charge.isAffordableFor(player); - Commandspawnmob command = new Commandspawnmob(); + Commandspawnmob command = new Commandspawnmob(); command.init(ess, "spawnmob"); String[] args = new String[] { diff --git a/EssentialsSigns/src/com/earth2me/essentials/signs/SignTime.java b/EssentialsSigns/src/net/ess3/signs/SignTime.java index 6f56ba51e..8ef98a4d5 100644 --- a/EssentialsSigns/src/com/earth2me/essentials/signs/SignTime.java +++ b/EssentialsSigns/src/net/ess3/signs/SignTime.java @@ -1,10 +1,10 @@ -package com.earth2me.essentials.signs; +package net.ess3.signs; -import net.ess3.api.ChargeException; import static net.ess3.I18n._; -import net.ess3.economy.Trade; +import net.ess3.api.ChargeException; import net.ess3.api.IEssentials; import net.ess3.api.IUser; +import net.ess3.economy.Trade; public class SignTime extends EssentialsSign diff --git a/EssentialsSigns/src/com/earth2me/essentials/signs/SignTrade.java b/EssentialsSigns/src/net/ess3/signs/SignTrade.java index 15296ecc9..c3e78e226 100644 --- a/EssentialsSigns/src/com/earth2me/essentials/signs/SignTrade.java +++ b/EssentialsSigns/src/net/ess3/signs/SignTrade.java @@ -1,4 +1,4 @@ -package com.earth2me.essentials.signs; +package net.ess3.signs; import net.ess3.api.ChargeException; import static net.ess3.I18n._; @@ -228,7 +228,7 @@ public class SignTrade extends EssentialsSign } catch (SignException e) { - throw new SignException(_("tradeSignEmpty")); + throw new SignException(_("tradeSignEmpty"), e); } } diff --git a/EssentialsSigns/src/com/earth2me/essentials/signs/SignWarp.java b/EssentialsSigns/src/net/ess3/signs/SignWarp.java index a69c2ce8e..b6dc95d0f 100644 --- a/EssentialsSigns/src/com/earth2me/essentials/signs/SignWarp.java +++ b/EssentialsSigns/src/net/ess3/signs/SignWarp.java @@ -1,9 +1,9 @@ -package com.earth2me.essentials.signs; +package net.ess3.signs; import net.ess3.api.ChargeException; -import net.ess3.economy.Trade; import net.ess3.api.IEssentials; import net.ess3.api.IUser; +import net.ess3.economy.Trade; import net.ess3.permissions.WarpPermissions; import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; diff --git a/EssentialsSigns/src/com/earth2me/essentials/signs/SignWeather.java b/EssentialsSigns/src/net/ess3/signs/SignWeather.java index 17d28c195..94217aeec 100644 --- a/EssentialsSigns/src/com/earth2me/essentials/signs/SignWeather.java +++ b/EssentialsSigns/src/net/ess3/signs/SignWeather.java @@ -1,10 +1,10 @@ -package com.earth2me.essentials.signs; +package net.ess3.signs; -import net.ess3.api.ChargeException; import static net.ess3.I18n._; -import net.ess3.economy.Trade; +import net.ess3.api.ChargeException; import net.ess3.api.IEssentials; import net.ess3.api.IUser; +import net.ess3.economy.Trade; public class SignWeather extends EssentialsSign diff --git a/EssentialsSigns/src/com/earth2me/essentials/signs/Signs.java b/EssentialsSigns/src/net/ess3/signs/Signs.java index e29d45ad4..af4111dac 100644 --- a/EssentialsSigns/src/com/earth2me/essentials/signs/Signs.java +++ b/EssentialsSigns/src/net/ess3/signs/Signs.java @@ -1,4 +1,4 @@ -package com.earth2me.essentials.signs; +package net.ess3.signs; public enum Signs diff --git a/EssentialsSigns/src/com/earth2me/essentials/signs/SignsConfig.java b/EssentialsSigns/src/net/ess3/signs/SignsConfig.java index d8113e36d..70b606962 100644 --- a/EssentialsSigns/src/com/earth2me/essentials/signs/SignsConfig.java +++ b/EssentialsSigns/src/net/ess3/signs/SignsConfig.java @@ -1,10 +1,12 @@ -package com.earth2me.essentials.signs; +package net.ess3.signs; import net.ess3.storage.StorageObject; import java.util.HashMap; import java.util.Map; -public class SignsConfig implements StorageObject { + +public class SignsConfig implements StorageObject +{ private Map<String, Boolean> signs = new HashMap<String, Boolean>(); public Map<String, Boolean> getSigns() @@ -12,7 +14,7 @@ public class SignsConfig implements StorageObject { return signs; } - public void setSigns(Map<String, Boolean> signs) + public void setSigns(final Map<String, Boolean> signs) { this.signs = signs; } diff --git a/EssentialsSigns/src/com/earth2me/essentials/signs/SignsConfigHolder.java b/EssentialsSigns/src/net/ess3/signs/SignsConfigHolder.java index 274c2a1be..fce56906d 100644 --- a/EssentialsSigns/src/com/earth2me/essentials/signs/SignsConfigHolder.java +++ b/EssentialsSigns/src/net/ess3/signs/SignsConfigHolder.java @@ -1,4 +1,4 @@ -package com.earth2me.essentials.signs; +package net.ess3.signs; import net.ess3.api.IEssentials; import net.ess3.storage.AsyncStorageObjectHolder; @@ -10,8 +10,9 @@ import org.bukkit.plugin.Plugin; public class SignsConfigHolder extends AsyncStorageObjectHolder<SignsConfig> { - private final Plugin plugin; + private final transient Plugin plugin; private Set<EssentialsSign> enabledSigns = new HashSet<EssentialsSign>(); + private boolean signsEnabled = false; public SignsConfigHolder(final IEssentials ess, final Plugin plugin) { @@ -21,14 +22,20 @@ public class SignsConfigHolder extends AsyncStorageObjectHolder<SignsConfig> acquireReadLock(); try { - Map<String, Boolean> signs = getData().getSigns(); + final Map<String, Boolean> signs = getData().getSigns(); for (Map.Entry<String, Boolean> entry : signs.entrySet()) { - Signs sign = Signs.valueOf(entry.getKey().toUpperCase(Locale.ENGLISH)); + if (entry.getKey().trim().toUpperCase(Locale.ENGLISH).equals("COLOR") || entry.getKey().trim().toUpperCase(Locale.ENGLISH).equals("COLOUR")) + { + signsEnabled = true; + continue; + } + final Signs sign = Signs.valueOf(entry.getKey().toUpperCase(Locale.ENGLISH)); if (sign != null && entry.getValue()) { enabledSigns.add(sign.getSign()); - } + signsEnabled = true; + } } } finally @@ -38,7 +45,7 @@ public class SignsConfigHolder extends AsyncStorageObjectHolder<SignsConfig> acquireWriteLock(); try { - Map<String, Boolean> signs = new HashMap<String, Boolean>(); + final Map<String, Boolean> signs = new HashMap<String, Boolean>(); for (Signs sign : Signs.values()) { signs.put(sign.toString(), enabledSigns.contains(sign.getSign())); @@ -61,4 +68,19 @@ public class SignsConfigHolder extends AsyncStorageObjectHolder<SignsConfig> { return enabledSigns; } + + public boolean areSignsDisabled() + { + return !signsEnabled; + } + + @Override + public void finishRead() + { + } + + @Override + public void finishWrite() + { + } } diff --git a/EssentialsSigns/src/com/earth2me/essentials/signs/SignsPermissions.java b/EssentialsSigns/src/net/ess3/signs/SignsPermissions.java index b27eb3c45..21c736b7d 100644 --- a/EssentialsSigns/src/com/earth2me/essentials/signs/SignsPermissions.java +++ b/EssentialsSigns/src/net/ess3/signs/SignsPermissions.java @@ -1,4 +1,4 @@ -package com.earth2me.essentials.signs; +package net.ess3.signs; import net.ess3.api.IPermission; import net.ess3.permissions.BasePermission; diff --git a/EssentialsSigns/src/plugin.yml b/EssentialsSigns/src/plugin.yml index 7f0bda1a2..a58338c86 100644 --- a/EssentialsSigns/src/plugin.yml +++ b/EssentialsSigns/src/plugin.yml @@ -1,9 +1,9 @@ # This determines the command prefix when there are conflicts (/name:home, /name:help, etc.) name: EssentialsSigns -main: com.earth2me.essentials.signs.EssentialsSignsPlugin +main: net.ess3.signs.EssentialsSignsPlugin # Note to developers: This next line cannot change, or the automatic versioning system will break. version: ${build.number} website: http://tiny.cc/EssentialsWiki description: Provides signs, utilizing Essentials. authors: [Zenexer, ementalo, Aelux, Brettflan, KimKandor, snowleo, ceulemans, Xeology, KHobbits] -depend: [Essentials3]
\ No newline at end of file +depend: [Essentials-3]
\ No newline at end of file diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/states/EssentialsSpawn.java b/EssentialsUpdate/src/com/earth2me/essentials/update/states/EssentialsSpawn.java deleted file mode 100644 index 2a87638ba..000000000 --- a/EssentialsUpdate/src/com/earth2me/essentials/update/states/EssentialsSpawn.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.earth2me.essentials.update.states; - -import com.earth2me.essentials.update.AbstractWorkListener; -import com.earth2me.essentials.update.tasks.InstallModule; -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; -import org.bukkit.plugin.Plugin; - - -public class EssentialsSpawn extends AbstractYesNoState -{ - public EssentialsSpawn(final StateMap states) - { - super(states, null); - } - - @Override - public boolean guessAnswer() - { - final Plugin plugin = Bukkit.getPluginManager().getPlugin("EssentialsSpawn"); - if (plugin != null) - { - setAnswer(true); - return true; - } - return false; - } - - @Override - public void askQuestion(final Player sender) - { - sender.sendMessage("Do you want to install EssentialsSpawn? (yes/no)"); - sender.sendMessage("EssentialsSpawn lets you control player spawning"); - sender.sendMessage("It allows you to set different places where players spawn on death, new players join and allows players to return to spawn."); - } - - @Override - public void doWork(final AbstractWorkListener listener) - { - if (getAnswer()) - { - new InstallModule(listener, "EssentialsSpawn").start(); - return; - } - listener.onWorkDone(); - } -}
\ No newline at end of file diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/states/InstallationFinishedEvent.java b/EssentialsUpdate/src/com/earth2me/essentials/update/states/InstallationFinishedEvent.java deleted file mode 100644 index 2f27421f9..000000000 --- a/EssentialsUpdate/src/com/earth2me/essentials/update/states/InstallationFinishedEvent.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.earth2me.essentials.update.states; - -import org.bukkit.event.Event; -import org.bukkit.event.HandlerList; - - -public class InstallationFinishedEvent extends Event -{ - private static final HandlerList handlers = new HandlerList(); - - @Override - public HandlerList getHandlers() - { - return handlers; - } -} diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/tasks/Task.java b/EssentialsUpdate/src/com/earth2me/essentials/update/tasks/Task.java deleted file mode 100644 index 3f1d572ed..000000000 --- a/EssentialsUpdate/src/com/earth2me/essentials/update/tasks/Task.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.earth2me.essentials.update.tasks; - - -public interface Task -{ - void start(); -} diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/AbstractWorkListener.java b/EssentialsUpdate/src/net/ess3/update/AbstractWorkListener.java index d2cbb8a64..7a927d4db 100644 --- a/EssentialsUpdate/src/com/earth2me/essentials/update/AbstractWorkListener.java +++ b/EssentialsUpdate/src/net/ess3/update/AbstractWorkListener.java @@ -1,4 +1,4 @@ -package com.earth2me.essentials.update; +package net.ess3.update; import org.bukkit.plugin.Plugin; diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/EssentialsHelp.java b/EssentialsUpdate/src/net/ess3/update/EssentialsHelp.java index 7dd46451a..0d433ecc0 100644 --- a/EssentialsUpdate/src/com/earth2me/essentials/update/EssentialsHelp.java +++ b/EssentialsUpdate/src/net/ess3/update/EssentialsHelp.java @@ -1,6 +1,6 @@ -package com.earth2me.essentials.update; +package net.ess3.update; -import com.earth2me.essentials.update.chat.*; +import net.ess3.update.chat.*; import java.util.HashMap; import java.util.Locale; import java.util.Map; diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/EssentialsUpdate.java b/EssentialsUpdate/src/net/ess3/update/EssentialsUpdate.java index be6e42ce9..33875423a 100644 --- a/EssentialsUpdate/src/com/earth2me/essentials/update/EssentialsUpdate.java +++ b/EssentialsUpdate/src/net/ess3/update/EssentialsUpdate.java @@ -1,4 +1,4 @@ -package com.earth2me.essentials.update; +package net.ess3.update; import java.util.logging.Level; import org.bukkit.Bukkit; @@ -27,8 +27,6 @@ public class EssentialsUpdate extends JavaPlugin updateProcess = new UpdateProcess(this, updateCheck); updateProcess.registerEvents(); - Bukkit.getLogger().log(Level.INFO, "EssentialsUpdate {0} loaded.", getDescription().getVersion()); - if (updateCheck.isEssentialsInstalled()) { updateCheck.scheduleUpdateTask(); diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/GetFile.java b/EssentialsUpdate/src/net/ess3/update/GetFile.java index 06b414e93..9636e3bd1 100644 --- a/EssentialsUpdate/src/com/earth2me/essentials/update/GetFile.java +++ b/EssentialsUpdate/src/net/ess3/update/GetFile.java @@ -1,4 +1,4 @@ -package com.earth2me.essentials.update; +package net.ess3.update; import java.io.*; import java.math.BigInteger; diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/ModuleInfo.java b/EssentialsUpdate/src/net/ess3/update/ModuleInfo.java index 722fca3e1..993575cbf 100644 --- a/EssentialsUpdate/src/com/earth2me/essentials/update/ModuleInfo.java +++ b/EssentialsUpdate/src/net/ess3/update/ModuleInfo.java @@ -1,4 +1,4 @@ -package com.earth2me.essentials.update; +package net.ess3.update; import java.net.MalformedURLException; import java.net.URL; diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/PastieUpload.java b/EssentialsUpdate/src/net/ess3/update/PastieUpload.java index 6cad44e4d..9fba2351d 100644 --- a/EssentialsUpdate/src/com/earth2me/essentials/update/PastieUpload.java +++ b/EssentialsUpdate/src/net/ess3/update/PastieUpload.java @@ -1,4 +1,4 @@ -package com.earth2me.essentials.update; +package net.ess3.update; import java.io.IOException; import java.net.MalformedURLException; @@ -37,4 +37,4 @@ public class PastieUpload throw new IOException("Failed to upload to pastie.org"); } } -}
\ No newline at end of file +} diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/PostToUrl.java b/EssentialsUpdate/src/net/ess3/update/PostToUrl.java index c8978961b..28fc13c55 100644 --- a/EssentialsUpdate/src/com/earth2me/essentials/update/PostToUrl.java +++ b/EssentialsUpdate/src/net/ess3/update/PostToUrl.java @@ -1,4 +1,4 @@ -package com.earth2me.essentials.update; +package net.ess3.update; import java.io.BufferedReader; import java.io.IOException; diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/UpdateCheck.java b/EssentialsUpdate/src/net/ess3/update/UpdateCheck.java index 29afc4d3f..98a9983e8 100644 --- a/EssentialsUpdate/src/com/earth2me/essentials/update/UpdateCheck.java +++ b/EssentialsUpdate/src/net/ess3/update/UpdateCheck.java @@ -1,4 +1,4 @@ -package com.earth2me.essentials.update; +package net.ess3.update; import java.io.File; import java.util.Map; @@ -31,7 +31,7 @@ public class UpdateCheck private void checkForEssentials() { final PluginManager pluginManager = plugin.getServer().getPluginManager(); - final Plugin essentials = pluginManager.getPlugin("Essentials"); + final Plugin essentials = pluginManager.getPlugin("Essentials-3"); essentialsInstalled = essentials != null; if (essentialsInstalled) { @@ -187,10 +187,10 @@ public class UpdateCheck private int getBukkitVersion() { - final Matcher versionMatch = Pattern.compile("git-Bukkit-([0-9]+).([0-9]+).([0-9]+)-[0-9]+-[0-9a-z]+-b([0-9]+)jnks.*").matcher(plugin.getServer().getVersion()); + final Matcher versionMatch = Pattern.compile("git-Bukkit-(?:(?:[0-9]+)\\.)+[0-9]+-R[\\.0-9]+-(?:[0-9]+-g[0-9a-f]+-)?b([0-9]+)jnks.*").matcher(plugin.getServer().getVersion()); if (versionMatch.matches()) { - return Integer.parseInt(versionMatch.group(4)); + return Integer.parseInt(versionMatch.group(1)); } throw new NumberFormatException("Bukkit Version changed!"); } diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/UpdateFile.java b/EssentialsUpdate/src/net/ess3/update/UpdateFile.java index 3d465e2e8..cdab65600 100644 --- a/EssentialsUpdate/src/com/earth2me/essentials/update/UpdateFile.java +++ b/EssentialsUpdate/src/net/ess3/update/UpdateFile.java @@ -1,8 +1,9 @@ -package com.earth2me.essentials.update; +package net.ess3.update; import java.io.BufferedInputStream; import java.io.File; import java.io.FileInputStream; +import java.io.FileNotFoundException; import java.io.IOException; import java.math.BigInteger; import java.security.KeyFactory; @@ -15,6 +16,7 @@ import java.util.TreeMap; import java.util.logging.Level; import java.util.logging.Logger; import org.bukkit.Bukkit; +import org.bukkit.configuration.InvalidConfigurationException; import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.plugin.Plugin; @@ -25,7 +27,6 @@ public class UpdateFile private final static String UPDATE_URL = "http://goo.gl/67jev"; private final static BigInteger PUBLIC_KEY = new BigInteger("5ha6a2d4qdy17ttkg8evh74sl5a87djojwenu12k1lvy8ui6003e6l06rntczpoh99mhc3txj8mqlxw111oyy9yl7s7qpyluyzix3j1odxrxx4u52gxvyu6qiteapczkzvi7rxgeqsozz7b19rdx73a7quo9ybwpz1cr82r7x5k0pg2a73pjjsv2j1awr13azo7klrcxp9y5xxwf5qv1s3tw4zqftli18u0ek5qkbzfbgk1v5n2f11pkwwk6p0mibrn26wnjbv11vyiqgu95o7busmt6vf5q7grpcenl637w83mbin56s3asj1131b2mscj9xep3cbj7la9tgsxl5bj87vzy8sk2d34kzwqdqgh9nry43nqqus12l1stmiv184r8r3jcy8w43e8h1u1mzklldb5eytkuhayqik8l3ns04hwt8sgacvw534be8sx26qrn5s1", 36); private final transient File file; - private transient YamlConfiguration updateConfig; private final transient Plugin plugin; private final transient TreeMap<Version, VersionInfo> versions = new TreeMap<Version, VersionInfo>(); @@ -185,16 +186,14 @@ public class UpdateFile return false; } - private void readVersions() throws Exception + private void readVersions() throws FileNotFoundException, InvalidConfigurationException, IOException { - updateConfig = new YamlConfiguration(); + final YamlConfiguration updateConfig = new YamlConfiguration(); updateConfig.load(file); versions.clear(); for (String versionString : updateConfig.getKeys(false)) { - final Version version = new Version(versionString); - final VersionInfo info = new VersionInfo(updateConfig, versionString); - versions.put(version, info); + versions.put(new Version(versionString), new VersionInfo(updateConfig, versionString)); } } diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/UpdateProcess.java b/EssentialsUpdate/src/net/ess3/update/UpdateProcess.java index 9fa587f8f..f96cdd18f 100644 --- a/EssentialsUpdate/src/com/earth2me/essentials/update/UpdateProcess.java +++ b/EssentialsUpdate/src/net/ess3/update/UpdateProcess.java @@ -1,8 +1,8 @@ -package com.earth2me.essentials.update; +package net.ess3.update; -import com.earth2me.essentials.update.states.InstallationFinishedEvent; -import com.earth2me.essentials.update.states.StateMachine; -import com.earth2me.essentials.update.tasks.SelfUpdate; +import net.ess3.update.states.InstallationFinishedEvent; +import net.ess3.update.states.StateMachine; +import net.ess3.update.tasks.SelfUpdate; import java.util.logging.Level; import org.bukkit.Bukkit; import org.bukkit.command.CommandSender; @@ -14,7 +14,7 @@ import org.bukkit.event.player.PlayerChatEvent; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.plugin.Plugin; - +// TODO: This whole thing should make use of the conversations api public class UpdateProcess implements Listener { private transient Player currentPlayer; @@ -123,7 +123,7 @@ public class UpdateProcess implements Listener public void onPlayerJoin(final PlayerJoinEvent event) { final Player player = event.getPlayer(); - if (currentPlayer.getName().equals(player.getName())) + if (currentPlayer != null && currentPlayer.getName().equals(player.getName())) { currentPlayer = player; player.sendMessage("You quit the game, while the installation wizard was running."); diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/Version.java b/EssentialsUpdate/src/net/ess3/update/Version.java index a82f49abf..5fc10eb18 100644 --- a/EssentialsUpdate/src/com/earth2me/essentials/update/Version.java +++ b/EssentialsUpdate/src/net/ess3/update/Version.java @@ -1,4 +1,4 @@ -package com.earth2me.essentials.update; +package net.ess3.update; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -37,7 +37,7 @@ public class Version implements Comparable<Version> public Version(final String versionString) { - final Matcher matcher = Pattern.compile("(Pre|Dev)?([0-9]+)[_\\.]([0-9]+)[_\\.]([0-9]+).*").matcher(versionString); + final Matcher matcher = Pattern.compile("(Pre|Dev)?([0-9]+)[_\\.-]([0-9]+)[_\\.-]([0-9]+).*").matcher(versionString); if (!matcher.matches() || matcher.groupCount() < 4) { type = Type.DEVELOPER; diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/VersionInfo.java b/EssentialsUpdate/src/net/ess3/update/VersionInfo.java index c06aa2e64..afbe87de8 100644 --- a/EssentialsUpdate/src/com/earth2me/essentials/update/VersionInfo.java +++ b/EssentialsUpdate/src/net/ess3/update/VersionInfo.java @@ -1,4 +1,4 @@ -package com.earth2me.essentials.update; +package net.ess3.update; import java.util.Collections; import java.util.HashMap; diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/chat/AbstractFileCommand.java b/EssentialsUpdate/src/net/ess3/update/chat/AbstractFileCommand.java index 7c99d28f6..2e6d44f20 100644 --- a/EssentialsUpdate/src/com/earth2me/essentials/update/chat/AbstractFileCommand.java +++ b/EssentialsUpdate/src/net/ess3/update/chat/AbstractFileCommand.java @@ -1,8 +1,10 @@ -package com.earth2me.essentials.update.chat; +package net.ess3.update.chat; -import com.earth2me.essentials.update.PastieUpload; +import net.ess3.update.PastieUpload; import java.io.*; import java.nio.charset.Charset; + +import net.ess3.update.PastieUpload; import org.bukkit.plugin.Plugin; diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/chat/Command.java b/EssentialsUpdate/src/net/ess3/update/chat/Command.java index ad4c75e43..1e7e94e1c 100644 --- a/EssentialsUpdate/src/com/earth2me/essentials/update/chat/Command.java +++ b/EssentialsUpdate/src/net/ess3/update/chat/Command.java @@ -1,4 +1,4 @@ -package com.earth2me.essentials.update.chat; +package net.ess3.update.chat; import org.bukkit.entity.Player; diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/chat/ConfigCommand.java b/EssentialsUpdate/src/net/ess3/update/chat/ConfigCommand.java index de2c6a830..913294b01 100644 --- a/EssentialsUpdate/src/com/earth2me/essentials/update/chat/ConfigCommand.java +++ b/EssentialsUpdate/src/net/ess3/update/chat/ConfigCommand.java @@ -1,4 +1,4 @@ -package com.earth2me.essentials.update.chat; +package net.ess3.update.chat; import java.io.BufferedReader; import java.io.IOException; @@ -21,7 +21,7 @@ public class ConfigCommand extends AbstractFileCommand implements Command BufferedReader page = null; try { - page = getPluginConfig("Essentials", "config.yml"); + page = getPluginConfig("Essentials-3", "config.yml"); final StringBuilder input = new StringBuilder(); do { @@ -61,6 +61,5 @@ public class ConfigCommand extends AbstractFileCommand implements Command player.sendMessage(ex.getMessage()); } } - } } diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/chat/ErrorsCommand.java b/EssentialsUpdate/src/net/ess3/update/chat/ErrorsCommand.java index 41aa551c4..6e3c29924 100644 --- a/EssentialsUpdate/src/com/earth2me/essentials/update/chat/ErrorsCommand.java +++ b/EssentialsUpdate/src/net/ess3/update/chat/ErrorsCommand.java @@ -1,4 +1,4 @@ -package com.earth2me.essentials.update.chat; +package net.ess3.update.chat; import java.io.BufferedReader; import java.io.IOException; diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/chat/HelpCommand.java b/EssentialsUpdate/src/net/ess3/update/chat/HelpCommand.java index a6f76cece..1e82953f0 100644 --- a/EssentialsUpdate/src/com/earth2me/essentials/update/chat/HelpCommand.java +++ b/EssentialsUpdate/src/net/ess3/update/chat/HelpCommand.java @@ -1,4 +1,4 @@ -package com.earth2me.essentials.update.chat; +package net.ess3.update.chat; import org.bukkit.entity.Player; diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/chat/IrcBot.java b/EssentialsUpdate/src/net/ess3/update/chat/IrcBot.java index 31e9384ee..10ce9ad8a 100644 --- a/EssentialsUpdate/src/com/earth2me/essentials/update/chat/IrcBot.java +++ b/EssentialsUpdate/src/net/ess3/update/chat/IrcBot.java @@ -1,4 +1,4 @@ -package com.earth2me.essentials.update.chat; +package net.ess3.update.chat; import java.io.IOException; import java.util.logging.Level; @@ -35,7 +35,6 @@ public class IrcBot extends PircBot try { connect(SERVER, PORT); - return; } catch (IOException ex) { diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/chat/ListCommand.java b/EssentialsUpdate/src/net/ess3/update/chat/ListCommand.java index 9aa932efa..218b6631b 100644 --- a/EssentialsUpdate/src/com/earth2me/essentials/update/chat/ListCommand.java +++ b/EssentialsUpdate/src/net/ess3/update/chat/ListCommand.java @@ -1,4 +1,4 @@ -package com.earth2me.essentials.update.chat; +package net.ess3.update.chat; import org.bukkit.entity.Player; import org.jibble.pircbot.User; diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/chat/StartupCommand.java b/EssentialsUpdate/src/net/ess3/update/chat/StartupCommand.java index f244d6e3a..978da60c2 100644 --- a/EssentialsUpdate/src/com/earth2me/essentials/update/chat/StartupCommand.java +++ b/EssentialsUpdate/src/net/ess3/update/chat/StartupCommand.java @@ -1,4 +1,4 @@ -package com.earth2me.essentials.update.chat; +package net.ess3.update.chat; import java.io.BufferedReader; import java.io.IOException; diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/chat/UsernameUtil.java b/EssentialsUpdate/src/net/ess3/update/chat/UsernameUtil.java index 3df615652..e9dfdf728 100644 --- a/EssentialsUpdate/src/com/earth2me/essentials/update/chat/UsernameUtil.java +++ b/EssentialsUpdate/src/net/ess3/update/chat/UsernameUtil.java @@ -1,4 +1,4 @@ -package com.earth2me.essentials.update.chat; +package net.ess3.update.chat; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -104,7 +104,7 @@ public final class UsernameUtil private static void addEssentialsVersion(final Server server, final StringBuilder nameBuilder) { - final Plugin essentials = server.getPluginManager().getPlugin("Essentials"); + final Plugin essentials = server.getPluginManager().getPlugin("Essentials-3"); if (essentials != null) { nameBuilder.append(" ESS"); diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/states/AbstractState.java b/EssentialsUpdate/src/net/ess3/update/states/AbstractState.java index 2c85c39fd..5d4e03a2c 100644 --- a/EssentialsUpdate/src/com/earth2me/essentials/update/states/AbstractState.java +++ b/EssentialsUpdate/src/net/ess3/update/states/AbstractState.java @@ -1,6 +1,7 @@ -package com.earth2me.essentials.update.states; +package net.ess3.update.states; -import com.earth2me.essentials.update.AbstractWorkListener; +import net.ess3.update.AbstractWorkListener; +import net.ess3.update.AbstractWorkListener; import org.bukkit.entity.Player; @@ -39,7 +40,7 @@ public abstract class AbstractState /** * Check if we already know the answer, so the user does not have to answer the question. - * + * * @return true, if the answer could be guessed. */ public boolean guessAnswer() @@ -49,12 +50,14 @@ public abstract class AbstractState /** * Ask the user the question. - * @param sender + * + * @param sender */ public abstract void askQuestion(Player sender); /** * React on the answer and set internal variables + * * @param answer * @return true, if the answer could be recognized as a valid answer */ diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/states/AbstractYesNoState.java b/EssentialsUpdate/src/net/ess3/update/states/AbstractYesNoState.java index 67baf6bb6..3ee7d0ee2 100644 --- a/EssentialsUpdate/src/com/earth2me/essentials/update/states/AbstractYesNoState.java +++ b/EssentialsUpdate/src/net/ess3/update/states/AbstractYesNoState.java @@ -1,4 +1,4 @@ -package com.earth2me.essentials.update.states; +package net.ess3.update.states; public abstract class AbstractYesNoState extends AbstractState diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/states/AdvancedMode.java b/EssentialsUpdate/src/net/ess3/update/states/AdvancedMode.java index 88d9efc4a..8ddf06eeb 100644 --- a/EssentialsUpdate/src/com/earth2me/essentials/update/states/AdvancedMode.java +++ b/EssentialsUpdate/src/net/ess3/update/states/AdvancedMode.java @@ -1,4 +1,4 @@ -package com.earth2me.essentials.update.states; +package net.ess3.update.states; import org.bukkit.entity.Player; diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/states/Changelog.java b/EssentialsUpdate/src/net/ess3/update/states/Changelog.java index 10a4f33c5..42fdc8ca2 100644 --- a/EssentialsUpdate/src/com/earth2me/essentials/update/states/Changelog.java +++ b/EssentialsUpdate/src/net/ess3/update/states/Changelog.java @@ -1,7 +1,7 @@ -package com.earth2me.essentials.update.states; +package net.ess3.update.states; -import com.earth2me.essentials.update.UpdateCheck; -import com.earth2me.essentials.update.VersionInfo; +import net.ess3.update.UpdateCheck; +import net.ess3.update.VersionInfo; import java.util.List; import org.bukkit.entity.Player; diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/states/EssentialsChat.java b/EssentialsUpdate/src/net/ess3/update/states/EssentialsChat.java index 6aaed634a..a62735f5e 100644 --- a/EssentialsUpdate/src/com/earth2me/essentials/update/states/EssentialsChat.java +++ b/EssentialsUpdate/src/net/ess3/update/states/EssentialsChat.java @@ -1,7 +1,7 @@ -package com.earth2me.essentials.update.states; +package net.ess3.update.states; -import com.earth2me.essentials.update.AbstractWorkListener; -import com.earth2me.essentials.update.tasks.InstallModule; +import net.ess3.update.AbstractWorkListener; +import net.ess3.update.tasks.InstallModule; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.plugin.Plugin; @@ -11,7 +11,7 @@ public class EssentialsChat extends AbstractYesNoState { public EssentialsChat(final StateMap states) { - super(states, EssentialsChatSettings.class, EssentialsSpawn.class); + super(states, EssentialsChatSettings.class); } @Override diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/states/EssentialsChatSettings.java b/EssentialsUpdate/src/net/ess3/update/states/EssentialsChatSettings.java index 6666ff371..db3202ab3 100644 --- a/EssentialsUpdate/src/com/earth2me/essentials/update/states/EssentialsChatSettings.java +++ b/EssentialsUpdate/src/net/ess3/update/states/EssentialsChatSettings.java @@ -1,4 +1,4 @@ -package com.earth2me.essentials.update.states; +package net.ess3.update.states; import org.bukkit.entity.Player; @@ -7,7 +7,7 @@ public class EssentialsChatSettings extends AbstractYesNoState { public EssentialsChatSettings(final StateMap states) { - super(states, EssentialsSpawn.class); + super(states, null); } @Override diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/states/EssentialsGeoIP.java b/EssentialsUpdate/src/net/ess3/update/states/EssentialsGeoIP.java index a91a44787..cd1865b42 100644 --- a/EssentialsUpdate/src/com/earth2me/essentials/update/states/EssentialsGeoIP.java +++ b/EssentialsUpdate/src/net/ess3/update/states/EssentialsGeoIP.java @@ -1,7 +1,8 @@ -package com.earth2me.essentials.update.states; +package net.ess3.update.states; -import com.earth2me.essentials.update.AbstractWorkListener; -import com.earth2me.essentials.update.tasks.InstallModule; +import net.ess3.update.AbstractWorkListener; +import net.ess3.update.tasks.InstallModule; +import net.ess3.update.AbstractWorkListener; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.plugin.Plugin; @@ -44,4 +45,4 @@ public class EssentialsGeoIP extends AbstractYesNoState } listener.onWorkDone(); } -}
\ No newline at end of file +} diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/states/EssentialsProtect.java b/EssentialsUpdate/src/net/ess3/update/states/EssentialsProtect.java index ca0337d30..bb3a841a7 100644 --- a/EssentialsUpdate/src/com/earth2me/essentials/update/states/EssentialsProtect.java +++ b/EssentialsUpdate/src/net/ess3/update/states/EssentialsProtect.java @@ -1,7 +1,8 @@ -package com.earth2me.essentials.update.states; +package net.ess3.update.states; -import com.earth2me.essentials.update.AbstractWorkListener; -import com.earth2me.essentials.update.tasks.InstallModule; +import net.ess3.update.AbstractWorkListener; +import net.ess3.update.tasks.InstallModule; +import net.ess3.update.AbstractWorkListener; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.plugin.Plugin; @@ -44,4 +45,4 @@ public class EssentialsProtect extends AbstractYesNoState } listener.onWorkDone(); } -}
\ No newline at end of file +} diff --git a/EssentialsUpdate/src/net/ess3/update/states/InstallationFinishedEvent.java b/EssentialsUpdate/src/net/ess3/update/states/InstallationFinishedEvent.java new file mode 100644 index 000000000..5c38db7ee --- /dev/null +++ b/EssentialsUpdate/src/net/ess3/update/states/InstallationFinishedEvent.java @@ -0,0 +1,21 @@ +package net.ess3.update.states; + +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; + + +public class InstallationFinishedEvent extends Event +{ + private static final HandlerList handlers = new HandlerList(); + + @Override + public HandlerList getHandlers() + { + return handlers; + } + + public static HandlerList getHandlerList() + { + return handlers; + } +} diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/states/StateMachine.java b/EssentialsUpdate/src/net/ess3/update/states/StateMachine.java index 6ce926f92..b66ca4c58 100644 --- a/EssentialsUpdate/src/com/earth2me/essentials/update/states/StateMachine.java +++ b/EssentialsUpdate/src/net/ess3/update/states/StateMachine.java @@ -1,8 +1,10 @@ -package com.earth2me.essentials.update.states; +package net.ess3.update.states; -import com.earth2me.essentials.update.AbstractWorkListener; -import com.earth2me.essentials.update.UpdateCheck; +import net.ess3.update.AbstractWorkListener; +import net.ess3.update.UpdateCheck; import java.util.Iterator; + +import net.ess3.update.UpdateCheck; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.plugin.Plugin; diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/states/StateMap.java b/EssentialsUpdate/src/net/ess3/update/states/StateMap.java index cca4223d6..397ef7c81 100644 --- a/EssentialsUpdate/src/com/earth2me/essentials/update/states/StateMap.java +++ b/EssentialsUpdate/src/net/ess3/update/states/StateMap.java @@ -1,4 +1,4 @@ -package com.earth2me.essentials.update.states; +package net.ess3.update.states; import java.util.LinkedHashMap; diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/states/UpdateOrInstallation.java b/EssentialsUpdate/src/net/ess3/update/states/UpdateOrInstallation.java index 6b48f90be..c7bd5127a 100644 --- a/EssentialsUpdate/src/com/earth2me/essentials/update/states/UpdateOrInstallation.java +++ b/EssentialsUpdate/src/net/ess3/update/states/UpdateOrInstallation.java @@ -1,6 +1,7 @@ -package com.earth2me.essentials.update.states; +package net.ess3.update.states; -import com.earth2me.essentials.update.UpdateCheck; +import net.ess3.update.UpdateCheck; +import net.ess3.update.UpdateCheck; import org.bukkit.entity.Player; diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/tasks/InstallModule.java b/EssentialsUpdate/src/net/ess3/update/tasks/InstallModule.java index 778f5172f..1f7742026 100644 --- a/EssentialsUpdate/src/com/earth2me/essentials/update/tasks/InstallModule.java +++ b/EssentialsUpdate/src/net/ess3/update/tasks/InstallModule.java @@ -1,12 +1,16 @@ -package com.earth2me.essentials.update.tasks; +package net.ess3.update.tasks; -import com.earth2me.essentials.update.AbstractWorkListener; -import com.earth2me.essentials.update.GetFile; -import com.earth2me.essentials.update.ModuleInfo; -import com.earth2me.essentials.update.VersionInfo; +import net.ess3.update.AbstractWorkListener; +import net.ess3.update.GetFile; +import net.ess3.update.AbstractWorkListener; +import net.ess3.update.GetFile; +import net.ess3.update.ModuleInfo; +import net.ess3.update.VersionInfo; import java.io.File; import java.net.URL; import java.util.logging.Level; + +import net.ess3.update.VersionInfo; import org.bukkit.Bukkit; diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/tasks/SelfUpdate.java b/EssentialsUpdate/src/net/ess3/update/tasks/SelfUpdate.java index 3baf86be7..bc0d65b5e 100644 --- a/EssentialsUpdate/src/com/earth2me/essentials/update/tasks/SelfUpdate.java +++ b/EssentialsUpdate/src/net/ess3/update/tasks/SelfUpdate.java @@ -1,6 +1,7 @@ -package com.earth2me.essentials.update.tasks; +package net.ess3.update.tasks; -import com.earth2me.essentials.update.AbstractWorkListener; +import net.ess3.update.AbstractWorkListener; +import net.ess3.update.AbstractWorkListener; import org.bukkit.Bukkit; diff --git a/EssentialsUpdate/src/net/ess3/update/tasks/Task.java b/EssentialsUpdate/src/net/ess3/update/tasks/Task.java new file mode 100644 index 000000000..0dc421446 --- /dev/null +++ b/EssentialsUpdate/src/net/ess3/update/tasks/Task.java @@ -0,0 +1,7 @@ +package net.ess3.update.tasks; + + +public interface Task +{ + void start(); +} diff --git a/EssentialsUpdate/src/plugin.yml b/EssentialsUpdate/src/plugin.yml index 4e7700711..c2811ad63 100644 --- a/EssentialsUpdate/src/plugin.yml +++ b/EssentialsUpdate/src/plugin.yml @@ -1,6 +1,6 @@ # This determines the command prefix when there are conflicts (/name:home, /name:help, etc.) name: EssentialsUpdate -main: com.earth2me.essentials.update.EssentialsUpdate +main: net.ess3.update.EssentialsUpdate # Note to developers: This next line cannot change, or the automatic versioning system will break. version: ${build.number} description: This plugin allows to install or update all Essentials plugins diff --git a/EssentialsUpdate/test/com/earth2me/essentials/update/UploadTest.java b/EssentialsUpdate/test/net/ess3/update/UploadTest.java index a51f03bd7..7720e9670 100644 --- a/EssentialsUpdate/test/com/earth2me/essentials/update/UploadTest.java +++ b/EssentialsUpdate/test/net/ess3/update/UploadTest.java @@ -1,4 +1,4 @@ -package com.earth2me.essentials.update; +package net.ess3.update; import java.io.IOException; import java.util.logging.Level; diff --git a/EssentialsUpdate/test/com/earth2me/essentials/update/VersionTest.java b/EssentialsUpdate/test/net/ess3/update/VersionTest.java index d77e53542..1187eecd7 100644 --- a/EssentialsUpdate/test/com/earth2me/essentials/update/VersionTest.java +++ b/EssentialsUpdate/test/net/ess3/update/VersionTest.java @@ -1,8 +1,9 @@ -package com.earth2me.essentials.update; +package net.ess3.update; -import com.earth2me.essentials.update.Version.Type; +import net.ess3.update.Version.Type; import java.util.TreeSet; import junit.framework.TestCase; +import net.ess3.update.Version; import org.junit.Test; diff --git a/EssentialsXMPP/pom.xml b/EssentialsXMPP/pom.xml index bba1ef519..6bb0fd54a 100644 --- a/EssentialsXMPP/pom.xml +++ b/EssentialsXMPP/pom.xml @@ -29,7 +29,7 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-shade-plugin</artifactId> - <version>1.5</version> + <version>1.7</version> <executions> <execution> <goals> @@ -41,6 +41,7 @@ <include>jivesoftware:smack</include> </includes> </artifactSet> + <minimizeJar>true</minimizeJar> </configuration> </execution> </executions> diff --git a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/Commandsetxmpp.java b/EssentialsXMPP/src/net/ess3/xmpp/Commandsetxmpp.java index bc4ef0b6c..57bee3b58 100644 --- a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/Commandsetxmpp.java +++ b/EssentialsXMPP/src/net/ess3/xmpp/Commandsetxmpp.java @@ -1,4 +1,4 @@ -package com.earth2me.essentials.xmpp; +package net.ess3.xmpp; import net.ess3.api.IUser; import net.ess3.commands.EssentialsCommand; diff --git a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/Commandxmpp.java b/EssentialsXMPP/src/net/ess3/xmpp/Commandxmpp.java index 0a5b41218..88e1d9810 100644 --- a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/Commandxmpp.java +++ b/EssentialsXMPP/src/net/ess3/xmpp/Commandxmpp.java @@ -1,4 +1,4 @@ -package com.earth2me.essentials.xmpp; +package net.ess3.xmpp; import net.ess3.Console; import net.ess3.commands.EssentialsCommand; diff --git a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/Commandxmppspy.java b/EssentialsXMPP/src/net/ess3/xmpp/Commandxmppspy.java index 392e20d5c..dcace3b7d 100644 --- a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/Commandxmppspy.java +++ b/EssentialsXMPP/src/net/ess3/xmpp/Commandxmppspy.java @@ -1,4 +1,4 @@ -package com.earth2me.essentials.xmpp; +package net.ess3.xmpp; import net.ess3.commands.EssentialsCommand; import net.ess3.commands.NotEnoughArgumentsException; @@ -37,4 +37,4 @@ public class Commandxmppspy extends EssentialsCommand } } } -}
\ No newline at end of file +} diff --git a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/EssentialsXMPP.java b/EssentialsXMPP/src/net/ess3/xmpp/EssentialsXMPP.java index e4727d8a5..74ab09fd5 100644 --- a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/EssentialsXMPP.java +++ b/EssentialsXMPP/src/net/ess3/xmpp/EssentialsXMPP.java @@ -1,10 +1,10 @@ -package com.earth2me.essentials.xmpp; +package net.ess3.xmpp; -import net.ess3.commands.EssentialsCommandHandler; import static net.ess3.I18n._; import net.ess3.api.ICommandHandler; import net.ess3.api.IEssentials; import net.ess3.api.IUser; +import net.ess3.commands.EssentialsCommandHandler; import java.util.List; import java.util.Locale; import java.util.logging.Level; @@ -36,7 +36,7 @@ public class EssentialsXMPP extends JavaPlugin implements IEssentialsXMPP instance = this; final PluginManager pluginManager = getServer().getPluginManager(); - ess = (IEssentials)pluginManager.getPlugin("Essentials3"); + ess = (IEssentials)pluginManager.getPlugin("Essentials-3"); if (!this.getDescription().getVersion().equals(ess.getDescription().getVersion())) { LOGGER.log(Level.WARNING, _("versionMismatchAll")); @@ -55,8 +55,8 @@ public class EssentialsXMPP extends JavaPlugin implements IEssentialsXMPP ess.addReloadListener(users); ess.addReloadListener(xmpp); - - commandHandler = new EssentialsCommandHandler(EssentialsXMPP.class.getClassLoader(), "com.earth2me.essentials.xmpp.Command", "essentials.", ess); + + commandHandler = new EssentialsCommandHandler(EssentialsXMPP.class.getClassLoader(), "net.ess3.xmpp.Command", "essentials.", ess); } @Override diff --git a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/EssentialsXMPPPlayerListener.java b/EssentialsXMPP/src/net/ess3/xmpp/EssentialsXMPPPlayerListener.java index 2d454deb1..4880aead7 100644 --- a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/EssentialsXMPPPlayerListener.java +++ b/EssentialsXMPP/src/net/ess3/xmpp/EssentialsXMPPPlayerListener.java @@ -1,4 +1,4 @@ -package com.earth2me.essentials.xmpp; +package net.ess3.xmpp; import net.ess3.api.IEssentials; import net.ess3.api.IUser; diff --git a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/IEssentialsXMPP.java b/EssentialsXMPP/src/net/ess3/xmpp/IEssentialsXMPP.java index df329156d..373a7879d 100644 --- a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/IEssentialsXMPP.java +++ b/EssentialsXMPP/src/net/ess3/xmpp/IEssentialsXMPP.java @@ -1,4 +1,4 @@ -package com.earth2me.essentials.xmpp; +package net.ess3.xmpp; import net.ess3.api.IUser; import java.util.List; diff --git a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/UserManager.java b/EssentialsXMPP/src/net/ess3/xmpp/UserManager.java index 44ad39d2d..a2018c006 100644 --- a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/UserManager.java +++ b/EssentialsXMPP/src/net/ess3/xmpp/UserManager.java @@ -1,4 +1,4 @@ -package com.earth2me.essentials.xmpp; +package net.ess3.xmpp; import net.ess3.api.IReload; import java.io.File; diff --git a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/XMPPManager.java b/EssentialsXMPP/src/net/ess3/xmpp/XMPPManager.java index d4fb64756..ff49bc931 100644 --- a/EssentialsXMPP/src/com/earth2me/essentials/xmpp/XMPPManager.java +++ b/EssentialsXMPP/src/net/ess3/xmpp/XMPPManager.java @@ -1,7 +1,8 @@ -package com.earth2me.essentials.xmpp; +package net.ess3.xmpp; import net.ess3.api.IReload; import net.ess3.api.IUser; +import net.ess3.utils.Util; import java.io.File; import java.util.*; import java.util.logging.Handler; @@ -10,14 +11,14 @@ import java.util.logging.LogRecord; import java.util.logging.Logger; import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.entity.Player; -import org.jivesoftware.smack.Roster.SubscriptionMode; import org.jivesoftware.smack.*; +import org.jivesoftware.smack.Roster.SubscriptionMode; import org.jivesoftware.smack.packet.Message; import org.jivesoftware.smack.packet.Presence; import org.jivesoftware.smack.util.StringUtils; -public class XMPPManager extends Handler implements MessageListener, ChatManagerListener, IReload +public final class XMPPManager extends Handler implements MessageListener, ChatManagerListener, IReload { private static final Logger LOGGER = Logger.getLogger("Minecraft"); private transient YamlConfiguration config = null; @@ -59,7 +60,7 @@ public class XMPPManager extends Handler implements MessageListener, ChatManager disconnect(); connect(); } - chat.sendMessage(message.replaceAll("ยง[0-9a-f]", "")); + chat.sendMessage(Util.stripFormat(message)); return true; } } @@ -131,7 +132,7 @@ public class XMPPManager extends Handler implements MessageListener, ChatManager } } - public final void disconnect() + public void disconnect() { if (loggerThread != null) { @@ -164,7 +165,7 @@ public class XMPPManager extends Handler implements MessageListener, ChatManager } @Override - public final void onReload() + public void onReload() { LOGGER.removeHandler(this); config = YamlConfiguration.loadConfiguration(new File(parent.getDataFolder(), "config.yml")); diff --git a/EssentialsXMPP/src/plugin.yml b/EssentialsXMPP/src/plugin.yml index 7109284b7..49f6abd98 100644 --- a/EssentialsXMPP/src/plugin.yml +++ b/EssentialsXMPP/src/plugin.yml @@ -1,13 +1,13 @@ # This determines the command prefix when there are conflicts (/name:home, /name:help, etc.) name: EssentialsXMPP -main: com.earth2me.essentials.xmpp.EssentialsXMPP +main: net.ess3.xmpp.EssentialsXMPP # Note to developers: This next line cannot change, or the automatic versioning system will break. version: ${build.number} website: http://tiny.cc/EssentialsWiki description: Provides xmpp communication. authors: - snowleo -depend: [Essentials3] +depend: [Essentials-3] commands: setxmpp: description: set your xmpp address diff --git a/README.markdown b/README.markdown index 1913e1ba1..a3c2c1d42 100644 --- a/README.markdown +++ b/README.markdown @@ -1,9 +1,11 @@ -Essentials Development Readme +Essentials Development Readme - 3.0 ============================= The official repository is at: https://github.com/essentials/Essentials +The master repository is not for production use. Use branch 2.9 for production use code. + We use NetBeans 7 for development. Recommended NetBeans plugins: diff --git a/Essentials/src/examples/bpermissions.yml b/examples/bpermissions.yml index 6b7900c4f..6b7900c4f 100644 --- a/Essentials/src/examples/bpermissions.yml +++ b/examples/bpermissions.yml diff --git a/Essentials/src/examples/permissionsbukkit.yml b/examples/permissionsbukkit.yml index 515256ef1..515256ef1 100644 --- a/Essentials/src/examples/permissionsbukkit.yml +++ b/examples/permissionsbukkit.yml diff --git a/Essentials/src/examples/permissionsex.yml b/examples/permissionsex.yml index 3dc6354fb..3dc6354fb 100644 --- a/Essentials/src/examples/permissionsex.yml +++ b/examples/permissionsex.yml diff --git a/packager.xml b/packager.xml index 86cd572d2..f5c2b161a 100644 --- a/packager.xml +++ b/packager.xml @@ -4,7 +4,6 @@ <mkdir dir="jars"/> <copy todir="jars"> <fileset dir="."> - <!-- include name="**/target/Essentials*.jar"/ --> <include name="**/Essentials/src/config.yml" /> <include name="**/target/classes/messages*.properties" /> <include name="**/target/classes/items.csv" /> @@ -9,11 +9,10 @@ <packaging>pom</packaging> <name>BuildAll</name> <url>http://tiny.cc/EssentialsWiki</url> - + <modules> <module>Essentials</module> <module>Essentials2Compat</module> - <module>EssentialsAntiCheat</module> <module>EssentialsChat</module> <module>EssentialsGeoIP</module> <module>EssentialsGroupBridge</module> @@ -35,16 +34,17 @@ <dependency> <groupId>org.bukkit</groupId> <artifactId>bukkit</artifactId> - <version>${bukkitversion}</version> + <version>${bukkit.version}</version> </dependency> </dependencies> <build> - <sourceDirectory>${basedir}/src</sourceDirectory> - <testSourceDirectory>${basedir}/test</testSourceDirectory> + <finalName>${project.name}</finalName> + <sourceDirectory>${project.basedir}/src</sourceDirectory> + <testSourceDirectory>${project.basedir}/test</testSourceDirectory> <resources> <resource> - <directory>${basedir}/src</directory> + <directory>${project.basedir}/src</directory> <filtering>true</filtering> <includes> <include>*.*</include> @@ -54,54 +54,27 @@ <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - <version>2.3.2</version> - <configuration> - <source>1.6</source> - <target>1.6</target> - </configuration> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <version>2.4</version> <configuration> - <finalName>${project.artifactId}</finalName> <outputDirectory>../jars</outputDirectory> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-dependency-plugin</artifactId> - <version>2.4</version> - <executions> - <execution> - <id>copy</id> - <phase>package</phase> - <goals> - <goal>copy</goal> - </goals> - <configuration> - <artifactItems> - <artifactItem> - <groupId>org.bukkit</groupId> - <artifactId>craftbukkit</artifactId> - <version>${bukkitversion}</version> - <overWrite>true</overWrite> - <outputDirectory>../jars</outputDirectory> - <destFileName>craftbukkit.jar</destFileName> - </artifactItem> - </artifactItems> - </configuration> - </execution> - </executions> + <artifactId>maven-compiler-plugin</artifactId> + <version>2.3.2</version> + <configuration> + <source>1.6</source> + <target>1.6</target> + </configuration> </plugin> </plugins> </build> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - <bukkitversion>1.2.3-R0.3-SNAPSHOT</bukkitversion> + <bukkit.version>1.2.5-R4.1-SNAPSHOT</bukkit.version> <build.number>Unknown</build.number> <org-netbeans-modules-editor-indent.CodeStyle.project.expand-tabs>true</org-netbeans-modules-editor-indent.CodeStyle.project.expand-tabs> <org-netbeans-modules-editor-indent.CodeStyle.project.indent-shift-width>2</org-netbeans-modules-editor-indent.CodeStyle.project.indent-shift-width> |