mirror of
https://github.com/md5sha256/AreaShop.git
synced 2026-11-06 17:32:43 -05:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
07ea919aba | ||
|
|
2c1771cc52 | ||
|
|
83778ff803 | ||
|
|
0c79525144 | ||
|
|
e719930364 | ||
|
|
5568ee240b | ||
|
|
46abc8f83d | ||
|
|
cf3139f373 | ||
|
|
59627e1b97 | ||
|
|
a25b5a5752 | ||
|
|
aceb6945fd | ||
|
|
cbeffe9316 | ||
|
|
9ea97fdb5d | ||
|
|
ed1f73fdd7 | ||
|
|
09af826f88 | ||
|
|
1fd24d864d | ||
|
|
4125364a96 | ||
|
|
a6f5a2eb5e | ||
|
|
5eae75fef1 | ||
|
|
7982531e63 | ||
|
|
6ce15b27b7 | ||
|
|
b1809fb265 | ||
|
|
0344391588 | ||
|
|
8d254e17bb | ||
|
|
2098b9f4e3 | ||
|
|
95e3a4a120 | ||
|
|
9269279d44 | ||
|
|
d8fbeaf53a | ||
|
|
6886db8edc | ||
|
|
05df539189 | ||
|
|
f20c573b06 | ||
|
|
793e3dfd1b | ||
|
|
d7eff6c0df | ||
|
|
911115213f | ||
|
|
beeef8c757 | ||
|
|
60bdd50ab6 | ||
|
|
b5ba813410 | ||
|
|
7de0b34b3b | ||
|
|
b5077215ec | ||
|
|
98c45866a3 | ||
|
|
a96101519a | ||
|
|
fc18819a95 | ||
|
|
6dd0750bea | ||
|
|
36b73f57fd | ||
|
|
b111110251 | ||
|
|
555f648dfe | ||
|
|
4ac4c9ae35 | ||
|
|
97fe92588c | ||
|
|
8fc03b21f0 | ||
|
|
a74643d724 | ||
|
|
c309cbbbae | ||
|
|
73ceee6f27 | ||
|
|
9c57f434db | ||
|
|
f41e614d38 | ||
|
|
4fa1267971 | ||
|
|
e99ca02bcb | ||
|
|
3479bcd0d8 | ||
|
|
c0cd528f0e | ||
|
|
14f379f7c6 | ||
|
|
73c1f88d8c | ||
|
|
1bbca09fc6 | ||
|
|
8219269fbb | ||
|
|
bf283d52b6 | ||
|
|
def6005b92 | ||
|
|
62934ceab6 | ||
|
|
9124de9bb0 | ||
|
|
d5da1bb012 | ||
|
|
99d4cdb685 | ||
|
|
b3ea7f7e73 | ||
|
|
24ee8df215 | ||
|
|
63e8f10e20 | ||
|
|
7c03041ae1 | ||
|
|
fb03baf3ad | ||
|
|
c1ef15193c | ||
|
|
c1e89ef75e | ||
|
|
56a35d373b | ||
|
|
5aff3f1ce6 | ||
|
|
6a4b8f9d9a | ||
|
|
ef4b599897 | ||
|
|
a04b96d452 | ||
|
|
0728ce672d | ||
|
|
c42e1ccbe5 | ||
|
|
dfcd896cab | ||
|
|
69ee2d5c7f | ||
|
|
b42bb38e5f | ||
|
|
418b736fae | ||
|
|
bed4bbac23 | ||
|
|
f13534ae33 | ||
|
|
3b1522bad8 | ||
|
|
2995b59070 | ||
|
|
0e46f01150 |
No files matched your search
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>NLThijs48 - AreaShop</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
@@ -1,2 +0,0 @@
|
||||
/.project
|
||||
/.classpath
|
||||
@@ -1 +0,0 @@
|
||||
/org.eclipse.jdt.core.prefs
|
||||
@@ -1 +0,0 @@
|
||||
/nl
|
||||
@@ -1,64 +0,0 @@
|
||||
##############################################
|
||||
# config.yml of the AreaShop plugin #
|
||||
# This plugin has been created by NLThijs48 #
|
||||
# Check the server minecraft.go-craft.com #
|
||||
# and then the Prison server for a demo #
|
||||
##############################################
|
||||
|
||||
########## GENERAL ##########
|
||||
## Chatprefix used for all messages in the chat
|
||||
chatPrefix: '&2[AreaShop]&r '
|
||||
## The character used for the prices of regions, for the euro character use '%euro%'
|
||||
moneyCharacter: '$'
|
||||
## Enables / disables debug messages in the console, no need to change
|
||||
debug: false
|
||||
## The .yml language file that should be used, provided by this plugin: EN, NL
|
||||
language: EN
|
||||
## Maximum total amount of rents and buys together
|
||||
maximumTotal: 1
|
||||
|
||||
########## RENTING ##########
|
||||
## The tag you have to write on the sign for renting a region
|
||||
rentSign: '[rent]'
|
||||
## The line that should be placed on the sign when the region is not rented
|
||||
signRentable: '&2&l[For Rent]'
|
||||
## The line that should be placed on the sign when the region is rented
|
||||
signRented: '&4&l[Rented]'
|
||||
## How much regions a player can rent at the same time, -1 for not limited
|
||||
maximumRents: 1
|
||||
## The percentage of the renting price you get back if you unrent the region (price of time left will be multiplied by this/100)
|
||||
rentMoneyBack: 100
|
||||
## How much seconds between checking if renting has expired (don't put this to low)
|
||||
checkDelay: 60
|
||||
## Flags for the 'For Rent' regions, flags and options to apply when the region is not rented
|
||||
## All region flags can be used + members, owners, priority and parent.
|
||||
flagsForRent:
|
||||
members: -%player%
|
||||
greeting: '%region% can be rented for %price% per %duration%'
|
||||
## Flags for the 'Rented' regions, flags and options to apply when the region is rented
|
||||
## All region flags can be used + members, owners, priority and parent.
|
||||
flagsRented:
|
||||
members: +%player%
|
||||
greeting: '%region% is rented by %player% until %until%'
|
||||
|
||||
########## BUYING ##########
|
||||
## The tag you have to write on the sign for renting a region
|
||||
buySign: '[buy]'
|
||||
## The line that should be placed on the sign when the region is not sold
|
||||
signBuyable: '&2&l[For Sale]'
|
||||
## The line that should be placed on the sign when the region is sold
|
||||
signBuyed: '&4&l[Sold]'
|
||||
## How much regions a player can buy at the same time, -1 for not limited
|
||||
maximumBuys: 1
|
||||
## The percentage of the buying price you get back if you sell the region
|
||||
buyMoneyBack: 100
|
||||
## Flags for the 'For Sale' regions, flags and options to apply when the region is for sale
|
||||
## All region flags can be used + members, owners, priority and parent.
|
||||
flagsForSale:
|
||||
members: -%player%
|
||||
greeting: '%region% can be bought for %price%'
|
||||
## Flags for the 'Sold' regions, flags and options to apply when the region is rented
|
||||
## All region flags can be used + members, owners, priority and parent.
|
||||
flagsSold:
|
||||
members: +%player%
|
||||
greeting: '%region% is bought by %player%'
|
||||
@@ -1,116 +0,0 @@
|
||||
###################################################
|
||||
# English language file for the AreaShop plugin #
|
||||
###################################################
|
||||
# Copy this file and change the strings to your #
|
||||
# favor. Then change the 'language' setting in #
|
||||
# the config to the filename (excluding .yml) #
|
||||
###################################################
|
||||
|
||||
########## Command strings
|
||||
total-maximum: "You can't rent and buy more than %0% region(s) in total"
|
||||
|
||||
cmd-notValid: "That command is not valid, use '/as help' for info"
|
||||
cmd-onlyByPlayer: "This command can only be run by a player"
|
||||
|
||||
rent-regionNotRentable: "That region is not available for renting"
|
||||
rent-help: "/as rent <regionname>"
|
||||
rent-noPermission: "You don't have permission to rent a region"
|
||||
rent-maximum: "You can't rent more than %0% region(s)"
|
||||
rent-payError: "Something went wrong with paying, try again later"
|
||||
rent-rented: "You rented %0% until %1%"
|
||||
rent-extended: "You extended your rent of %0% until %1%"
|
||||
rent-extend: "You can extend your rent by rightclicking the sign again or using /rs rent"
|
||||
rent-lowMoneyExtend: "You don't have enough money to extend the rent (you have %0% and you need %1%)"
|
||||
rent-lowMoneyRent: "You don't have enough money to rent this region (you have %0% and you need %1%)"
|
||||
rent-someoneElse: "Someone else already rented this region"
|
||||
|
||||
buy-help: "/as buy <regionname>"
|
||||
buy-noPermission: "You don't have permission to buy a region"
|
||||
buy-notBuyable: "That region is not available for buying"
|
||||
buy-maximum: "You can't buy more than %0% region(s)"
|
||||
buy-payError: "Something went wrong with paying, try again later"
|
||||
buy-succes: "You succesfully bought %0%"
|
||||
buy-lowMoney: "You don't have enough money to buy this region (you have %0% and you need %1%)"
|
||||
buy-yours: "You already own this region"
|
||||
buy-someoneElse: "Someone else already bought this region"
|
||||
|
||||
unrent-help: "/as unrent <regionname>"
|
||||
unrent-noPermission: "You don't have permission to unrent a region"
|
||||
unrent-noPermissionOther: "You don't have permission to unrent another region"
|
||||
unrent-notRegistered: "The region can't be unrent because it is not registered for renting"
|
||||
unrent-notRented: "The region can't be unrent because it is not rented"
|
||||
unrent-unrented: "Your region has been unrented"
|
||||
unrent-other: "The region has been unrented for player %0%"
|
||||
unrent-expired: "Your rent of %0% has expired"
|
||||
|
||||
sell-help: "/as sell <regionname>"
|
||||
sell-notRegistered: "The region can't be selled because it is not registered for buying"
|
||||
sell-notBought: "The region can't be selled because it is not someone's property"
|
||||
sell-sold: "The region has been sold for player %0%"
|
||||
sell-soldYours: "Your region has been sold"
|
||||
sell-noPermission: "You don't have permission to sell a region"
|
||||
sell-noPermissionOther: "You don't have permission to sell another region"
|
||||
|
||||
rentsigns-updated: "All signs for renting have been updated"
|
||||
rentsigns-notUpdated: "Not all signs have been updated, maybe reload fixes it"
|
||||
rentsgins-noPermission: "You don't have permission to update all rentsigns"
|
||||
|
||||
buysigns-updated: "All signs for selling have been updated"
|
||||
buysigns-notUpdated: "Not all signs have been updated, maybe reload fixes it"
|
||||
buysigns-noPermission: "You don't have permission to update all buysigns"
|
||||
|
||||
rentregions-updated: "All renting regions have been updated"
|
||||
rentregions-noPermission: "You don't have permission to update all renting regions"
|
||||
|
||||
buyregions-updated: "All buying regions have been updated"
|
||||
buyregions-noPermission: "You don't have permission to update all buying regions"
|
||||
|
||||
reload-reloaded: "The config has been reloaded successfully"
|
||||
reload-noPermission: "You don't have permission to reload the config"
|
||||
|
||||
info-help: "/rs info <all|rented|forrent|sold|forsale|player|region>"
|
||||
info-all-rents: "Regions registered for renting: %0%"
|
||||
info-all-noRents: "There are no regions registered for renting"
|
||||
info-all-buys: "Regions registered for buying: %0%"
|
||||
info-all-noBuys: "There are no regions registered for buying"
|
||||
info-rented: "Rented regions: %0%"
|
||||
info-noRented: "No regions are rented"
|
||||
info-unrented: "Unrented regions: %0%"
|
||||
info-noUnrented: "All regions are rented"
|
||||
info-sold: "Sold regions: %0%"
|
||||
info-noSold: "No regions are sold"
|
||||
info-forsale: "Regions for sale: %0%"
|
||||
info-noForsale: "All regions are sold"
|
||||
info-playerHelp: "/rs info player <name>"
|
||||
info-playerRents: "Regions rented by %0%: %1%"
|
||||
info-playerNoRents: "%0% has not rented a region"
|
||||
info-playerBuys: "Regions bought by %0%: %1%"
|
||||
info-playerNoBuys: "%0% has not bought a region"
|
||||
info-regionHelp: "/rs info region <name>"
|
||||
info-regionNoRenting: "%0% is not registered for renting"
|
||||
info-regionRenting: "&6Renting details for %0%"
|
||||
info-regionRentedBy: "Rented by: %0% until %1%"
|
||||
info-regionNotRented: "Currently not rented"
|
||||
info-regionBuying: "&6Buying details for %0%"
|
||||
info-regionNoBuying: "%0% is not registered for buying"
|
||||
info-regionNotBought: "Currently not sold"
|
||||
info-regionBoughtBy: "Bought by: %0%"
|
||||
info-regionSign: "Sign position: world=%0%, X=%1%, Y=%2%, Z=%3%"
|
||||
info-regionPriceDuration: "Price: %0% for each %1%"
|
||||
info-regionPrice: "Price: %0%"
|
||||
|
||||
help-header: "Help page, commands that you can execute"
|
||||
help-alias: "Command aliases: /areashop, /as"
|
||||
help-help: "&6/as help &7-&r Shows this help page"
|
||||
help-info: "&6/as info &7-&r Get info about current regions"
|
||||
help-rent: "&6/as rent &7-&r Rent a region or extend your current rent"
|
||||
help-buy: "&6/as buy &7-&r Buy a region"
|
||||
help-unrent: "&6/as unrent &7-&r Unrent a region"
|
||||
help-unrentOwn: "&6/as unrent &7-&r Unrent your own region"
|
||||
help-sell: "&6/as sell &7-&r Sell a region"
|
||||
help-sellOwn: "&6/as sell &7-&r Sell your own region"
|
||||
help-updaterentsigns: "&6/as updaterentsigns &7-&r Update all rent signs"
|
||||
help-updatebuysigns: "&6/as updatebuysigns &7-&r Update all buy signs"
|
||||
help-updaterentregions: "&6/as updaterentregions &7-&r Update all rent regions"
|
||||
help-updatebuyregions: "&6/as updatebuyregions &7-&r Update all buy regions"
|
||||
help-reload: "&6/as reload &7-&r Reload the config and languages"
|
||||
@@ -1,116 +0,0 @@
|
||||
###################################################
|
||||
# Dutch language file for the AreaShop plugin #
|
||||
###################################################
|
||||
# Copy this file and change the strings to your #
|
||||
# favor. Then change the 'language' setting in #
|
||||
# the config to the filename (excluding .yml) #
|
||||
###################################################
|
||||
|
||||
########## Command strings
|
||||
total-maximum: "Je kunt niet meer dan %0% gebied(en) in totaal huren en kopen"
|
||||
|
||||
cmd-onlyByPlayer: "Dit commando kan alleen door een speler uitgevoert worden"
|
||||
cmd-notValid: "Dat commando is niet geldig , gebruik '/rs help' voor informatie"
|
||||
|
||||
rent-regionNotRentable: "Dat gebied is niet beschikbaar om te huren"
|
||||
rent-help: "/as rent <gebiednaam>"
|
||||
rent-noPermission: "Je hebt geen toestemming om een gebied te huren"
|
||||
rent-maximum: "Je kunt niet meer dan %0% gebied(en) huren"
|
||||
rent-payError: "Er is iets mis gegaan met betalen, probeer het later opnieuw"
|
||||
rent-rented: "Je hebt %0% tot %1% gehuurd"
|
||||
rent-extended: "Je hebt je huur van %0% verlengt tot %1%"
|
||||
rent-extend: "Je kunt je huur verlengen door opnieuw op het bordje te klikken of gebruik te maken van /rs rent"
|
||||
rent-lowMoneyExtend: "Je hebt niet genoeg geld om de huur te verlengen (je hebt %0% van de %1%)"
|
||||
rent-lowMoneyRent: "Je hebt niet genoeg geld om het gebied te huren (je hebt %0% van de %1%)"
|
||||
rent-someoneElse: "Iemand anders heeft dit gebied al gehuurd"
|
||||
|
||||
buy-help: "/as buy <gebiednaam>"
|
||||
buy-noPermission: "Je hebt geen toestemming om een gebied te kopen"
|
||||
buy-notBuyable: "Dat gebied is niet beschikbaar om te kopen"
|
||||
buy-maximum: "Je kunt niet meer dan %0% gebied(en) kopen"
|
||||
buy-payError: "Er is iets mis gegaan met betalen, probeer het later opnieuw"
|
||||
buy-succes: "Je hebt %0% succesvol gekocht"
|
||||
buy-lowMoney: "Je hebt niet genoeg geld om het gebied te kopen (je hebt %0% van de %1%)"
|
||||
buy-yours: "Je hebt dit gebied al gekocht"
|
||||
buy-someoneElse: "Iemand anders heeft dit gebied al gekocht"
|
||||
|
||||
unrent-help: "/as unrent <gebiednaam>"
|
||||
unrent-noPermission: "Je hebt geen toestemming om te stoppen met huren"
|
||||
unrent-noPermissionOther: "Je hebt geen toestemming om iemand anders huur te stoppen"
|
||||
unrent-notRegistered: "De huur kan niet gestopt worden want het gebied is niet geregistreerd om te huren"
|
||||
unrent-notRented: "De huur kan niet gestopt worden want het gebied is niet gehuurd"
|
||||
unrent-unrented: "De huur van je gebied is gestopt"
|
||||
unrent-other: "De huur voor het gebied is gestopt voor speler %0%"
|
||||
unrent-expired: "De huur van je gebied %0% is gestopt"
|
||||
|
||||
sell-help: "/as sell <gebiednaam>"
|
||||
sell-notRegistered: "Het gebied kan niet verkocht worden want het staat niet geregistreerd om te kopen"
|
||||
sell-notBought: "Het gebied kan niet verkocht worden want het is niet gekocht"
|
||||
sell-sold: "Het gebied is verkocht voor speler %0%"
|
||||
sell-soldYours: "Je gebied is verkocht"
|
||||
sell-noPermission: "Je hebt geen toestemming om een gebied te verkopen"
|
||||
sell-noPermissionOther: "Je hebt geen toestemming om een gebied van iemand anders te verkopen"
|
||||
|
||||
rentsigns-updated: "Alle bordjes voor de verhuur zijn geupdate"
|
||||
rentsigns-notUpdated: "Niet alle bordjes zijn geupdate, een reload zou het op kunnen lossen"
|
||||
rentsgins-noPermission: "Je hebt geen toestemming om alle verhuur bordjes te updaten"
|
||||
|
||||
buysigns-updated: "All bordjes voor de verkoop zijn geupdate"
|
||||
buysigns-notUpdated: "Niet alle bordjes zijn geupdate, een reload zou het op kunnen lossen"
|
||||
buysigns-noPermission: "Je hebt geen toestemming om alle verkoop bordjes te updaten"
|
||||
|
||||
rentregions-updated: "Alle verhuur gebieden zijn geupdate"
|
||||
rentregions-noPermission: "Je hebt geen toestemming om de verhuur gebieden te updaten"
|
||||
|
||||
buyregions-updated: "Alle verkoop gebieden zijn geupdate"
|
||||
buyregions-noPermission: "Je hebt geen toestemming om alle verkoop gebieden te updaten"
|
||||
|
||||
reload-reloaded: "De config is succesvol opnieuw ingeladen"
|
||||
reload-noPermission: "Je hebt geen toestemming om de config opnieuw in te laden"
|
||||
|
||||
info-help: "/as info <all|rented|forrent|sold|forsale|player|region>"
|
||||
info-all-rents: "Gebieden geregistreerd voor de verhuur: %0%"
|
||||
info-all-noRents: "Er zijn geen gebieden geregistreerd voor de verhuur"
|
||||
info-all-buys: "Gebieden geregistreerd voor de verkoop: %0%"
|
||||
info-all-noBuys: "Er zijn geen gebieden geregistreerd voor de verkoop"
|
||||
info-rented: "Verhuurde gebieden: %0%"
|
||||
info-noRented: "Er zijn geen verhuurde gebieden"
|
||||
info-unrented: "Gebieden te huur: %0%"
|
||||
info-noUnrented: "Alle gebieden zijn verhuurd"
|
||||
info-sold: "Verkochte gebieden: %0%"
|
||||
info-noSold: "Alle gebieden zijn verkocht"
|
||||
info-forsale: "Gebieden te koop: %0%"
|
||||
info-noForsale: "Alle gebieden zijn verkocht"
|
||||
info-playerHelp: "/rs info player <naam>"
|
||||
info-playerRents: "Gebieden gehuurd door %0%: %1%"
|
||||
info-playerNoRents: "%0% heeft geen gebied gehuurd"
|
||||
info-playerBuys: "Gebieden gekocht door %0%: %1%"
|
||||
info-playerNoBuys: "%0% heeft geen gebieden gekocht"
|
||||
info-regionHelp: "/rs info region <naam>"
|
||||
info-regionNoRenting: "%0% is niet geregistreerd voor verhuur"
|
||||
info-regionRenting: "&6Huur informatie voor %0%"
|
||||
info-regionRentedBy: "Gehuurd door: %0% tot %1%"
|
||||
info-regionNotRented: "Nu niet verhuurd"
|
||||
info-regionBuying: "&6Verkoop informatie voor %0%"
|
||||
info-regionNoBuying: "%0% is niet geregistreerd voor verkoop"
|
||||
info-regionNotBought: "Nu niet verkocht"
|
||||
info-regionBoughtBy: "Gekocht door: %0%"
|
||||
info-regionSign: "Plek van het bordje: wereld=%0%, X=%1%, Y=%2%, Z=%3%"
|
||||
info-regionPriceDuration: "Prijs: %0% voor elke %1%"
|
||||
info-regionPrice: "Prijs: %0%"
|
||||
|
||||
help-header: "Help pagina, commando's die jij kunt uitvoeren"
|
||||
help-alias: "Commando aliassen: /areashop, /as"
|
||||
help-help: "&6/as help &7-&r Laat deze help pagina zien"
|
||||
help-info: "&6/as info &7-&r Vraag informatie over gebieden op"
|
||||
help-rent: "&6/as rent &7-&r Huur een gebied of verleng de huur"
|
||||
help-buy: "&6/as buy &7-&r Koop een gebied"
|
||||
help-unrent: "&6/as unrent &7-&r Stop de huur van een gebied"
|
||||
help-unrentOwn: "&6/as unrent &7-&r Stop de huur van een eigen gebied"
|
||||
help-sell: "&6/as sell &7-&r Verkoop een gebied"
|
||||
help-sellOwn: "&6/as sell &7-&r Verkoop een eigen gebied"
|
||||
help-updaterentsigns: "&6/as updaterentsigns &7-&r Update alle huur borden"
|
||||
help-updatebuysigns: "&6/as updatebuysigns &7-&r Update alle koop borden"
|
||||
help-updaterentregions: "&6/as updaterentregions &7-&r Update alle huur gebieden"
|
||||
help-updatebuyregions: "&6/as updatebuyregions &7-&r Update alle koop gebieden"
|
||||
help-reload: "&6/as reload &7-&r Herlaad de config en de taalbestanden"
|
||||
@@ -1,80 +0,0 @@
|
||||
name: AreaShop
|
||||
main: nl.evolutioncoding.AreaShop.AreaShop
|
||||
version: 1.0
|
||||
depend: [Vault, WorldGuard]
|
||||
commands:
|
||||
AreaShop:
|
||||
description: For all commands use /as help
|
||||
usage: /AreaShop or /AS
|
||||
permission: areashop.help
|
||||
permission-message: You don't have <permission>
|
||||
aliases: [as]
|
||||
permissions:
|
||||
areashop.*:
|
||||
description: Give access to all commands of RegionRent
|
||||
children:
|
||||
areashop.help: true
|
||||
areashop.createrent: true
|
||||
areashop.createbuy: true
|
||||
areashop.destroyrent: true
|
||||
areashop.destroybuy: true
|
||||
areashop.rent: true
|
||||
areashop.buy: true
|
||||
areashop.unrent: true
|
||||
areashop.info: true
|
||||
areashop.updaterentsigns: true
|
||||
areashop.updatebuysigns: true
|
||||
areashop.updaterentregions: true
|
||||
areashop.updatebuyregions: true
|
||||
areashop.reload: true
|
||||
areashop.help:
|
||||
description: Allows you to see the help pages
|
||||
default: true
|
||||
areashop.rent:
|
||||
description: Allows you to rent a region
|
||||
default: true
|
||||
areashop.buy:
|
||||
description: Allows you to buy a region
|
||||
default: true
|
||||
areashop.unrent:
|
||||
description: Allows you to unrent a specific region
|
||||
default: op
|
||||
areashop.unrentown:
|
||||
description: Allows you to unrent your own region
|
||||
default: true
|
||||
areashop.sell:
|
||||
description: Allows you to sell a specific region
|
||||
default: op
|
||||
areashop.sellown:
|
||||
description: Allows you to sell your own region
|
||||
default: true
|
||||
areashop.createrent:
|
||||
description: Allows you to set up signs for renting regions
|
||||
default: op
|
||||
areashop.createbuy:
|
||||
description: Allows you to set up signs for buying regions
|
||||
default: op
|
||||
areashop.destroyrent:
|
||||
description: Allows you to break signs used for renting regions
|
||||
default: op
|
||||
areashop.destroybuy:
|
||||
description: Allows you to break signs used for renting regions
|
||||
default: op
|
||||
areashop.info:
|
||||
description: Allows you check the status of regions and players
|
||||
default: true
|
||||
areashop.updaterentsigns:
|
||||
description: Allows you to update all rent signs
|
||||
default: op
|
||||
areashop.updatebuysigns:
|
||||
description: Allows you to update all buy signs
|
||||
default: op
|
||||
areashop.updaterentregions:
|
||||
description: Allows you to update all rent regions
|
||||
default: op
|
||||
areashop.updatebuyregions:
|
||||
description: Allows you to update all buy regions
|
||||
default: op
|
||||
areashop.reload:
|
||||
description: Allows you to reload the config
|
||||
default: op
|
||||
@@ -1,448 +0,0 @@
|
||||
package nl.evolutioncoding.AreaShop;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import net.milkbowl.vault.economy.Economy;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.configuration.Configuration;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
||||
|
||||
/**
|
||||
* Main class for the AreaShop plugin
|
||||
* @author NLThijs48
|
||||
*/
|
||||
public final class AreaShop extends JavaPlugin {
|
||||
/* General variables */
|
||||
private WorldGuardPlugin worldGuard = null;
|
||||
private Economy economy = null;
|
||||
private ShopManager shopManager = null;
|
||||
private LanguageManager languageManager = null;
|
||||
private boolean configOk = false;
|
||||
private boolean debug = false;
|
||||
private String chatprefix = null;
|
||||
|
||||
/* Folder where the language files will be stored */
|
||||
public final String languageFolder = "lang";
|
||||
|
||||
/* Euro tag for in the config */
|
||||
public final String currencyEuro = "%euro%";
|
||||
|
||||
/* Keys for adding things to the hashmap */
|
||||
public final String keyWorld = "world";
|
||||
public final String keyX = "x";
|
||||
public final String keyY = "y";
|
||||
public final String keyZ = "z";
|
||||
public final String keyDuration = "duration";
|
||||
public final String keyPrice = "price";
|
||||
public final String keyPlayer = "player";
|
||||
public final String keyRentedUntil = "rented";
|
||||
public final String keyName = "name";
|
||||
|
||||
/* Keys for replacing parts of flags */
|
||||
public final String tagPlayerName = "%player%";
|
||||
public final String tagRegionName = "%region%";
|
||||
public final String tagPrice = "%price%";
|
||||
public final String tagDuration = "%duration%";
|
||||
public final String tagRentedUntil = "%until%";
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Called on start or reload of the server
|
||||
*/
|
||||
public void onEnable(){
|
||||
boolean error = false;
|
||||
|
||||
/* Save a copy of the default config.yml if one is not present */
|
||||
this.saveDefaultConfig();
|
||||
|
||||
/* Check the config, loads default if errors */
|
||||
configOk = this.checkConfig();
|
||||
|
||||
/* Check if WorldGuard is present */
|
||||
Plugin plugin = getServer().getPluginManager().getPlugin("WorldGuard");
|
||||
if (plugin == null || !(plugin instanceof WorldGuardPlugin)) {
|
||||
this.getLogger().info("Error: WorldGuard plugin is not present or has not loaded correctly");
|
||||
error = true;
|
||||
} else {
|
||||
worldGuard = (WorldGuardPlugin)plugin;
|
||||
}
|
||||
|
||||
/* Check if Vault is present */
|
||||
RegisteredServiceProvider<Economy> economyProvider = getServer().getServicesManager().getRegistration(net.milkbowl.vault.economy.Economy.class);
|
||||
if (economyProvider == null) {
|
||||
this.getLogger().info("Error: Vault plugin is not present or has not loaded correctly");
|
||||
error = true;
|
||||
} else {
|
||||
economy = economyProvider.getProvider();
|
||||
}
|
||||
|
||||
/* Create a LanguageMananager */
|
||||
languageManager = new LanguageManager(this);
|
||||
|
||||
/* Save the chatPrefix */
|
||||
chatprefix = this.config().getString("chatPrefix");
|
||||
|
||||
/* Load all data from files */
|
||||
shopManager = new ShopManager(this);
|
||||
error = error & !shopManager.loadRents();
|
||||
shopManager.checkRents();
|
||||
error = error & !shopManager.loadBuys();
|
||||
|
||||
if(error) {
|
||||
this.getLogger().info("The plugin has not started, fix the errors listed above");
|
||||
} else {
|
||||
/* Register the event listeners */
|
||||
this.getServer().getPluginManager().registerEvents(new SignChangeListener(this), this);
|
||||
this.getServer().getPluginManager().registerEvents(new SignBreakListener(this), this);
|
||||
this.getServer().getPluginManager().registerEvents(new RightClickListener(this), this);
|
||||
|
||||
/* Start thread for checking renting */
|
||||
int checkDelay = Integer.parseInt(this.config().getString("checkDelay"))*20;
|
||||
new RentCheck(this).runTaskTimer(this, checkDelay, checkDelay);
|
||||
|
||||
/* Bind commands for this plugin */
|
||||
getCommand("AreaShop").setExecutor(new ShopCommands(this));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called on shutdown or reload of the server
|
||||
*/
|
||||
public void onDisable() {
|
||||
|
||||
/* set variables to null to prevent memory leaks */
|
||||
worldGuard = null;
|
||||
economy = null;
|
||||
shopManager = null;
|
||||
languageManager = null;
|
||||
configOk = false;
|
||||
debug = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to get the WorldGuard plugin
|
||||
* @return WorldGuardPlugin
|
||||
*/
|
||||
public WorldGuardPlugin getWorldGuard() {
|
||||
return worldGuard;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to get the WorldGuard plugin
|
||||
* @return WorldGuardPlugin
|
||||
*/
|
||||
public LanguageManager getLanguageManager() {
|
||||
return languageManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to get the Vault plugin
|
||||
* @return Economy
|
||||
*/
|
||||
public Economy getEconomy() {
|
||||
return economy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the ShopManager
|
||||
* @return The shopManager
|
||||
*/
|
||||
public ShopManager getShopManager() {
|
||||
return shopManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to send a message to a CommandSender, using chatprefix if it is a player
|
||||
* @param target The CommandSender you wan't to send the message to (e.g. a player)
|
||||
* @param key The key to get the translation
|
||||
* @param params The parameters to inject into the message string
|
||||
*/
|
||||
public void message(Object target, String key, Object... params) {
|
||||
String langString = this.fixColors(languageManager.getLang(key, params));
|
||||
if(langString == null) {
|
||||
this.getLogger().info("Something is wrong with the language file, could not find key: " + key);
|
||||
} else {
|
||||
if(target instanceof Player) {
|
||||
((Player)target).sendMessage(this.fixColors(chatprefix) + langString);
|
||||
} else if(target instanceof CommandSender) {
|
||||
((CommandSender)target).sendMessage(langString);
|
||||
}
|
||||
else if(target instanceof Logger) {
|
||||
((Logger)target).info(langString);
|
||||
} else {
|
||||
this.getLogger().info("Could not send message, target is wrong: " + langString);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert color and formatting codes to bukkit values
|
||||
* @param input Start string with color and formatting codes in it
|
||||
* @return String with the color and formatting codes in the bukkit format
|
||||
*/
|
||||
public String fixColors(String input) {
|
||||
String result = null;
|
||||
if(input != null) {
|
||||
result = input.replaceAll("(&([a-f0-9]))", "\u00A7$2");
|
||||
result = result.replaceAll("&k", ChatColor.MAGIC.toString());
|
||||
result = result.replaceAll("&l", ChatColor.BOLD.toString());
|
||||
result = result.replaceAll("&m", ChatColor.STRIKETHROUGH.toString());
|
||||
result = result.replaceAll("&n", ChatColor.UNDERLINE.toString());
|
||||
result = result.replaceAll("&o", ChatColor.ITALIC.toString());
|
||||
result = result.replaceAll("&r", ChatColor.RESET.toString());
|
||||
result = result.replaceAll("€", "\u20AC");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the currency character, fixes problems with euro character acting weird
|
||||
* @return Currency character
|
||||
*/
|
||||
public String getCurrencyCharacter() {
|
||||
String result = this.config().getString("moneyCharacter");
|
||||
result = result.replace(currencyEuro, "\u20ac");
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function for quitting the plugin, NOT USED ATM
|
||||
*/
|
||||
public void quit() {
|
||||
this.getLogger().info("Plugin will be stopped");
|
||||
Bukkit.getPluginManager().disablePlugin(this);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the config configured by the user or the default
|
||||
*/
|
||||
public Configuration config() {
|
||||
if(configOk) {
|
||||
return this.getConfig();
|
||||
} else {
|
||||
return this.getConfig().getDefaults();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the help page for the player
|
||||
* @param player The player to show the help to
|
||||
*/
|
||||
public void showHelp(CommandSender target) {
|
||||
/* Set up the list of messages to be sent */
|
||||
ArrayList<String> messages = new ArrayList<String>();
|
||||
messages.add(this.config().getString("chatPrefix") + languageManager.getLang("help-header"));
|
||||
messages.add(this.config().getString("chatPrefix") + languageManager.getLang("help-alias"));
|
||||
if(target.hasPermission("areashop.help")) {
|
||||
messages.add(languageManager.getLang("help-help"));
|
||||
}
|
||||
if(target.hasPermission("areashop.info")) {
|
||||
messages.add(languageManager.getLang("help-info"));
|
||||
}
|
||||
if(target.hasPermission("areashop.rent")) {
|
||||
messages.add(languageManager.getLang("help-rent"));
|
||||
}
|
||||
if(target.hasPermission("areashop.buy")) {
|
||||
messages.add(languageManager.getLang("help-buy"));
|
||||
}
|
||||
if(target.hasPermission("areashop.unrent")) {
|
||||
messages.add(languageManager.getLang("help-unrent"));
|
||||
} else if(target.hasPermission("areashop.unrentown")) {
|
||||
messages.add(languageManager.getLang("help-unrentOwn"));
|
||||
}
|
||||
if(target.hasPermission("areashop.sell")) {
|
||||
messages.add(languageManager.getLang("help-sell"));
|
||||
} else if(target.hasPermission("areashop.sellown")) {
|
||||
messages.add(languageManager.getLang("help-sellOwn"));
|
||||
}
|
||||
if(target.hasPermission("areashop.updaterentsigns")) {
|
||||
messages.add(languageManager.getLang("help-updaterentsigns"));
|
||||
}
|
||||
if(target.hasPermission("areashop.updatebuysigns")) {
|
||||
messages.add(languageManager.getLang("help-updatebuysigns"));
|
||||
}
|
||||
if(target.hasPermission("areashop.updaterentregions")) {
|
||||
messages.add(languageManager.getLang("help-updaterentregions"));
|
||||
}
|
||||
if(target.hasPermission("areashop.updatebuyregions")) {
|
||||
messages.add(languageManager.getLang("help-updatebuyregions"));
|
||||
}
|
||||
if(target.hasPermission("areashop.reload")) {
|
||||
messages.add(languageManager.getLang("help-reload"));
|
||||
}
|
||||
|
||||
/* Send them all */
|
||||
for(int i=0; i<messages.size(); i++) {
|
||||
target.sendMessage(this.fixColors(messages.get(i)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Checks the config for errors, loads default config if they occur
|
||||
*/
|
||||
public boolean checkConfig() {
|
||||
int error = 0;
|
||||
debug = this.getConfig().getString("debug").equalsIgnoreCase("true");
|
||||
|
||||
/* GENERAL */
|
||||
String chatPrefix = this.getConfig().getString("chatPrefix");
|
||||
if (chatPrefix.length() == 0) {
|
||||
this.getLogger().info("Config-Error: chatPrefix has length zero");
|
||||
error++;
|
||||
}
|
||||
String moneyCharacter = this.getCurrencyCharacter();
|
||||
if (moneyCharacter.length() > 14) {
|
||||
this.getLogger().info("Config-Error: moneyCharacter is longer than 14 characters");
|
||||
error++;
|
||||
}
|
||||
String maximumTotal = this.getConfig().getString("maximumTotal");
|
||||
try {
|
||||
int maximumTotalInt = Integer.parseInt(maximumTotal);
|
||||
if(maximumTotalInt < -1) {
|
||||
this.getLogger().info("Config-Error: maximumTotal must be -1 or higher");
|
||||
error++;
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
this.getLogger().info("Config-Error: maximumTotal is not a valid number");
|
||||
error++;
|
||||
}
|
||||
|
||||
/* RENTING */
|
||||
String rentSign = this.getConfig().getString("rentSign");
|
||||
if (rentSign.length() > 15) {
|
||||
this.getLogger().info("Config-Error: rentSign is too long, maximum length is 15 characters");
|
||||
error++;
|
||||
}
|
||||
String signRentable = this.getConfig().getString("signRentable");
|
||||
if (signRentable.length() > 15) {
|
||||
this.getLogger().info("Config-Error: signRentable is too long, maximum length is 15 characters");
|
||||
error++;
|
||||
}
|
||||
String signRented = this.getConfig().getString("signRented");
|
||||
if (signRented.length() > 15) {
|
||||
this.getLogger().info("Config-Error: signRented is too long, maximum length is 15 characters");
|
||||
error++;
|
||||
}
|
||||
String maximumRents = this.getConfig().getString("maximumRents");
|
||||
try {
|
||||
int maximumRentsInt = Integer.parseInt(maximumRents);
|
||||
if(maximumRentsInt < -1) {
|
||||
this.getLogger().info("Config-Error: maximumRents must be -1 or higher");
|
||||
error++;
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
this.getLogger().info("Config-Error: maximumRents is not a valid number");
|
||||
error++;
|
||||
}
|
||||
String rentMoneyBack = this.getConfig().getString("rentMoneyBack");
|
||||
try {
|
||||
int rentMoneyBackInt = Integer.parseInt(rentMoneyBack);
|
||||
if(rentMoneyBackInt < 0 || rentMoneyBackInt > 100) {
|
||||
this.getLogger().info("Config-Error: rentMoneyBack must be between 0 and 100");
|
||||
error++;
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
this.getLogger().info("Config-Error: rentMoneyBack is not a valid number");
|
||||
error++;
|
||||
}
|
||||
String checkDelay = this.getConfig().getString("checkDelay");
|
||||
try {
|
||||
int checkDelayInt = Integer.parseInt(checkDelay);
|
||||
if(checkDelayInt < 1) {
|
||||
this.getLogger().info("Config-Error: checkDelay can't be below 1");
|
||||
error++;
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
this.getLogger().info("Config-Error: checkDelay is not a valid number");
|
||||
error++;
|
||||
}
|
||||
|
||||
/* BUYING */
|
||||
String buySign = this.getConfig().getString("buySign");
|
||||
if (buySign.length() > 15) {
|
||||
this.getLogger().info("Config-Error: buySign is too long, maximum length is 15 characters");
|
||||
error++;
|
||||
}
|
||||
String signBuyable = this.getConfig().getString("signBuyable");
|
||||
if (signBuyable.length() > 15) {
|
||||
this.getLogger().info("Config-Error: signBuyable is too long, maximum length is 15 characters");
|
||||
error++;
|
||||
}
|
||||
String signBuyed = this.getConfig().getString("signBuyed");
|
||||
if (signBuyed.length() > 15) {
|
||||
this.getLogger().info("Config-Error: signBuyed is too long, maximum length is 15 characters");
|
||||
error++;
|
||||
}
|
||||
String maximumBuys = this.getConfig().getString("maximumBuys");
|
||||
try {
|
||||
int maximumBuysInt = Integer.parseInt(maximumBuys);
|
||||
if(maximumBuysInt < -1) {
|
||||
this.getLogger().info("Config-Error: maximumBuys must be -1 or higher");
|
||||
error++;
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
this.getLogger().info("Config-Error: maximumBuys is not a valid number");
|
||||
error++;
|
||||
}
|
||||
String buyMoneyBack = this.getConfig().getString("buyMoneyBack");
|
||||
try {
|
||||
int buyMoneyBackInt = Integer.parseInt(buyMoneyBack);
|
||||
if(buyMoneyBackInt < 0 || buyMoneyBackInt > 100) {
|
||||
this.getLogger().info("Config-Error: buyMoneyBack must be between 0 and 100");
|
||||
error++;
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
this.getLogger().info("Config-Error: buyMoneyBack is not a valid number");
|
||||
error++;
|
||||
}
|
||||
|
||||
/* Load default config if errors have occurred */
|
||||
if (error > 0) {
|
||||
this.getLogger().info("The plugin has " + error + " error(s) in the config, default config will be used");
|
||||
}
|
||||
|
||||
/* return true if no errors, false if there are errors */
|
||||
return (error == 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends an debug message to the console
|
||||
* @param message The message that should be printed to the console
|
||||
*/
|
||||
public void debug(String message) {
|
||||
if(this.debug) {
|
||||
this.getLogger().info("Debug: " + message);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reload the config of the plugin
|
||||
*/
|
||||
public void reload() {
|
||||
this.saveDefaultConfig();
|
||||
this.reloadConfig();
|
||||
configOk = this.checkConfig();
|
||||
chatprefix = this.config().getString("chatPrefix");
|
||||
languageManager = new LanguageManager(this);
|
||||
shopManager.checkRents();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
package nl.evolutioncoding.AreaShop;
|
||||
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
public class RentCheck extends BukkitRunnable {
|
||||
AreaShop plugin;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param plugin The AreaShop plugin
|
||||
*/
|
||||
public RentCheck(AreaShop plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
plugin.getShopManager().checkRents();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,89 +0,0 @@
|
||||
package nl.evolutioncoding.AreaShop;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.Sign;
|
||||
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.player.PlayerInteractEvent;
|
||||
|
||||
public class RightClickListener implements Listener {
|
||||
AreaShop plugin;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param plugin The AreaShop plugin
|
||||
*/
|
||||
public RightClickListener(AreaShop plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a player interacts
|
||||
* @param event The event
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void onRightClick(PlayerInteractEvent event) {
|
||||
Block block = event.getClickedBlock();
|
||||
/* Check for clicking a sign and rightclicking */
|
||||
if(event.getAction() == Action.RIGHT_CLICK_BLOCK && (block.getType() == Material.SIGN_POST || block.getType() == Material.WALL_SIGN)) {
|
||||
/* Check if the rent sign is really the same as a saved rent */
|
||||
String regionName = ((Sign)(event.getClickedBlock().getState())).getLine(1);
|
||||
HashMap<String,String> rent = plugin.getShopManager().getRent(regionName);
|
||||
HashMap<String,String> buy = plugin.getShopManager().getBuy(regionName);
|
||||
|
||||
if(rent != null && block.getWorld().getName().equals(rent.get(plugin.keyWorld))
|
||||
&& rent.get(plugin.keyX).equals(String.valueOf(block.getX()))
|
||||
&& rent.get(plugin.keyY).equals(String.valueOf(block.getY()))
|
||||
&& rent.get(plugin.keyZ).equals(String.valueOf(block.getZ())) ) {
|
||||
|
||||
plugin.getShopManager().rent(event.getPlayer(), regionName);
|
||||
/* Cancel placing a block */
|
||||
event.setCancelled(true);
|
||||
|
||||
} else if(buy != null && block.getWorld().getName().equals(buy.get(plugin.keyWorld))
|
||||
&& buy.get(plugin.keyX).equals(String.valueOf(block.getX()))
|
||||
&& buy.get(plugin.keyY).equals(String.valueOf(block.getY()))
|
||||
&& buy.get(plugin.keyZ).equals(String.valueOf(block.getZ())) ) {
|
||||
|
||||
plugin.getShopManager().buy(event.getPlayer(), regionName);
|
||||
/* Cancel placing a block */
|
||||
event.setCancelled(true);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,406 +0,0 @@
|
||||
package nl.evolutioncoding.AreaShop;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class ShopCommands implements CommandExecutor {
|
||||
AreaShop plugin;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param plugin The AreaShop plugin
|
||||
*/
|
||||
public ShopCommands(AreaShop plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String alias, String[] args) {
|
||||
if(command.getName().equalsIgnoreCase("AreaShop")) {
|
||||
ShopManager shopManager = plugin.getShopManager();
|
||||
|
||||
/* Commands with 1 argument or more */
|
||||
if(args.length > 0 && args[0] != null) {
|
||||
/* Help command */
|
||||
if(args[0].equalsIgnoreCase("help")) {
|
||||
plugin.showHelp(sender);
|
||||
}
|
||||
|
||||
/* Renting command */
|
||||
else if(args[0].equalsIgnoreCase("rent")) {
|
||||
if (!(sender instanceof Player)) {
|
||||
plugin.message(sender, "onlyByPlayer");
|
||||
return true;
|
||||
}
|
||||
Player player = (Player)sender;
|
||||
if(args.length > 1 && args[1] != null) {
|
||||
shopManager.rent(player, args[1]);
|
||||
} else {
|
||||
plugin.message(sender, "rent-help");
|
||||
}
|
||||
}
|
||||
|
||||
/* Buying command */
|
||||
else if(args[0].equalsIgnoreCase("buy")) {
|
||||
if (!(sender instanceof Player)) {
|
||||
plugin.message(sender, "onlyByPlayer");
|
||||
return true;
|
||||
}
|
||||
Player player = (Player)sender;
|
||||
if(args.length > 1 && args[1] != null) {
|
||||
shopManager.buy(player, args[1]);
|
||||
} else {
|
||||
plugin.message(player, "buy-help");
|
||||
}
|
||||
}
|
||||
|
||||
/* Info command */
|
||||
else if(args[0].equalsIgnoreCase("info")) {
|
||||
if(args.length > 1 && args[1] != null) {
|
||||
if(args[1].equalsIgnoreCase("all")) {
|
||||
String message = "";
|
||||
/* Message for rents */
|
||||
Iterator<String> it = shopManager.getRents().keySet().iterator();
|
||||
if(it.hasNext()) {
|
||||
message = shopManager.getRent(it.next()).get(plugin.keyName);
|
||||
while(it.hasNext()) {
|
||||
message += ", " + shopManager.getRent(it.next()).get(plugin.keyName);
|
||||
}
|
||||
}
|
||||
if(message.equals("")) {
|
||||
plugin.message(sender, "info-all-noRents");
|
||||
} else {
|
||||
plugin.message(sender, "info-all-rents", message);
|
||||
}
|
||||
|
||||
/* Message for buys */
|
||||
it = shopManager.getBuys().keySet().iterator();
|
||||
if(it.hasNext()) {
|
||||
message = shopManager.getBuy(it.next()).get(plugin.keyName);
|
||||
while(it.hasNext()) {
|
||||
message += ", " + shopManager.getBuy(it.next()).get(plugin.keyName);
|
||||
}
|
||||
}
|
||||
if(message.equals("")) {
|
||||
plugin.message(sender, "info-all-noBuys");
|
||||
} else {
|
||||
plugin.message(sender, "info-all-buys", message);
|
||||
}
|
||||
}
|
||||
else if(args[1].equalsIgnoreCase("rented")) {
|
||||
String message = "";
|
||||
Iterator<String> it = shopManager.getRents().keySet().iterator();
|
||||
boolean first = true;
|
||||
while(it.hasNext()) {
|
||||
String next = shopManager.getRent(it.next()).get(plugin.keyName);
|
||||
if(shopManager.getRent(next).get(plugin.keyPlayer) != null) {
|
||||
if(!first) {
|
||||
message += ", " + next;
|
||||
} else {
|
||||
first = false;
|
||||
message = next;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(message.equals("")) {
|
||||
plugin.message(sender, "info-noRented");
|
||||
} else {
|
||||
plugin.message(sender, "info-rented", message);
|
||||
}
|
||||
} else if(args[1].equalsIgnoreCase("forrent")) {
|
||||
String message = "";
|
||||
Iterator<String> it = shopManager.getRents().keySet().iterator();
|
||||
boolean first = true;
|
||||
while(it.hasNext()) {
|
||||
String next = shopManager.getRent(it.next()).get(plugin.keyName);
|
||||
if(shopManager.getRent(next).get(plugin.keyPlayer) == null) {
|
||||
if(!first) {
|
||||
message += ", " + next;
|
||||
} else {
|
||||
first = false;
|
||||
message = next;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(message.equals("")) {
|
||||
plugin.message(sender, "info-noUnrented");
|
||||
} else {
|
||||
plugin.message(sender, "info-unrented", message);
|
||||
}
|
||||
} else if(args[1].equalsIgnoreCase("sold")) {
|
||||
String message = "";
|
||||
Iterator<String> it = shopManager.getBuys().keySet().iterator();
|
||||
boolean first = true;
|
||||
while(it.hasNext()) {
|
||||
String next = shopManager.getBuy(it.next()).get(plugin.keyName);
|
||||
if(shopManager.getBuy(next).get(plugin.keyPlayer) != null) {
|
||||
if(!first) {
|
||||
message += ", ";
|
||||
} else {
|
||||
first = false;
|
||||
}
|
||||
message += next;
|
||||
}
|
||||
}
|
||||
if(message.equals("")) {
|
||||
plugin.message(sender, "info-noSold");
|
||||
} else {
|
||||
plugin.message(sender, "info-sold", message);
|
||||
}
|
||||
} else if(args[1].equalsIgnoreCase("forsale")) {
|
||||
String message = "";
|
||||
Iterator<String> it = shopManager.getBuys().keySet().iterator();
|
||||
boolean first = true;
|
||||
while(it.hasNext()) {
|
||||
String next = shopManager.getBuy(it.next()).get(plugin.keyName);
|
||||
if(shopManager.getBuy(next).get(plugin.keyPlayer) == null) {
|
||||
if(!first) {
|
||||
message += ", " + next;
|
||||
} else {
|
||||
first = false;
|
||||
message = next;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(message.equals("")) {
|
||||
plugin.message(sender, "info-noForsale");
|
||||
} else {
|
||||
plugin.message(sender, "info-forsale", message);
|
||||
}
|
||||
} else if(args[1].equalsIgnoreCase("player")) {
|
||||
if(args.length > 2 && args[2] != null) {
|
||||
String message = "";
|
||||
Iterator<String> it = shopManager.getRents().keySet().iterator();
|
||||
boolean first = true;
|
||||
while(it.hasNext()) {
|
||||
String next = shopManager.getRent(it.next()).get(plugin.keyName);
|
||||
if(shopManager.getRent(next).get(plugin.keyPlayer) != null && shopManager.getRent(next).get(plugin.keyPlayer).equalsIgnoreCase(args[2])) {
|
||||
if(!first) {
|
||||
message += ", " + next;
|
||||
} else {
|
||||
first = false;
|
||||
message = next;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(message.equals("")) {
|
||||
plugin.message(sender, "info-playerNoRents", args[2]);
|
||||
} else {
|
||||
plugin.message(sender, "info-playerRents", args[2], message);
|
||||
}
|
||||
|
||||
message = "";
|
||||
it = shopManager.getBuys().keySet().iterator();
|
||||
first = true;
|
||||
while(it.hasNext()) {
|
||||
String next = shopManager.getBuy(it.next()).get(plugin.keyName);
|
||||
if(shopManager.getBuy(next).get(plugin.keyPlayer) != null && shopManager.getBuy(next).get(plugin.keyPlayer).equalsIgnoreCase(args[2])) {
|
||||
if(!first) {
|
||||
message += ", ";
|
||||
} else {
|
||||
first = false;
|
||||
}
|
||||
message += next;
|
||||
}
|
||||
}
|
||||
if(message.equals("")) {
|
||||
plugin.message(sender, "info-playerNoBuys", args[2]);
|
||||
} else {
|
||||
plugin.message(sender, "info-playerBuys", args[2], message);
|
||||
}
|
||||
} else {
|
||||
plugin.message(sender, "info-playerHelp");
|
||||
}
|
||||
} else if(args[1].equalsIgnoreCase("region")) {
|
||||
if(args.length > 2 && args[2] != null) {
|
||||
|
||||
HashMap<String,String> rent = shopManager.getRent(args[2]);
|
||||
HashMap<String,String> buy = shopManager.getBuy(args[2]);
|
||||
|
||||
if(rent == null) {
|
||||
plugin.message(sender, "info-regionRenting", args[2]);
|
||||
plugin.message(sender, "info-regionNoRenting", args[2]);
|
||||
} else {
|
||||
plugin.message(sender, "info-regionRenting", rent.get(plugin.keyName));
|
||||
plugin.message(sender, "info-regionSign", rent.get(plugin.keyWorld), rent.get(plugin.keyX), rent.get(plugin.keyY), rent.get(plugin.keyZ));
|
||||
plugin.message(sender, "info-regionPriceDuration", plugin.getCurrencyCharacter() + rent.get(plugin.keyPrice), rent.get(plugin.keyDuration));
|
||||
if(rent.get(plugin.keyPlayer) == null) {
|
||||
plugin.message(sender, "info-regionNotRented");
|
||||
} else {
|
||||
SimpleDateFormat dateFull = new SimpleDateFormat("dd MMMMMMMMMMMMMMMMM yyyy HH:mm");
|
||||
plugin.message(sender, "info-regionRentedBy", rent.get(plugin.keyPlayer), dateFull.format(Long.parseLong(rent.get(plugin.keyRentedUntil))));
|
||||
}
|
||||
}
|
||||
|
||||
if(buy == null) {
|
||||
plugin.message(sender, "info-regionBuying", args[2]);
|
||||
plugin.message(sender, "info-regionNoBuying", args[2]);
|
||||
} else {
|
||||
plugin.message(sender, "info-regionBuying", buy.get(plugin.keyName));
|
||||
plugin.message(sender, "info-regionSign", buy.get(plugin.keyWorld), buy.get(plugin.keyX), buy.get(plugin.keyY), buy.get(plugin.keyZ));
|
||||
plugin.message(sender, "info-regionPrice", plugin.getCurrencyCharacter() + buy.get(plugin.keyPrice));
|
||||
if(buy.get(plugin.keyPlayer) == null) {
|
||||
plugin.message(sender, "info-regionNotBought");
|
||||
} else {
|
||||
plugin.message(sender, "info-regionBoughtBy", buy.get(plugin.keyPlayer));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
plugin.message(sender, "info-regionHelp");
|
||||
}
|
||||
} else {
|
||||
plugin.message(sender, "info-help");
|
||||
}
|
||||
} else {
|
||||
plugin.message(sender, "info-help");
|
||||
}
|
||||
}
|
||||
|
||||
/* Unrenting command */
|
||||
else if(args[0].equalsIgnoreCase("unrent")) {
|
||||
if(args.length > 1 && args[1] != null) {
|
||||
HashMap<String,String> rent = shopManager.getRent(args[1]);
|
||||
if(rent == null) {
|
||||
plugin.message(sender, "unrent-notRegistered");
|
||||
} else {
|
||||
if(rent.get(plugin.keyPlayer) == null) {
|
||||
plugin.message(sender, "unrent-notRented");
|
||||
} else {
|
||||
if(sender.hasPermission("areashop.unrent")) {
|
||||
plugin.message(sender, "unrent-other", rent.get(plugin.keyPlayer));
|
||||
shopManager.unRent(args[1]);
|
||||
} else {
|
||||
if(sender.hasPermission("areashop.unrentown")) {
|
||||
if(rent.get(plugin.keyPlayer).equals(sender.getName())) {
|
||||
plugin.message(sender, "unrent-unrented");
|
||||
shopManager.unRent(args[1]);
|
||||
} else {
|
||||
plugin.message(sender, "unrent-noPermissionOther");
|
||||
}
|
||||
} else {
|
||||
plugin.message(sender, "unrent-noPermission");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
plugin.message(sender, "unrent-help");
|
||||
}
|
||||
}
|
||||
|
||||
/* Selling command */
|
||||
else if(args[0].equalsIgnoreCase("sell")) {
|
||||
if(args.length > 1 && args[1] != null) {
|
||||
HashMap<String,String> buy = shopManager.getBuy(args[1]);
|
||||
if(buy == null) {
|
||||
plugin.message(sender, "sell-notRegistered");
|
||||
} else {
|
||||
if(buy.get(plugin.keyPlayer) == null) {
|
||||
plugin.message(sender, "sell-notBought");
|
||||
} else {
|
||||
if(sender.hasPermission("areashop.sell")) {
|
||||
plugin.message(sender, "sell-sold", buy.get(plugin.keyPlayer));
|
||||
shopManager.unBuy(args[1]);
|
||||
} else {
|
||||
if(sender.hasPermission("areashop.sellown")) {
|
||||
if(buy.get(plugin.keyPlayer).equals(sender.getName())) {
|
||||
plugin.message(sender, "sell-soldYours");
|
||||
shopManager.unBuy(args[1]);
|
||||
} else {
|
||||
plugin.message(sender, "sell-noPermissionOther");
|
||||
}
|
||||
} else {
|
||||
plugin.message(sender, "sell-noPermission");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
plugin.message(sender, "sell-help");
|
||||
}
|
||||
}
|
||||
|
||||
/* UpdateRentSigns command */
|
||||
else if(args[0].equalsIgnoreCase("updaterentsigns")) {
|
||||
|
||||
if(sender.hasPermission("areashop.updaterentsigns")) {
|
||||
boolean result = plugin.getShopManager().updateRentSigns();
|
||||
if(result) {
|
||||
plugin.message(sender, "rentsigns-updated");
|
||||
} else {
|
||||
plugin.message(sender, "rentsigns-notUpdated");
|
||||
}
|
||||
|
||||
} else {
|
||||
plugin.message(sender, "rentsigns-noPermission");
|
||||
}
|
||||
}
|
||||
|
||||
/* UpdateBuySigns command */
|
||||
else if(args[0].equalsIgnoreCase("updatebuysigns")) {
|
||||
|
||||
if(sender.hasPermission("areashop.updatebuysigns")) {
|
||||
boolean result = plugin.getShopManager().updateBuySigns();
|
||||
if(result) {
|
||||
plugin.message(sender, "buysigns-updated");
|
||||
} else {
|
||||
plugin.message(sender, "buysigns-notUpdated");
|
||||
}
|
||||
} else {
|
||||
plugin.message(sender, "buysigns-noPermission");
|
||||
}
|
||||
}
|
||||
|
||||
/* updaterentregions command */
|
||||
else if(args[0].equalsIgnoreCase("updaterentregions")) {
|
||||
|
||||
if(sender.hasPermission("areashop.updaterentregions")) {
|
||||
plugin.getShopManager().updateRentRegions();
|
||||
plugin.message(sender, "rentregions-updated");
|
||||
} else {
|
||||
plugin.message(sender, "rentregions-noPermission");
|
||||
}
|
||||
}
|
||||
|
||||
/* updatebuyregions command */
|
||||
else if(args[0].equalsIgnoreCase("updatebuyregions")) {
|
||||
|
||||
if(sender.hasPermission("areashop.updatebuyregions")) {
|
||||
plugin.getShopManager().updateBuyRegions();
|
||||
plugin.message(sender, "buyregions-updated");
|
||||
} else {
|
||||
plugin.message(sender, "buyregions-noPermission");
|
||||
}
|
||||
}
|
||||
|
||||
/* reload command */
|
||||
else if(args[0].equalsIgnoreCase("reload")) {
|
||||
|
||||
if(sender.hasPermission("areashop.reload")) {
|
||||
plugin.reload();
|
||||
plugin.message(sender, "reload-reloaded");
|
||||
} else {
|
||||
plugin.message(sender, "reload-noPermission");
|
||||
}
|
||||
}
|
||||
|
||||
/* Not a valid command */
|
||||
else {
|
||||
plugin.message(sender, "cmd-notValid");
|
||||
}
|
||||
|
||||
} else {
|
||||
plugin.showHelp(sender);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,162 +0,0 @@
|
||||
package nl.evolutioncoding.AreaShop;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.Sign;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.event.block.BlockPhysicsEvent;
|
||||
|
||||
/**
|
||||
* Checks for placement of signs for this plugin
|
||||
* @author NLThijs48
|
||||
*/
|
||||
public final class SignBreakListener implements Listener {
|
||||
AreaShop plugin;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param plugin The AreaShop plugin
|
||||
*/
|
||||
public SignBreakListener(AreaShop plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Called when a block is broken
|
||||
* @param event The event
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void onSignBreak(BlockBreakEvent event) {
|
||||
Block block = event.getBlock();
|
||||
/* Check if it is a sign */
|
||||
if(block.getType() == Material.WALL_SIGN || block.getType() == Material.SIGN_POST) {
|
||||
Sign sign = (Sign)(block.getState());
|
||||
/* Check if the rent sign is really the same as a saved rent */
|
||||
HashMap<String,String> rent = plugin.getShopManager().getRent(sign.getLine(1));
|
||||
HashMap<String,String> buy = plugin.getShopManager().getBuy(sign.getLine(1));
|
||||
if(rent != null && rent.get(plugin.keyWorld).equals(block.getWorld().getName())
|
||||
&& rent.get(plugin.keyX).equals(String.valueOf(block.getX()))
|
||||
&& rent.get(plugin.keyY).equals(String.valueOf(block.getY()))
|
||||
&& rent.get(plugin.keyZ).equals(String.valueOf(block.getZ())) ) {
|
||||
/* Remove the rent if the player has permission */
|
||||
if(event.getPlayer().hasPermission("areashop.destroyrent")) {
|
||||
boolean result = plugin.getShopManager().removeRent(sign.getLine(1));
|
||||
if(result) {
|
||||
event.getPlayer().sendMessage(plugin.fixColors(plugin.config().getString("chatPrefix")) + "Renting of the region succesfully removed");
|
||||
}
|
||||
} else { /* Cancel the breaking of the sign */
|
||||
event.setCancelled(true);
|
||||
event.getPlayer().sendMessage(plugin.fixColors(plugin.config().getString("chatPrefix")) + "You don't have permission for destroying a sign for renting a region");
|
||||
}
|
||||
} else if(buy != null && buy.get(plugin.keyWorld).equals(block.getWorld().getName())
|
||||
&& buy.get(plugin.keyX).equals(String.valueOf(block.getX()))
|
||||
&& buy.get(plugin.keyY).equals(String.valueOf(block.getY()))
|
||||
&& buy.get(plugin.keyZ).equals(String.valueOf(block.getZ())) ) {
|
||||
/* Remove the buy if the player has permission */
|
||||
if(event.getPlayer().hasPermission("areashop.destroybuy")) {
|
||||
boolean result = plugin.getShopManager().removeBuy(sign.getLine(1));
|
||||
if(result) {
|
||||
event.getPlayer().sendMessage(plugin.fixColors(plugin.config().getString("chatPrefix")) + "Buying of the region succesfully removed");
|
||||
}
|
||||
} else { /* Cancel the breaking of the sign */
|
||||
event.setCancelled(true);
|
||||
event.getPlayer().sendMessage(plugin.fixColors(plugin.config().getString("chatPrefix")) + "You don't have permission for destroying a sign for buying a region");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the physics of a block change
|
||||
* @param event The event
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void onIndirectSignBreak(BlockPhysicsEvent event){
|
||||
Block block = event.getBlock();
|
||||
if(block.getType() == Material.SIGN_POST || block.getType() == Material.WALL_SIGN){
|
||||
Sign sign = (Sign)block.getState();
|
||||
Block attachedTo = block.getRelative(((org.bukkit.material.Sign)sign.getData()).getAttachedFace());
|
||||
if(attachedTo.getType() == Material.AIR){
|
||||
/* Check if the rent sign is really the same as a saved rent */
|
||||
HashMap<String,String> rent = plugin.getShopManager().getRent(sign.getLine(1));
|
||||
HashMap<String,String> buy = plugin.getShopManager().getBuy(sign.getLine(1));
|
||||
if(rent != null && rent.get(plugin.keyWorld).equals(block.getWorld().getName())
|
||||
&& rent.get(plugin.keyX).equals(String.valueOf(block.getX()))
|
||||
&& rent.get(plugin.keyY).equals(String.valueOf(block.getY()))
|
||||
&& rent.get(plugin.keyZ).equals(String.valueOf(block.getZ())) ) {
|
||||
/* Remove the rent */
|
||||
boolean result = plugin.getShopManager().removeRent(sign.getLine(1));
|
||||
if(result) {
|
||||
plugin.getLogger().info("Renting of region '" + sign.getLine(1) + "' has been removed by indirectly breaking the sign");
|
||||
}
|
||||
} else if(buy != null && buy.get(plugin.keyWorld).equals(block.getWorld().getName())
|
||||
&& buy.get(plugin.keyX).equals(String.valueOf(block.getX()))
|
||||
&& buy.get(plugin.keyY).equals(String.valueOf(block.getY()))
|
||||
&& buy.get(plugin.keyZ).equals(String.valueOf(block.getZ())) ) {
|
||||
/* Remove the buy */
|
||||
boolean result = plugin.getShopManager().removeBuy(sign.getLine(1));
|
||||
if(result) {
|
||||
plugin.getLogger().info("Buying of region '" + sign.getLine(1) + "' has been removed by indirectly breaking the sign");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,235 +0,0 @@
|
||||
package nl.evolutioncoding.AreaShop;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.block.SignChangeEvent;
|
||||
|
||||
import com.sk89q.worldguard.protection.managers.RegionManager;
|
||||
|
||||
/**
|
||||
* Checks for placement of signs for this plugin
|
||||
* @author NLThijs48
|
||||
*/
|
||||
public final class SignChangeListener implements Listener {
|
||||
AreaShop plugin;
|
||||
String chatPrefix;
|
||||
String rentSign;
|
||||
String buySign;
|
||||
String signRentable;
|
||||
String signBuyable;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param plugin The AreaShop plugin
|
||||
*/
|
||||
public SignChangeListener(AreaShop plugin) {
|
||||
this.plugin = plugin;
|
||||
chatPrefix = plugin.fixColors(plugin.config().getString("chatPrefix"));
|
||||
rentSign = plugin.config().getString("rentSign");
|
||||
buySign = plugin.config().getString("buySign");
|
||||
signRentable = plugin.fixColors(plugin.config().getString("signRentable"));
|
||||
signBuyable = plugin.fixColors(plugin.config().getString("signBuyable"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a sign is changed
|
||||
* @param event The event
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void onSignChange(SignChangeEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
|
||||
/* Check if the sign is meant for this plugin */
|
||||
if(event.getLine(0).contains(rentSign)) {
|
||||
if(!player.hasPermission("areashop.createrent")) {
|
||||
player.sendMessage(chatPrefix + "You don't have permission for setting up renting of regions");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* Get the other lines */
|
||||
String secondLine = event.getLine(1);
|
||||
String thirdLine = event.getLine(2);
|
||||
if(!thirdLine.equals("M")) {
|
||||
thirdLine = thirdLine.toLowerCase();
|
||||
}
|
||||
String fourthLine = event.getLine(3);
|
||||
|
||||
/* Get the regionManager for accessing regions */
|
||||
RegionManager regionManager = plugin.getWorldGuard().getRegionManager(event.getPlayer().getWorld());
|
||||
|
||||
/* check if all the lines are correct */
|
||||
if(secondLine == null || secondLine.length() == 0) {
|
||||
player.sendMessage(chatPrefix + "You did not specify a region on the second line!");
|
||||
return;
|
||||
} else if(regionManager.getRegion(secondLine) == null) {
|
||||
player.sendMessage(chatPrefix + "The region you specified does not exist!");
|
||||
return;
|
||||
} else if(plugin.getShopManager().getRent(secondLine) != null) {
|
||||
player.sendMessage(chatPrefix + "The region you specified already has a sign for renting");
|
||||
return;
|
||||
} else if(thirdLine == null || thirdLine.length() == 0) {
|
||||
player.sendMessage(chatPrefix + "You did not specify how long the region can be rented, do this on the third line");
|
||||
return;
|
||||
} else if(!this.checkTimeFormat(thirdLine)) {
|
||||
player.sendMessage(chatPrefix + "The time specified is not in the correct format");
|
||||
return;
|
||||
} else if(fourthLine == null || fourthLine.length() == 0) {
|
||||
player.sendMessage(chatPrefix + "You did not specify how much the renting costs on the fourth line!");
|
||||
return;
|
||||
} else {
|
||||
/* Check the fourth line */
|
||||
try {
|
||||
Double.parseDouble(fourthLine);
|
||||
} catch (NumberFormatException e) {
|
||||
player.sendMessage(chatPrefix + "You did not specify the renting cost correctly, use a number only");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Set the first line to signRentable */
|
||||
event.setLine(0, signRentable);
|
||||
event.setLine(1, regionManager.getRegion(secondLine).getId());
|
||||
event.setLine(3, plugin.getCurrencyCharacter() + fourthLine);
|
||||
|
||||
/* Add rent to the ShopManager */
|
||||
HashMap<String,String> rent = new HashMap<String,String>();
|
||||
rent.put(plugin.keyWorld, event.getBlock().getWorld().getName());
|
||||
rent.put(plugin.keyX, String.valueOf(event.getBlock().getX()));
|
||||
rent.put(plugin.keyY, String.valueOf(event.getBlock().getY()));
|
||||
rent.put(plugin.keyZ, String.valueOf(event.getBlock().getZ()));
|
||||
rent.put(plugin.keyDuration, thirdLine);
|
||||
rent.put(plugin.keyPrice, fourthLine);
|
||||
rent.put(plugin.keyName, regionManager.getRegion(secondLine).getId());
|
||||
plugin.getShopManager().addRent(secondLine, rent);
|
||||
|
||||
/* Set the flags for the region */
|
||||
plugin.getShopManager().setRegionFlags(secondLine, plugin.config().getConfigurationSection("flagsForRent"), true);
|
||||
|
||||
player.sendMessage(chatPrefix + "Renting of the region is setup correctly");
|
||||
}
|
||||
} else if (event.getLine(0).contains(buySign)) {
|
||||
/* Check for permission */
|
||||
if(!player.hasPermission("areashop.createbuy")) {
|
||||
player.sendMessage(chatPrefix + "You don't have permission for setting up buying of regions");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Get the other lines */
|
||||
String secondLine = event.getLine(1);
|
||||
String thirdLine = event.getLine(2);
|
||||
|
||||
/* Get the regionManager for accessing regions */
|
||||
RegionManager regionManager = plugin.getWorldGuard().getRegionManager(event.getPlayer().getWorld());
|
||||
|
||||
/* Check if all the lines are correct */
|
||||
if(secondLine == null || secondLine.length() == 0) {
|
||||
player.sendMessage(chatPrefix + "You did not specify a region on the second line!");
|
||||
return;
|
||||
} else if(regionManager.getRegion(secondLine) == null) {
|
||||
player.sendMessage(chatPrefix + "The region you specified does not exist!");
|
||||
return;
|
||||
} else if(plugin.getShopManager().getBuy(secondLine) != null) {
|
||||
player.sendMessage(chatPrefix + "The region you specified already has a sign for buying");
|
||||
return;
|
||||
} else if(thirdLine == null || thirdLine.length() == 0) {
|
||||
player.sendMessage(chatPrefix + "You did not specify how much the buying costs on the fourth line!");
|
||||
return;
|
||||
} else {
|
||||
/* Check the fourth line */
|
||||
try {
|
||||
Double.parseDouble(thirdLine);
|
||||
} catch (NumberFormatException e) {
|
||||
player.sendMessage(chatPrefix + "You did not specify the buying cost correctly, use a number only");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Set the first line to signbuyable */
|
||||
event.setLine(0, signBuyable);
|
||||
event.setLine(1, regionManager.getRegion(secondLine).getId());
|
||||
event.setLine(2, plugin.getCurrencyCharacter() + thirdLine);
|
||||
|
||||
/* Add buy to the ShopManager */
|
||||
HashMap<String,String> buy = new HashMap<String,String>();
|
||||
buy.put(plugin.keyWorld, event.getBlock().getWorld().getName());
|
||||
buy.put(plugin.keyX, String.valueOf(event.getBlock().getX()));
|
||||
buy.put(plugin.keyY, String.valueOf(event.getBlock().getY()));
|
||||
buy.put(plugin.keyZ, String.valueOf(event.getBlock().getZ()));
|
||||
buy.put(plugin.keyPrice, thirdLine);
|
||||
buy.put(plugin.keyName, regionManager.getRegion(secondLine).getId());
|
||||
plugin.getShopManager().addBuy(secondLine, buy);
|
||||
|
||||
/* Set the flags for the region */
|
||||
plugin.getShopManager().setRegionFlags(secondLine, plugin.config().getConfigurationSection("flagsForSale"), false);
|
||||
|
||||
player.sendMessage(chatPrefix + "Buying of the region is setup correctly");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the string is a correct time period
|
||||
* @param time String that has to be checked
|
||||
* @return true if format is correct, false if not
|
||||
*/
|
||||
public boolean checkTimeFormat(String time) {
|
||||
/* Check if the string is not empty and check the length */
|
||||
if(time == null || time.length() <= 1 || time.indexOf(' ') == -1 || time.indexOf(' ') >= (time.length()-1)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Check if the suffix is one of these values */
|
||||
String[] timeValues = {"m","min","mins","minute","minutes","minuten","minuut",
|
||||
"h","hour","hours","uur","uren",
|
||||
"M", "month", "months","maanden","maand",
|
||||
"d","day","days","dag","dagen",
|
||||
"y","year","years","jaar","jaren"};
|
||||
String suffix = time.substring(time.indexOf(' ')+1, time.length());
|
||||
boolean result = false;
|
||||
for(int i=0; i<timeValues.length && !result; i++) {
|
||||
result = timeValues[i].equals(suffix);
|
||||
}
|
||||
if(!result) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* check if the part before the space is a number */
|
||||
String prefix = time.substring(0, (time.indexOf(' ')));
|
||||
return prefix.matches("\\d+");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
#AreaShop
|
||||
|
||||
Check the documentation at http://dev.bukkit.org/bukkit-plugins/regionbuyandrent/
|
||||
|
||||
Note: From now on I will try to update this repository every time I make a change to the code.
|
||||
+327
@@ -0,0 +1,327 @@
|
||||
# ╔════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════╗
|
||||
# ║ config.yml file of the AreaShop plugin created by NLThijs48, Github can be found at https://github.com/NLthijs48/AreaShop ║
|
||||
# ║ This file contains options to change the working of the plugin, the profiles defined here can be used in default.yml ║
|
||||
# ╚════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════╝
|
||||
# ┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
# │ GENERAL: Options that influence the global state of the plugin │
|
||||
# └────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
## Chatprefix used for all messages in the chat. Also check the 'greeting' lines in the 'flagProfiles' section,
|
||||
## these also contain the prefix and you may want to change those to
|
||||
chatPrefix: '&2[AreaShop]&r '
|
||||
## The characters used for the prices of regions, will appear before the number, for the euro character use '%euro%'
|
||||
moneyCharacter: '$'
|
||||
## The characters used after a currency number, '%euro%' will become the euro character
|
||||
moneyCharacterAfter: ''
|
||||
## How many numbers behind the dot should be shown (2 will make numbers like '8.55', '9.01')
|
||||
fractionalNumbers: 2
|
||||
## Set this to true if you want to hide '.0' for a number like '15.0' ('4.50' will still stay '4.50')
|
||||
hideEmptyFractionalPart: true
|
||||
## The .yml language file that should be used, provided by this plugin: EN, NL
|
||||
language: EN
|
||||
## Enable Schematic saving and restoring in general
|
||||
enableSchematics: true
|
||||
## The tags you need to write on the sign to trigger the plugin
|
||||
signTags:
|
||||
## Tag for adding a rent region
|
||||
rent: '[rent]'
|
||||
## Tag for adding a buy region
|
||||
buy: '[buy]'
|
||||
## Tag for adding a sign to an existing region
|
||||
add: '[as]'
|
||||
## Enable sending stats to http://mcstats.org/ (Metrics plugin)
|
||||
sendStats: true
|
||||
## Use colors when sending messages to console and log files
|
||||
useColorsInConsole: false
|
||||
## Post error messages in the console when a command run from the config fails (from the 'runCommands' section for example)
|
||||
postCommandErrors: true
|
||||
## Enables / disables debug messages in the console, could be useful to figure out where errors come from
|
||||
debug: false
|
||||
## Version of the config, do not change!
|
||||
version: 2.1.0
|
||||
|
||||
|
||||
# ┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
# │ RENTING: Options that apply to all rent regions │
|
||||
# └────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
## Timeformat to use on the signs, default is like '30-06 14:52', US format: 'MM-dd KK:mm a'
|
||||
## Search for 'java SimpleDateFormat' for more options and documentation
|
||||
timeFormatSign: 'dd-MM HH:mm'
|
||||
## Timeformat used in the chat, default is like '30 june 2014 14:52', US format: 'MMMMMMMMMMMMMMMMM dd yyyy KK:mm a'
|
||||
## Search for 'java SimpleDateFormat' for more options and documentation
|
||||
timeFormatChat: 'dd MMMMMMMMMMMMMMMMM yyyy HH:mm'
|
||||
## Time indicators, used for specifing rent duration on the signs
|
||||
## Be careful with deleting words, will break signs using those, adding is no problem
|
||||
minutes: [m, min, mins, minute, minutes, minuten, minuut]
|
||||
hours: [h, hour, hours, uur, uren]
|
||||
days: [d, day, days, dag, dagen]
|
||||
months: [M, month, months, maanden, maand]
|
||||
years: [y, year, years, jaar, jaren]
|
||||
|
||||
|
||||
# ┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
# │ PERMISSION GROUPS: Assigned by giving players certain permissions │
|
||||
# └────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
## Configure the max total regions, max rent regions and max buy regions with different groups (-1 is unlimited)
|
||||
## Assign a group to players by giving them the permission 'areashop.limits.<group>'
|
||||
## Every player already has the group 'default' and ops have the unlimited group
|
||||
## All the groups applied to the player will be checked and only if they all allow an extra region it will be permitted
|
||||
## Add a 'worlds' or 'groups' list to a group to only count regions from those worlds and/or groups .
|
||||
## This can be used to get different limits for other worlds or area's.
|
||||
## Give players permissions globally and not per world! That would break limits when then try renting/buying from within another world
|
||||
limitGroups:
|
||||
default:
|
||||
total: 1
|
||||
rents: 1
|
||||
buys: 1
|
||||
|
||||
|
||||
# ┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
# │ PROFILES: Assigned in general (default.yml), for a group (groups.yml) or individually (<region>.yml) │
|
||||
# └────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
## Below is a list of tags that can be used with all the profiles below.
|
||||
## If a tag has no value (for example when you use %player% when the region is not rented/bought) then the tag will not get replaced
|
||||
## %region% The region name (with correct capitalization)
|
||||
## %player% The name of the player that rents/buys the region (with correct capitalization), will not get replaced if no renter/buyer
|
||||
## %uuid% The uuid of the player that rents/buys the region, will not get replaced if no renter/buyer
|
||||
## %friends% The names of friends added to this region separated by ', '
|
||||
## %friendsuuid% The UUID's of friends added to this region separated by ', '
|
||||
## %price% The price of the region formatted with the configured characters before and after the number
|
||||
## %duration% The duration of a rent region, for example '1 d', '4 minutes' or '2 years'
|
||||
## %world% The name of the world that the region is in
|
||||
## %type% The type of the region, 'rent' or 'buy'
|
||||
## %until% The end time of a rent formatted as configured with 'timeFormatChat'
|
||||
## %untilshort% The end time of a rent formatted as configured with 'timeFormatSign'
|
||||
## %width% The width of the region (amount of blocks on the x-axis)
|
||||
## %depth% The depth of the region (amount of blocks on the z-axis)
|
||||
## %height% The height of the region (amount of blocks on the y-axis)
|
||||
## %timeleft% The time left on the rent (uses the unit of time that fits best, minutes used from 121 seconds till 120 minutes)
|
||||
## %clicker% The name of the player that clicked the sign (only to be used in the signProfiles section)
|
||||
## %resellprice% The price of a region when it is in resell mode
|
||||
## %moneyback% The amount of money the player will get back when unrenting/selling the region (formatted with currency characters)
|
||||
## %moneybackpercent% The percentage of the price the player will get back when unrenting (only the number between 0-100)
|
||||
## %maxextends% The maximum number of extends a player can do on the region
|
||||
## %extendsleft% The number of extends that are left (maxextends - timesextended)
|
||||
## %maxrenttime% The maximum time you can rent a region in advance (human readble)
|
||||
## %inactivetime% The maximum time a player may be inactive before unrent/sell (human readble)
|
||||
|
||||
## Below are profiles for the signs, you can assign profiles to regions
|
||||
## by setting 'general.signProfile' in default.yml, groups or individual regions
|
||||
signProfiles:
|
||||
default:
|
||||
## The following sections can be added for performing certain commands when the sign is clicked:
|
||||
## rightClickPlayer, rightClickConsole, shiftRightClickPlayer, shiftRightClickConsole,
|
||||
## leftClickPlayer, leftClickConsole, shiftLeftClickPlayer, shiftLeftClickConsole
|
||||
## Sections with 'Player' at the end will be run by the clicking player and 'Console' ones from the console
|
||||
forrent:
|
||||
line1: '&2&l[For Rent]'
|
||||
line2: '%region%'
|
||||
line3: '%duration%'
|
||||
line4: '%price%'
|
||||
rightClickPlayer:
|
||||
- 'areashop rent %region%'
|
||||
leftClickPlayer:
|
||||
- 'areashop info region %region%'
|
||||
rented:
|
||||
line1: '&4&l[Rented]'
|
||||
line2: '%region%'
|
||||
line3: '%player%'
|
||||
line4: '%untilshort%'
|
||||
rightClickPlayer:
|
||||
- 'areashop rent %region%'
|
||||
leftClickPlayer:
|
||||
- 'areashop info region %region%'
|
||||
shiftRightClickPlayer:
|
||||
- 'areashop unrent %region%'
|
||||
forsale:
|
||||
line1: '&2&l[For Sale]'
|
||||
line2: '%region%'
|
||||
line3: '%price%'
|
||||
line4:
|
||||
rightClickPlayer:
|
||||
- 'areashop buy %region%'
|
||||
leftClickPlayer:
|
||||
- 'areashop info region %region%'
|
||||
resell:
|
||||
line1: '&9&l[Resale]'
|
||||
line2: '%region%'
|
||||
line3: '%resellprice%'
|
||||
line4: '&8%player%'
|
||||
rightClickPlayer:
|
||||
- 'areashop buy %region%'
|
||||
leftClickPlayer:
|
||||
- 'areashop info region %region%'
|
||||
shiftRightClickPlayer:
|
||||
- 'areashop stopresell %region%'
|
||||
sold:
|
||||
line1: '&4&l[Sold]'
|
||||
line2: '%region%'
|
||||
line3: '%player%'
|
||||
line4:
|
||||
rightClickPlayer:
|
||||
- 'areashop buy %region%'
|
||||
leftClickPlayer:
|
||||
- 'areashop info region %region%'
|
||||
shiftRightClickPlayer:
|
||||
- 'areashop sell %region%'
|
||||
## Option to run certain commands when one of these events happen
|
||||
## Commands at a 'before' section will execute before the region details are changed in the AreaShop system
|
||||
## and before any other actions occurred (changing signs, saving/loading schematics, etc.),
|
||||
## the 'after' commands will be run when all changes are done.
|
||||
## After 'before' or 'after' you can create a list of commands (see example at the created event)
|
||||
eventCommandProfiles:
|
||||
default:
|
||||
created:
|
||||
before:
|
||||
after:
|
||||
## - "say An AreaShop region has been created: %region%"
|
||||
deleted:
|
||||
before:
|
||||
after:
|
||||
rented:
|
||||
before:
|
||||
after:
|
||||
extended:
|
||||
before:
|
||||
after:
|
||||
unrented:
|
||||
before:
|
||||
after:
|
||||
bought:
|
||||
before:
|
||||
after:
|
||||
sold:
|
||||
before:
|
||||
after:
|
||||
resell:
|
||||
before:
|
||||
after:
|
||||
## For the following events you can specify if you want to restore or save the region to a schematic
|
||||
## After 'save:' or 'restore:' you enter the name of the file to restore from/to
|
||||
## If you want your regions all looking the same then you can leave out the %region% part to use the same schematic for all
|
||||
## Be carefull with these options, it could crash your server or destroy (parts of) your world if used wrong!
|
||||
## The limit 'maximumBlocks' applies to restoring/saving schematics, be sure your regions are below the limit
|
||||
schematicProfiles:
|
||||
default:
|
||||
created:
|
||||
save: '%type%-%region%'
|
||||
restore: ''
|
||||
deleted:
|
||||
save: ''
|
||||
restore: '%type%-%region%'
|
||||
rented:
|
||||
save: ''
|
||||
restore: ''
|
||||
unrented:
|
||||
save: ''
|
||||
restore: '%type%-%region%'
|
||||
bought:
|
||||
save: ''
|
||||
restore: ''
|
||||
sold:
|
||||
save: ''
|
||||
restore: '%type%-%region%'
|
||||
resell:
|
||||
save: ''
|
||||
restore: ''
|
||||
## Flag profiles to specify what flags should be set on the WorldGuard regions
|
||||
## All normal region flags as present in WorldGuard can be used, and also members, owners, priority and parent
|
||||
## The members and owners flag normally take a list of UUID's separated by 'comma space', adding by name is possible with 'n:<name>'
|
||||
## You can add groups by using 'g:<groupname>', so in total you could use: '%uuid%, %friendsuuid%, g:vip, n:cool-guy'
|
||||
## For flags like 'entry' and 'exit' you can add group setting by using 'g:<scope>' behind it, <scope> is one of the following:
|
||||
## members, non_members, owners, non_owners, all. Example, only owners can enter the region:
|
||||
## entry: 'deny g:non_owners'
|
||||
## Use '' for a flag to reset it.
|
||||
flagProfiles:
|
||||
default:
|
||||
forrent:
|
||||
members: ''
|
||||
greeting: '%lang:prefix%%lang:greeting-forrent%'
|
||||
rented:
|
||||
members: '%uuid%, %friendsuuid%'
|
||||
greeting: '%lang:prefix%%lang:greeting-rented%'
|
||||
forsale:
|
||||
members: ''
|
||||
greeting: '%lang:prefix%%lang:greeting-forsale%'
|
||||
sold:
|
||||
members: '%uuid%, %friendsuuid%'
|
||||
greeting: '%lang:prefix%%lang:greeting-bought%'
|
||||
resale:
|
||||
members: '%uuid%, %friendsuuid%'
|
||||
greetin: '%lang:prefix%%lang:greeting-resale%'
|
||||
## Profiles that specify when players should get messages about rent that almost run out
|
||||
## The numbers that start sections in the profile specify how time before it actually runs out it should be executed
|
||||
## When warnPlayer is set to true a message will be send that is specified in the language file
|
||||
## All commands in the list below 'commands:' will execute together with the warning, all normal variables can be used
|
||||
expirationWarningProfiles:
|
||||
default:
|
||||
"1 day":
|
||||
warnPlayer: true
|
||||
commands:
|
||||
## - "say %region% is about to expire for %player%: %timeleft% left"
|
||||
"1 hour":
|
||||
warnPlayer: true
|
||||
commands:
|
||||
"5 minutes":
|
||||
warnPlayer: true
|
||||
commands:
|
||||
|
||||
|
||||
# ┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
# │ LIMITS AND TIMINGS: Options for limits and the frequencies for certain functions (be very carefull with these!) │
|
||||
# └────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
## Setting the 'delay' setting to 0 or lower will prevent the taks from runnning, if you don't use a certain feature you
|
||||
## could switch the task off this way.
|
||||
|
||||
## Maximum number of blocks to save to or restore from a .schemetic
|
||||
maximumBlocks: 1000000
|
||||
## Maximum number of locations the teleport function should check to find a safe spot
|
||||
maximumTries: 50000
|
||||
## Timings for saving files that need saving
|
||||
saving:
|
||||
## Time between saving files that need to be saved (not all files will be saved by default)
|
||||
delay: 10
|
||||
## How many regions per tick will be saved
|
||||
regionsPerTick: 1
|
||||
## Timings for rent expiration checking
|
||||
expiration:
|
||||
## Time between checking if rent regions have been expired (seconds)
|
||||
delay: 59
|
||||
## Number of rent regions to check per tick (there are 20 ticks in a second)
|
||||
regionsPerTick: 5
|
||||
## Timings for expiration warning to online players
|
||||
expireWarning:
|
||||
## The time between checking if expiration warning need to be sent
|
||||
delay: 5
|
||||
## Number of regions to update per tick (there are 20 ticks in a second)
|
||||
regionsPerTick: 1
|
||||
## Timings for updating signs and region flags (/as updaterents or /as updatebuys)
|
||||
update:
|
||||
## Number of regions to update per tick (there are 20 ticks in a second)
|
||||
regionsPerTick: 2
|
||||
## Time between checking if any regions need to be unrented because the player was not online for the specified time period (minutes)
|
||||
## -1 means never, 1440 is one day, 43200 is one month, 525600 is one year
|
||||
inactive:
|
||||
## Time between checking if a regions needs to be unrented/sold because of inactivity by the player (minutes)
|
||||
delay: 15
|
||||
## Number of rent regions to check per tick (there are 20 ticks in a second)
|
||||
regionsPerTick: 5
|
||||
## Timings for the periodic updating of signs (for timeleft tags etc)
|
||||
signs:
|
||||
## Time between updates of all signs (seconds)
|
||||
delay: 60
|
||||
## Number of regions to update signs for per tick (there are 20 ticks in a second)
|
||||
regionsPerTick: 1
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
+82
@@ -0,0 +1,82 @@
|
||||
# ╔════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════╗
|
||||
# ║ default.yml file of the AreaShop plugin created by NLThijs48, Github can be found at https://github.com/NLthijs48/AreaShop ║
|
||||
# ║ All settings below are default settings and can be overridden by group settings or individual region settings ║
|
||||
# ╚════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════╝
|
||||
# ┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
# │ GENERAL: Options for all regions │
|
||||
# └────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
general:
|
||||
## Set this to true to enable saving/restoring for regions as specified in the profile below, which is specified in the config
|
||||
enableRestore: false
|
||||
## The schematic profile as specified in the config
|
||||
schematicProfile: 'default'
|
||||
## The event commands profile as specified in the config
|
||||
eventCommandProfile: 'default'
|
||||
## The profile for the format of the sign as specified in the config
|
||||
signProfile: 'default'
|
||||
## The profile for the WorldGuard flags as specified in the config
|
||||
flagProfile: 'default'
|
||||
## The y location within the region to start searching for safe teleport spots (x and z will be in the middle of the region)
|
||||
## Possible values: bottom, middle, top
|
||||
teleportLocationY: bottom
|
||||
## If true the teleportation algorithm only allows telportation to inside the region, otherwise it will expand algorithm
|
||||
## a cube from the starting point to check for safe spots (then it could end outside the region)
|
||||
## If you set a teleport location outside of the region with /as settp then setting this to true breaks that teleport (players cannot use it)
|
||||
teleportIntoRegion: true
|
||||
## Same as above, but then for when you teleport to the sign of a region instead of the region itself
|
||||
teleportToSignIntoRegion: false
|
||||
## Restricts the /as buy and /as rent commands to the world of the region
|
||||
## Usefull if you have diffrent economies for different worlds
|
||||
restrictedToWorld: false
|
||||
## Restricts the /as buy and /as rent commands to the region itself (player needs to be inside)
|
||||
restrictedToRegion: false
|
||||
|
||||
|
||||
# ┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
# │ RENT: Options for rent regions │
|
||||
# └────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
rent:
|
||||
## The default price of a renting region
|
||||
price: 1000
|
||||
## The default duration of a renting region, you can find all time indicators in config.yml below the RENTING header
|
||||
duration: '1 day'
|
||||
## The percentage of the renting price you get back if you unrent the region (price of time left will be multiplied by this/100)
|
||||
moneyBack: 100
|
||||
## Maximum number of extends a player can do (-1 for infinite, 0 for no extending)
|
||||
maxExtends: -1
|
||||
## The Maximum time they can have the region rented in advance (minutes, -1 for infinite)
|
||||
## If you set this higher then the duration players will not be able to rent the region
|
||||
maxRentTime: -1
|
||||
## Automatically unrent the region after the specified number of minutes between the last login time of the renter and the current time
|
||||
## -1 means never, 1440 is one day, 43200 is one month, 525600 is one year
|
||||
inactiveTimeUntilUnrent: -1
|
||||
## If a region of a player has less then this time left when he joins the server he will get a warning
|
||||
## You can find all time indicators in config.yml below the RENTING header, change to '' to disable
|
||||
warningOnLoginTime: '1 day'
|
||||
## The profile for the expiration warnings as specified in the config
|
||||
expirationWarningProfile: 'default'
|
||||
|
||||
|
||||
# ┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
|
||||
# │ BUY: Options for buy regions │
|
||||
# └────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
|
||||
buy:
|
||||
## The default price of a buying region
|
||||
price: 1000
|
||||
## The percentage of the buying price you get back if you sell the region
|
||||
moneyBack: 100
|
||||
## Automatically sell the region after the specified number of minutes between the last login time of the buyer and the current time
|
||||
## -1 mean never, 1440 is one day, 43200 is one month, 525600 is one year
|
||||
inactiveTimeUntilSell: -1
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
+309
@@ -0,0 +1,309 @@
|
||||
# ╔════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════╗
|
||||
# ║ Language file of the AreaShop plugin created by NLThijs48, Github can be found at https://github.com/NLthijs48/AreaShop ║
|
||||
# ║ Language: German, Version: V2.1.0, Percentage translated: 88%, author(s): Androkai ║
|
||||
# ║ This file will be overwritten at each startup/reload of the plugin, if you want to change anything then do the following: ║
|
||||
# ║ 1: Make a copy of this file ║
|
||||
# ║ 2: Rename it to <servername>.yml (don't use a language code as filename, could otherwise be overwritten in future updates) ║
|
||||
# ║ 3: Change the 'language' setting in config.yml to '<servername>', do not include '.yml' ║
|
||||
# ╚════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════╝
|
||||
total-maximum: "Du kannst nicht mehr als zusammen %0% Region(en) mieten/kaufen (Du hast bereits %1% in Gruppe '%2%')"
|
||||
cmd-notValid: "Der Befehl ist ungültig, nutze '/as help' für weitere Informationen"
|
||||
cmd-onlyByPlayer: "Dieser Befehl kann nur von einem Spieler ausgeführt werden"
|
||||
cmd-weOnlyByPlayer: "Eine WorldEdit-Selektion kann nur von einem Spieler gewählt werden, gib die Region als extra Argument an"
|
||||
cmd-noSelection: "Du hast mit WorldEdit Nichts markiert"
|
||||
cmd-noRegionsFound: "In deiner Selektion wurden keine mit AreaShop registrierten Regionen gefunden"
|
||||
cmd-noWERegionsFound: "Es wurden keine WorldEdit-Regionen gefunden, die sich mit deiner Selektion überschneiden"
|
||||
cmd-notRegistered: "%0% ist nicht in AreaShop eingetragen"
|
||||
cmd-noRegionsAtLocation: "Keine Regionen an deiner Stelle gefunden, gib die Region als Argument an"
|
||||
cmd-moreRegionsAtLocation: "Mehr als eine Region wurde an deiner Position gefunden, gib die Region als Argument an"
|
||||
cmd-automaticRegionOnlyByPlayer: "Automatische Auswahl einer Region ist nur für Spieler möglich, gibt die Region als Argument an"
|
||||
help-header: "Hilfeseite mit Befehlen, die du ausführen kannst"
|
||||
help-alias: "Befehlsaliase: /areashop, /as"
|
||||
help-help: "&6/as help &7-&r Zeigt diese Hilfeseite"
|
||||
help-info: "&6/as info &7-&r Zeigt Informationen über die aktuellen Regionen"
|
||||
help-rent: "&6/as rent &7-&r Miete eine Region oder verlängere die Mietzeit"
|
||||
help-buy: "&6/as buy &7-&r Kaufe eine Region"
|
||||
help-unrent: "&6/as unrent &7-&r Kündige den Mietvertrag einer Region"
|
||||
help-unrentOwn: "&6/as unrent &7-&r Kündige den Mietvertrag deiner Region"
|
||||
help-sell: "&6/as sell &7-&r Verkaufe eine Region"
|
||||
help-sellOwn: "&6/as sell &7-&r Verkaufe deine Region"
|
||||
help-updaterents: "&6/as updaterents &7-&r Aktualisiere alle Mietschilder und -regionen"
|
||||
help-updatebuys: "&6/as updatebuys &7-&r Aktualisiere alle Verkaufsschilder und -regionen"
|
||||
help-reload: "&6/as reload &7-&r Lade die Konfigurations- und Sprachdateien neu ein"
|
||||
help-setrestore: "&6/as setrestore &7-&r Setze Wiederherstellung an/aus und wähle Profil"
|
||||
help-setprice: "&6/as setprice &7-&r Ändere den Preis einer Region"
|
||||
help-setduration: "&6/as setduration &7-&r Ändere die Mietdauer einer Region"
|
||||
help-teleport: "&6/as tp &7-&r Teleportiere zu deiner gekauften/gemieteten Region"
|
||||
help-teleportAll: "&6/as tp &7-&r Teleportiere zu einer gekauften/gemieteten Region"
|
||||
help-setteleport: "&6/as settp &7-&r Erstelle Teleport-Punkt für eine gekaufte/gemietete Region"
|
||||
help-setteleportAll: "&6/as settp &7-&r Erstelle Teleportpunkt für eine Region"
|
||||
help-find: "&6/as find &7-&r Finde eine Region, welche gekauft oder gemietet werden kann"
|
||||
help-groupadd: "&6/as groupadd &7-&r Füge eine Region einer Gruppe hinzu"
|
||||
help-groupdel: "&6/as groupdel &7-&r Entferne eine Region aus einer Gruppe"
|
||||
help-grouplist: "&6/as grouplist &7-&r Zeige alle momentan existierenden Gruppen an"
|
||||
help-groupinfo: "&6/as groupinfo &7-&r Zeige Informationen über eine Gruppe an"
|
||||
help-schemevent: "&6/as schemevent &7-&r Starte ein Schematic-Event für eine Region"
|
||||
help-add: "&6/as add &7-&r Definiere eine Region als zu verkaufen oder zu vermieten"
|
||||
help-del: "&6/as del &7-&r Entferne eine Region aus AreaShop"
|
||||
help-addsign: "&6/as addsign &7-&r Füge einer Region ein Schild hinzu"
|
||||
help-delsign: "&6/as delsign &7-&r Lösche das Schild einer Region, welches du gerade ansiehst"
|
||||
help-me: "&6/as me &7-&r Überprüfe, welche Regionen du besitzt (+Verfallsdatum)"
|
||||
help-setowner: "&6/as setowner &7-&r Lege den Besitzer der Region fest oder verlängere die Mietdauer"
|
||||
help-resell: "&6/as resell &7-&r Aktiviere den Weiterverkaufs-Modus für eine deiner Regionen"
|
||||
help-resellAll: "&6/as resell &7-&r Aktiviere Weiterverkaufs-Modus für eine Region"
|
||||
help-stopResell: "&6/as stopresell &7-&r Stoppe den Weiterverkauf deiner Region"
|
||||
help-stopResellAll: "&6/as stopresell &7-&r Stoppe den Weiterverkauf einer Region"
|
||||
help-addFriend: "&6/as addfriend &7-&r Füge einen Freund zu deiner Region hinzu"
|
||||
help-addFriendAll: "&6/as addfriend &7-&r Füge einen Spieler zu einer Region hinzu"
|
||||
help-delFriend: "&6/as delfriend &7-&r Entferne einen Freund von deiner Region"
|
||||
help-delFriendAll: "&6/as delfriend &7-&r Entferne einen Spieler von einer Region"
|
||||
rent-help: "/as rent [Region], Wenn kein Regionsname angegeben wird, wird die Region genutzt, in der du dich gerade befindest"
|
||||
rent-noPermission: "Du bist nicht berechtigt, diese Region zu mieten"
|
||||
rent-maximum: "Du kannst nicht mehr als %0% Region(en) mieten (Du hast bereits %1% in Gruppe '%2%')"
|
||||
rent-payError: "Die Bezahlung hat nicht funktioniert. Bitte versuche es später noch einmal"
|
||||
rent-rented: "Du hast %0% von %1% gemietet"
|
||||
rent-extended: "Du hast die Miete verlängert von %0% bis %1%"
|
||||
rent-extend: "Du kannst die Miete verlängern, indem du mit rechts noch einmal auf das Schild klickst oder den Befehl /as rent nutzt"
|
||||
rent-lowMoneyExtend: "Du hast nicht genug Geld, um die Miete zu verlängern (Du hast %0%, benötigst aber %1%)"
|
||||
rent-lowMoneyRent: "Du hast nicht genug Geld, um diese Region zu mieten (Du hast %0%, benötigst aber %1%)"
|
||||
rent-someoneElse: "Diese Region ist bereits vermietet"
|
||||
rent-notRentable: "Diese Region ist nicht mietbar"
|
||||
rent-maxExtends: "Du kannst die Miete nicht verlängern (Die Miete ist maximal %0% mal verlängerbar), du kannst die Region allerdings neu mieten, sobald sie wieder zu vermieten ist"
|
||||
rent-maxRentTime: "Du kannst die Mietdauer dieser Region nicht erneut verlängern. Die maximale Zeit beträgt %0% Minuten und du hast sie bereits für %1% Minuten gemietet"
|
||||
rent-restrictedToWorld: "Du musst dich in der '%0%' Welt befinden, um diese Region mieten zu können (Du bist in '%1%')"
|
||||
rent-restrictedToRegion: "Du musst innerhalb von '%0%' sein, um es zu mieten"
|
||||
rent-expireWarning: "Deine Region %region% hat %timeleft% übrig. Gehe sicher, dass du es rechtzeitig verlängerst, wenn du sie behalten willst"
|
||||
buy-help: "/as buy [Region], Wenn kein Regionsname angegeben wird, wird die Region genutzt, in der du dich gerade befindest"
|
||||
buy-noPermission: "Du bist nicht berechtigt, eine Region zu kaufen"
|
||||
buy-notBuyable: "Diese Region steht nicht zum Verkauf bereit"
|
||||
buy-maximum: "Du kannst nicht mehr als %0% Region(en) erwerben (Du hast bereits %1% in Gruppe '%2%')"
|
||||
buy-payError: "Die Bezahlung hat nicht funktioniert. Bitte versuche es später noch einmal"
|
||||
buy-succes: "Du hast %0% erfolgreich gekauft"
|
||||
buy-successResale: "Du hast %0% erfolgreich von %1% gekauft"
|
||||
buy-successSeller: "Deine Region %0% wurde an %1% für %2% verkauft"
|
||||
buy-lowMoney: "Du hast nicht genug Geld, um diese Region zu kaufen. (Du hast %0% benötigst aber %1%)"
|
||||
buy-yours: "Du besitzt diese Region bereits"
|
||||
buy-someoneElse: "Jemand anderes hat diese Region bereits gekauft"
|
||||
buy-restrictedToWorld: "Du musst in der Welt '%0%' sein, um diese Region kaufen zu können (Du befindest dich in '%1%')"
|
||||
buy-restrictedToRegion: "Du musst innerhalb von '%0%' sein, um es zu kaufen."
|
||||
unrent-help: "/as unrent [Region], Wenn kein Regionsname angegeben wird, wird die Region genutzt, in der du dich gerade befindest"
|
||||
unrent-noPermission: "Du bist nicht berechtigt, den Mietvertrag zu kündigen"
|
||||
unrent-noPermissionOther: "Du bist nicht berechtigt, den Mietvertrag einer anderen Region zu kündigen"
|
||||
unrent-notRegistered: "Ein Mietvertrag kann hier nicht gekündigt werden, da diese Region gar nicht mietbar ist"
|
||||
unrent-notRented: "Ein Mietvertrag kann hier nicht gekündigt werden, da diese Region noch gar nicht vermietet ist"
|
||||
unrent-unrented: "Der Mietvertrag wurde gekündigt"
|
||||
unrent-other: "Der Mietvertrag dieser Region wurde von %0% gekündigt"
|
||||
unrent-expired: "Dein Mietvertrag von %0% ist abgelaufen"
|
||||
sell-help: "/as sell [Region], Wenn kein Regionsname angegeben wird, wird die Region genutzt, in der du dich gerade befindest"
|
||||
sell-notRegistered: "Diese Region kann nicht verkauft werden, da sie momentan nicht zum Verkauf zur Verfügung steht"
|
||||
sell-notBought: "Diese Region kann nicht verkauft werden, da sie bisher niemandem gehört"
|
||||
sell-sold: "Diese Region wurde verkauft an %0%"
|
||||
sell-soldYours: "Region erfolgreich verkauft"
|
||||
sell-noPermission: "Du bist nicht berechtigt, diese Region zu verkaufen"
|
||||
sell-noPermissionOther: "Du bist nicht berechtigt, eine Region zu verkaufen"
|
||||
rents-updated: "Alle Verkaufs- und Mietschilder aktualisiert"
|
||||
rents-noPermission: "Du bist nicht berechtigt, alle Verkaufs- und Mietschilder zu aktualisieren"
|
||||
rents-notUpdated: "Es sind nicht alle Schilder aktualisiert worden, Wiederholen kann das Problem beheben"
|
||||
buys-updated: "Alle Schilder der kaufbaren Regionen aktualisiert"
|
||||
buys-noPermission: "Du bist nicht berechtigt, alle Verkaufsschilder und Regionen zu aktualisieren"
|
||||
buys-notUpdated: "Es sind nicht alle Schilder aktualisiert worden, Wiederholen kann das Problem beheben"
|
||||
reload-reloaded: "Konfiguration erfolgreich neu geladen"
|
||||
reload-noPermission: "Du bist nicht berechtigt, die Konfiguration neu zu laden"
|
||||
info-help: "/as info <all|rented|forrent|sold|forsale|player|region>"
|
||||
info-noPermission: "Du hast keine Berechtigung, Informationen über Regionen zu erhalten"
|
||||
info-all-rents: "Mietbare Regionen: &7%0%"
|
||||
info-all-noRents: "Es gibt momentan keine mietbaren Regionen"
|
||||
info-all-buys: "Verkaufte Regionen: &7%0%"
|
||||
info-all-noBuys: "Es gibt momentan keine verkauften Regionen"
|
||||
info-rented: "Vermietete Regionen: &7%0%"
|
||||
info-noRented: "Momentan sind keine Regionen vermietet"
|
||||
info-unrented: "Nicht vermietete Regionen: &7%0%"
|
||||
info-noUnrented: "Sämtliche Regionen sind vermietet"
|
||||
info-sold: "Verkaufte Regionen: &7%0%"
|
||||
info-noSold: "Es sind momentan keine Regionen verkauft"
|
||||
info-forsale: "Zum Verkauf stehende Regionen: &7%0%"
|
||||
info-noForsale: "Sämtliche Regionen sind verkauft"
|
||||
info-playerHelp: "/as info player <Spielername>"
|
||||
info-playerRents: "Von %0% gemietete Regionen: &7%1%"
|
||||
info-playerNoRents: "%0% hat bisher keine Region(en) gemietet"
|
||||
info-playerBuys: "Von %0% verkaufte Regionen: &7%1%"
|
||||
info-playerNoBuys: "%0% hat bisher keine Region(en) gekauft"
|
||||
info-regionHelp: "/as info region [Region], Wenn kein Regionsname angegeben wird, wird die Region genutzt, in der du dich gerade befindest"
|
||||
info-regionSignLocation: "&7(%0%, %1%, %2%, %3%)&r"
|
||||
info-regionNoSign: "Für diese Region gibt es bisher kein Schild"
|
||||
info-regionPriceDuration: "Preis: &7%0% pro %1%"
|
||||
info-regionPrice: "Preis: &7%0%"
|
||||
info-regionRestore: "Wiederherstellung aktiviert: &7%0%"
|
||||
info-regionRestoreProfile: "Wiederherstellungs-Profil: &7%0%"
|
||||
info-regionTPLocation: "Teleport-Adresse: &7Welt=%0%, X=%1%, Y=%2%, Z=%3%, Pitch=%4%, Yaw=%5%"
|
||||
info-regionNoTP: "Keine Teleport-Adressen vorhanden"
|
||||
info-regionNotExisting: "Region %0% ist nicht eingetragen"
|
||||
setrestore-help: "/as setrestore <Region> <true|false|general> [Profil]"
|
||||
setrestore-noPermission: "Du bist nicht berechtigt, die Wiederherstellungs-Einstellungen zu verändern"
|
||||
setrestore-notRegistered: "%0% ist nicht eingetragen"
|
||||
setrestore-invalidSetting: "'%0%' ist kein gültiger Status, kann true sein, false oder general"
|
||||
setprice-noPermission: "Du bist nicht berechtigt, den Preis einer Region zu ändern"
|
||||
setprice-help: "/as setprice <Preis> [Region], Wenn kein Regionsname angegeben wird, wird die Region genutzt, in der du dich gerade befindest"
|
||||
setprice-notRegistered: "%0% ist nicht in AreaShop eingetragen"
|
||||
setprice-wrongPrice: "'%0%' ist kein gültiger Preis"
|
||||
setprice-successRent: "Preis der Region %0% geändert auf %1% von %2%"
|
||||
setprice-successBuy: "Preis der Region %0% geändert auf %1%"
|
||||
setduration-noPermission: "Du hast keine Berechtigung, die Mietdauer zu verändern."
|
||||
setduration-help: "/as setduration <Anzahl> <Zeiteinheit> [Region], wählt automatisch die Region, in der du dich gerade befindest, wenn nichts angegeben wird"
|
||||
setduration-notRegistered: "%0% wird nicht vermietet"
|
||||
setduration-wrongAmount: "'%0%' ist keine gültige Anzahl, gib eine ganze Zahl an"
|
||||
setduration-wrongFormat: "'%0%' ist kein gültiges Zeitformat, schau in der Doku auf Bukkit nach"
|
||||
setduration-success: "Dauer von Region %0% geändert zu '%1%'"
|
||||
setup-noRegion: "Du hast in der zweiten Zeile keine Region angegeben"
|
||||
setup-wrongRegion: "Die angegebene Region existiert nicht"
|
||||
setup-alreadyRentSign: "Die angegebene Region hat bereits ein Miet-Schild"
|
||||
setup-alreadyBuySign: "Die angegebene Region hat bereits ein Kauf-Schild"
|
||||
setup-noDuration: "Du hast nicht angegeben, wie lange eine Region mietbar ist. Bitte trage dies in die dritte Zeile ein"
|
||||
setup-wrongDuration: "Die angegebene Zeit liegt nicht in einem korrekten Format vor. Beispiel: 1 Tag"
|
||||
setup-noPrice: "Du hast in der vierten Zeile noch keinen Preis angegeben"
|
||||
setup-wrongPrice: "Du hast den Preis nicht korrekt angegeben, bitte nutze dafür ausschließlich Zahlen"
|
||||
setup-rentSuccess: "Die Vermietung von %0% ist korrekt erfolgt"
|
||||
setup-buySuccess: "Der Kauf von %0% ist korrekt erfolgt"
|
||||
setup-noPermissionRent: "Du bist nicht berechtigt, Regionen zu vermieten"
|
||||
setup-noPermissionBuy: "Du bist nicht berechtigt, Regionen zu kaufen"
|
||||
setup-couldNotDetect: "Mehrere Regionen mit der selben Priorität und/oder Eltern/Kind-Verhältnis gefunden, bitte gib die gewünschte Region in der zweiten Zeile an (zwei der gefundenen Regionen: %0% und %1%)"
|
||||
destroy-noPermissionRent: "Du bist nicht berechtigt, ein Mietschild zu zerstören"
|
||||
destroy-noPermissionBuy: "Du bist nicht berechtigt ein Verkaufsschild zu zerstören"
|
||||
destroy-successRent: "Miet-Status von %0% erfolgreich entfernt"
|
||||
destroy-successBuy: "Verkauf-Status von %0% erfolgreich entfernt"
|
||||
teleport-help: "/as tp <Region> [Schild]"
|
||||
teleport-noRentOrBuy: "Region '%0%' steht momentan nicht zum Verkauf oder zur Vermietung zur Verfügung"
|
||||
teleport-noPermission: "Du hast keine Rechte um dich zu dieser Region zu teleportieren"
|
||||
teleport-noPermissionOther: "Du bist nicht berechtigt, dich zu einer Region zu teleportieren, welche du nicht besitzt"
|
||||
teleport-noPermissionSign: "Du hast keine Rechte um dich zu diesem Schild in deiner Region zu teleportieren"
|
||||
teleport-noPermissionOtherSign: "Du fehlt die Berechtigung, dich zu Schildern von Regionen, die du nicht besitzt, zu teleportieren"
|
||||
teleport-success: "Du wurdest zu %0% teleportiert"
|
||||
teleport-successSign: "Du wurdest zu %0% teleportiert"
|
||||
teleport-noSafe: "Keine sichere Position in %0% gefunden, kein Boden vorhanden oder maximale Anzahl an Versuchen erreicht (%1%/%2%)"
|
||||
teleport-blocked: "Du kannst dich nicht teleportieren, weil sich die Position außerhalb der Region befindet und erzwungen wird, dass du dich nur zu welchen innerhalb teleportieren kannst"
|
||||
setteleport-help: "/as settp [Region] [reset], Wenn kein Regionsname angegeben wird, wird die Region genutzt, in der du dich gerade befindest"
|
||||
setteleport-noPermission: "Du bist nicht berechtigt, einen Teleport-Punkt zu setzen"
|
||||
setteleport-noPermissionOther: "Dir fehlt die Berechtigung die Teleportposition für eine Region, du du nicht besitzt, festzulegen"
|
||||
setteleport-noRentOrBuy: "Region '%0%' steht momentan nicht zum Verkauf oder zur Vermietung zur Verfügung"
|
||||
setteleport-success: "Teleport-Punkt von %0% erfolgreich gesetzt"
|
||||
setteleport-notInside: "Der Teleportpunkt muss sich innerhalb einer Region befinden"
|
||||
setteleport-reset: "Teleport-Punkt von %0% erfolgreich zurückgesetzt"
|
||||
find-help: "/as find <buy|rent> [maximaler Preis] [Gruppe]"
|
||||
find-success: "%0% Region gefunden: %1%, bei Suche nach max. Preis in Höhe deines Guthabens: %2%%3%"
|
||||
find-successMax: "%0% Region gefunden: %1%, bei Suche nach max. Preis in Höhe von %2%%3%"
|
||||
find-wrongMaxPrice: "Der angegebene Maximal-Preis ist kein korrekter Betrag: %0%"
|
||||
find-wrongGroup: "Die angegebene Gruppe existiert nicht: %0%"
|
||||
find-noneFound: "Keine %0% Region gefunden bei Suche nach max. Preis in Höhe deines Guthabens: %1%%2%"
|
||||
find-noneFoundMax: "Keine %0% Region gefunden bei Suche nach max. Preis in Höhe von %1%%2%"
|
||||
find-onlyInGroup: ", nur nach Regionen in der Gruppe %0% suchen"
|
||||
groupadd-help: "/as groupadd <Gruppe> [Region], Wenn kein Regionsname angegeben wird, werden alle Regionen deiner WorldEdit-Markierung einbezogen"
|
||||
groupadd-noPermission: "Du bist nicht berechtigt Regionen zu Gruppen hinzuzufügen"
|
||||
groupadd-noRegion: "Die angegebene Region ist nicht eingetragen: %0%"
|
||||
groupadd-success: "Region %0% wurde zu Gruppe '%1%' hinzugefügt, diese Gruppe hat nun %2% Mitglied(er)"
|
||||
groupadd-failed: "Region %0% ist bereits Mitglied der Gruppe '%1%'"
|
||||
groupadd-weSuccess: "Zu Gruppe %0% hinzugefügt: &7%1%"
|
||||
groupadd-weFailed: "Ist bereits in Gruppe %0%: &7%1%"
|
||||
groupdel-help: "/as groupdel <Gruppe> [Region], Wenn kein Regionsname angegeben wird, werden alle Regionen deiner WorldEdit-Markierung einbezogen"
|
||||
groupdel-noPermission: "Du bist nicht berechtigt, Regionen aus Gruppen zu entfernen"
|
||||
groupdel-noRegion: "Die angegebene Region ist nicht eingetragen: %0%"
|
||||
groupdel-success: "Region %0% ist aus Gruppe '%1%' entfernt worden. Diese Gruppe hat nun %2% Mitglied(er)"
|
||||
groupdel-failed: "Region %0% gehört nicht zur Gruppe '%1%'"
|
||||
groupdel-weSuccess: "Entfernt aus Gruppe %0%: &7%1%"
|
||||
groupdel-weFailed: "Ist nicht länger in Gruppe %0%: &7%1%"
|
||||
grouplist-noPermission: "Du bist nicht berechtigt, die eingetragenen Gruppen abzurufen"
|
||||
grouplist-noGroups: "Momentan sind keine Gruppen vorhanden"
|
||||
grouplist-success: "Folgende Gruppen sind vorhanden: &7%0%"
|
||||
groupinfo-help: "/as groupinfo <Gruppe>"
|
||||
groupinfo-noPermission: "Du bist nicht berechtigt, Informationen über eine Gruppe abzurufen"
|
||||
groupinfo-noGroup: "Es ist keine Gruppe mit dem Namen '%0%' vorhanden, bitte benutze zum Anzeigen der verfügbaren Gruppen /as grouplist"
|
||||
groupinfo-members: "Die folgenden Regionen gehören zur Gruppe %0%: &7%1%"
|
||||
groupinfo-noMembers: "Gruppe %0% hat keine Mitglieder"
|
||||
schemevent-help: "/as schemevent <Region> <created|deleted|rented|unrented|bought|sold>"
|
||||
schemevent-noRegion: "Folgende angegebene Region ist nicht eingetragen: %0%"
|
||||
schemevent-wrongEvent: "Das angegebene Event '%0%' existiert nicht, bitte benutze eines der folgenden: &7%1%"
|
||||
schemevent-success: "'%0%'-Event wurde erfolgreich für Region %1% ausgelöst"
|
||||
schemevent-noPermission: "Du bist nicht berechtigt, Schematic-Events auszuführen"
|
||||
add-help: "/as add <rent|buy> [Region] [Welt]"
|
||||
add-noPermission: "Du bist nicht berechtigt, eine Region in AreaShop hinzuzufügen"
|
||||
add-success: "Hinzugefügt als %0%: &7%1%"
|
||||
add-failed: "Bereits eingetragen: &7%0%"
|
||||
add-specifyWorld: "Bei Verwendung der Konsole bitte Welt der Region eintragen"
|
||||
add-incorrectWorld: "Welt '%0%' nicht gefunden, versuche es bitte noch einmal (Groß- und Kleinschreibung beachten)"
|
||||
add-noRegion: "Region '%0%' existiert nicht in dieser Welt"
|
||||
del-noRegion: "Region '%0%' ist nicht in AreaShop eingetragen"
|
||||
del-noPermission: "Du bist nicht berechtigt, Regionen zu entfernen"
|
||||
del-success: "Entfernte Region(en): &7%0%"
|
||||
del-failed: "Keine Berechtigung zum Entfernen oder nicht in AreaShop eingetragen: &7%0%"
|
||||
addsign-help: "/as addsign [Region] [Profil]"
|
||||
addsign-noSign: "Du schaust gerade nicht auf ein Schild"
|
||||
addsign-noRegion: "Region '%0%' nicht gefunden"
|
||||
addsign-noRegions: "Keine Region(en) um das Schild herum gefunden"
|
||||
addsign-couldNotDetect: "Mehrere Regionen um das Schild herum gefunden, bitte gewünschte Region als Argument angeben (zwei der gefundenen Regionen: %0% und %1%)"
|
||||
addsign-couldNotDetectSign: "Mehrere Regionen um das Schild herum gefunden, bitte gewünschte Region in die zweite Zeile eintragen (zwei der gefundenen Regionen: %0% und %1%)"
|
||||
addsign-wrongProfile: "Das eingetragene Profil existiert nicht. Bitte benutze eines der folgenden (überprüfe config): &7%0%"
|
||||
addsign-success: "Schild zu %0% erfolgreich hinzugefügt"
|
||||
addsign-successProfile: "Schild erfolgreich zu %0% mit Profil %1% hinzugefügt"
|
||||
addsign-alreadyRegistered: "Dieses Schild gehört zur Region %0%"
|
||||
addsign-noPermission: "Du bist nicht berechtigt, ein Schild hinzuzufügen"
|
||||
delsign-noSign: "Du schaust gerade nicht auf ein Schild"
|
||||
delsign-noPermission: "Du bist nicht berechtigt, ein Schild zu entfernen"
|
||||
delsign-noRegion: "Dieses Schild gehört zu keiner in AreaShop eingetragenen Region"
|
||||
delsign-success: "Schild von Region %0% erfolgreich entfernt"
|
||||
me-noPermission: "Dir fehlt die Berechtigung einzusehen, welche Regionen du besitzt."
|
||||
me-notAPlayer: "Du bist kein Spieler, darum können dir keine Regionen gehören."
|
||||
me-noRentRegions: "Du hast aktuell keine Regionen angemietet"
|
||||
me-noBuyRegions: "Du hast aktuell keine Regionen im Besitz"
|
||||
me-rentRegions: "Du hast die folgenden Regionen angemietet:"
|
||||
me-buyRegions: "Du bist Eigentümer der folgenden Regionen:"
|
||||
setowner-help: "/as setowner <Spieler> [Region], wenn kein Regionsname angegeben wird, wird die Region genutzt, in der du dich gerade befindest"
|
||||
setowner-noPermission: "Dir fehlt die Berechtigung den Besitzer einer Region festzulegen."
|
||||
setowner-noPermissionRent: "Dir fehlt die Berechtigung den Mieter einer Region festzulegen."
|
||||
setowner-noPermissionBuy: "Dir fehlt die Berechtigung den Eigentümer einer Region festzulegen."
|
||||
setowner-notRegistered: "Die angegebene Region ist nicht registriert, Besitzer kann nicht festgelegt werden"
|
||||
setowner-noPlayer: "Die UUID des Spielers %0% konnte nicht gefunden werden."
|
||||
setowner-succesRent: "Besitzer von %region% erfolgreich geändert zu %player%, gemietet bis %until% (%timeleft% verbleibend)"
|
||||
setowner-succesRentExtend: "%player% ist bereits Besitzer, Miete verlängert um '%duration%', nun gemietet bist %until% (%timeleft% verbleibend)"
|
||||
setowner-succesBuy: "Besitzer von %region% erfolgreich geändert zu %player%"
|
||||
resell-help: "/as resell <Preis> [Region], wählt automatisch die Region, in der du dich befindest, wenn nicht angegeben"
|
||||
resell-wrongPrice: "'%0%' ist keine gültige Preisangabe"
|
||||
resell-notRegistered: "%0% ist nicht für AreaShop registriert worden"
|
||||
resell-noRegionFound: "Keine AreaShop-Region an deiner Stelle gefunden, gib die Region als Argument an"
|
||||
resell-notBought: "Du kannst %region% nicht weiterverkaufen, weil sie noch nicht erworben wurde"
|
||||
resell-success: "Weiterverkauf für %region% erfolgreich aktiviert. Preis: %resellprice%"
|
||||
resell-noPermission: "Du hast keine Berechtigung, deine Region weiterzuverkaufen"
|
||||
resell-noPermissionOther: "Du hast keine Berechtigung, den Weiterverkauf von Regionen zu aktivieren"
|
||||
stopresell-help: "/as stopresell [Region], wählt automatisch die Region, in der du dich befindest, wenn nicht angegeben"
|
||||
stopresell-notRegistered: "%0% ist nicht in AreaShop eingetragen"
|
||||
stopresell-noRegionFound: "Keine AreaShop-Region an deiner Stelle gefunden, gib die Region als Argument an"
|
||||
stopresell-notResell: "Du kannst den Weiterverkauf von %region% nicht stoppen, weil sie bisher nicht weiterverkauft werden soll"
|
||||
stopresell-success: "Weiterverkauf von %region% wurde erfolgreich gestoppt"
|
||||
stopresell-noPermission: "Du hast keine Berechtigung, den Weiterverkauf deiner Region zu stoppen"
|
||||
stopresell-noPermissionOther: "Du hast keine Berechtigung, den Weiterverkauf einer Region zu stoppen"
|
||||
addfriend-help: "/as addfriend <Spieler> [Region], wählt automatisch die Region, in der du dich befindest, wenn nicht angegeben"
|
||||
addfriend-noPermissionOther: "Du hast keine Berechtigung, Freunde zu deiner Region hinzuzufügen"
|
||||
addfriend-noPermission: "Du hast keine Berechtigung, Spieler zu einer Region hinzuzufügen"
|
||||
addfriend-successOther: "%0% wurde als Freund zu Region %1% hinzugefügt"
|
||||
addfriend-success: "%0% wurde als Freund zu deiner Region %1% hinzugefügt"
|
||||
addfriend-alreadyAdded: "&0% wurde bereits als Freund zu dieser Region hinzugefügt"
|
||||
addfriend-self: "Den Besitzer der Region als Freund hinzuzufügen wäre sinnlos"
|
||||
addfriend-noOwner: "Du kannst keine Freunde zu einer Region ohne Besitzer hinzufügen"
|
||||
delfriend-help: "/as delfriend <Spieler> [Region], wählt automatisch die Region, in der du dich befindest, wenn nicht angegeben"
|
||||
delfriend-noPermissionOther: "Du hast keine Berechtigung, Freunde von Regionen zu entfernen, die dir nicht gehören"
|
||||
delfriend-noPermission: "Du hast keine Berechtigung, Freunde von deinen Regionen zu entfernen"
|
||||
delfriend-successOther: "%0% wurde als Freund der Region %1% entfernt"
|
||||
delfriend-success: "%0% wurde als Freund deiner Region %1% entfernt"
|
||||
delfriend-notAdded: "%0% ist nicht als Freund dieser Region eingetragen"
|
||||
delfriend-noOwner: "Du kannst keine Freunde von einer Region ohne Besitzer entfernen"
|
||||
timeleft-years: "%0% Jahre"
|
||||
timeleft-months: "%0% Monate"
|
||||
timeleft-days: "%0% Tage"
|
||||
timeleft-hours: "%0% Stunden"
|
||||
timeleft-minutes: "%0% Minuten"
|
||||
timeleft-second: "%0% Sekunde"
|
||||
timeleft-seconds: "%0% Sekunden"
|
||||
timeleft-ended: "abgelaufen"
|
||||
greeting-forrent: "%region% kann gemietet werden für %price% je %duration%"
|
||||
greeting-rented: "%region% ist vermietet an %player% bis %until%"
|
||||
greeting-forsale: "%region% kann gekauft werden für %price%"
|
||||
greeting-bought: "%region% ist Eigentum von %player%"
|
||||
greeting-resale: "%region% kann %player% für %resaleprice% abgekauft werden"
|
||||
+385
@@ -0,0 +1,385 @@
|
||||
# ╔════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════╗
|
||||
# ║ Language file of the AreaShop plugin created by NLThijs48, Github can be found at https://github.com/NLthijs48/AreaShop ║
|
||||
# ║ Language: English, Version: V2.1.0, Percentage translated: 100% (source), author(s): NLThijs48 ║
|
||||
# ║ This file will be overwritten at each startup/reload of the plugin, if you want to change anything then do the following: ║
|
||||
# ║ 1: Make a copy of this file ║
|
||||
# ║ 2: Rename it to <servername>.yml (don't use a language code as filename, could otherwise be overwritten in future updates) ║
|
||||
# ║ 3: Change the 'language' setting in config.yml to '<servername>', do not include '.yml' ║
|
||||
# ╚════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════╝
|
||||
total-maximum: "You can't rent and buy more than %0% region(s) in total (you already have %1% in group '%2%')"
|
||||
|
||||
cmd-notValid: "That command is not valid, use '/as help' for info"
|
||||
cmd-onlyByPlayer: "This command can only be run by a player"
|
||||
cmd-weOnlyByPlayer: "Using a WorldEdit selection is only possible as a player, specify the region name as extra argument"
|
||||
cmd-noSelection: "You don't have a WorldEdit selection"
|
||||
cmd-noRegionsFound: "No regions registered in AreaShop are found in your selection"
|
||||
cmd-noWERegionsFound: "No WorldEdit regions intersecting your selection are found"
|
||||
cmd-notRegistered: "%0% is not registered in AreaShop"
|
||||
cmd-noRegionsAtLocation: "No regions found at your location, specify the region as argument"
|
||||
cmd-moreRegionsAtLocation: "More than one region has been found at your location, specify the region as argument"
|
||||
cmd-automaticRegionOnlyByPlayer: "Automatically determining the region is only possible for players, specify the region as argument"
|
||||
|
||||
help-header: "Help page, commands that you can execute"
|
||||
help-alias: "Command aliases: /areashop, /as"
|
||||
help-help: "&6/as help &7-&r Shows this help page"
|
||||
help-info: "&6/as info &7-&r Get info about current regions"
|
||||
help-rent: "&6/as rent &7-&r Rent a region or extend your current rent"
|
||||
help-buy: "&6/as buy &7-&r Buy a region"
|
||||
help-unrent: "&6/as unrent &7-&r Unrent a region"
|
||||
help-unrentOwn: "&6/as unrent &7-&r Unrent your own region"
|
||||
help-sell: "&6/as sell &7-&r Sell a region"
|
||||
help-sellOwn: "&6/as sell &7-&r Sell your own region"
|
||||
help-updaterents: "&6/as updaterents &7-&r Update all rent signs and regions"
|
||||
help-updatebuys: "&6/as updatebuys &7-&r Update all buy signs and regions"
|
||||
help-reload: "&6/as reload &7-&r Reload the config and languages"
|
||||
help-setrestore: "&6/as setrestore &7-&r Set restoring on/off and choose profile"
|
||||
help-setprice: "&6/as setprice &7-&r Change the price of a region"
|
||||
help-setduration: "&6/as setduration &7-&r Change the duration of a rent region"
|
||||
help-teleport: "&6/as tp &7-&r Teleport to your bought/rented regions"
|
||||
help-teleportAll: "&6/as tp &7-&r Teleport to a rent/buy region"
|
||||
help-setteleport: "&6/as settp &7-&r Set teleport position for bought/rented regions"
|
||||
help-setteleportAll: "&6/as settp &7-&r Set teleport position for a region"
|
||||
help-find: "&6/as find &7-&r Find an empty buy or rent"
|
||||
help-groupadd: "&6/as groupadd &7-&r Add a region to a group"
|
||||
help-groupdel: "&6/as groupdel &7-&r Delete a region from a group"
|
||||
help-grouplist: "&6/as grouplist &7-&r Display all groups currently registered"
|
||||
help-groupinfo: "&6/as groupinfo &7-&r Display information about a group"
|
||||
help-schemevent: "&6/as schemevent &7-&r Trigger a schematic event for a region"
|
||||
help-add: "&6/as add &7-&r Register a region as rent or buy"
|
||||
help-del: "&6/as del &7-&r Delete a registered region from AreaShop"
|
||||
help-addsign: "&6/as addsign &7-&r Add a sign to an existing region"
|
||||
help-delsign: "&6/as delsign &7-&r Delete the sign you are looking at"
|
||||
help-me: "&6/as me &7-&r Check which regions you have (+expiration)"
|
||||
help-setowner: "&6/as setowner &7-&r Set region owner or extend the rent"
|
||||
help-resell: "&6/as resell &7-&r Put one of your regions into resell mode"
|
||||
help-resellAll: "&6/as resell &7-&r Put a region into resell mode"
|
||||
help-stopResell: "&6/as stopresell &7-&r Put your region back into sold mode"
|
||||
help-stopResellAll: "&6/as stopresell &7-&r Put a region back into sold mode"
|
||||
help-addFriend: "&6/as addfriend &7-&r Add a friend to your region"
|
||||
help-addFriendAll: "&6/as addfriend &7-&r Add a friend to a region"
|
||||
help-delFriend: "&6/as delfriend &7-&r Delete a friend from your region"
|
||||
help-delFriendAll: "&6/as delfriend &7-&r Delete a friend from a region"
|
||||
|
||||
rent-help: "/as rent [regionname], the region you stand in will be used if not specified"
|
||||
rent-noPermission: "You don't have permission to rent a region"
|
||||
rent-maximum: "You can't rent more than %0% region(s) (you already have %1% in group '%2%')"
|
||||
rent-payError: "Something went wrong with paying, try again later"
|
||||
rent-rented: "You rented %0% until %1%"
|
||||
rent-extended: "You extended your rent of %0% until %1%"
|
||||
rent-extend: "You can extend your rent by rightclicking the sign again or using /as rent"
|
||||
rent-lowMoneyExtend: "You don't have enough money to extend the rent (you have %0% and you need %1%)"
|
||||
rent-lowMoneyRent: "You don't have enough money to rent this region (you have %0% and you need %1%)"
|
||||
rent-someoneElse: "Someone else already rented this region"
|
||||
rent-notRentable: "That region is not available for renting"
|
||||
rent-maxExtends: "You cannot extend this rent anymore (the maximum is %0% times), however after the rent is over you can rent this region again"
|
||||
rent-maxRentTime: "You cannot rent this region more time in advance, the maximum time is %0% minutes and you have currently rented it for %1% minutes"
|
||||
rent-restrictedToWorld: "You need to be in the '%0%' world to rent this region (you are in '%1%')"
|
||||
rent-restrictedToRegion: "You need to be inside '%0%' to rent it"
|
||||
rent-expireWarning: "Your region %region% has %timeleft% left, be sure to extend it if you want to keep it"
|
||||
|
||||
buy-help: "/as buy [regionname], the region you stand in will be used if not specified"
|
||||
buy-noPermission: "You don't have permission to buy a region"
|
||||
buy-notBuyable: "That region is not available for buying"
|
||||
buy-maximum: "You can't buy more than %0% region(s) (you already have %1% in group '%2%')"
|
||||
buy-payError: "Something went wrong with paying, try again later"
|
||||
buy-succes: "You successfully bought %0%"
|
||||
buy-successResale: "You successfully bought %0% from %1%"
|
||||
buy-successSeller: "Your region %0% has been sold to %1% for %2%"
|
||||
buy-lowMoney: "You don't have enough money to buy this region (you have %0% and you need %1%)"
|
||||
buy-yours: "You already own this region"
|
||||
buy-someoneElse: "Someone else already bought this region"
|
||||
buy-restrictedToWorld: "You need to be in the '%0%' world to buy this region (you are in '%1%')"
|
||||
buy-restrictedToRegion: "You need to be inside '%0%' to buy it"
|
||||
|
||||
unrent-help: "/as unrent [regionname], the region you stand in will be used if not specified"
|
||||
unrent-noPermission: "You don't have permission to unrent a region"
|
||||
unrent-noPermissionOther: "You don't have permission to unrent another region"
|
||||
unrent-notRegistered: "The region can't be unrent because it is not registered for renting"
|
||||
unrent-notRented: "The region can't be unrent because it is not rented"
|
||||
unrent-unrented: "Your region has been unrented"
|
||||
unrent-other: "The region has been unrented for player %0%"
|
||||
unrent-expired: "Your rent of %0% has expired"
|
||||
|
||||
sell-help: "/as sell [regionname], the region you stand in will be used if not specified"
|
||||
sell-notRegistered: "The region can't be selled because it is not registered for buying"
|
||||
sell-notBought: "The region can't be selled because it is not someone's property"
|
||||
sell-sold: "The region has been sold for player %0%"
|
||||
sell-soldYours: "Your region has been sold"
|
||||
sell-noPermission: "You don't have permission to sell a region"
|
||||
sell-noPermissionOther: "You don't have permission to sell another region"
|
||||
|
||||
rents-updated: "All signs and regions for renting have been updated"
|
||||
rents-noPermission: "You don't have permission to update all rent signs and regions"
|
||||
rents-notUpdated: "Not all signs have been updated, maybe reload fixes it"
|
||||
|
||||
buys-updated: "All signs and regions for selling have been updated"
|
||||
buys-noPermission: "You don't have permission to update all buy signs and regions"
|
||||
buys-notUpdated: "Not all signs have been updated, maybe reload fixes it"
|
||||
|
||||
reload-reloaded: "The config has been reloaded successfully"
|
||||
reload-noPermission: "You don't have permission to reload the config"
|
||||
|
||||
info-help: "/as info <all|rented|forrent|sold|forsale|player|region>"
|
||||
info-noPermission: "You don't have permission to get information about regions"
|
||||
info-all-rents: "Regions registered for renting: &7%0%"
|
||||
info-all-noRents: "There are no regions registered for renting"
|
||||
info-all-buys: "Regions registered for buying: &7%0%"
|
||||
info-all-noBuys: "There are no regions registered for buying"
|
||||
info-rented: "Rented regions: &7%0%"
|
||||
info-noRented: "No regions are rented"
|
||||
info-unrented: "Unrented regions: &7%0%"
|
||||
info-noUnrented: "All regions are rented"
|
||||
info-sold: "Sold regions: &7%0%"
|
||||
info-noSold: "No regions are sold"
|
||||
info-forsale: "Regions for sale: &7%0%"
|
||||
info-noForsale: "All regions are sold"
|
||||
info-playerHelp: "/as info player <name>"
|
||||
info-playerRents: "Regions rented by %0%: &7%1%"
|
||||
info-playerNoRents: "%0% has not rented a region"
|
||||
info-playerBuys: "Regions bought by %0%: &7%1%"
|
||||
info-playerNoBuys: "%0% has not bought a region"
|
||||
info-regionHelp: "/as info region [name], the region you stand in will be used if not specified"
|
||||
info-regionHeaderRent: "&2Information about %region%:"
|
||||
info-regionHeaderBuy: "&2Information about %region%:"
|
||||
info-regionFooterRent: ""
|
||||
info-regionFooterBuy: ""
|
||||
info-regionRented: "&2&l►&r Rented by %player% until: &7%until%"
|
||||
info-regionBought: "&2&l►&r Bought by %player%"
|
||||
info-regionExtending: "&2&l►&r Price to extend: &7%price% per %duration%"
|
||||
info-regionCanBeRented: "&2&l►&r Price to rent: &7%price% per %duration%"
|
||||
info-regionCanBeBought: "&2&l►&r Price to buy: &7%price%"
|
||||
info-regionFriends: "&2&l►&r Added friends: &7%friends%"
|
||||
info-regionMoneyBackBuy: "&2&l►&r Selling payback: &7%moneyback% (%moneybackpercent%% of the price)"
|
||||
info-regionMoneyBackRent: "&2&l►&r Unrenting payback: &7%moneyback% (%moneybackpercent%% of the remaining time)"
|
||||
info-regionMaxExtends: "&2&l►&r Maximum number of extends: &7%maxextends% time(s)"
|
||||
info-regionNoExtending: "&2&l►&r Rent cannot be extended"
|
||||
info-regionExtendsLeft: "&2&l►&r Extending left: &7%extendsleft% time(s) out of %maxextends%"
|
||||
info-regionMaxRentTime: "&2&l►&r In advance renting: &7%maxrenttime% at maximum"
|
||||
info-regionNoTeleport: "&2&l►&r Teleport location not set%0%"
|
||||
info-regionTeleportHint: " &7(use '/as settp' for a better spot)"
|
||||
info-regionTeleportAt: "&2&l►&r Teleport set at: &7(%0%, %1%, %2%, %3%, pitch:%4%, yaw:%5%)"
|
||||
info-regionSigns: "&2&l►&r Connected signs: &7%0%"
|
||||
info-regionSignLocation: "&7(%0%, %1%, %2%, %3%)&r"
|
||||
info-regionGroups: "&2&l►&r Assigned groups: &7%0%"
|
||||
info-regionInactiveUnrent: "&2&l►&r Auto unrent after: &7%inactivetime% of inactivity by the player"
|
||||
info-regionInactiveSell: "&2&l►&r Auto sell after: &7%inactivetime% of inactivity by the player"
|
||||
info-regionRestrictedRegionRent: "&2&l►&r To rent this region you need to be inside it"
|
||||
info-regionRestrictedWorldRent: "&2&l►&r To rent this region you need to be inside world '%world%'"
|
||||
info-regionRestrictedRegionBuy: "&2&l►&r To buy this region you need to be inside it"
|
||||
info-regionRestrictedWorldBuy: "&2&l►&r To buy this region you need to be inside world '%world%'"
|
||||
info-regionRestoringRent: "&2&l►&r Restoring is enabled &7(region will reset at unrent)%0%"
|
||||
info-regionRestoringBuy: "&2&l►&r Restoring is enabled &7(region will reset at sell)%0%"
|
||||
info-regionRestoringProfile: " (profile: %0%)"
|
||||
|
||||
info-regionNoSign: "There is no sign registered for this region"
|
||||
info-regionPriceDuration: "Price: &7%0% for each %1%"
|
||||
info-regionPrice: "Price: &7%0%"
|
||||
info-regionRestore: "Restoring enabled: &7%0%"
|
||||
info-regionRestoreProfile: "Restoring profile: &7%0%"
|
||||
info-regionTPLocation: "Teleport location: &7World=%0%, X=%1%, Y=%2%, Z=%3%, Pitch=%4%, Yaw=%5%"
|
||||
info-regionNoTP: "No teleport location set"
|
||||
info-regionNotExisting: "Region %0% is not registered"
|
||||
|
||||
setrestore-help: "/as setrestore <region> <true|false|general> [profile]"
|
||||
setrestore-noPermission: "You don't have permission to change the restore settings"
|
||||
setrestore-notRegistered: "%0% is not registered"
|
||||
setrestore-invalidSetting: "'%0%' is not a valid state, should be true, false or general"
|
||||
setrestore-success: "Successfully set the restore setting of %0% to '%1%'"
|
||||
setrestore-successProfile: "Successfully set the restore setting of %0% to '%1%' and the profile to '%2%'"
|
||||
|
||||
setprice-noPermission: "You don't have permission to change the price of a region"
|
||||
setprice-help: "/as setprice <price> [region], the region you stand in will be used if not specified"
|
||||
setprice-notRegistered: "%0% is not registered in AreaShop"
|
||||
setprice-wrongPrice: "'%0%' is not a valid price"
|
||||
setprice-successRent: "Price of region %0% changed to %1% per %2%"
|
||||
setprice-successBuy: "Price of region %0% changed to %1%"
|
||||
|
||||
setduration-noPermission: "You don't have permission to change the duration of a rent"
|
||||
setduration-help: "/as setduration <amount> <identifier> [region], the region you stand in will be used if not specified"
|
||||
setduration-notRegistered: "%0% is not registered as a rent"
|
||||
setduration-wrongAmount: "'%0%' is not a valid amount, use a whole number"
|
||||
setduration-wrongFormat: "'%0%' is not a proper timeformat, check the documentation on Bukkit"
|
||||
setduration-success: "Duration of region %0% changed to '%1%'"
|
||||
|
||||
setup-noRegion: "You did not specify a region on the second line"
|
||||
setup-wrongRegion: "The region you specified does not exist"
|
||||
setup-alreadyRentSign: "The region you specified already has a sign for renting"
|
||||
setup-alreadyBuySign: "The region you specified already has a sign for buying"
|
||||
setup-noDuration: "You did not specify how long the region can be rented, do this on the third line"
|
||||
setup-wrongDuration: "The time specified is not in the correct format, example: 1 day"
|
||||
setup-noPrice: "You did not specify the price on the fourth line"
|
||||
setup-wrongPrice: "You did not specify the price correctly, use a number only"
|
||||
setup-rentSuccess: "Renting of region %0% is setup correctly"
|
||||
setup-buySuccess: "Buying of region %0% is setup correctly"
|
||||
setup-noPermissionRent: "You don't have permission for setting up renting of regions"
|
||||
setup-noPermissionBuy: "You don't have permission for setting up buying of regions"
|
||||
setup-couldNotDetect: "Found multiple regions with the same priority and/or parent/child relation, specify one on the second line (2 of the regions that were found: %0% and %1%)"
|
||||
|
||||
destroy-noPermissionRent: "You don't have permission for destroying a sign for renting a region"
|
||||
destroy-noPermissionBuy: "You don't have permission for destroying a sign for buying a region"
|
||||
destroy-successRent: "Renting of %0% successfully removed"
|
||||
destroy-successBuy: "Buying of %0% successfully removed"
|
||||
|
||||
teleport-help: "/as tp <region> [sign]"
|
||||
teleport-noRentOrBuy: "Region '%0%' is not registered as rent or buy"
|
||||
teleport-noPermission: "You don't have permission to teleport to your region"
|
||||
teleport-noPermissionOther: "You don't have permission to teleport to regions you do not own"
|
||||
teleport-noPermissionSign: "You don't have permission to teleport to the sign of your region"
|
||||
teleport-noPermissionOtherSign: "You don't have permission to teleport to signs of regions you do not own"
|
||||
teleport-noPermissionFriend: "You don't have permission to teleport to regions you are added as friend"
|
||||
teleport-noPermissionFriendSign: "You don't have permission to teleport to the sign of region you are added as friend"
|
||||
teleport-success: "You teleported to %0%"
|
||||
teleport-successSign: "You teleported to the sign of %0%"
|
||||
teleport-noSafe: "No safe position found in region %0%, no spots in region left or maximum tries exceeded (%1%/%2%)"
|
||||
teleport-blocked: "You can't teleport because the position is outside the region and you are forced to teleport inside"
|
||||
|
||||
setteleport-help: "/as settp [region] [reset], the region you stand in will be used if not specified"
|
||||
setteleport-noPermission: "You don't have permission to set the teleport location"
|
||||
setteleport-noPermissionOther: "You don't have permission to set the teleport location for a region you do not own"
|
||||
setteleport-noRentOrBuy: "Region '%0%' is not registered as rent or buy"
|
||||
setteleport-success: "Teleport location of %0% set"
|
||||
setteleport-notInside: "The location has to be inside the region"
|
||||
setteleport-reset: "Teleport location of %0% has been reset"
|
||||
|
||||
find-help: "/as find <buy|rent> [maxprice] [group]"
|
||||
find-noPermission: "You don't have permission to search regions and teleport to them"
|
||||
find-success: "Found a %0% region: %1%, while searching with a max price of your balance: %2%%3%"
|
||||
find-successMax: "Found a %0% region: %1%, while searching with a max price of %2%%3%"
|
||||
find-wrongMaxPrice: "The specified maximum price is not a correct number: %0%"
|
||||
find-wrongGroup: "The specified group does not exist: %0%"
|
||||
find-noneFound: "No %0% region found while searching with a max price of your balance: %1%%2%"
|
||||
find-noneFoundMax: "No %0% region found while searching with a max price of %1%%2%"
|
||||
find-onlyInGroup: ", only searched for regions in group: %0%"
|
||||
|
||||
groupadd-help: "/as groupadd <group> [region], if no region specified all regions from your WorldEdit selection are used"
|
||||
groupadd-noPermission: "You don't have permission to add regions to groups"
|
||||
groupadd-noRegion: "The specified region is not registered: %0%"
|
||||
groupadd-success: "Region %0% has been added to group '%1%', this group now has %2% member(s)"
|
||||
groupadd-failed: "Region %0% is already a member of group '%1%'"
|
||||
groupadd-weSuccess: "Added to group %0%: &7%1%"
|
||||
groupadd-weFailed: "Were already in group %0%: &7%1%"
|
||||
|
||||
groupdel-help: "/as groupdel <group> [region], if no region specified all regions from your WorldEdit selection are used"
|
||||
groupdel-noPermission: "You don't have permission to remove regions from groups"
|
||||
groupdel-noRegion: "The specified region is not registered: %0%"
|
||||
groupdel-success: "Region %0% has been removed from group '%1%', this group now has %2% member(s)"
|
||||
groupdel-failed: "Region %0% is not a member of group '%1%'"
|
||||
groupdel-weSuccess: "Removed from group %0%: &7%1%"
|
||||
groupdel-weFailed: "Were not in group %0% anyway: &7%1%"
|
||||
|
||||
grouplist-noPermission: "You don't have permission to display the registered groups"
|
||||
grouplist-noGroups: "There are currently no groups registered"
|
||||
grouplist-success: "The following groups are registered: &7%0%"
|
||||
|
||||
groupinfo-help: "/as groupinfo <group>"
|
||||
groupinfo-noPermission: "You don't have permission to display information about a group"
|
||||
groupinfo-noGroup: "There is no group registered with the name '%0%', use /as grouplist to check groups"
|
||||
groupinfo-members: "The following regions are member of group %0%: &7%1%"
|
||||
groupinfo-noMembers: "Group %0% does not have any members"
|
||||
|
||||
schemevent-help: "/as schemevent <region> <created|deleted|rented|unrented|bought|sold>"
|
||||
schemevent-noRegion: "The specified region is not registered: %0%"
|
||||
schemevent-wrongEvent: "The specified event '%0%' does not exist, use one of the following: &7%1%"
|
||||
schemevent-success: "Event '%0%' has successfully been triggered for region %1%"
|
||||
schemevent-noPermission: "You don't have permission to trigger schematic events"
|
||||
|
||||
add-help: "/as add <rent|buy> [region] [world]"
|
||||
add-noPermission: "You don't have permission to add a region to AreaShop"
|
||||
add-success: "Added as %0%: &7%1%"
|
||||
add-failed: "Already registered: &7%0%"
|
||||
add-specifyWorld: "Specify the world of the region when using from console"
|
||||
add-incorrectWorld: "World '%0%' not found, try again (case-sensitive)"
|
||||
add-noRegion: "Region '%0%' does not exist in this world"
|
||||
|
||||
del-noRegion: "Region '%0%' is not registered in AreaShop"
|
||||
del-noPermission: "You don't have permission to remove regions"
|
||||
del-success: "Removed regions: &7%0%"
|
||||
del-failed: "No permission to remove or not registered: &7%0%"
|
||||
|
||||
addsign-help: "/as addsign [region] [profile]"
|
||||
addsign-noSign: "You are not looking at a sign"
|
||||
addsign-noRegion: "Region '%0%' cannot be found"
|
||||
addsign-noRegions: "No region found around the sign position"
|
||||
addsign-couldNotDetect: "Found multiple regions around the sign, specify region as extra argument (2 of the regions that were found: %0% and %1%)"
|
||||
addsign-couldNotDetectSign: "Found multiple regions around the sign, specify region on the second line (2 of the regions that were found: %0% and %1%)"
|
||||
addsign-wrongProfile: "The specified profile does not exist, use one of the following (check config): &7%0%"
|
||||
addsign-success: "The sign has been added to %0%"
|
||||
addsign-successProfile: "The sign has been added to %0% with profile %1%"
|
||||
addsign-alreadyRegistered: "That sign is already registered for region %0%"
|
||||
addsign-noPermission: "You don't have permission to add a sign"
|
||||
|
||||
delsign-noSign: "You are not looking at a sign"
|
||||
delsign-noPermission: "You don't have permission to delete a sign"
|
||||
delsign-noRegion: "That sign does not belong to an AreaShop region"
|
||||
delsign-success: "The sign has been removed from region %0%"
|
||||
|
||||
me-noPermission: "You don't have permission to check which regions you have"
|
||||
me-notAPlayer: "You are not a player so you can't have any regions"
|
||||
me-noRentRegions: "You have not rented any rent regions"
|
||||
me-noBuyRegions: "You have not bought any buy regions"
|
||||
me-rentRegions: "You have rented the following regions:"
|
||||
me-buyRegions: "You have bought the following regions:"
|
||||
me-rentLine: "&2&l►&r %region% until %until% &7(%timeleft% left)"
|
||||
me-buyLine: "&2&l►&r %region%"
|
||||
me-noFriendRegions: "You have not been added to regions as friend"
|
||||
me-friendRegions: "You are added as friend to the following regions:"
|
||||
me-friendLine: "&2&l►&r %region% &7(owner: %player%)"
|
||||
|
||||
setowner-help: "/as setowner <player> [region], the region you stand in will be used if not specified"
|
||||
setowner-noPermission: "You don't have permission to set the owner of a region"
|
||||
setowner-noPermissionRent: "You don't have permission to set the owner of rent regions"
|
||||
setowner-noPermissionBuy: "You don't have permission to set the owner of buy regions"
|
||||
setowner-notRegistered: "The specified region is not registered, owner cannot be set"
|
||||
setowner-noPlayer: "Could not get the UUID of the specified player: %0%"
|
||||
setowner-succesRent: "Owner of %region% successfully changed to %player%, rented until %until% (%timeleft% left)"
|
||||
setowner-succesRentExtend: "Owner was already %player%, rent extended with '%duration%', now rented until %until% (%timeleft% left)"
|
||||
setowner-succesBuy: "Owner of %region% successfully changed to %player%"
|
||||
|
||||
resell-help: "/as resell <price> [region], the region you stand in will be used if not specified"
|
||||
resell-wrongPrice: "'%0%' is not a valid price"
|
||||
resell-notRegistered: "%0% is not registered in AreaShop"
|
||||
resell-noRegionFound: "No AreaShop region could be found at your location, try specifying the region as argument"
|
||||
resell-notBought: "You can't resell %region% because it is not sold yet"
|
||||
resell-success: "%region% is successfully put into reselling mode for %resellprice%"
|
||||
resell-noPermission: "You don't have permission to set your region in reselling mode"
|
||||
resell-noPermissionOther: "You don't have permission to set regions in reselling mode"
|
||||
|
||||
stopresell-help: "/as stopresell [region], the region you stand in will be used if not specified"
|
||||
stopresell-notRegistered: "%0% is not registered in AreaShop"
|
||||
stopresell-noRegionFound: "No AreaShop region could be found at your location, try specifying the region as argument"
|
||||
stopresell-notResell: "You can't stop reselling %region% because it is not in resell mode"
|
||||
stopresell-success: "%region% is successfully put back into sold mode"
|
||||
stopresell-noPermission: "You don't have permission to set your region back to sold mode"
|
||||
stopresell-noPermissionOther: "You don't have permission to set regions back to sold mode"
|
||||
|
||||
addfriend-help: "/as addfriend <player> [region], the region you stand in will be used if not specified"
|
||||
addfriend-noPermissionOther: "You don't have permission to add friends to regions that are not yours"
|
||||
addfriend-noPermission: "You don't have permission to add friends to your region"
|
||||
addfriend-successOther: "%0% has been added as friend to region %1%"
|
||||
addfriend-success: "%0% has been added as friend to your region %1%"
|
||||
addfriend-alreadyAdded: "%0% is already added as friend for this region"
|
||||
addfriend-self: "Adding the owner of the region as friend would be pointless"
|
||||
addfriend-noOwner: "You cannot add friends to a region without owner"
|
||||
|
||||
delfriend-help: "/as delfriend <player> [region], the region you stand in will be used if not specified"
|
||||
delfriend-noPermissionOther: "You don't have permission to delete friends from regions that are not yours"
|
||||
delfriend-noPermission: "You don't have permission to delete friends from your region"
|
||||
delfriend-successOther: "%0% has been deleted as friend from region %1%"
|
||||
delfriend-success: "%0% has been deleted as friend from your region %1%"
|
||||
delfriend-notAdded: "%0% is not added as friend for this region"
|
||||
delfriend-noOwner: "You cannot remove friends from a region without owner"
|
||||
|
||||
timeleft-years: "%0% years"
|
||||
timeleft-months: "%0% months"
|
||||
timeleft-days: "%0% days"
|
||||
timeleft-hours: "%0% hours"
|
||||
timeleft-minutes: "%0% minutes"
|
||||
timeleft-second: "%0% second"
|
||||
timeleft-seconds: "%0% seconds"
|
||||
timeleft-ended: "Expired"
|
||||
|
||||
greeting-forrent: "%region% can be rented for %price% per %duration%"
|
||||
greeting-rented: "%region% is rented by %player% until %until%"
|
||||
greeting-forsale: "%region% can be bought for %price%"
|
||||
greeting-bought: "%region% is bought by %player%"
|
||||
greeting-resale: "%region% can be bought for %resaleprice% from %player%"
|
||||
+201
@@ -0,0 +1,201 @@
|
||||
# ╔════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════╗
|
||||
# ║ Language file of the AreaShop plugin created by NLThijs48, Github can be found at https://github.com/NLthijs48/AreaShop ║
|
||||
# ║ Language: French (Français), Version: V2.1.0, Percentage translated: 56%, author(s): BlaZingHope ║
|
||||
# ║ This file will be overwritten at each startup/reload of the plugin, if you want to change anything then do the following: ║
|
||||
# ║ 1: Make a copy of this file ║
|
||||
# ║ 2: Rename it to <servername>.yml (don't use a language code as filename, could otherwise be overwritten in future updates) ║
|
||||
# ║ 3: Change the 'language' setting in config.yml to '<servername>', do not include '.yml' ║
|
||||
# ╚════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════╝
|
||||
cmd-notValid: "Cette commande est incorrecte, utilisez '/as help' pour plus de détails"
|
||||
cmd-onlyByPlayer: "Cette commande ne peut être utilisé que par un joueur"
|
||||
cmd-weOnlyByPlayer: "Utiliser une séléction WorldEdit n'est possible qu'en tant que joueur. Spécifiez le nom de la région en argument supplémentaire."
|
||||
cmd-noSelection: "Vous n'avez pas de séléction WorldEdit"
|
||||
cmd-noRegionsFound: "Aucune région enregistré dans AreaShop n'a été trouvé dans votre séléction"
|
||||
cmd-noWERegionsFound: "Aucun région WorldEdit croisant votre séléction n'a été trouvé"
|
||||
help-header: "Pade d'aide, Commande que vous pouvez éxécuter"
|
||||
help-alias: "Alias des commandes: /areashop, /as"
|
||||
help-help: "&6/as help &7-&r Affiche la page d'aide"
|
||||
help-info: "&6/as info &7-&r Obtenir les infos sur les régions actuelles"
|
||||
help-rent: "&6/as rent &7-&r Louer une région, ou prolonger la location actuelle"
|
||||
help-buy: "&6/as buy &7-&r Acheter une région"
|
||||
help-unrent: "&6/as unrent &7-&r Dé-louer une région"
|
||||
help-unrentOwn: "&6/as unrent &7-&r Dé-louer votre propre région"
|
||||
help-sell: "&6/as sell &7-&r Vendre une région"
|
||||
help-sellOwn: "&6/as sell &7-&r Vendre votree propre région"
|
||||
help-updaterents: "&6/as updaterents &7-&r Mettre à jours toutes les pancartes et les régions louées."
|
||||
help-updatebuys: "&6/as updatebuys &7-&r Mettre à jours toutes les pancartes et les régions achetées"
|
||||
help-reload: "&6/as reload &7-&r Recharge les configs et langages"
|
||||
help-teleport: "&6/as tp &7-&r Téléportation vers votre région acheté / louée"
|
||||
help-teleportAll: "&6/as tp &7-&r Téléportation vers une région louée / acheté"
|
||||
help-setteleport: "&6/as settp &7-&r Définie la position de téléportation pour la région louée / acheté"
|
||||
help-setteleportAll: "&6/as settp &7-&r Défini la position de téléportation pour une région"
|
||||
help-find: "&6/as find &7-&r trouve un achat ou une location vide"
|
||||
help-groupadd: "&6/as groupadd &7-&r Ajoute une région à un groupe"
|
||||
help-groupdel: "&6/as groupdel &7-&r Supprime une région d'un groupe"
|
||||
help-grouplist: "&6/as grouplist &7-&r Affiche tout les groupes enregistrés"
|
||||
help-groupinfo: "&6/as groupinfo &7-&r Affiche les informations d'un groupe"
|
||||
help-schemevent: "&6/as schemevent &7-&r Déclanche un évenement schématique d'une région"
|
||||
help-add: "&6/as add &7-&r Enregistre une région comme louée ou acheté"
|
||||
help-del: "&6/as del &7-&r Supprime une région enregistré dans AreaShop"
|
||||
help-addsign: "&6/as addsign &7-&r Ajoute une pancarte à une région existante"
|
||||
help-delsign: "&6/as delsign &7-&r Supprime la pancarte que vous regardez"
|
||||
rent-help: "/as rent [regionname], Si non spécifié, cible la région dans laquelle vous vous trouvez"
|
||||
rent-noPermission: "Vous n'avez pas la permission de louer une région"
|
||||
rent-payError: "Une erreur durant le paiement s'est produite. Essayez de nouveau plus tard"
|
||||
rent-rented: "Vous avez loué de %0% jusqu'à %1%"
|
||||
rent-extended: "Vous avez prolongé la location de %0% jusqu'à %1%"
|
||||
rent-extend: "Vous pouvez prolonger votre location avec un clic droit sur la pancarte, ou en utilisant /as rent"
|
||||
rent-lowMoneyExtend: "Vous n'avez pas assez d'argent pour prolonger la location. (Vous possédez %0% et devez payer %1%)"
|
||||
rent-lowMoneyRent: "Vous n'avez pas assez d'argent pour louer cette région. (Vous possédez %0% et devez payer %1%)"
|
||||
rent-someoneElse: "Quelqu'un d'autre a déjà louer cette région"
|
||||
rent-notRentable: "cette région n'est pas disponible à la location"
|
||||
rent-maxExtends: "Vous ne pouvez plus prolonger cette location. (Le maximum est de %0% fois). Mais lorsque la location sera terminé, vous pourrez louer de nouveau cette région"
|
||||
buy-help: "/as buy [regionname], Si non spécifié, cible la région dans laquelle vous vous trouvez"
|
||||
buy-noPermission: "Vous n'avez pas la permission d'acheter une région"
|
||||
buy-notBuyable: "cette région n'est pas disponible à l'achat"
|
||||
buy-payError: "Une erreur durant le paiement s'est produite. Essayez de nouveau plus tard"
|
||||
buy-lowMoney: "Vous n'avez pas assez d'argent pour acheter cette région. (Vous possédez %0% et devez payer %1%)"
|
||||
buy-yours: "Vous avez déjà acheter cette région"
|
||||
buy-someoneElse: "Quelqu'un a déjà acheté cette région"
|
||||
unrent-help: "/as unrent [regionname], Si non spécifié, cible la région dans laquelle vous vous trouvez"
|
||||
unrent-noPermission: "Vous n'avez pas la permission de dé-louer une région"
|
||||
unrent-noPermissionOther: "Vous n'avez pas la permission de délouer une autre région"
|
||||
unrent-notRegistered: "La région ne peut pas être dé-louée car elle n'est pas enregistré à la location"
|
||||
unrent-notRented: "La région ne peut pas être dé-louée car elle n'est pas loué"
|
||||
unrent-unrented: "Votre région a été dé-louée."
|
||||
unrent-other: "La région du joueur %0% a été dé-louée"
|
||||
unrent-expired: "Votre location de %0% a expiré"
|
||||
sell-help: "/as sell [regionname], Si non spécifié, cible la région dans laquelle vous vous trouvez"
|
||||
sell-notRegistered: "la région ne peut pas être vendue car elle n'est pas enregistré comme acheté"
|
||||
sell-notBought: "La région ne peut pas être vendue car elle n'est pas la propriété de quelqu'un"
|
||||
sell-sold: "Cette région a été vendu au joueur %0%"
|
||||
sell-soldYours: "Votre région a été vendue"
|
||||
sell-noPermission: "Vous n'avez pas la permission de vendre une région"
|
||||
sell-noPermissionOther: "Vous n'avez pas la permission de vendre une autre région"
|
||||
rents-updated: "Tout les panneaux et régions en location ont été mis à jour"
|
||||
rents-noPermission: "Vous n'avez pas la permission de mettre à jour les panneaux et régions en location"
|
||||
rents-notUpdated: "Tout les panneaux n'ont pas été mis à jour. Recharger peut corriger le problème"
|
||||
buys-updated: "Tout les panneaux et régions en vente ont été mis à jour"
|
||||
buys-noPermission: "Vous n'avez pas la permission de mettre à jour les panneaux et régions en vente"
|
||||
buys-notUpdated: "Tout les panneaux n'ont pas été mis à jour. Recharger peut corriger le problème"
|
||||
reload-reloaded: "La configuration a bien été rechargée"
|
||||
reload-noPermission: "Vous n'avez pas la permission de recharger la configuration"
|
||||
info-help: "/as info <all|rented|forrent|sold|forsale|player|region>"
|
||||
info-all-rents: "Régions enregistrées en location: &7%0%"
|
||||
info-all-noRents: "Il n'y a pas de régions enregistrées en location"
|
||||
info-all-buys: "Régions enregistrées en vente: &7%0%"
|
||||
info-all-noBuys: "Il n'y a pas de régions enregistrées en achat"
|
||||
info-rented: "Régions louées: &7%0%"
|
||||
info-noRented: "Aucune régions louée"
|
||||
info-unrented: "régions non louées: &7%0%"
|
||||
info-noUnrented: "Toutes les régions sont louées"
|
||||
info-sold: "Régions vendues: &7%0%"
|
||||
info-noSold: "Aucune région n'est vendue"
|
||||
info-forsale: "Région en vente: &7%0%"
|
||||
info-noForsale: "Toutes les régions sont vendues"
|
||||
info-playerHelp: "/as info player <name>"
|
||||
info-playerRents: "Regions louées par %0%: &7%1%"
|
||||
info-playerNoRents: "%0% n'a de région louée"
|
||||
info-playerBuys: "Régions achetés par %0%: &7%1%"
|
||||
info-playerNoBuys: "%0% n'a pas acheté de région"
|
||||
info-regionHelp: "/as info region [name], Si non spécifié, cible la région dans laquelle vous vous trouvez"
|
||||
info-regionSignLocation: "&7(%0%, %1%, %2%, %3%)&r"
|
||||
info-regionNoSign: "Il n'y a pas de panneaux enregistré pour cette région"
|
||||
info-regionPriceDuration: "Prix: &7%0% pour chaque %1%"
|
||||
info-regionPrice: "Prix: &7%0%"
|
||||
info-regionRestore: "Réstauration activé: &7%0%"
|
||||
info-regionRestoreProfile: "profil de restauration: &7%0%"
|
||||
info-regionTPLocation: "lieu de téléportation: &7World=%0%, X=%1%, Y=%2%, Z=%3%, Pitch=%4%, Yaw=%5%"
|
||||
info-regionNoTP: "Aucun lieu de téléportation défini"
|
||||
info-regionNotExisting: "La région %0% n'est pas enregistrée"
|
||||
setrestore-help: "/as setrestore <region> <true|false|general> [profile]"
|
||||
setrestore-noPermission: "Vous n'avez pas la permission de restaurer les paramètres"
|
||||
setrestore-notRegistered: "%0% n'est pas enregistré"
|
||||
setrestore-invalidSetting: "'%0%' est invalide. Doit être true, false ou general"
|
||||
setprice-noPermission: "Vous n'avez pas la permission de changer le prix d'une région"
|
||||
setprice-help: "/as setprice <price> [region], Si non spécifié, cible la région dans laquelle vous vous trouvez"
|
||||
setprice-notRegistered: "%0% n'est pas enregistré dans AreaShop"
|
||||
setprice-wrongPrice: "'%0%' n'est pas un rpix valide"
|
||||
setprice-successRent: "Prix de la région %0% changé de %1% à %2%"
|
||||
setprice-successBuy: "Pprix de la région %0% changé à %1%"
|
||||
setup-noRegion: "Vous n'avez pas spécifié une région à la seconde ligne"
|
||||
setup-wrongRegion: "la région que vous avez spécifié n'existe pas"
|
||||
setup-alreadyRentSign: "La région que vous avez spécifiée possède déjà un panneau de location"
|
||||
setup-alreadyBuySign: "La région que vous avez spécifiée possède déjà un panneau de vente"
|
||||
setup-noDuration: "A la troisième ligne, vous n'avez pas spécifié la durée de location de la région"
|
||||
setup-wrongDuration: "Le temps spécifié n'est pas au bon format. Exemple: 1 day"
|
||||
setup-noPrice: "A la quatrième ligne, vous n'avez pas spécifié le prix"
|
||||
setup-wrongPrice: "Vous n'avez pas indiqué un prix correcte, utilisez un nombre entier"
|
||||
setup-rentSuccess: "La location de la région %0% est correctement configurée"
|
||||
setup-buySuccess: "L'achat de la région %0% est correctement configuré"
|
||||
setup-noPermissionRent: "Vous n'avez pas la permission de mettre en place la location de régions"
|
||||
setup-noPermissionBuy: "Vous n'avez pas la permission de mettre en place l'achat de régions"
|
||||
setup-couldNotDetect: "Multiples régions trouvées avec la même priorité et/ou parent/enfant relation. Spécifiez en un sur la deuxième ligne. (2 des régions trouvées: %0% et %1%)"
|
||||
destroy-noPermissionRent: "Vous n'avez pas la permission de détruire le panneau de location d'une région"
|
||||
destroy-noPermissionBuy: "Vous n'avez pas la permission de détruire le panneau de vente d'une région"
|
||||
destroy-successRent: "Location de %0% supprimé"
|
||||
destroy-successBuy: "Achat de %0% supprimé"
|
||||
teleport-help: "/as tp <region> [sign]"
|
||||
teleport-noRentOrBuy: "La région '%0%' n'est pas enregistré comme location ou achat"
|
||||
teleport-noPermissionOther: "Vous n'avez pas la permission de vous téléporter à une région qui ne vous appartient pas"
|
||||
teleport-success: "Vous avez été téléporté à %0%"
|
||||
teleport-noSafe: "Aucune position sécurisé trouvé dans la région %0%. Pas de point restant, ou tentatives maximales dépassées. (%1%/%2%)"
|
||||
setteleport-help: "/as settp [region] [reset], Si non spécifié, cible la région dans laquelle vous vous trouvez"
|
||||
setteleport-noPermission: "Vous n'avez pas la permission de définir un point de téléportation"
|
||||
setteleport-noRentOrBuy: "La région '%0%' n'est pas enregistré comme location ou achat"
|
||||
setteleport-success: "Lieu de téléportation de %0% défini"
|
||||
setteleport-notInside: "Le lieu doit se trouver dans votre région"
|
||||
setteleport-reset: "le lieu de téléportation de %0% a été reset"
|
||||
find-wrongMaxPrice: "le prix maximum n'est pas un nombre valide: %0%"
|
||||
groupadd-help: "/as groupadd <group> [region], Si non spécifié, cible la région dans laquelle vous vous trouvez"
|
||||
groupadd-noPermission: "Vous n'avez pas la permission d'ajouter des régions aux groupes"
|
||||
groupadd-noRegion: "la région spécifiée n'est pas enregistré: %0%"
|
||||
groupadd-success: "La région %0% a été ajouté au groupe '%1%'. ce groupe a maintenant %2% membre(s)"
|
||||
groupadd-failed: "La région %0% est déjà membre du groupe '%1%'"
|
||||
groupadd-weSuccess: "Ajouté au groupe %0%: &7%1%"
|
||||
groupadd-weFailed: "Nous étions déjà dans le groupe %0%: &7%1%"
|
||||
groupdel-help: "/as groupdel <group> [region], Si non spécifié, cible la région dans laquelle vous vous trouvez"
|
||||
groupdel-noPermission: "Vous n'avez pas la permission de supprimer des régions depuis les groupes"
|
||||
groupdel-noRegion: "La région spécifiée n'est pas enregistré: %0%"
|
||||
groupdel-success: "La région %0% a été supprimé du groupe '%1%', ce groupe a maintenant %2% membre(s)"
|
||||
groupdel-failed: "La région %0% n'est pas membre du groupe '%1%'"
|
||||
groupdel-weSuccess: "Supprimé du groupe %0%: &7%1%"
|
||||
groupdel-weFailed: "Nous ne sommes pas dans le groupe %0% de toute façon: &7%1%"
|
||||
grouplist-noPermission: "Vous n'avez pas l'autorisation d'afficher les groupes enregistrés"
|
||||
grouplist-noGroups: "Il n'y a actuellement aucun groupe enregistré"
|
||||
grouplist-success: "les groupes suivants sont enregistrés: &7%0%"
|
||||
groupinfo-help: "/as groupinfo <group>"
|
||||
groupinfo-noPermission: "Vous n'avez pas la permission d'afficher des informations sur un groupe"
|
||||
groupinfo-noGroup: "Il n'y a pas de groupe enregistré sous le nom '%0%', utilisez /as grouplist pour vérifier les groupes"
|
||||
groupinfo-members: "Les régions suivantes sont membres du groupe %0%: &7%1%"
|
||||
groupinfo-noMembers: "Le groupe %0% ne possède aucun membre"
|
||||
schemevent-help: "/as schemevent <region> <created|deleted|rented|unrented|bought|sold>"
|
||||
schemevent-noRegion: "La région spécifiée n'est pas enregistré: %0%"
|
||||
schemevent-wrongEvent: "L'évent spécifié '%0%' n'existe pas, utilisez un des suivants: &7%1%"
|
||||
schemevent-noPermission: "Vous n'avez pas la permission de déclencher des événements schématiques"
|
||||
add-help: "/as add <rent|buy> [region] [world]"
|
||||
add-noPermission: "Vous n'avez pas la permission d'ajouter une région à AreaShop"
|
||||
add-success: "Ajouté comme %0%: &7%1%"
|
||||
add-failed: "Déjà enregistré: &7%0%"
|
||||
add-specifyWorld: "Spécifiez le monde de la région lors de l'utilisation de la console"
|
||||
add-incorrectWorld: "Le monde '%0%' est introuvable, essayez de nouveau (Attention à la casse)"
|
||||
add-noRegion: "La région '%0%' n'existe pas dans ce monde"
|
||||
del-noRegion: "Le région '%0%' n'est pas enregistré à AreaShop"
|
||||
del-noPermission: "Vous n'avez pas la permission de supprimer des régions"
|
||||
del-success: "Régions supprimées: &7%0%"
|
||||
del-failed: "Pas de permission pour supprimer, ou pas enregistré: &7%0%"
|
||||
addsign-help: "/as addsign [region] [profile]"
|
||||
addsign-noSign: "Vous ne regardez pas de panneau"
|
||||
addsign-noRegion: "La région '%0%' n'a pas été trouvé"
|
||||
addsign-noRegions: "Aucune région trouvé autour du panneau"
|
||||
addsign-couldNotDetect: "Plusieurs régions ont été trouvées à promixité du panneau. Spécifiez la région en argument supplémentaire. (2 des régions trouvées: %0% et %1%)"
|
||||
addsign-couldNotDetectSign: "Plusieurs régions ont été trouvées à proximité du panneau. Spécifiez la région à la deuxième ligne. (2 des régions trouvées: %0% et %1%)"
|
||||
addsign-wrongProfile: "le profil spécifié n'existe pas. utilisez un des suivants (vérifier la configuration): &7%0%"
|
||||
addsign-success: "Le panneau a été ajouté à %0%"
|
||||
addsign-successProfile: "Le panneau a été ajouté à %0% avec le profil %1%"
|
||||
addsign-alreadyRegistered: "Ce panneau a déjà été enregistré pour la région %0%"
|
||||
addsign-noPermission: "Vous n'avez pas la permission d'ajouter un panneau"
|
||||
delsign-noSign: "Vous ne regardez pas un panneau"
|
||||
delsign-noPermission: "Vous n'avez pas la permission de supprimer un panneau"
|
||||
delsign-noRegion: "Ce signe n'appartient pas à une région AreaShop"
|
||||
delsign-success: "Ce panneau a été supprimé de la région %0%"
|
||||
+347
@@ -0,0 +1,347 @@
|
||||
# ╔════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════╗
|
||||
# ║ Language file of the AreaShop plugin created by NLThijs48, Github can be found at https://github.com/NLthijs48/AreaShop ║
|
||||
# ║ Language: Dutch (Nederlands), Version: V2.1.0, Percentage translated: 100%, author(s): NLThijs48 ║
|
||||
# ║ This file will be overwritten at each startup/reload of the plugin, if you want to change anything then do the following: ║
|
||||
# ║ 1: Make a copy of this file ║
|
||||
# ║ 2: Rename it to <servername>.yml (don't use a language code as filename, could otherwise be overwritten in future updates) ║
|
||||
# ║ 3: Change the 'language' setting in config.yml to '<servername>', do not include '.yml' ║
|
||||
# ╚════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════╝
|
||||
total-maximum: "Je kunt niet meer dan %0% gebied(en) kopen en huren in totaal (je hebt er al %1% in groep '%2%')"
|
||||
cmd-notValid: "Dat commando is niet geldig , gebruik '/as help' voor informatie"
|
||||
cmd-onlyByPlayer: "Dit commando kan alleen door een speler uitgevoert worden"
|
||||
cmd-weOnlyByPlayer: "Gebruikmaken van een WorldEdit selectie is alleen mogelijk als speler, geef de naam van het gebied mee als extra argument"
|
||||
cmd-noSelection: "Je hebt geen WorldEdit selectie"
|
||||
cmd-noRegionsFound: "Er zijn geen gebieden in je selectie gevonden die geregistreerd staan in AreaShop"
|
||||
cmd-noWERegionsFound: "Er zijn geen WorldEdit gebieden gevonden die zich in je selectie bevinden"
|
||||
cmd-notRegistered: "%0% is niet geregistreerd in AreaShop"
|
||||
cmd-noRegionsAtLocation: "Geen gebieden gevonden op je lokatie, geef het gebied mee als argument"
|
||||
cmd-moreRegionsAtLocation: "Meerdere gebieden gevonden op je lokatie, geef het gebied mee als argument"
|
||||
cmd-automaticRegionOnlyByPlayer: "Automatisch bepalen van het gebied is alleen mogelijk voor spelers, geef het gebied mee als argument"
|
||||
help-header: "Help pagina, commando's die jij kunt uitvoeren"
|
||||
help-alias: "Commando aliassen: /areashop, /as"
|
||||
help-help: "&6/as help &7-&r Laat deze help pagina zien"
|
||||
help-info: "&6/as info &7-&r Vraag informatie over gebieden op"
|
||||
help-rent: "&6/as rent &7-&r Huur een gebied of verleng de huur"
|
||||
help-buy: "&6/as buy &7-&r Koop een gebied"
|
||||
help-unrent: "&6/as unrent &7-&r Stop de huur van een gebied"
|
||||
help-unrentOwn: "&6/as unrent &7-&r Stop de huur van een eigen gebied"
|
||||
help-sell: "&6/as sell &7-&r Verkoop een gebied"
|
||||
help-sellOwn: "&6/as sell &7-&r Verkoop een eigen gebied"
|
||||
help-updaterents: "&6/as updaterents &7-&r Update alle huur borden en gebieden"
|
||||
help-updatebuys: "&6/as updatebuys &7-&r Update alle koop borden en gebieden"
|
||||
help-reload: "&6/as reload &7-&r Herlaad de config en de taalbestanden"
|
||||
help-setrestore: "&6/as setrestore &7-&r Schakel herstellen in/uit en kies het profiel"
|
||||
help-setprice: "&6/as setprice &7-&r Verander de prijs van een gebied"
|
||||
help-setduration: "&6/as setduration &7-&r Verander de huurtijd van een region"
|
||||
help-teleport: "&6/as tp &7-&r Teleporteer naar je gekochte/gehuurde gebieden"
|
||||
help-teleportAll: "&6/as tp &7-&r Teleporteer naar koop/huur gebieden"
|
||||
help-setteleport: "&6/as settp &7-&r Stel de teleporteer locatie in van jouw gebieden"
|
||||
help-setteleportAll: "&6/as settp &7-&r Stel een teleporteer gebied in"
|
||||
help-find: "&6/as find &7-&r Zoek een leeg huur of koop gebied"
|
||||
help-groupadd: "&6/as groupadd &7-&r Voeg een gebied toe aan een groep"
|
||||
help-groupdel: "&6/as groupdel &7-&r Verwijder een gebied uit een groep"
|
||||
help-grouplist: "&6/as grouplist &7-&r Laat een lijst met groepen zien"
|
||||
help-groupinfo: "&6/as groupinfo &7-&r Laat informatie over een groep zien"
|
||||
help-schemevent: "&6/as schemevent &7-&r Voer een schematic gebeurtenis uit"
|
||||
help-add: "&6/as add &7-&r Registreer een huur of koop gebied"
|
||||
help-del: "&6/as del &7-&r Verwijder een geregistreerd gebied"
|
||||
help-addsign: "&6/as addsign &7-&r Voeg een bordje toe aan een bestaand gebied"
|
||||
help-delsign: "&6/as delsign &7-&r Verwijder het bord waar je naar kijkt"
|
||||
help-me: "&6/as me &7-&r Bekijk welke gebieden je hebt (+aflooptijd)"
|
||||
help-setowner: "&6/as setowner &7-&r Stel gebied eigenaar in of verleng de huur"
|
||||
help-resell: "&6/as resell &7-&r Zet een gebied in doorverkoop modus"
|
||||
help-resellAll: "&6/as resell &7-&r Zet een gebied in doorverkoop modus"
|
||||
help-stopResell: "&6/as stopresell &7-&r Stop het herverkopen van je gebied"
|
||||
help-stopResellAll: "&6/as stopresell &7-&r Stop het herverkopen van een gebied"
|
||||
help-addFriend: "&6/as addfriend &7-&r Voeg een vriend toe aan je gebied"
|
||||
help-addFriendAll: "&6/as addfriend &7-&r Voeg een vriend toe aan een gebied"
|
||||
help-delFriend: "&6/as delfriend &7-&r Verwijder een vriend van je gebied"
|
||||
help-delFriendAll: "&6/as delfriend &7-&r Verwijder een vriend van een gebied"
|
||||
rent-help: "/as rent <gebiednaam>"
|
||||
rent-noPermission: "Je hebt geen toestemming om een gebied te huren"
|
||||
rent-maximum: "Je kunt niet meer dan %0% gebied(en) huren (je hebt er al %1% in groep '%2%')"
|
||||
rent-payError: "Er is iets mis gegaan met betalen, probeer het later opnieuw"
|
||||
rent-rented: "Je hebt %0% tot %1% gehuurd"
|
||||
rent-extended: "Je hebt je huur van %0% verlengt tot %1%"
|
||||
rent-extend: "Je kunt je huur verlengen door opnieuw op het bordje te klikken of gebruik te maken van /as rent"
|
||||
rent-lowMoneyExtend: "Je hebt niet genoeg geld om de huur te verlengen (je hebt %0% van de %1%)"
|
||||
rent-lowMoneyRent: "Je hebt niet genoeg geld om het gebied te huren (je hebt %0% van de %1%)"
|
||||
rent-someoneElse: "Iemand anders heeft dit gebied al gehuurd"
|
||||
rent-notRentable: "Dat gebied is niet beschikbaar om te huren"
|
||||
rent-maxExtends: "Je kunt de huur niet meer verlengen (het maximum is %0% keer), je kunt echter wel het gebied opnieuw huren als het afgelopen is"
|
||||
rent-maxRentTime: "Je kunt dit huur gebied niet meer tijd van tevoren huren, de maximum tijd is %0% minuten en je hebt het al voor %1% minuten gehuurt"
|
||||
rent-restrictedToWorld: "Je moet in de '%0%' wereld zijn om dit gebied te huren (je bent in '%1%')"
|
||||
rent-restrictedToRegion: "Je moet in '%0%' staan om hem te huren"
|
||||
rent-expireWarning: "Je gebied %region% heeft nog %timeleft% over, verleng het als je het wilt houden."
|
||||
buy-help: "/as buy <gebiednaam>"
|
||||
buy-noPermission: "Je hebt geen toestemming om een gebied te kopen"
|
||||
buy-notBuyable: "Dat gebied is niet beschikbaar om te kopen"
|
||||
buy-maximum: "Je kunt niet meer dan %0% gebied(en) kopen (je hebt er al %1% in de groep '%2%')"
|
||||
buy-payError: "Er is iets mis gegaan met betalen, probeer het later opnieuw"
|
||||
buy-succes: "Je hebt %0% succesvol gekocht"
|
||||
buy-successResale: "Je hebt %0% succesvol gekocht van %1%"
|
||||
buy-successSeller: "Je gebied %0% is verkocht aan %1% voor %2%"
|
||||
buy-lowMoney: "Je hebt niet genoeg geld om het gebied te kopen (je hebt %0% van de %1%)"
|
||||
buy-yours: "Je hebt dit gebied al gekocht"
|
||||
buy-someoneElse: "Iemand anders heeft dit gebied al gekocht"
|
||||
buy-restrictedToWorld: "Je moet in de wereld '%0%' zijn om dit gebied te kopen (je ben in '%1%')"
|
||||
buy-restrictedToRegion: "Je moet in '%0%' staan om hem te kopen"
|
||||
unrent-help: "/as unrent <gebiednaam>, het gebied waarin je staat zal worden gebruikt als je deze niet aangeeft"
|
||||
unrent-noPermission: "Je hebt geen toestemming om te stoppen met huren"
|
||||
unrent-noPermissionOther: "Je hebt geen toestemming om iemand anders huur te stoppen"
|
||||
unrent-notRegistered: "De huur kan niet gestopt worden want het gebied is niet geregistreerd om te huren"
|
||||
unrent-notRented: "De huur kan niet gestopt worden want het gebied is niet gehuurd"
|
||||
unrent-unrented: "De huur van je gebied is gestopt"
|
||||
unrent-other: "De huur voor het gebied is gestopt voor speler %0%"
|
||||
unrent-expired: "De huur van je gebied %0% is gestopt"
|
||||
sell-help: "/as sell <gebiednaam>, het gebied waarin je staat zal worden gebruikt als je deze niet aangeeft"
|
||||
sell-notRegistered: "Het gebied kan niet verkocht worden want het staat niet geregistreerd om te kopen"
|
||||
sell-notBought: "Het gebied kan niet verkocht worden want het is niet gekocht"
|
||||
sell-sold: "Het gebied is verkocht voor speler %0%"
|
||||
sell-soldYours: "Je gebied is verkocht"
|
||||
sell-noPermission: "Je hebt geen toestemming om een gebied te verkopen"
|
||||
sell-noPermissionOther: "Je hebt geen toestemming om een gebied van iemand anders te verkopen"
|
||||
rents-updated: "Alle borden en gebieden voor de verhuur zijn geupdate"
|
||||
rents-noPermission: "Je hebt geen toestemming om alle verhuur borden en gebieden te updaten"
|
||||
rents-notUpdated: "Niet alle borden zijn geupdate, een reload zou het op kunnen lossen"
|
||||
buys-updated: "Alle borden en gebieden voor de verkoop zijn geupdate"
|
||||
buys-noPermission: "Je hebt geen toestemming om alle verkoop borden en gebieden te updaten"
|
||||
buys-notUpdated: "Niet alle borden zijn geupdate, een reload zou het op kunnen lossen"
|
||||
reload-reloaded: "De config is succesvol opnieuw ingeladen"
|
||||
reload-noPermission: "Je hebt geen toestemming om de config opnieuw in te laden"
|
||||
info-help: "/as info <all|rented|forrent|sold|forsale|player|region>"
|
||||
info-noPermission: "Je hebt geen toestemming om informatie over gebieden te bekijken"
|
||||
info-all-rents: "Gebieden geregistreerd voor de verhuur: %0%"
|
||||
info-all-noRents: "Er zijn geen gebieden geregistreerd voor de verhuur"
|
||||
info-all-buys: "Gebieden geregistreerd voor de verkoop: %0%"
|
||||
info-all-noBuys: "Er zijn geen gebieden geregistreerd voor de verkoop"
|
||||
info-rented: "Verhuurde gebieden: %0%"
|
||||
info-noRented: "Er zijn geen verhuurde gebieden"
|
||||
info-unrented: "Gebieden te huur: %0%"
|
||||
info-noUnrented: "Alle gebieden zijn verhuurd"
|
||||
info-sold: "Verkochte gebieden: %0%"
|
||||
info-noSold: "Alle gebieden zijn verkocht"
|
||||
info-forsale: "Gebieden te koop: %0%"
|
||||
info-noForsale: "Alle gebieden zijn verkocht"
|
||||
info-playerHelp: "/as info player <naam>"
|
||||
info-playerRents: "Gebieden gehuurd door %0%: %1%"
|
||||
info-playerNoRents: "%0% heeft geen gebied gehuurd"
|
||||
info-playerBuys: "Gebieden gekocht door %0%: %1%"
|
||||
info-playerNoBuys: "%0% heeft geen gebieden gekocht"
|
||||
info-regionHelp: "/as info region <naam>"
|
||||
info-regionHeaderRent: "&2Informatie over %region%:"
|
||||
info-regionHeaderBuy: "&2Informatie over %region%:"
|
||||
info-regionRented: "&2&l►&r Gehuurd door %player% tot: &7%until%"
|
||||
info-regionBought: "&2&l►&r Gekocht door %player%"
|
||||
info-regionExtending: "&2&l►&r Verleng prijs: &7%price% per %duration%"
|
||||
info-regionCanBeRented: "&2&l►&r Huurprijs: &7%price% per %duration%"
|
||||
info-regionCanBeBought: "&2&l►&r Koopprijs: &7%price%"
|
||||
info-regionFriends: "&2&l►&r Toegevoegde vrienden: &7%friends%"
|
||||
info-regionMoneyBackBuy: "&2&l►&r Verkoop terugbetaling: &7%moneyback% (%moneybackpercent%% van de prijs)"
|
||||
info-regionMoneyBackRent: "&2&l►&r Huurstop geld terug: &7%moneyback% (%moneybackpercent%% van de overgebleven tijd)"
|
||||
info-regionMaxExtends: "&2&l►&r Maximaal aantal keer verlengen: &7%maxextends% keer"
|
||||
info-regionNoExtending: "&2&l►&r Huurgebied kan niet verlengt worden"
|
||||
info-regionExtendsLeft: "&2&l►&r Verlengen over: &7%extendsleft% keer van de %maxextends%"
|
||||
info-regionMaxRentTime: "&2&l►&r Van te voren huren: &7%maxrenttime% maximum"
|
||||
info-regionNoTeleport: "&2&l►&r Teleporteer lokatie niet ingesteld%0%"
|
||||
info-regionTeleportHint: " &7(gebruik '/as settp' voor een betere lokatie)"
|
||||
info-regionTeleportAt: "&2&l►&r Teleporteer lokatie ingesteld op: &7(%0%, %1%, %2%, %3%, helling:%4%, draaiing:%5%)"
|
||||
info-regionSigns: "&2&l►&r Verbonden borden: &7%0%"
|
||||
info-regionSignLocation: "&7(%0%, %1%, %2%, %3%)&r"
|
||||
info-regionGroups: "&2&l►&r Toegewezen groepen: &7%0%"
|
||||
info-regionInactiveUnrent: "&2&l►&r Automatische huurstop na: &7%inactivetime% inactiviteit van de speler"
|
||||
info-regionInactiveSell: "&2&l►&r Automatische verkoop na: &7%inactivetime% inactiviteit van de speler"
|
||||
info-regionRestrictedRegionRent: "&2&l►&r Om dit gebied te huren moet je erin staan"
|
||||
info-regionRestrictedWorldRent: "&2&l►&r Om dit gebied te huren moet je in de wereld '%world%' zijn"
|
||||
info-regionRestrictedRegionBuy: "&2&l►&r Om dit gebied te kopen moet je erin staan"
|
||||
info-regionRestrictedWorldBuy: "&2&l►&r Om dit gebied te kopen moet je in de wereld '%world%' zijn"
|
||||
info-regionRestoringRent: "&2&l►&r Herstel is ingeschakeld &7(gebied zal resetten bij een huurstop)%0%"
|
||||
info-regionRestoringBuy: "&2&l►&r Herstel is ingeschakeld &7(gebied zal resetten bij een verkoop)%0%"
|
||||
info-regionRestoringProfile: " (profiel: %0%)"
|
||||
info-regionNoSign: "Er is geen bordje geregistreerd voor dit gebied"
|
||||
info-regionPriceDuration: "Prijs: %0% voor elke %1%"
|
||||
info-regionPrice: "Prijs: %0%"
|
||||
info-regionRestore: "Herstellen ingeschakeld: %0%"
|
||||
info-regionRestoreProfile: "Herstel profiel: %0%"
|
||||
info-regionTPLocation: "Teleporteer locatie: &7Wereld=%0%, X=%1%, Y=%2%, Z=%3%, Helling=%4%, Draaiing=%5%"
|
||||
info-regionNoTP: "Geen teleporteer locatie ingesteld"
|
||||
info-regionNotExisting: "Gebeid %0% staat niet geregistreerd"
|
||||
setrestore-help: "/as setrestore <gebied> <true|false|general> [profiel]"
|
||||
setrestore-noPermission: "Je hebt geen toestemming om de herstel opties te veranderen"
|
||||
setrestore-notRegistered: "%0% is niet geregistreerd"
|
||||
setrestore-invalidSetting: "'%0%' is geen geldige staat, gebruik true, false of general"
|
||||
setrestore-success: "De herstel optie van %0% is succesvol gezet naar '%1%'"
|
||||
setrestore-successProfile: "Herstel instelling van %0% is succesvol gezet op '%1%' en het profiel naar '%2%'"
|
||||
setprice-noPermission: "Je hebt geen toestemming om de prijs van een gebied te veranderen"
|
||||
setprice-help: "/as setprice <prijs> [gebied], het gebied waarin je staat zal worden gebruikt als je deze niet aangeeft"
|
||||
setprice-notRegistered: "%0% is niet geregistreerd in AreaShop"
|
||||
setprice-wrongPrice: "'%0%' is geen geldige prijs"
|
||||
setprice-successRent: "Prijs van gebied %0% is veranderd naar %1% per %2%"
|
||||
setprice-successBuy: "De prijs van het gebied %0% is veranderd naar %1%"
|
||||
setduration-noPermission: "Je hebt geen toestemming om de duur van het huur gebied aan te passen"
|
||||
setduration-help: "/as setduration <aantal> <identificator> [gebied], het gebied waarin je staat zal worden gebruikt als je niets aangeeft"
|
||||
setduration-notRegistered: "%0% is niet geregistreerd als een huur gebied"
|
||||
setduration-wrongAmount: "'%0%' is geen geldig aantal, gebruik een geheel nummer"
|
||||
setduration-wrongFormat: "'%0%' is geen goed tijdsformaat, bekijk de documentatie op Bukkit"
|
||||
setduration-success: "Duur van het gebied %0% veranderd naar '%1%'"
|
||||
setup-noRegion: "Je hebt geen gebied aangegeven op de tweede regel"
|
||||
setup-wrongRegion: "Het aangegeven gebied bestaat niet"
|
||||
setup-alreadyRentSign: "Het aangegeven gebied heeft al een bord voor huren"
|
||||
setup-alreadyBuySign: "Het aangegeven gebied heeft al een bord voor kopen"
|
||||
setup-noDuration: "Je hebt geen tijdsduur voor het huren aangegeven, zet dit op de derde regel"
|
||||
setup-wrongDuration: "De aangegeven tijdsduur is niet in het correcte formaat, voorbeeld: 1 dag"
|
||||
setup-noPrice: "Je hebt geen prijs aangegeven op de vierde regel"
|
||||
setup-wrongPrice: "Je hebt de prijs niet goed aangegeven, gebruik een nummer"
|
||||
setup-rentSuccess: "Huren van gebied %0% is goed opgezet"
|
||||
setup-buySuccess: "Kopen van gebied %0% is goed opgezet"
|
||||
setup-noPermissionRent: "Je hebt geen toestemming om huur gebieden op te zetten"
|
||||
setup-noPermissionBuy: "Je hebt geen toestemming om koop gebieden op te zetten"
|
||||
setup-couldNotDetect: "Meerdere gebieden gevonden met dezelfde prioriteit en/of parent/child relatie, geeft een specifieke aan op de tweede regel (2 van de gebieden die gevonden zijn: %0% en %1%)"
|
||||
destroy-noPermissionRent: "Je hebt geen toestemming om een bordje van dit huur gebied kapot te maken"
|
||||
destroy-noPermissionBuy: "Je hebt geen toestemming om een bordje van dit koop gebied kapot te maken"
|
||||
destroy-successRent: "Het huren van %0% is succesvol verwijderd"
|
||||
destroy-successBuy: "Het kopen van %0% is succesvol verwijderd"
|
||||
teleport-help: "/as tp <gebied> <aantal> <soort>"
|
||||
teleport-noRentOrBuy: "Gebied '%0%' is niet geregistreerd als koop of huur gebied"
|
||||
teleport-noPermission: "Je hebt geen toestemming om naar je gebied te teleporteren"
|
||||
teleport-noPermissionOther: "Je hebt geen toestemming om te teleporteren naar een gebied dat niet van jou is"
|
||||
teleport-noPermissionSign: "Je hebt geen toestemming om naar het bordje van je gebied te teleporteren"
|
||||
teleport-noPermissionOtherSign: "Je hebt geen toestemming om naar bordjes te teleporteren van gebieden die niet van jou zijn"
|
||||
teleport-noPermissionFriend: "Je hebt geen toestemming om te teleporteren naar gebieden waar je als vriend bent toegevoegd"
|
||||
teleport-noPermissionFriendSign: "Je hebt geen toestemming om te teleporteren naar het bord van gebieden waar je als vriend bent toegevoegd"
|
||||
teleport-success: "Je bent naar %0% geteleporteerd"
|
||||
teleport-successSign: "Je bent geteleporteerd naar het bordje van %0%"
|
||||
teleport-noSafe: "Geen veilige plek gevonden in gebied %0%, verander het gebied of stel de teleporteer positie in"
|
||||
teleport-blocked: "Je kunt niet teleporteren omdat de positie buiten het gebied ligt en je geforceerd word erbinnen te teleporteren"
|
||||
setteleport-help: "/as settp [gebied] [reset], het gebied waar je in staat zal worden gebruikt als je deze niet aangeeft"
|
||||
setteleport-noPermission: "Je hebt geen toestemming om de teleporteer lokatie in te stellen"
|
||||
setteleport-noPermissionOther: "Je hebt geen toestemming om de teleporteer lokatie in te stellen voor een gebied dat niet van jou is"
|
||||
setteleport-noRentOrBuy: "Gebied '%0%' is niet geregistreerd als koop of huur gebied"
|
||||
setteleport-success: "Teleporteer lokatie van %0% ingestelt"
|
||||
setteleport-notInside: "De lokatie moet zich binnen het gebied bevinden"
|
||||
setteleport-reset: "Teleporteer lokatie van %0% is gereset"
|
||||
find-help: "/as find <buy|rent> [maxprijs] [groep]"
|
||||
find-noPermission: "Je hebt geen toestemming om te zoeken naar gebieden en naar deze te teleporteren"
|
||||
find-success: "Een %0% gebied is gevonden: %1%, bij het zoeken met een maximale prijs gelijk aan je saldo: %2%%3%"
|
||||
find-successMax: "Een %0% gebied is gevonden: %1%, bij het zoeken met een maximale prijs van %2%%3%"
|
||||
find-wrongMaxPrice: "De aangegeven maximum prijs is geen correct nummer: %0%"
|
||||
find-wrongGroup: "De aangegeven groep bestaat niet: %0%"
|
||||
find-noneFound: "Geen %0% gebied gevonden bij het zoeken met een maximale prijs gelijk aan je saldo: %1%%2%"
|
||||
find-noneFoundMax: "Geen %0% gebied gevonden bij het zoeken met een maximale prijs van %1%%2%"
|
||||
find-onlyInGroup: ", alleen gebieden gezocht in de groep: %0%"
|
||||
groupadd-help: "/as groupadd <groep> [gebied], als er geen gebied is aangegeven dan worden alle gebieden in je WorldEdit selectie gebruikt"
|
||||
groupadd-noPermission: "Je hebt geen toestemming om gebieden toe te voegen aan groepen"
|
||||
groupadd-noRegion: "Het aangegeven gebied is niet geregistreerd: %0%"
|
||||
groupadd-success: "Gebied %0% is toegevoegd aan groep '%1%', deze group heeft nu %2% leden"
|
||||
groupadd-failed: "Gebied %0% is al toegevoegd aan groep '%1%'"
|
||||
groupadd-weSuccess: "Toegevoegd aan groep %0%: &7%1%"
|
||||
groupadd-weFailed: "Waren al toegevoegd aan groep %0%: &7%1%"
|
||||
groupdel-help: "/as groupdel <groep> [gebied], als er geen gebied is aangegeven worden alle gebieden in je WorldEdit selectie gebruikt"
|
||||
groupdel-noPermission: "Je hebt geen toestemming om gebieden van groepen te verwijderen"
|
||||
groupdel-noRegion: "Het aangegeven gebied staat niet geregistreerd: %0%"
|
||||
groupdel-success: "Gebied %0% is verwijderd van groep '%1%', deze groep heeft nu %2% leden"
|
||||
groupdel-failed: "Gebied %0% is geen lid van groep '%1%'"
|
||||
groupdel-weSuccess: "Verwijderd van groep %0%: &7%1%"
|
||||
groupdel-weFailed: "Waren al niet in de groep %0%: &7%1%"
|
||||
grouplist-noPermission: "Je hebt geen toestemming om de geregistreerde groepen te bekijken"
|
||||
grouplist-noGroups: "Er zijn geen groepen aangemaakt"
|
||||
grouplist-success: "De volgende groepen zijn geregistreerd: &7%0%"
|
||||
groupinfo-help: "/as groupinfo <groep>"
|
||||
groupinfo-noPermission: "Je hebt geen toestemming voor het bekijken van informatie over een groep"
|
||||
groupinfo-noGroup: "Er is geen groep geregistreerd met de naam '%0%', gebruik /as grouplist om de lijst te bekijken"
|
||||
groupinfo-members: "De volgende gebieden zijn leden van de groep %0%: &7%1%"
|
||||
groupinfo-noMembers: "Groep %0% heeft geen leden"
|
||||
schemevent-help: "/as schemevent <gebied> <created|deleted|rented|unrented|bought|sold>"
|
||||
schemevent-noRegion: "Het aangegeven gebied is niet geregistreerd: %0%"
|
||||
schemevent-wrongEvent: "Het aangegeven event '%0%' bestaat niet, gebruik een van de volgende: &7%1%"
|
||||
schemevent-success: "Event '%0%' succesvol getriggerd voor gebied %1%"
|
||||
schemevent-noPermission: "Je hebt geen toestemming om events te triggeren"
|
||||
add-help: "/as add <rent|buy> [gebied] [wereld]"
|
||||
add-noPermission: "Je hebt geen toestemming om een gebied toe te voegen aan AreaShop"
|
||||
add-success: "Toegevoegd als %0%: &7%1%"
|
||||
add-failed: "Al geregistreerd: &7%0%"
|
||||
add-specifyWorld: "Geef de wereld van het gebied aan als je het commando vanuit de console gebruikt"
|
||||
add-incorrectWorld: "Wereld '%0%' niet gevonden, probeer opnieuw (hoofdlettergevoelig)"
|
||||
add-noRegion: "Gebied '%0%' bestaat niet in deze wereld"
|
||||
del-noRegion: "Gebied '%0%' is niet geregistreerd in AreaShop"
|
||||
del-noPermission: "Je hebt geen toestemming om gebieden te verwijderen"
|
||||
del-success: "Verwijderde gebieden: &7%0%"
|
||||
del-failed: "Geen toestemming om te verwijderen of niet geregistreerd: &7%0%"
|
||||
addsign-help: "/as addsign [gebied] [profiel]"
|
||||
addsign-noSign: "Je kijkt niet naar een bord"
|
||||
addsign-noRegion: "Gebied '%0%' kan niet gevonden worden"
|
||||
addsign-noRegions: "Geen gebied gevonden op de lokatie van het bord"
|
||||
addsign-couldNotDetect: "Meerdere gebieden gevonden op de lokatie van het bord, geef het gebied mee als extra argument (2 van de gevonden gebieden: %0% en %1%)"
|
||||
addsign-couldNotDetectSign: "Meerdere gebieden gevonden op de lokatie van het bord, geef het gebied aan op de tweede regel (2 van de gevonden gebieden: %0% en %1%)"
|
||||
addsign-wrongProfile: "Het aangegeven profiel bestaat niet, gebruik een van de volgende (check de config): &7%0%"
|
||||
addsign-success: "Het bord is toegevoegd aan %0%"
|
||||
addsign-successProfile: "Het bord is toegevoegd aan %0% met profiel %1%"
|
||||
addsign-alreadyRegistered: "Dat bord is al geregistreerd voor gebied %0%"
|
||||
addsign-noPermission: "Je hebt geen toestemming om een bord toe te voegen"
|
||||
delsign-noSign: "Je kijkt niet naar een bord"
|
||||
delsign-noPermission: "Je hebt geen toestemming om een bord te verwijderen"
|
||||
delsign-noRegion: "Dat bord hoort niet bij een AreaShop gebied"
|
||||
delsign-success: "Het bord is verwijderd van gebied %0%"
|
||||
me-noPermission: "Je hebt geen toestemming om te zien welke gebieden je hebt"
|
||||
me-notAPlayer: "Je bent geen speler dus je kunt geen gebieden hebben"
|
||||
me-noRentRegions: "Je hebt geen huur gebieden gehuurt"
|
||||
me-noBuyRegions: "Je hebt geen koop gebieden gekocht"
|
||||
me-rentRegions: "Je hebt de volgende gebieden gehuurt:"
|
||||
me-buyRegions: "Je hebt de volgende gebieden gekocht:"
|
||||
me-rentLine: "&2&l►&r %region% tot %until% &7(%timeleft% over)"
|
||||
me-buyLine: "&2&l►&r %region%"
|
||||
me-noFriendRegions: "Je bent niet aan gebieden toegevoegd als vriend"
|
||||
me-friendRegions: "Je bent toegevoegd als vriend aan de volgende gebieden:"
|
||||
me-friendLine: "&2&l►&r %region% &7(eigenaar: %player%)"
|
||||
setowner-help: "/as setowner <speler> [gebied], het gebied waar je in staat zal worden gebruikt als je deze niet aangeeft"
|
||||
setowner-noPermission: "Je hebt geen toestemming om de eigenaar van een gebied in te stellen"
|
||||
setowner-noPermissionRent: "Je hebt geen toestemming om de eigenaar van huur gebieden in te stellen"
|
||||
setowner-noPermissionBuy: "Je hebt geen toestemming om de eigenaar van koop gebieden in te stellen"
|
||||
setowner-notRegistered: "Het aangegeven gebied is niet geregistreerd, eigenaar kan niet worden ingesteld"
|
||||
setowner-noPlayer: "De UUID van de aangegeven speler kon niet worden gevonden: %0%"
|
||||
setowner-succesRent: "Eigenaar van %region% succesvol veranderd naar %player%, gehuurt tot %until% (%timeleft% over)"
|
||||
setowner-succesRentExtend: "Eigenaar was al %player%, huur verlengt met '%duration%', nu gehuurd tot %until% (%timeleft% over)"
|
||||
setowner-succesBuy: "Eigenaar van %region% succesvol veranderd naar %player%"
|
||||
resell-help: "/as resell <prijs> [gebied], het gebied waarin je staat zal worden gebruikt als je deze niet aangeeft"
|
||||
resell-wrongPrice: "'%0%' is geen geldige prijs"
|
||||
resell-notRegistered: "%0% is niet geregistreerd in AreaShop"
|
||||
resell-noRegionFound: "Geen AreaShop gebied gevonden op je lokatie, geeft de naam van het gebied mee als argument"
|
||||
resell-notBought: "Je kunt %region% niet doorverkopen want dit gebied is nog niet verkocht"
|
||||
resell-success: "%region% is succesvol in doorverkoop mode gezet voor %resellprice%"
|
||||
resell-noPermission: "Je hebt geen toestemming om je gebied in doorverkoop mode te zetten"
|
||||
resell-noPermissionOther: "Je hebt geen toestemming om gebieden in doorverkoop mode te zetten"
|
||||
stopresell-help: "/as stopresell [gebied], het gebied waarin je staat zal worden gebruikt als je deze niet aangeeft"
|
||||
stopresell-notRegistered: "%0% is niet geregistreerd in AreaShop"
|
||||
stopresell-noRegionFound: "Geen AreaShop gebied gevonden op je lokatie, geeft de naam van het gebied mee als argument"
|
||||
stopresell-notResell: "Je kunt niet stoppen met doorverkopen van %region% want hij staat niet in doorverkoop mode"
|
||||
stopresell-success: "%region% is succesvol terug gezet in verkocht mode"
|
||||
stopresell-noPermission: "Je hebt geen toestemming om je gebied terug te zetten in verkocht mode"
|
||||
stopresell-noPermissionOther: "Je hebt geen toestemming om een gebied terug te zetten in verkocht mode"
|
||||
addfriend-help: "/as addfriend <speler> [gebied], het gebied waar je in staat zal worden gebruikt als je deze niet aangeeft"
|
||||
addfriend-noPermissionOther: "Je hebt geen toestemming om vrienden toe te voegen aan gebieden die niet van jou zijn"
|
||||
addfriend-noPermission: "Je hebt geen toestemming om vrienden toe te voegen aan je gebied"
|
||||
addfriend-successOther: "%0% is toegevoegd als vriend bij gebied %1%"
|
||||
addfriend-success: "%0% is toegevoegd als vriend bij je gebied %1%"
|
||||
addfriend-alreadyAdded: "%0% is al toegevoegd als vriend voor dit gebied"
|
||||
addfriend-self: "Het toevoegen van de eigenaar van het gebied als vriend zou nutteloos zijn"
|
||||
addfriend-noOwner: "Je kunt geen vrienden toevoegen aan een gebied zonder eigenaar"
|
||||
delfriend-help: "/as delfriend <speler> [gebied], het gebied waar je in staat zal worden gebruikt als je deze niet aangeeft"
|
||||
delfriend-noPermissionOther: "Je hebt geen toestemming om vrienden te verwijderen van gebieden die niet van jou zijn"
|
||||
delfriend-noPermission: "Je hebt geen toestemming om vrienden te verwijderen van je gebied"
|
||||
delfriend-successOther: "%0% is verwijderd als vriend van gebied %1%"
|
||||
delfriend-success: "%0% is verwijderd als vriend van je gebied %1%"
|
||||
delfriend-notAdded: "%0% is niet toegevoegd als vriend voor dit gebied"
|
||||
delfriend-noOwner: "Je kunt geen vrienden verwijderen van een gebied zonder eigenaar"
|
||||
timeleft-years: "%0% jaren"
|
||||
timeleft-months: "%0% maanden"
|
||||
timeleft-days: "%0% dagen"
|
||||
timeleft-hours: "%0% uren"
|
||||
timeleft-minutes: "%0% minuten"
|
||||
timeleft-second: "%0% seconde"
|
||||
timeleft-seconds: "%0% seconden"
|
||||
timeleft-ended: "Verlopen"
|
||||
greeting-forrent: "%region% kan worden gehuurd voor %price% per %duration%"
|
||||
greeting-rented: "%region% is gehuurd door %player% tot %until%"
|
||||
greeting-forsale: "%region% kan worden gekocht voor %price%"
|
||||
greeting-bought: "%region% is gekocht door %player%"
|
||||
greeting-resale: "%region% kan worden gekocht voor %resaleprice% van %player%"
|
||||
+224
@@ -0,0 +1,224 @@
|
||||
# ╔════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════╗
|
||||
# ║ Language file of the AreaShop plugin created by NLThijs48, Github can be found at https://github.com/NLthijs48/AreaShop ║
|
||||
# ║ Language: Polish (Polski), Version: V2.1.0, Percentage translated: 63%, author(s): Rexlu ║
|
||||
# ║ This file will be overwritten at each startup/reload of the plugin, if you want to change anything then do the following: ║
|
||||
# ║ 1: Make a copy of this file ║
|
||||
# ║ 2: Rename it to <servername>.yml (don't use a language code as filename, could otherwise be overwritten in future updates) ║
|
||||
# ║ 3: Change the 'language' setting in config.yml to '<servername>', do not include '.yml' ║
|
||||
# ╚════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════╝
|
||||
cmd-notValid: "Komenda jest niepoprawna, wpisz /as help aby uzyskac liste komend"
|
||||
cmd-onlyByPlayer: "Ta komenda moze byc uzywana tylko przez gracza"
|
||||
cmd-weOnlyByPlayer: "Uzywanie zaznaczenia WorldEdit jest mozliwe tylko podczas bycia graczem, sprecyzuj nazwe miejsca jako dodatkowy argument"
|
||||
cmd-noSelection: "Nie zaznaczyles terenu pluginem WorldEdit"
|
||||
cmd-noRegionsFound: "Nie znaleziono miejsc AreShop w zaznaczeniu"
|
||||
help-header: "Strona pomocy, komendy ktore moga zostac uzzte"
|
||||
help-alias: "Aby wyswietlic ta strone: /areashop, /as"
|
||||
help-help: "&6/as help &7-&r Pokazuje stone pomocy"
|
||||
help-info: "&6/as info &7-&r Pokazuje informacje odnosnie miejsc"
|
||||
help-rent: "&6/as rent &7-&r Wynajmuje dane miejsce lub przedluza wynajem"
|
||||
help-buy: "&6/as buy &7-&r BKupuje miejsce"
|
||||
help-unrent: "&6/as unrent &7-&r Anuluje wynajem"
|
||||
help-unrentOwn: "&6/as unrent &7-&r Anuluje wynajem"
|
||||
help-sell: "&6/as sell &7-&r Sprzedaje miejsce"
|
||||
help-sellOwn: "&6/as sell &7-&r Sprzedaje miejsce"
|
||||
help-updaterents: "&6/as updaterents &7-&r Aktualizuje wszystkie miejsca wynajmu oraz tabliczki"
|
||||
help-updatebuys: "&6/as updatebuys &7-&r Aktualizuje wszystkie miejsca do kupienia oraz tabliczki"
|
||||
help-reload: "&6/as reload &7-&r Laduje ponownie ustawienia oraz pliki jezykowe"
|
||||
help-teleport: "&6/as tp &7-&r Teleportuje do kupionych/wynajetych miejsc"
|
||||
help-teleportAll: "&6/as tp &7-&r Teleportuje do wynajmowanego/kupionego miejsca"
|
||||
help-setteleport: "&6/as settp &7-&r Ustawia koordynaty teleportacji dla kupionego/wynajetego miejsca"
|
||||
help-setteleportAll: "&6/as settp &7-&r Ustawia koordynaty teleportacji dla danego miejsca"
|
||||
help-find: "&6/as find &7-&r Znajdz niezakupione i wolne regiony"
|
||||
help-groupadd: "&6/as groupadd &7-&r Dodaje miejsce do grupy"
|
||||
help-groupdel: "&6/as groupdel &7-&r Usuwa miejsce z grupy"
|
||||
help-grouplist: "&6/as grouplist &7-&r Wyswietla wszystkie grupy"
|
||||
help-groupinfo: "&6/as groupinfo &7-&r Wyswietla informacje o grupie"
|
||||
help-add: "&6/as add &7-&r Dodaje region do wynajmu lub zakupu"
|
||||
help-del: "&6/as del &7-&r Usuwa dane miejsce z AreaShop"
|
||||
help-addsign: "&6/as addsign &7-&r Dodaje tabliczke do istniejacego miejsca"
|
||||
help-delsign: "&6/as delsign &7-&r Usuwa tabliczke na ktora patrzysz"
|
||||
help-me: "&6/as me &7-&r Sprawdza ktore miejsca sa twoja wlasnoscia (+czas wygasniecia)"
|
||||
help-setowner: "&6/as setowner &7-&r Ustawia wlasciciela lub wydluza czas wynajmu"
|
||||
rent-noPermission: "Nie masz uprawnien aby wynajac to miejsce"
|
||||
rent-maximum: "Nie mozesz wynajac wiecej niz %0%"
|
||||
rent-payError: "Cos poszlo nie tak, sprobuj ponownie pozniej"
|
||||
rent-rented: "Wynajales %0% do %1%"
|
||||
rent-extended: "Przedluzyles wynajem %0% do %1%"
|
||||
rent-extend: "Mozesz przedluzyc czas wynajmu poprzez klikniecie PPM na tabliczke badz wpisanie /as rent"
|
||||
rent-lowMoneyExtend: "Nie masz wystarczajaco pieniedzy aby przedluzyc czas wynajmu"
|
||||
rent-lowMoneyRent: "Nie masz wystarczajaco pieniedzy aby wynajac"
|
||||
rent-someoneElse: "Ktos wynajmuje juz to miejsce"
|
||||
rent-notRentable: "Tego miejsca nie mozna wynajac"
|
||||
rent-maxExtends: "Nie mozesz wydluzyc czasu wynajmu (maksymalnie %0% razy), po skonczeniu czasu wynajmu, mozesz ponownie wynajac to miejsce"
|
||||
buy-noPermission: "Nie posiadasz uprawnien aby kupic to miejsce"
|
||||
buy-notBuyable: "Tego miejsca nie mozna kupic"
|
||||
buy-maximum: "Nie mozesz zakupic wiecej niz %0%"
|
||||
buy-payError: "Cos poszlo nie tak, sprobuj ponownie pozniej"
|
||||
buy-lowMoney: "Nie masz wystarczajaco pieniedzy aby kupic to miejsce"
|
||||
buy-yours: "Jestes wlascicielem tego miejsca"
|
||||
buy-someoneElse: "Ktos juz kupil to miejsce"
|
||||
unrent-noPermission: "Nie masz uprawnien aby anulowac wynajem"
|
||||
unrent-noPermissionOther: "Nie masz uprawnien aby anulowac wynajem innemu graczowi"
|
||||
unrent-notRegistered: "Nie mozna anulowac wynajmu dla tego miejsca, poniewaz nie blyo ustawione pod wynajem"
|
||||
unrent-notRented: "Nie mozna anulowac wynajmu tego miejsca, poniewaz nie jest wynajete"
|
||||
unrent-unrented: "Anulowales wynajem"
|
||||
unrent-other: "Anulowano wynajem graczowi %0%"
|
||||
unrent-expired: "Twoj czas wynajmu %0% dobiegl konca"
|
||||
sell-notRegistered: "To miejsce nie moze zostac sprzedane, poniewaz nie mozna bylo ustawione do kupna"
|
||||
sell-notBought: "To miejsce nie moze byc sprzedane, poniewaz nie jest kogos wlasnoscia"
|
||||
sell-sold: "To miejsce zostalo sprzedane graczowi %0%"
|
||||
sell-soldYours: "Sprzedales miejsce"
|
||||
sell-noPermission: "Nie masz uprawnien aby sprzedac to miejsce"
|
||||
sell-noPermissionOther: "Nie masz uprawnien aby sprzedawac miejsce nalezace do kogos"
|
||||
rents-updated: "Wszystkie znaki i regiony do wynajecia zostaly zaaktualizowane"
|
||||
rents-noPermission: "Nie masz uprawnien aby zaaktualizowac miejsca i tabliczki"
|
||||
rents-notUpdated: "Nie wszystkie tabliczki zostaly zaaktualizwane, sprobuj komendy /as reload"
|
||||
buys-updated: "Wszystkie znaki i regiony na sprzedaz zostaly zaaktualizowane"
|
||||
buys-noPermission: "Nie masz uprawnien aby zaaktualizowac miejsca i tabliczki"
|
||||
buys-notUpdated: "Nie wszystkie tabliczki zostaly zaaktualizwane, sprobuj komendy /as reload"
|
||||
reload-reloaded: "Ustawienia zostaly przeladowane pomyslnie"
|
||||
reload-noPermission: "Nie masz do tego uprawnien"
|
||||
info-help: "/as info <all|rented|forrent|sold|forsale|player|region>"
|
||||
info-all-rents: "Miejsca do wynajmu: &7%0%"
|
||||
info-all-noRents: "Nie ma miejsc, ktore mozna wynajac"
|
||||
info-all-buys: "Miejsca do kupienia: &7%0%"
|
||||
info-all-noBuys: "Nie ma miejsc ktore mozna kupic"
|
||||
info-rented: "Wynajete miejsca: &7%0%"
|
||||
info-noRented: "Wszystkie miejsca sa wolne"
|
||||
info-unrented: "Anulowane wynajmy: &7%0%"
|
||||
info-noUnrented: "Wszystkie miejsca sa wynajmowane"
|
||||
info-sold: "Sprzedane miejsca: &7%0%"
|
||||
info-noSold: "Nie ma miejsc na sprzedaz"
|
||||
info-forsale: "Miejsca na sprzedaz: &7%0%"
|
||||
info-noForsale: "Wszystkie miejsca sa wyprzedane"
|
||||
info-playerHelp: "/as info player <nick>"
|
||||
info-playerRents: "Miejsca wynajmowane przez %0%: &7%1%"
|
||||
info-playerNoRents: "%0% nie wynajmuje zadnych miejsc"
|
||||
info-playerBuys: "Miejsca kupione przez %0%: %1%"
|
||||
info-playerNoBuys: "%0% nie kupil jeszcze zadnego miejsca"
|
||||
info-regionSignLocation: "&7(%0%, %1%, %2%, %3%)&r"
|
||||
info-regionNoSign: "Tabliczka dla tego miejsca nie istnieje."
|
||||
info-regionPriceDuration: "Cena: &7%0% za kazdy %1%"
|
||||
info-regionPrice: "Cena: &7%0%"
|
||||
info-regionRestore: "Restoring enabled: &7%0%"
|
||||
info-regionRestoreProfile: "Restoring profile: &7%0%"
|
||||
info-regionTPLocation: "Lokacja teleportu: &7World=%0%, X=%1%, Y=%2%, Z=%3%, Pitch=%4%, Yaw=%5%"
|
||||
info-regionNoTP: "Nie ustawiono lokacji teleportu"
|
||||
setrestore-help: "/as setrestore <miejsce> <true|false|general> [profil]"
|
||||
setrestore-invalidSetting: "'%0%' nie jest wlasciwa wartoscia, powinno byc true, false lub general"
|
||||
setprice-noPermission: "Nie masz uprawnien aby zmienic cene tego miejsca"
|
||||
setprice-help: "/as setprice <price> [region], cena zostanie nadana miejscu na ktorym stoisz jezeli nie sprecyzujesz miejsca"
|
||||
setprice-notRegistered: "%0% nie istnieje w AreaShop"
|
||||
setprice-wrongPrice: "'%0%' nie jest prawidlowa cena"
|
||||
setprice-successRent: "Cena za %0% zmieniona na %1% za %2%"
|
||||
setprice-successBuy: "Cena za %0% zmieniona na %1%"
|
||||
setup-noRegion: "Nie sprecyzowales miejsca w drugiej linijce"
|
||||
setup-wrongRegion: "Sprecyzowane miejsce nie istnieje"
|
||||
setup-alreadyRentSign: "Sprecyzowane miejsce aktualnie ma juz tabliczke"
|
||||
setup-alreadyBuySign: "Sprecyzowane miejsce aktualnie ma juz tabliczke"
|
||||
setup-noDuration: "Nie sprecyzowales jak dlugi ma byc czas wynajmu, zrob to w 3 linijce"
|
||||
setup-wrongDuration: "Sprecyzowany czas nie jest poprawny, przyklad: 1 day"
|
||||
setup-noPrice: "Nie sprecyzowales ceny, zrob to w 4 linijce"
|
||||
setup-wrongPrice: "Sprecyzowana cena jest niepoprawna, uzyj liczby"
|
||||
setup-rentSuccess: "Wynajem miejsca %0% zostal ustawiony poprawnie"
|
||||
setup-buySuccess: "Kupno miejsca %0% zostalo ustawione poprawnie"
|
||||
setup-noPermissionRent: "Nie masz uprawnien aby ustawic miejsce do wynajmu"
|
||||
setup-noPermissionBuy: "Nie masz uprawnien aby ustawic miejsc do kupna"
|
||||
setup-couldNotDetect: "Found multiple regions with the same priority and/or parent/child relation, specify one on the second line (2 of the regions that were found: %0% and %1%)"
|
||||
destroy-noPermissionRent: "Nie masz uprawnien aby niszczyc tabliczki wynajmu miejsca"
|
||||
destroy-noPermissionBuy: "Nie masz uprawnien aby niszczyc tabliczki kupna miejsca"
|
||||
destroy-successRent: "Usunieto wynajem dla miejsca: %0%"
|
||||
destroy-successBuy: "Usunieto status kupionego dla: %0%"
|
||||
teleport-help: "/as tp <miejsce> [tabliczka]"
|
||||
teleport-noRentOrBuy: "Miejsce '%0%' nie jest ustawione pod wynajem lub kupno"
|
||||
teleport-noPermission: "Nie masz uprawnien aby teleportowac sie do twojego miejsca/regionu"
|
||||
teleport-noPermissionOther: "Nie masz uprawnien aby teleportowac sie do miejsc, ktore nie sa twoja wlasnoscia"
|
||||
teleport-noPermissionSign: "Nie masz uprawnien aby teleportowac sie do tabliczki twojej posiadlosci"
|
||||
teleport-noPermissionOtherSign: "Nie masz uprawnien aby teleportowac sie do tabliczek miejsc, ktore nie sa twoja wlasnoscia"
|
||||
teleport-success: "Teleportowales sie do %0%"
|
||||
teleport-successSign: "Teleportowales sie do tabliczki miejsca %0%"
|
||||
setteleport-help: "/as settp [miejsce] [reset], zostanie uzyty region na ktorym stoisz jezeli nie sprecyzujesz"
|
||||
setteleport-noPermission: "Nie masz uprawnien aby ustawic koordynaty do teleportacji"
|
||||
setteleport-noPermissionOther: "Nie masz uprawnien aby ustawic koordynaty teleportacji dla miejsca, ktore nie jest twoja wlasnoscia"
|
||||
setteleport-noRentOrBuy: "Miejsce '%0%' nie jest ustawione pod wynajem lub zakup"
|
||||
setteleport-success: "Ustawiono koordynaty teleportacji dla %0%"
|
||||
setteleport-notInside: "Koordynaty teleportu musza byc na terenie twojego miejsca/regionu"
|
||||
setteleport-reset: "Koordynaty teleportacji dla %0% zostaly zresetowane"
|
||||
find-help: "/as find <buy|rent> [maxcena] [grupa]"
|
||||
find-wrongMaxPrice: "Sprecyzowana maksymalna cena nie jest liczba: %0%"
|
||||
find-wrongGroup: "Sprecyzowana grupa nie istnieje: %0%"
|
||||
groupadd-help: "/as groupadd <grupa> [miejsce], jezeli nie sprecyzujesz, wszystkie miejsca z twojego zaznaczenia WorldEdit zostana uzyte"
|
||||
groupadd-noPermission: "Nie masz uprawnien aby dodawac miejsca/regiony do grup"
|
||||
groupadd-noRegion: "Sprecyzowany region/miejsce nie istnieje: %0%"
|
||||
groupadd-success: "Miejsce %0% zostalo dodane do grupy '%1%', ta grupa ma %2% czlonkow"
|
||||
groupadd-failed: "Miejsce %0% nalezy do grupy '%1%'"
|
||||
groupadd-weSuccess: "Dodano do grupy %0%: &7%1%"
|
||||
groupadd-weFailed: "Jestesmy juz w grupie %0%: &7%1%"
|
||||
groupdel-help: "/as groupdel <grupa> [miejsce], jezeli nie sprecyzowano miejsca/regionu, to wszystkie regiony z zaznaczenia WorldEdit beda uzyte"
|
||||
groupdel-noPermission: "Nie masz uprawnien aby usuwac miejsca/regiony z grup"
|
||||
groupdel-noRegion: "Sprecyzowany region/miejsce nie istnieje: %0%"
|
||||
groupdel-success: "Miejsce %0% zostalo usuniete z grupy '%1%', ta grupa ma teraz %2% czlonkow"
|
||||
groupdel-failed: "Miejsce %0% nie nalezy do grupy '%1%'"
|
||||
groupdel-weSuccess: "Usunieto z grupy %0%: &7%1%"
|
||||
groupdel-weFailed: "Nie jestesmy w grupie %0% swoja droga: &7%1%"
|
||||
grouplist-noPermission: "Nie masz uprawnien aby wyswietlic grupy"
|
||||
grouplist-noGroups: "Aktualnie nie ma zadnych grup"
|
||||
grouplist-success: "Istnieja nastepujace grupy: &7%0%"
|
||||
groupinfo-help: "/as groupinfo <grupa>"
|
||||
groupinfo-noPermission: "Nie masz uprawnien aby wyswietlic informacje o grupie"
|
||||
groupinfo-noGroup: "Nie ma grupy o nazwie '%0%', wpisz /as grouplist aby sprawdzic istniejace grupy"
|
||||
groupinfo-members: "Nastepujace miejsca/regiony naleza do grupy %0%: &7%1%"
|
||||
groupinfo-noMembers: "W grupie %0% nie ma zadnych czlonkow"
|
||||
schemevent-help: "/as schemevent <miejsce> <created|deleted|rented|unrented|bought|sold>"
|
||||
schemevent-noRegion: "Taki region/miejsce nie istnieje %0%"
|
||||
schemevent-wrongEvent: "Sprecyzowana zaszłość/event '%0%' nie istnieje, uzyj jednej z nastepujacych: &7%1%"
|
||||
add-help: "/as add <rent|buy> [miejsce] [swiat]"
|
||||
add-noPermission: "Nie masz uprawnien aby dodac miejsce/region do AreaShop"
|
||||
add-success: "Dodano jako %0%: &7%1%"
|
||||
add-failed: "Aktualnie istnieje: &7%0%"
|
||||
add-specifyWorld: "Musisz sprecyzowac swiat w ktorym istnieje dany region/miejsce kiedy uzywasz konsoli"
|
||||
add-incorrectWorld: "Swiat '%0%' nie zostal znaleziony, sprobuj ponownie (zwroc uwage na wielkosc liter)"
|
||||
add-noRegion: "Miejsce '%0%' nie istnieje w tym swiecie"
|
||||
del-noRegion: "Miejsce '%0%' nie istnieje w AreaShop"
|
||||
del-noPermission: "Nie masz uprawnien aby usuwac miejsca/regiony"
|
||||
del-success: "Usuniete miejsca/regiony: &7%0%"
|
||||
del-failed: "Brak uprawnien aby usunac lub nie istnieja: &7%0%"
|
||||
addsign-help: "/as addsign [miejsce] [profil]"
|
||||
addsign-noSign: "Nie patrzysz sie na tabliczke"
|
||||
addsign-noRegion: "Miejsce '%0%' nie moze zostac znalezione"
|
||||
addsign-noRegions: "Nie znaleziono miejsca/regionu w poblizu tabliczki"
|
||||
addsign-couldNotDetect: "Znaleziono wiele miejsc/regionow wokol tabliczki, sprecyzuj miejsce jako dodatkowy argument (2 miejsca zostaly znalezione: %0% and %1%)"
|
||||
addsign-couldNotDetectSign: "Znaleziono wiele miejsc/regionow wokol tabliczki, sprecyzuj miejsce w drugiej linijce (2 miejsca zostaly znalezione: %0% and %1%)"
|
||||
addsign-wrongProfile: "Sprecyzowany profil nie istnieje, uzyj jednego z nastepujacych (sprawdz ustawienia): &7%0%"
|
||||
addsign-success: "Tabliczka zostala dodana do %0%"
|
||||
addsign-successProfile: "Tabliczka zostala dodana do %0% z profilem %1%"
|
||||
addsign-alreadyRegistered: "Ta tabliczka aktualnie istnieje dla miejsca %0%"
|
||||
addsign-noPermission: "Nie masz uprawnien aby dodac tabliczke"
|
||||
delsign-noSign: "Nie patrzysz sie na tabliczke"
|
||||
delsign-noPermission: "Nie masz uprawnien aby usunac tabliczke"
|
||||
delsign-noRegion: "Ta tabliczka nie nalezy do AreaShop"
|
||||
delsign-success: "Tabliczka zostala usunieta z %0%"
|
||||
me-noPermission: "Nie masz uprawnien aby sprawdzic jakie miejsca naleza do ciebie"
|
||||
me-notAPlayer: "Nie jestes graczem, wiec nie mozesz miec zadnych miejsc"
|
||||
me-noRentRegions: "Nie wynajales zadnych miejsc"
|
||||
me-noBuyRegions: "Nie kupiles zadnych miejsc"
|
||||
me-rentRegions: "Wynajmujesz nastepujace miejsca:"
|
||||
me-buyRegions: "Kupiles nastepujace miejsca:"
|
||||
setowner-help: "/as setowner <gracz> [miejsce], jezeli nie sprecyzujesz zostanie uzyty region/miejsce na ktorym stoisz"
|
||||
setowner-noPermission: "Nie masz uprawnien aby nadawac wlasciciela dla danego miejsca/regionu"
|
||||
setowner-noPermissionRent: "Nie masz uprawnien aby nadawac wlasciciela dla danego miejsca/regionu"
|
||||
setowner-noPermissionBuy: "Nie masz uprawnien aby nadawac wlasciciela dla danego miejsca/regionu"
|
||||
setowner-notRegistered: "Sprecyzowane miejsce nie istnieje, wlasciciel nie moze zostac ustawiony"
|
||||
setowner-noPlayer: "Nie mozna pozyskac UUID sprecyzowanego gracza: %0%"
|
||||
timeleft-years: "%0% lat"
|
||||
timeleft-months: "%0% miesiecy"
|
||||
timeleft-days: "%0% dni"
|
||||
timeleft-hours: "%0% godzin"
|
||||
timeleft-minutes: "%0% minut"
|
||||
timeleft-second: "%0% sekunda"
|
||||
timeleft-seconds: "%0% sekund"
|
||||
timeleft-ended: "Wygaslo/przedawniony"
|
||||
greeting-forrent: "%region% moze zostac wynajety za %price% za %duration%"
|
||||
greeting-rented: "%region% jest wynajety graczowi %player% do %until%"
|
||||
greeting-forsale: "%region% moze zostac kupiony za %price%"
|
||||
greeting-bought: "%region% zostal zakupiony przez gracza %player%"
|
||||
+209
@@ -0,0 +1,209 @@
|
||||
name: AreaShop
|
||||
main: nl.evolutioncoding.areashop.AreaShop
|
||||
version: 2.1.0
|
||||
depend: [Vault, WorldGuard, WorldEdit]
|
||||
softdepend: [Multiverse-Core]
|
||||
author: NLThijs48
|
||||
website: http://dev.bukkit.org/bukkit-plugins/regionbuyandrent/
|
||||
commands:
|
||||
AreaShop:
|
||||
description: For all commands use /as help
|
||||
usage: /AreaShop or /AS
|
||||
permission: areashop.help
|
||||
permission-message: You don't have <permission>
|
||||
aliases: [as]
|
||||
permissions:
|
||||
areashop.*:
|
||||
description: Give access to all commands of AreaShop
|
||||
children:
|
||||
areashop.help: true
|
||||
areashop.createrent: true
|
||||
areashop.createbuy: true
|
||||
areashop.destroyrent: true
|
||||
areashop.destroybuy: true
|
||||
areashop.rent: true
|
||||
areashop.buy: true
|
||||
areashop.unrent: true
|
||||
areashop.info: true
|
||||
areashop.updaterents: true
|
||||
areashop.updatebuys: true
|
||||
areashop.reload: true
|
||||
areashop.setrestore: true
|
||||
areashop.setprice: true
|
||||
areashop.setduration: true
|
||||
areashop.teleport: true
|
||||
areashop.teleportall: true
|
||||
areashop.setteleportall: true
|
||||
areashop.teleportsign: true
|
||||
areashop.teleportsignall: true
|
||||
areashop.tabcomplete: true
|
||||
areashop.setteleportoutsideregion: true
|
||||
areashop.find: true
|
||||
areashop.groupadd: true
|
||||
areashop.groupdel: true
|
||||
areashop.grouplist: true
|
||||
areashop.groupinfo: true
|
||||
areashop.limitbypass: true
|
||||
areashop.schematicevents: true
|
||||
areashop.addsign: true
|
||||
areashop.delsign: true
|
||||
areashop.renttimebypass: true
|
||||
areashop.me: true
|
||||
areashop.resellall: true
|
||||
areashop.stopresellall: true
|
||||
areashop.addfriendall: true
|
||||
areashop.delfriendall: true
|
||||
areashop.help:
|
||||
description: Allows you to see the help pages
|
||||
default: true
|
||||
areashop.rent:
|
||||
description: Allows you to rent a region
|
||||
default: true
|
||||
areashop.buy:
|
||||
description: Allows you to buy a region
|
||||
default: true
|
||||
areashop.unrent:
|
||||
description: Allows you to unrent a specific region
|
||||
default: op
|
||||
areashop.unrentown:
|
||||
description: Allows you to unrent your own region
|
||||
default: true
|
||||
areashop.sell:
|
||||
description: Allows you to sell a specific region
|
||||
default: op
|
||||
areashop.sellown:
|
||||
description: Allows you to sell your own region
|
||||
default: true
|
||||
areashop.createrent:
|
||||
description: Allows you to set up signs for renting regions
|
||||
default: op
|
||||
areashop.createbuy:
|
||||
description: Allows you to set up signs for buying regions
|
||||
default: op
|
||||
areashop.destroyrent:
|
||||
description: Allows you to break signs used for renting regions
|
||||
default: op
|
||||
areashop.destroybuy:
|
||||
description: Allows you to break signs used for renting regions
|
||||
default: op
|
||||
areashop.info:
|
||||
description: Allows you check the status of regions and players
|
||||
default: true
|
||||
areashop.updaterents:
|
||||
description: Allows you to update all rent signs and regions
|
||||
default: op
|
||||
areashop.updatebuys:
|
||||
description: Allows you to update all buy signs and regions
|
||||
default: op
|
||||
areashop.reload:
|
||||
description: Allows you to reload the config
|
||||
default: op
|
||||
areashop.setrestore:
|
||||
description: Allows you to change the restore settings
|
||||
default: op
|
||||
areashop.setprice:
|
||||
description: Allows you to change the price
|
||||
default: op
|
||||
areashop.setduration:
|
||||
description: Allows you to change the duration of a rent
|
||||
default: op
|
||||
areashop.teleport:
|
||||
description: Teleport to your region
|
||||
default: true
|
||||
areashop.teleportall:
|
||||
description: Teleport to all regions
|
||||
default: op
|
||||
areashop.teleportsign:
|
||||
description: Teleport to signs of regions you own
|
||||
default: true
|
||||
areashop.teleportsignall:
|
||||
description: Teleport to signs of all regions
|
||||
default: op
|
||||
areashop.teleportfriend:
|
||||
description: Teleport to regions where you are added as friend
|
||||
default: true
|
||||
areashop.teleportfriendsign:
|
||||
description: Teleport to the sign of regions where you are added as friend
|
||||
default: true
|
||||
areashop.setteleport:
|
||||
description: Set the teleport spot for your region
|
||||
default: true
|
||||
areashop.setteleportall:
|
||||
description: Set the teleport for other regions
|
||||
default: op
|
||||
areashop.setteleportoutsideregion:
|
||||
description: Set the teleport location outside the WorldGuard region
|
||||
default: op
|
||||
areashop.tabcomplete:
|
||||
description: Allows you to tabcomplete all commands (also where you dont have permission)
|
||||
default: op
|
||||
areashop.find:
|
||||
description: Allows you to teleport to a free region (/as find)
|
||||
default: true
|
||||
areashop.groupadd:
|
||||
description: Allows you to add regions to groups
|
||||
default: op
|
||||
areashop.groupdel:
|
||||
description: Allows you to delete regions from groups
|
||||
default: op
|
||||
areashop.grouplist:
|
||||
description: Allows you to list all the groups currently created
|
||||
default: op
|
||||
areashop.groupinfo:
|
||||
description: Allows you to display information about a group (all members)
|
||||
default: op
|
||||
areashop.rentextendbypass:
|
||||
description: Bypass the extend limit on rents
|
||||
default: op
|
||||
areashop.limits.default:
|
||||
description: Assign limits as set in the 'default' group in the 'limitGroups' section of the config
|
||||
default: not op
|
||||
areashop.limitbypass:
|
||||
description: Bypass the limits for renting/buying regions (how many you can have at the same time)
|
||||
default: op
|
||||
areashop.schematicevents:
|
||||
description: Allows you to trigger schematic events for regions
|
||||
default: op
|
||||
areashop.addsign:
|
||||
description: Allows you to add signs to existing regions
|
||||
default: op
|
||||
areashop.delsign:
|
||||
description: Allows you to delete signs from existing regions
|
||||
default: op
|
||||
areashop.renttimebypass:
|
||||
description: Bypass the maximum rent time you can have in advance
|
||||
default: op
|
||||
areashop.me:
|
||||
description: Allows you to get information about your regions
|
||||
default: true
|
||||
areashop.setownerrent:
|
||||
description: Allows you to set the owner of rent regions
|
||||
default: op
|
||||
areashop.setownerbuy:
|
||||
description: Allows you to set the owner of buy regions
|
||||
default: op
|
||||
areashop.resell:
|
||||
description: Allows you to set your region to sell mode for selling to other players
|
||||
default: true
|
||||
areashop.resellall:
|
||||
description: Allows you to set any region into selling mode
|
||||
default: op
|
||||
areashop.stopresell:
|
||||
description: Allows you to set your region into normal mode if it is in sell mode
|
||||
default: true
|
||||
areashop.stopresellall:
|
||||
description: Allows you to set any region into normal mode if it is in sell mode
|
||||
default: op
|
||||
areashop.addfriend:
|
||||
description: Allows you to add friends to your regions
|
||||
default: true
|
||||
areashop.addfriendall:
|
||||
description: Allows you to add friends to all regions
|
||||
default: op
|
||||
areashop.delfriend:
|
||||
description: Allows you to delete friends from your regions
|
||||
default: true
|
||||
areashop.delfriendall:
|
||||
description: Allows you to delete friends from all regions
|
||||
default: op
|
||||
|
||||
@@ -0,0 +1,506 @@
|
||||
package nl.evolutioncoding.areashop;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.ArrayList;
|
||||
import java.util.UUID;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import net.milkbowl.vault.economy.Economy;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.permissions.Permission;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
|
||||
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
||||
|
||||
/**
|
||||
* Main class for the AreaShop plugin
|
||||
* @author NLThijs48
|
||||
*/
|
||||
public final class AreaShop extends JavaPlugin {
|
||||
/* General variables */
|
||||
private static AreaShop instance = null;
|
||||
|
||||
private WorldGuardPlugin worldGuard = null;
|
||||
private WorldEditPlugin worldEdit = null;
|
||||
private Economy economy = null;
|
||||
private FileManager fileManager = null;
|
||||
private LanguageManager languageManager = null;
|
||||
private CommandManager commandManager = null;
|
||||
private boolean debug = false;
|
||||
private String chatprefix = null;
|
||||
|
||||
/* Folders and file names */
|
||||
public static final String languageFolder = "lang";
|
||||
public static final String schematicFolder = "schem";
|
||||
public static final String schematicExtension = ".schematic";
|
||||
public static final String regionsFolder = "regions";
|
||||
public static final String groupsFile = "groups.yml";
|
||||
public static final String defaultFile = "default.yml";
|
||||
public static final String configFile = "config.yml";
|
||||
public static final String versionFile = "versions";
|
||||
|
||||
/* Euro tag for in the config */
|
||||
public static final String currencyEuro = "%euro%";
|
||||
|
||||
/* Constants for handling file versions */
|
||||
public static final String versionFiles = "files";
|
||||
public static final int versionFilesCurrent = 2;
|
||||
|
||||
/* Keys for replacing parts of flags */
|
||||
public static final String tagPlayerName = "%player%";
|
||||
public static final String tagPlayerUUID = "%uuid%";
|
||||
public static final String tagWorldName = "%world%";
|
||||
public static final String tagRegionName = "%region%";
|
||||
public static final String tagRegionType = "%type%";
|
||||
public static final String tagPrice = "%price%";
|
||||
public static final String tagDuration = "%duration%";
|
||||
public static final String tagRentedUntil = "%until%";
|
||||
public static final String tagRentedUntilShort = "%untilshort%";
|
||||
public static final String tagWidth = "%width%"; // x-axis
|
||||
public static final String tagHeight = "%height%"; // y-axis
|
||||
public static final String tagDepth = "%depth%"; // z-axis
|
||||
public static final String tagTimeLeft = "%timeleft%";
|
||||
public static final String tagClicker = "%clicker%";
|
||||
public static final String tagResellPrice = "%resellprice%";
|
||||
public static final String tagFriends = "%friends%";
|
||||
public static final String tagFriendsUUID = "%friendsuuid%";
|
||||
public static final String tagMoneyBackPercentage = "%moneybackpercent%";
|
||||
public static final String tagMoneyBackAmount = "%moneyback%";
|
||||
public static final String tagMaxExtends = "%maxextends%";
|
||||
public static final String tagExtendsLeft = "%extendsleft%";
|
||||
public static final String tagMaxRentTime = "%maxrenttime%";
|
||||
public static final String tagMaxInactiveTime = "%inactivetime%";
|
||||
|
||||
public static AreaShop getInstance() {
|
||||
return AreaShop.instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called on start or reload of the server
|
||||
*/
|
||||
public void onEnable() {
|
||||
AreaShop.instance = this;
|
||||
boolean error = false;
|
||||
|
||||
/* Check if WorldGuard is present */
|
||||
Plugin plugin = getServer().getPluginManager().getPlugin("WorldGuard");
|
||||
if (plugin == null || !(plugin instanceof WorldGuardPlugin)) {
|
||||
this.getLogger().severe("WorldGuard plugin is not present or has not loaded correctly");
|
||||
error = true;
|
||||
} else {
|
||||
worldGuard = (WorldGuardPlugin)plugin;
|
||||
}
|
||||
|
||||
/* Check if WorldEdit is present */
|
||||
plugin = getServer().getPluginManager().getPlugin("WorldEdit");
|
||||
if (plugin == null || !(plugin instanceof WorldEditPlugin)) {
|
||||
this.getLogger().severe("WorldEdit plugin is not present or has not loaded correctly");
|
||||
error = true;
|
||||
} else {
|
||||
worldEdit = (WorldEditPlugin)plugin;
|
||||
}
|
||||
|
||||
/* Check if Vault is present */
|
||||
RegisteredServiceProvider<Economy> economyProvider = getServer().getServicesManager().getRegistration(net.milkbowl.vault.economy.Economy.class);
|
||||
if (economyProvider == null) {
|
||||
this.getLogger().severe("Vault plugin is not present or has not loaded correctly");
|
||||
error = true;
|
||||
} else {
|
||||
economy = economyProvider.getProvider();
|
||||
}
|
||||
|
||||
/* Load all data from files and check versions */
|
||||
fileManager = new FileManager(this);
|
||||
error = error & !fileManager.loadFiles();
|
||||
|
||||
// Set the debug and chatprefix variables
|
||||
debug = this.getConfig().getBoolean("debug");
|
||||
chatprefix = this.getConfig().getString("chatPrefix");
|
||||
|
||||
/* Create a LanguageMananager */
|
||||
languageManager = new LanguageManager(this);
|
||||
|
||||
if(error) {
|
||||
this.getLogger().severe("The plugin has not started, fix the errors listed above");
|
||||
} else {
|
||||
// Register the event listeners
|
||||
this.getServer().getPluginManager().registerEvents(new SignChangeListener(this), this);
|
||||
this.getServer().getPluginManager().registerEvents(new SignBreakListener(this), this);
|
||||
this.getServer().getPluginManager().registerEvents(new SignClickListener(this), this);
|
||||
this.getServer().getPluginManager().registerEvents(new PlayerLoginListener(this), this);
|
||||
|
||||
setupTasks();
|
||||
|
||||
// Startup the CommandManager (registers itself for the command)
|
||||
commandManager = new CommandManager(this);
|
||||
|
||||
// Enable Metrics if config allows it
|
||||
if(this.getConfig().getBoolean("sendStats")) {
|
||||
this.startMetrics();
|
||||
}
|
||||
|
||||
// Register dynamic permission (things declared in config)
|
||||
registerDynamicPermissions();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called on shutdown or reload of the server
|
||||
*/
|
||||
public void onDisable() {
|
||||
fileManager.saveRequiredFilesAtOnce();
|
||||
Bukkit.getServer().getScheduler().cancelTasks(this);
|
||||
|
||||
/* set variables to null to prevent memory leaks */
|
||||
worldGuard = null;
|
||||
worldEdit = null;
|
||||
economy = null;
|
||||
fileManager = null;
|
||||
languageManager = null;
|
||||
commandManager = null;
|
||||
chatprefix = null;
|
||||
debug = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to get the WorldGuard plugin
|
||||
* @return WorldGuardPlugin
|
||||
*/
|
||||
public WorldGuardPlugin getWorldGuard() {
|
||||
return worldGuard;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to get the WorldEdit plugin
|
||||
* @return WorldEditPlugin
|
||||
*/
|
||||
public WorldEditPlugin getWorldEdit() {
|
||||
return worldEdit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to get the LanguageManager
|
||||
* @return the LanguageManager
|
||||
*/
|
||||
public LanguageManager getLanguageManager() {
|
||||
return languageManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to get the CommandManager
|
||||
* @return the CommandManager
|
||||
*/
|
||||
public CommandManager getCommandManager() {
|
||||
return commandManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to get the Vault plugin
|
||||
* @return Economy
|
||||
*/
|
||||
public Economy getEconomy() {
|
||||
return economy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current chatPrefix
|
||||
* @return
|
||||
*/
|
||||
public String getChatPrefix() {
|
||||
return chatprefix;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to get the FileManager (loads/save regions and can be used to get regions)
|
||||
* @return The fileManager
|
||||
*/
|
||||
public FileManager getFileManager() {
|
||||
return fileManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register dynamic permissions controlled by config settings
|
||||
*/
|
||||
public void registerDynamicPermissions() {
|
||||
// Register limit groups of amount of regions a player can have
|
||||
for(String group : getConfig().getConfigurationSection("limitGroups").getKeys(false)) {
|
||||
if(!"default".equals(group)) {
|
||||
Permission perm = new Permission("areashop.limits." + group);
|
||||
Bukkit.getPluginManager().addPermission(perm);
|
||||
}
|
||||
}
|
||||
Bukkit.getPluginManager().recalculatePermissionDefaults(Bukkit.getPluginManager().getPermission("playerwarps.limits"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Register all required tasks
|
||||
*/
|
||||
public void setupTasks() {
|
||||
// Rent expiration timer
|
||||
int expirationCheck = this.getConfig().getInt("expiration.delay")*20;
|
||||
final AreaShop finalPlugin = this;
|
||||
if(expirationCheck > 0) {
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
finalPlugin.getFileManager().checkRents();
|
||||
AreaShop.debug("Checking rent expirations...");
|
||||
}
|
||||
}.runTaskTimer(this, expirationCheck, expirationCheck);
|
||||
}
|
||||
// Inactive unrenting/selling timer
|
||||
int inactiveCheck = this.getConfig().getInt("inactive.delay")*60*20;
|
||||
if(inactiveCheck > 0) {
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
finalPlugin.getFileManager().checkForInactiveRegions();
|
||||
AreaShop.debug("Checking for regions with players that are inactive too long...");
|
||||
}
|
||||
}.runTaskTimer(this, inactiveCheck, inactiveCheck);
|
||||
}
|
||||
// Periodic updating of signs for timeleft tags
|
||||
int periodicUpdate = this.getConfig().getInt("signs.delay")*20;
|
||||
if(periodicUpdate > 0) {
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
finalPlugin.getFileManager().performPeriodicSignUpdate();
|
||||
AreaShop.debug("Performing periodic sign update...");
|
||||
}
|
||||
}.runTaskTimer(this, periodicUpdate, periodicUpdate);
|
||||
}
|
||||
// Saving regions and group settings
|
||||
int saveFiles = this.getConfig().getInt("saving.delay")*20*60;
|
||||
if(saveFiles > 0) {
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
finalPlugin.getFileManager().saveRequiredFiles();
|
||||
AreaShop.debug("Saving required files...");
|
||||
}
|
||||
}.runTaskTimer(this, saveFiles, saveFiles);
|
||||
}
|
||||
// Sending warnings about rent regions to online players
|
||||
int expireWarning = this.getConfig().getInt("expireWarning.delay")*20*60;
|
||||
if(expireWarning > 0) {
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
finalPlugin.getFileManager().sendRentExpireWarnings();
|
||||
AreaShop.debug("Sending rent expire warnings...");
|
||||
}
|
||||
}.runTaskTimer(this, expireWarning, expireWarning);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to send a message to a CommandSender, using chatprefix if it is a player
|
||||
* @param target The CommandSender you wan't to send the message to (e.g. a player)
|
||||
* @param key The key to get the translation
|
||||
* @param prefix Specify if the message should have a prefix
|
||||
* @param params The parameters to inject into the message string
|
||||
*/
|
||||
public void configurableMessage(Object target, String key, boolean prefix, Object... params) {
|
||||
String langString = this.fixColors(languageManager.getLang(key, params));
|
||||
if(langString == null || langString.equals("")) {
|
||||
// Do nothing, message is not available or disabled
|
||||
} else {
|
||||
if(target instanceof Player) {
|
||||
if(prefix) {
|
||||
((Player)target).sendMessage(this.fixColors(chatprefix) + langString);
|
||||
} else {
|
||||
((Player)target).sendMessage(langString);
|
||||
}
|
||||
} else if(target instanceof CommandSender) {
|
||||
if(!getConfig().getBoolean("useColorsInConsole")) {
|
||||
langString = ChatColor.stripColor(langString);
|
||||
}
|
||||
((CommandSender)target).sendMessage(langString);
|
||||
}
|
||||
else if(target instanceof Logger) {
|
||||
if(!getConfig().getBoolean("useColorsInConsole")) {
|
||||
langString = ChatColor.stripColor(langString);
|
||||
}
|
||||
((Logger)target).info(langString);
|
||||
} else {
|
||||
langString = ChatColor.stripColor(langString);
|
||||
this.getLogger().info("Could not send message, target is wrong: " + langString);
|
||||
}
|
||||
}
|
||||
}
|
||||
public void messageNoPrefix(Object target, String key, Object... params) {
|
||||
configurableMessage(target, key, false, params);
|
||||
}
|
||||
public void message(Object target, String key, Object... params) {
|
||||
configurableMessage(target, key, true, params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert color and formatting codes to bukkit values
|
||||
* @param input Start string with color and formatting codes in it
|
||||
* @return String with the color and formatting codes in the bukkit format
|
||||
*/
|
||||
public String fixColors(String input) {
|
||||
String result = null;
|
||||
if(input != null) {
|
||||
result = ChatColor.translateAlternateColorCodes('&', input);
|
||||
result = result.replaceAll("€", "\u20AC");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Format the currency amount with the characters before and after
|
||||
* @return Currency character format string
|
||||
* @param amount Amount of money to format
|
||||
*/
|
||||
public String formatCurrency(double amount) {
|
||||
String before = this.getConfig().getString("moneyCharacter");
|
||||
before = before.replace(currencyEuro, "\u20ac");
|
||||
String after = this.getConfig().getString("moneyCharacterAfter");
|
||||
after = after.replace(currencyEuro, "\u20ac");
|
||||
BigDecimal bigDecimal = new BigDecimal(amount);
|
||||
bigDecimal = bigDecimal.setScale(getConfig().getInt("fractionalNumbers"), RoundingMode.HALF_UP);
|
||||
amount = bigDecimal.doubleValue();
|
||||
if(getConfig().getBoolean("hideEmptyFractionalPart") && (amount%1.0) == 0.0) {
|
||||
return before + ((int)amount) + after;
|
||||
} else {
|
||||
return before + bigDecimal.toString() + after;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Function for quitting the plugin, NOT USED ATM
|
||||
*/
|
||||
public void quit() {
|
||||
this.getLogger().info("Plugin will be stopped");
|
||||
Bukkit.getPluginManager().disablePlugin(this);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the config configured by the user or the default
|
||||
*/
|
||||
@Override
|
||||
public YamlConfiguration getConfig() {
|
||||
return fileManager.getConfig();
|
||||
}
|
||||
|
||||
/**
|
||||
* Start the Metrics stats collection
|
||||
*/
|
||||
private void startMetrics() {
|
||||
try {
|
||||
Metrics metrics = new Metrics(this);
|
||||
metrics.start();
|
||||
} catch (Exception e) {
|
||||
AreaShop.debug("Could not start Metrics");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the string is a correct time period
|
||||
* @param time String that has to be checked
|
||||
* @return true if format is correct, false if not
|
||||
*/
|
||||
public boolean checkTimeFormat(String time) {
|
||||
/* Check if the string is not empty and check the length */
|
||||
if(time == null || time.length() <= 1 || time.indexOf(' ') == -1 || time.indexOf(' ') >= (time.length()-1)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Check if the suffix is one of these values */
|
||||
String suffix = time.substring(time.indexOf(' ')+1, time.length());
|
||||
ArrayList<String> identifiers = new ArrayList<String>();
|
||||
identifiers.addAll(this.getConfig().getStringList("minutes"));
|
||||
identifiers.addAll(this.getConfig().getStringList("hours"));
|
||||
identifiers.addAll(this.getConfig().getStringList("days"));
|
||||
identifiers.addAll(this.getConfig().getStringList("months"));
|
||||
identifiers.addAll(this.getConfig().getStringList("years"));
|
||||
if(!identifiers.contains(suffix)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* check if the part before the space is a number */
|
||||
String prefix = time.substring(0, (time.indexOf(' ')));
|
||||
return prefix.matches("\\d+");
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends an debug message to the console
|
||||
* @param message The message that should be printed to the console
|
||||
*/
|
||||
public static void debug(String message) {
|
||||
if(AreaShop.getInstance().debug) {
|
||||
AreaShop.getInstance().getLogger().info("Debug: " + message);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reload all files of the plugin
|
||||
*/
|
||||
public void reload() {
|
||||
fileManager.saveRequiredFilesAtOnce();
|
||||
chatprefix = this.getConfig().getString("chatPrefix");
|
||||
debug = this.getConfig().getBoolean("debug");
|
||||
languageManager = new LanguageManager(this);
|
||||
fileManager.loadFiles();
|
||||
fileManager.checkRents();
|
||||
}
|
||||
|
||||
/**
|
||||
* Conversion to name by uuid
|
||||
* @param uuid The uuid in string format
|
||||
* @return the name of the player
|
||||
*/
|
||||
public String toName(String uuid) {
|
||||
if(uuid == null) {
|
||||
return null;
|
||||
} else {
|
||||
return this.toName(UUID.fromString(uuid));
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Conversion to name by uuid object
|
||||
* @param uuid The uuid in string format
|
||||
* @return the name of the player
|
||||
*/
|
||||
public String toName(UUID uuid) {
|
||||
if(uuid == null) {
|
||||
return null;
|
||||
} else {
|
||||
return Bukkit.getOfflinePlayer(uuid).getName();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Conversion from name to uuid
|
||||
* @param name The name of the player
|
||||
* @return The uuid of the player
|
||||
*/
|
||||
@SuppressWarnings("deprecation") // Fake deprecation by Bukkit to inform developers, method will stay
|
||||
public String toUUID(String name) {
|
||||
if(name == null) {
|
||||
return null;
|
||||
} else {
|
||||
return Bukkit.getOfflinePlayer(name).getUniqueId().toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,202 @@
|
||||
package nl.evolutioncoding.areashop;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.SortedSet;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import nl.evolutioncoding.areashop.commands.AddCommand;
|
||||
import nl.evolutioncoding.areashop.commands.AddfriendCommand;
|
||||
import nl.evolutioncoding.areashop.commands.AddsignCommand;
|
||||
import nl.evolutioncoding.areashop.commands.BuyCommand;
|
||||
import nl.evolutioncoding.areashop.commands.CommandAreaShop;
|
||||
import nl.evolutioncoding.areashop.commands.DelCommand;
|
||||
import nl.evolutioncoding.areashop.commands.DelfriendCommand;
|
||||
import nl.evolutioncoding.areashop.commands.DelsignCommand;
|
||||
import nl.evolutioncoding.areashop.commands.FindCommand;
|
||||
import nl.evolutioncoding.areashop.commands.GroupaddCommand;
|
||||
import nl.evolutioncoding.areashop.commands.GroupdelCommand;
|
||||
import nl.evolutioncoding.areashop.commands.GroupinfoCommand;
|
||||
import nl.evolutioncoding.areashop.commands.GrouplistCommand;
|
||||
import nl.evolutioncoding.areashop.commands.HelpCommand;
|
||||
import nl.evolutioncoding.areashop.commands.InfoCommand;
|
||||
import nl.evolutioncoding.areashop.commands.MeCommand;
|
||||
import nl.evolutioncoding.areashop.commands.ReloadCommand;
|
||||
import nl.evolutioncoding.areashop.commands.RentCommand;
|
||||
import nl.evolutioncoding.areashop.commands.ResellCommand;
|
||||
import nl.evolutioncoding.areashop.commands.SchematiceventCommand;
|
||||
import nl.evolutioncoding.areashop.commands.SellCommand;
|
||||
import nl.evolutioncoding.areashop.commands.SetdurationCommand;
|
||||
import nl.evolutioncoding.areashop.commands.SetownerCommand;
|
||||
import nl.evolutioncoding.areashop.commands.SetpriceCommand;
|
||||
import nl.evolutioncoding.areashop.commands.SetrestoreCommand;
|
||||
import nl.evolutioncoding.areashop.commands.SetteleportCommand;
|
||||
import nl.evolutioncoding.areashop.commands.StopresellCommand;
|
||||
import nl.evolutioncoding.areashop.commands.TeleportCommand;
|
||||
import nl.evolutioncoding.areashop.commands.UnrentCommand;
|
||||
import nl.evolutioncoding.areashop.commands.UpdatebuysCommand;
|
||||
import nl.evolutioncoding.areashop.commands.UpdaterentsCommand;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabCompleter;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class CommandManager implements CommandExecutor, TabCompleter {
|
||||
AreaShop plugin;
|
||||
ArrayList<CommandAreaShop> commands;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param plugin The AreaShop plugin
|
||||
*/
|
||||
public CommandManager(AreaShop plugin) {
|
||||
this.plugin = plugin;
|
||||
commands = new ArrayList<CommandAreaShop>();
|
||||
commands.add(new HelpCommand(plugin));
|
||||
commands.add(new RentCommand(plugin));
|
||||
commands.add(new UnrentCommand(plugin));
|
||||
commands.add(new BuyCommand(plugin));
|
||||
commands.add(new SellCommand(plugin));
|
||||
commands.add(new MeCommand(plugin));
|
||||
commands.add(new InfoCommand(plugin));
|
||||
commands.add(new TeleportCommand(plugin));
|
||||
commands.add(new SetteleportCommand(plugin));
|
||||
commands.add(new AddfriendCommand(plugin));
|
||||
commands.add(new DelfriendCommand(plugin));
|
||||
commands.add(new FindCommand(plugin));
|
||||
commands.add(new ResellCommand(plugin));
|
||||
commands.add(new StopresellCommand(plugin));
|
||||
commands.add(new UpdaterentsCommand(plugin));
|
||||
commands.add(new UpdatebuysCommand(plugin));
|
||||
commands.add(new SetrestoreCommand(plugin));
|
||||
commands.add(new SetpriceCommand(plugin));
|
||||
commands.add(new SetownerCommand(plugin));
|
||||
commands.add(new SetdurationCommand(plugin));
|
||||
commands.add(new ReloadCommand(plugin));
|
||||
commands.add(new GroupaddCommand(plugin));
|
||||
commands.add(new GroupdelCommand(plugin));
|
||||
commands.add(new GrouplistCommand(plugin));
|
||||
commands.add(new GroupinfoCommand(plugin));
|
||||
commands.add(new SchematiceventCommand(plugin));
|
||||
commands.add(new AddCommand(plugin));
|
||||
commands.add(new DelCommand(plugin));
|
||||
commands.add(new AddsignCommand(plugin));
|
||||
commands.add(new DelsignCommand(plugin));
|
||||
|
||||
/* Register commands in bukkit */
|
||||
plugin.getCommand("AreaShop").setExecutor(this);
|
||||
plugin.getCommand("AreaShop").setTabCompleter(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the list with AreaShop commands
|
||||
* @return The list with AreaShop commands
|
||||
*/
|
||||
public ArrayList<CommandAreaShop> getCommands() {
|
||||
return commands;
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the help page for the CommandSender
|
||||
* @param target The CommandSender to show the help to
|
||||
*/
|
||||
public void showHelp(CommandSender target) {
|
||||
/* Add all messages to a list */
|
||||
ArrayList<String> messages = new ArrayList<String>();
|
||||
messages.add(plugin.getConfig().getString("chatPrefix") + plugin.getLanguageManager().getLang("help-header"));
|
||||
messages.add(plugin.getConfig().getString("chatPrefix") + plugin.getLanguageManager().getLang("help-alias"));
|
||||
for(CommandAreaShop command : commands) {
|
||||
String help = command.getHelp(target);
|
||||
if(help != null && help.length() != 0) {
|
||||
messages.add(help);
|
||||
}
|
||||
}
|
||||
|
||||
/* Send the messages to the target */
|
||||
for(String message : messages) {
|
||||
if(!plugin.getConfig().getBoolean("useColorsInConsole") && !(target instanceof Player)) {
|
||||
target.sendMessage(ChatColor.stripColor(plugin.fixColors(message)));
|
||||
} else {
|
||||
target.sendMessage(plugin.fixColors(message));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String alias, String[] args) {
|
||||
boolean executed = false;
|
||||
for(int i=0; i<commands.size() && !executed; i++) {
|
||||
if(commands.get(i).canExecute(command, args)) {
|
||||
commands.get(i).execute(sender, command, args);
|
||||
executed = true;
|
||||
}
|
||||
}
|
||||
if(!executed && args.length == 0) {
|
||||
this.showHelp(sender);
|
||||
} else if(!executed && args.length > 0) {
|
||||
plugin.message(sender, "cmd-notValid");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
||||
List<String> result = new ArrayList<String>();
|
||||
if(!sender.hasPermission("areashop.tabcomplete")) {
|
||||
return result;
|
||||
}
|
||||
int toCompleteNumber = args.length;
|
||||
String toCompletePrefix = args[args.length-1].toLowerCase();
|
||||
AreaShop.debug("toCompleteNumber=" + toCompleteNumber + ", toCompletePrefix=" + toCompletePrefix + ", length=" + toCompletePrefix.length());
|
||||
if(toCompleteNumber == 1) {
|
||||
for(CommandAreaShop c : commands) {
|
||||
String begin = c.getCommandStart();
|
||||
result.add(begin.substring(begin.indexOf(' ') +1));
|
||||
}
|
||||
} else {
|
||||
String[] start = new String[args.length];
|
||||
start[0] = command.getName();
|
||||
for(int i=1; i<args.length; i++) {
|
||||
start[i] = args[i-1];
|
||||
}
|
||||
for(CommandAreaShop c : commands) {
|
||||
if(c.canExecute(command, args)) {
|
||||
result = c.getTabCompleteList(toCompleteNumber, start);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Filter and sort the results
|
||||
if(result.size() > 0) {
|
||||
SortedSet<String> set = new TreeSet<String>();
|
||||
for(String suggestion : result) {
|
||||
if(suggestion.toLowerCase().startsWith(toCompletePrefix)) {
|
||||
set.add(suggestion);
|
||||
}
|
||||
}
|
||||
result.clear();
|
||||
result.addAll(set);
|
||||
}
|
||||
AreaShop.debug("Tabcomplete #" + toCompleteNumber + ", prefix="+ toCompletePrefix + ", result=" + result.toString());
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
+52
-28
@@ -1,19 +1,26 @@
|
||||
package nl.evolutioncoding.AreaShop;
|
||||
package nl.evolutioncoding.areashop;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStream;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import nl.evolutioncoding.areashop.regions.GeneralRegion;
|
||||
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import com.google.common.base.Charsets;
|
||||
|
||||
public class LanguageManager {
|
||||
private AreaShop plugin = null;
|
||||
private String languages[] = {"EN", "NL"};
|
||||
private String languages[] = {"EN", "NL", "FR", "DE", "PL"};
|
||||
private HashMap<String, String> currentLanguage, defaultLanguage;
|
||||
|
||||
/**
|
||||
@@ -36,7 +43,7 @@ public class LanguageManager {
|
||||
public void saveDefaults() {
|
||||
/* Create the language folder if it not exists */
|
||||
File langFolder;
|
||||
langFolder = new File(plugin.getDataFolder() + File.separator + plugin.languageFolder);
|
||||
langFolder = new File(plugin.getDataFolder() + File.separator + AreaShop.languageFolder);
|
||||
if(!langFolder.exists()) {
|
||||
langFolder.mkdirs();
|
||||
}
|
||||
@@ -47,11 +54,11 @@ public class LanguageManager {
|
||||
/* file name as the default */
|
||||
File langFile;
|
||||
for(int i=0; i<languages.length; i++) {
|
||||
langFile = new File(plugin.getDataFolder() + File.separator + plugin.languageFolder + File.separator + languages[i] + ".yml");
|
||||
langFile = new File(plugin.getDataFolder() + File.separator + AreaShop.languageFolder + File.separator + languages[i] + ".yml");
|
||||
InputStream input = null;
|
||||
OutputStream output = null;
|
||||
try {
|
||||
input = plugin.getResource(plugin.languageFolder + "/" + languages[i] + ".yml");
|
||||
input = plugin.getResource(AreaShop.languageFolder + "/" + languages[i] + ".yml");
|
||||
output = new FileOutputStream(langFile);
|
||||
|
||||
int read = 0;
|
||||
@@ -67,7 +74,7 @@ public class LanguageManager {
|
||||
output.close();
|
||||
} catch (IOException e1) {} catch (NullPointerException e2) {}
|
||||
|
||||
plugin.getLogger().info("Something went wrong saving a default language file: " + langFile.getPath());
|
||||
plugin.getLogger().warning("Something went wrong saving a default language file: " + langFile.getPath());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,30 +90,39 @@ public class LanguageManager {
|
||||
|
||||
/* Save the current language file to the HashMap */
|
||||
currentLanguage = new HashMap<String, String>();
|
||||
File file = new File(plugin.getDataFolder() + File.separator + plugin.languageFolder + File.separator + plugin.config().getString("language") + ".yml");
|
||||
ymlFile = YamlConfiguration.loadConfiguration(file);
|
||||
map = ymlFile.getValues(true);
|
||||
set = map.keySet();
|
||||
File file = new File(plugin.getDataFolder() + File.separator + AreaShop.languageFolder + File.separator + plugin.getConfig().getString("language") + ".yml");
|
||||
InputStreamReader reader = null;
|
||||
try {
|
||||
for(String key : set) {
|
||||
currentLanguage.put(key, (String)map.get(key));
|
||||
}
|
||||
} catch(ClassCastException e) {}
|
||||
reader = new InputStreamReader(new FileInputStream(file), Charsets.UTF_8);
|
||||
} catch (FileNotFoundException e1) {}
|
||||
if(reader != null) {
|
||||
ymlFile = YamlConfiguration.loadConfiguration(reader);
|
||||
map = ymlFile.getValues(true);
|
||||
set = map.keySet();
|
||||
try {
|
||||
for(String key : set) {
|
||||
currentLanguage.put(key, (String)map.get(key));
|
||||
}
|
||||
} catch(ClassCastException e) {}
|
||||
}
|
||||
|
||||
/* Save the default strings to the HashMap */
|
||||
defaultLanguage = new HashMap<String, String>();
|
||||
InputStream defConfigStream = plugin.getResource(plugin.languageFolder + "/" + plugin.config().getString("language") + ".yml");
|
||||
if (defConfigStream == null) {
|
||||
defConfigStream = plugin.getResource(plugin.languageFolder + "/" + languages[0]+ ".yml");
|
||||
}
|
||||
ymlFile = YamlConfiguration.loadConfiguration(defConfigStream);
|
||||
map = ymlFile.getValues(true);
|
||||
set = map.keySet();
|
||||
File standard = new File(plugin.getDataFolder() + File.separator + AreaShop.languageFolder + "/" + languages[0]+ ".yml");
|
||||
InputStreamReader reader2 = null;
|
||||
try {
|
||||
for(String key : set) {
|
||||
defaultLanguage.put(key, (String)map.get(key));
|
||||
}
|
||||
} catch(ClassCastException e) {}
|
||||
reader2 = new InputStreamReader(new FileInputStream(standard), Charsets.UTF_8);
|
||||
} catch (FileNotFoundException e1) {}
|
||||
if(reader2 != null) {
|
||||
ymlFile = YamlConfiguration.loadConfiguration(reader2);
|
||||
map = ymlFile.getValues(true);
|
||||
set = map.keySet();
|
||||
try {
|
||||
for(String key : set) {
|
||||
defaultLanguage.put(key, (String)map.get(key));
|
||||
}
|
||||
} catch(ClassCastException e) {}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -126,11 +142,19 @@ public class LanguageManager {
|
||||
}
|
||||
|
||||
if(result == null) {
|
||||
plugin.getLogger().info("Wrong key for getting translation: " + key);
|
||||
plugin.getLogger().info("Wrong key for getting translation: " + key + ", please contact the author about this");
|
||||
} else {
|
||||
/* Replace all tags, e.g. %1% */
|
||||
/* Replace all tags like %0% and if given a GeneralRegion apply all replacements */
|
||||
int number=0;
|
||||
for (int i=0; i<params.length; i++) {
|
||||
result = result.replace("%" + i + "%", params[i].toString());
|
||||
if(params[i] != null) {
|
||||
if(params[i] instanceof GeneralRegion) {
|
||||
result = ((GeneralRegion)params[i]).applyAllReplacements(result);
|
||||
} else {
|
||||
result = result.replace("%" + number + "%", params[i].toString());
|
||||
number++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,759 @@
|
||||
/*
|
||||
* Copyright 2011-2013 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.
|
||||
*/
|
||||
package nl.evolutioncoding.areashop;
|
||||
|
||||
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;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStream;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.Proxy;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.logging.Level;
|
||||
import java.util.zip.GZIPOutputStream;
|
||||
|
||||
public class Metrics {
|
||||
|
||||
/**
|
||||
* The current revision number
|
||||
*/
|
||||
private final static int REVISION = 7;
|
||||
|
||||
/**
|
||||
* The base url of the metrics domain
|
||||
*/
|
||||
private static final String BASE_URL = "http://report.mcstats.org";
|
||||
|
||||
/**
|
||||
* The url used to report a server's status
|
||||
*/
|
||||
private static final String REPORT_URL = "/plugin/%s";
|
||||
|
||||
/**
|
||||
* Interval of time to ping (in minutes)
|
||||
*/
|
||||
private static final int PING_INTERVAL = 15;
|
||||
|
||||
/**
|
||||
* 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 plugin configuration file
|
||||
*/
|
||||
private final YamlConfiguration configuration;
|
||||
|
||||
/**
|
||||
* The plugin configuration file
|
||||
*/
|
||||
private final File configurationFile;
|
||||
|
||||
/**
|
||||
* Unique server id
|
||||
*/
|
||||
private final String guid;
|
||||
|
||||
/**
|
||||
* Debug mode
|
||||
*/
|
||||
private final boolean debug;
|
||||
|
||||
/**
|
||||
* Lock for synchronization
|
||||
*/
|
||||
private final Object optOutLock = new Object();
|
||||
|
||||
/**
|
||||
* The scheduled task
|
||||
*/
|
||||
private volatile BukkitTask task = null;
|
||||
|
||||
public Metrics(final Plugin plugin) throws IOException {
|
||||
if (plugin == null) {
|
||||
throw new IllegalArgumentException("Plugin cannot be null");
|
||||
}
|
||||
|
||||
this.plugin = plugin;
|
||||
|
||||
// load the config
|
||||
configurationFile = getConfigFile();
|
||||
configuration = YamlConfiguration.loadConfiguration(configurationFile);
|
||||
|
||||
// add some defaults
|
||||
configuration.addDefault("opt-out", false);
|
||||
configuration.addDefault("guid", UUID.randomUUID().toString());
|
||||
configuration.addDefault("debug", false);
|
||||
|
||||
// Do we need to create the file?
|
||||
if (configuration.get("guid", null) == null) {
|
||||
configuration.options().header("http://mcstats.org").copyDefaults(true);
|
||||
configuration.save(configurationFile);
|
||||
}
|
||||
|
||||
// Load the guid then
|
||||
guid = configuration.getString("guid");
|
||||
debug = configuration.getBoolean("debug", false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 The name of the graph
|
||||
* @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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a Graph object to BukkitMetrics that represents data for the plugin that should be sent to the backend
|
||||
*
|
||||
* @param graph The name of the graph
|
||||
*/
|
||||
public void addGraph(final Graph graph) {
|
||||
if (graph == null) {
|
||||
throw new IllegalArgumentException("Graph cannot be null");
|
||||
}
|
||||
|
||||
graphs.add(graph);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @return True if statistics measuring is running, otherwise false.
|
||||
*/
|
||||
public boolean start() {
|
||||
synchronized (optOutLock) {
|
||||
// Did we opt out?
|
||||
if (isOptOut()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Is metrics already running?
|
||||
if (task != null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Begin hitting the server with glorious data
|
||||
task = plugin.getServer().getScheduler().runTaskTimerAsynchronously(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() && task != null) {
|
||||
task.cancel();
|
||||
task = null;
|
||||
// Tell all plotters to stop gathering information.
|
||||
for (Graph graph : graphs) {
|
||||
graph.onOptOut();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 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) {
|
||||
if (debug) {
|
||||
Bukkit.getLogger().log(Level.INFO, "[Metrics] " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}, 0, PING_INTERVAL * 1200);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Has the server owner denied plugin metrics?
|
||||
*
|
||||
* @return true if metrics should be opted out of it
|
||||
*/
|
||||
public boolean isOptOut() {
|
||||
synchronized (optOutLock) {
|
||||
try {
|
||||
// Reload the metrics file
|
||||
configuration.load(getConfigFile());
|
||||
} catch (IOException ex) {
|
||||
if (debug) {
|
||||
Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.getMessage());
|
||||
}
|
||||
return true;
|
||||
} catch (InvalidConfigurationException ex) {
|
||||
if (debug) {
|
||||
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 java.io.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 (task == null) {
|
||||
start();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Disables metrics for the server by setting "opt-out" to true in the config file and canceling the metrics task.
|
||||
*
|
||||
* @throws java.io.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);
|
||||
configuration.save(configurationFile);
|
||||
}
|
||||
|
||||
// Disable Task, if it is running
|
||||
if (task != null) {
|
||||
task.cancel();
|
||||
task = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the File object of the config file that should be used to store data such as the GUID and opt-out status
|
||||
*
|
||||
* @return the File object for the config file
|
||||
*/
|
||||
public File getConfigFile() {
|
||||
// I believe the easiest way to get the base folder (e.g craftbukkit set via -P) for plugins to use
|
||||
// is to abuse the plugin object we already have
|
||||
// plugin.getDataFolder() => base/plugins/PluginA/
|
||||
// pluginsFolder => base/plugins/
|
||||
// The base is not necessarily relative to the startup directory.
|
||||
File pluginsFolder = plugin.getDataFolder().getParentFile();
|
||||
|
||||
// return => base/plugins/PluginMetrics/config.yml
|
||||
return new File(new File(pluginsFolder, "PluginMetrics"), "config.yml");
|
||||
}
|
||||
|
||||
/**
|
||||
* Generic method that posts a plugin to the metrics website
|
||||
*/
|
||||
private void postPlugin(final boolean isPing) throws IOException {
|
||||
// Server software specific section
|
||||
PluginDescriptionFile description = plugin.getDescription();
|
||||
String pluginName = description.getName();
|
||||
boolean onlineMode = Bukkit.getServer().getOnlineMode(); // TRUE if online mode is enabled
|
||||
String pluginVersion = description.getVersion();
|
||||
String serverVersion = Bukkit.getVersion();
|
||||
int playersOnline = Bukkit.getServer().getOnlinePlayers().length;
|
||||
|
||||
// END server software specific section -- all code below does not use any code outside of this class / Java
|
||||
|
||||
// Construct the post data
|
||||
StringBuilder json = new StringBuilder(1024);
|
||||
json.append('{');
|
||||
|
||||
// The plugin's description file containg all of the plugin data such as name, version, author, etc
|
||||
appendJSONPair(json, "guid", guid);
|
||||
appendJSONPair(json, "plugin_version", pluginVersion);
|
||||
appendJSONPair(json, "server_version", serverVersion);
|
||||
appendJSONPair(json, "players_online", Integer.toString(playersOnline));
|
||||
|
||||
// New data as of R6
|
||||
String osname = System.getProperty("os.name");
|
||||
String osarch = System.getProperty("os.arch");
|
||||
String osversion = System.getProperty("os.version");
|
||||
String java_version = System.getProperty("java.version");
|
||||
int coreCount = Runtime.getRuntime().availableProcessors();
|
||||
|
||||
// normalize os arch .. amd64 -> x86_64
|
||||
if (osarch.equals("amd64")) {
|
||||
osarch = "x86_64";
|
||||
}
|
||||
|
||||
appendJSONPair(json, "osname", osname);
|
||||
appendJSONPair(json, "osarch", osarch);
|
||||
appendJSONPair(json, "osversion", osversion);
|
||||
appendJSONPair(json, "cores", Integer.toString(coreCount));
|
||||
appendJSONPair(json, "auth_mode", onlineMode ? "1" : "0");
|
||||
appendJSONPair(json, "java_version", java_version);
|
||||
|
||||
// If we're pinging, append it
|
||||
if (isPing) {
|
||||
appendJSONPair(json, "ping", "1");
|
||||
}
|
||||
|
||||
if (graphs.size() > 0) {
|
||||
synchronized (graphs) {
|
||||
json.append(',');
|
||||
json.append('"');
|
||||
json.append("graphs");
|
||||
json.append('"');
|
||||
json.append(':');
|
||||
json.append('{');
|
||||
|
||||
boolean firstGraph = true;
|
||||
|
||||
final Iterator<Graph> iter = graphs.iterator();
|
||||
|
||||
while (iter.hasNext()) {
|
||||
Graph graph = iter.next();
|
||||
|
||||
StringBuilder graphJson = new StringBuilder();
|
||||
graphJson.append('{');
|
||||
|
||||
for (Plotter plotter : graph.getPlotters()) {
|
||||
appendJSONPair(graphJson, plotter.getColumnName(), Integer.toString(plotter.getValue()));
|
||||
}
|
||||
|
||||
graphJson.append('}');
|
||||
|
||||
if (!firstGraph) {
|
||||
json.append(',');
|
||||
}
|
||||
|
||||
json.append(escapeJSON(graph.getName()));
|
||||
json.append(':');
|
||||
json.append(graphJson);
|
||||
|
||||
firstGraph = false;
|
||||
}
|
||||
|
||||
json.append('}');
|
||||
}
|
||||
}
|
||||
|
||||
// close json
|
||||
json.append('}');
|
||||
|
||||
// Create the url
|
||||
URL url = new URL(BASE_URL + String.format(REPORT_URL, urlEncode(pluginName)));
|
||||
|
||||
// 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();
|
||||
}
|
||||
|
||||
|
||||
byte[] uncompressed = json.toString().getBytes();
|
||||
byte[] compressed = gzip(json.toString());
|
||||
|
||||
// Headers
|
||||
connection.addRequestProperty("User-Agent", "MCStats/" + REVISION);
|
||||
connection.addRequestProperty("Content-Type", "application/json");
|
||||
connection.addRequestProperty("Content-Encoding", "gzip");
|
||||
connection.addRequestProperty("Content-Length", Integer.toString(compressed.length));
|
||||
connection.addRequestProperty("Accept", "application/json");
|
||||
connection.addRequestProperty("Connection", "close");
|
||||
|
||||
connection.setDoOutput(true);
|
||||
|
||||
if (debug) {
|
||||
System.out.println("[Metrics] Prepared request for " + pluginName + " uncompressed=" + uncompressed.length + " compressed=" + compressed.length);
|
||||
}
|
||||
|
||||
// Write the data
|
||||
OutputStream os = connection.getOutputStream();
|
||||
os.write(compressed);
|
||||
os.flush();
|
||||
|
||||
// Now read the response
|
||||
final BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
|
||||
String response = reader.readLine();
|
||||
|
||||
// close resources
|
||||
os.close();
|
||||
reader.close();
|
||||
|
||||
if (response == null || response.startsWith("ERR") || response.startsWith("7")) {
|
||||
if (response == null) {
|
||||
response = "null";
|
||||
} else if (response.startsWith("7")) {
|
||||
response = response.substring(response.startsWith("7,") ? 2 : 1);
|
||||
}
|
||||
|
||||
throw new IOException(response);
|
||||
} else {
|
||||
// Is this the first update this hour?
|
||||
if (response.equals("1") || response.contains("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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* GZip compress a string of bytes
|
||||
*
|
||||
* @param input
|
||||
* @return
|
||||
*/
|
||||
public static byte[] gzip(String input) {
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
GZIPOutputStream gzos = null;
|
||||
|
||||
try {
|
||||
gzos = new GZIPOutputStream(baos);
|
||||
gzos.write(input.getBytes("UTF-8"));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (gzos != null) try {
|
||||
gzos.close();
|
||||
} catch (IOException ignore) {
|
||||
}
|
||||
}
|
||||
|
||||
return baos.toByteArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if mineshafter is present. If it is, we need to bypass it to send POST requests
|
||||
*
|
||||
* @return true if mineshafter is installed on the server
|
||||
*/
|
||||
private boolean isMineshafterPresent() {
|
||||
try {
|
||||
Class.forName("mineshafter.MineServer");
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends a json encoded key/value pair to the given string builder.
|
||||
*
|
||||
* @param json
|
||||
* @param key
|
||||
* @param value
|
||||
* @throws UnsupportedEncodingException
|
||||
*/
|
||||
private static void appendJSONPair(StringBuilder json, String key, String value) throws UnsupportedEncodingException {
|
||||
boolean isValueNumeric = false;
|
||||
|
||||
try {
|
||||
if (value.equals("0") || !value.endsWith("0")) {
|
||||
Double.parseDouble(value);
|
||||
isValueNumeric = true;
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
isValueNumeric = false;
|
||||
}
|
||||
|
||||
if (json.charAt(json.length() - 1) != '{') {
|
||||
json.append(',');
|
||||
}
|
||||
|
||||
json.append(escapeJSON(key));
|
||||
json.append(':');
|
||||
|
||||
if (isValueNumeric) {
|
||||
json.append(value);
|
||||
} else {
|
||||
json.append(escapeJSON(value));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Escape a string to create a valid JSON string
|
||||
*
|
||||
* @param text
|
||||
* @return
|
||||
*/
|
||||
private static String escapeJSON(String text) {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
||||
builder.append('"');
|
||||
for (int index = 0; index < text.length(); index++) {
|
||||
char chr = text.charAt(index);
|
||||
|
||||
switch (chr) {
|
||||
case '"':
|
||||
case '\\':
|
||||
builder.append('\\');
|
||||
builder.append(chr);
|
||||
break;
|
||||
case '\b':
|
||||
builder.append("\\b");
|
||||
break;
|
||||
case '\t':
|
||||
builder.append("\\t");
|
||||
break;
|
||||
case '\n':
|
||||
builder.append("\\n");
|
||||
break;
|
||||
case '\r':
|
||||
builder.append("\\r");
|
||||
break;
|
||||
default:
|
||||
if (chr < ' ') {
|
||||
String t = "000" + Integer.toHexString(chr);
|
||||
builder.append("\\u" + t.substring(t.length() - 4));
|
||||
} else {
|
||||
builder.append(chr);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
builder.append('"');
|
||||
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Encode text as UTF-8
|
||||
*
|
||||
* @param text the text to encode
|
||||
* @return the encoded text, as UTF-8
|
||||
*/
|
||||
private static String urlEncode(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 the Graph's name
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a plotter to the graph, which will be used to plot entries
|
||||
*
|
||||
* @param plotter the plotter to add to the graph
|
||||
*/
|
||||
public void addPlotter(final Plotter plotter) {
|
||||
plotters.add(plotter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a plotter from the graph
|
||||
*
|
||||
* @param plotter the plotter to remove from the graph
|
||||
*/
|
||||
public void removePlotter(final Plotter plotter) {
|
||||
plotters.remove(plotter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an <b>unmodifiable</b> set of the plotter objects in the graph
|
||||
*
|
||||
* @return an unmodifiable {@link java.util.Set} of the plotter objects
|
||||
*/
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the server owner decides to opt-out of BukkitMetrics while the server is running.
|
||||
*/
|
||||
protected void onOptOut() {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 the name of the plotter to use, which will show up on the website
|
||||
*/
|
||||
public Plotter(final String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current value for the plotted point. Since this function defers to an external function it may or may
|
||||
* not return immediately thus cannot be guaranteed to be thread friendly or safe. This function can be called
|
||||
* from any thread so care should be taken when accessing resources that need to be synchronized.
|
||||
*
|
||||
* @return the current value for the point to be plotted.
|
||||
*/
|
||||
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();
|
||||
}
|
||||
|
||||
@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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
package nl.evolutioncoding.areashop;
|
||||
|
||||
import nl.evolutioncoding.areashop.regions.RentRegion;
|
||||
|
||||
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.PlayerLoginEvent;
|
||||
import org.bukkit.event.player.PlayerLoginEvent.Result;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
/**
|
||||
* Checks for placement of signs for this plugin
|
||||
* @author NLThijs48
|
||||
*/
|
||||
public final class PlayerLoginListener implements Listener {
|
||||
AreaShop plugin;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param plugin The AreaShop plugin
|
||||
*/
|
||||
public PlayerLoginListener(AreaShop plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a sign is changed
|
||||
* @param event The event
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onPlayerLogin(PlayerLoginEvent event) {
|
||||
if(event.getResult() != Result.ALLOWED) {
|
||||
return;
|
||||
}
|
||||
Player player = event.getPlayer();
|
||||
|
||||
for(RentRegion region : plugin.getFileManager().getRents()) {
|
||||
if(region.isRenter(player)) {
|
||||
String warningSetting = region.getStringSetting("rent.warningOnLoginTime");
|
||||
if(warningSetting == null || warningSetting.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
long warningTime = region.durationStringToLong(warningSetting);
|
||||
if(region.getTimeLeft() < warningTime) {
|
||||
// Send the warning message later to let it appear after general MOTD messages
|
||||
final Player finalPlayer = player;
|
||||
final AreaShop finalPlugin = plugin;
|
||||
final RentRegion finalRegion = region;
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
finalPlugin.message(finalPlayer, "rent-expireWarning", finalRegion);
|
||||
}
|
||||
}.runTaskLater(plugin, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,146 @@
|
||||
package nl.evolutioncoding.areashop;
|
||||
|
||||
import nl.evolutioncoding.areashop.regions.BuyRegion;
|
||||
import nl.evolutioncoding.areashop.regions.GeneralRegion;
|
||||
import nl.evolutioncoding.areashop.regions.RentRegion;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.Sign;
|
||||
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.BlockPhysicsEvent;
|
||||
|
||||
/**
|
||||
* Checks for placement of signs for this plugin
|
||||
* @author NLThijs48
|
||||
*/
|
||||
public final class SignBreakListener implements Listener {
|
||||
AreaShop plugin;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param plugin The AreaShop plugin
|
||||
*/
|
||||
public SignBreakListener(AreaShop plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Called when a block is broken
|
||||
* @param event The event
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void onSignBreak(BlockBreakEvent event) {
|
||||
if(event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
Block block = event.getBlock();
|
||||
/* Check if it is a sign */
|
||||
if(block.getType() == Material.WALL_SIGN || block.getType() == Material.SIGN_POST) {
|
||||
/* Check if the rent sign is really the same as a saved rent */
|
||||
GeneralRegion region = plugin.getFileManager().getRegionBySignLocation(block.getLocation());
|
||||
if(region == null) {
|
||||
return;
|
||||
}
|
||||
if(region.isRentRegion()) {
|
||||
/* Remove the rent if the player has permission */
|
||||
if(event.getPlayer().hasPermission("areashop.destroyrent")) {
|
||||
plugin.getFileManager().removeRent((RentRegion)region, true);
|
||||
plugin.message(event.getPlayer(), "destroy-successRent", region.getName());
|
||||
} else { /* Cancel the breaking of the sign */
|
||||
event.setCancelled(true);
|
||||
plugin.message(event.getPlayer(), "destroy-noPermissionRent");
|
||||
}
|
||||
} else if(region.isBuyRegion()) {
|
||||
/* Remove the buy if the player has permission */
|
||||
if(event.getPlayer().hasPermission("areashop.destroybuy")) {
|
||||
plugin.getFileManager().removeBuy((BuyRegion)region, true);
|
||||
plugin.message(event.getPlayer(), "destroy-successBuy", region.getName());
|
||||
} else { /* Cancel the breaking of the sign */
|
||||
event.setCancelled(true);
|
||||
plugin.message(event.getPlayer(), "destroy-noPermissionBuy");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the physics of a block change
|
||||
* @param event The event
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onIndirectSignBreak(BlockPhysicsEvent event){
|
||||
Block block = event.getBlock();
|
||||
if(event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
if(block.getType() == Material.SIGN_POST || block.getType() == Material.WALL_SIGN){
|
||||
Sign sign = (Sign)block.getState();
|
||||
Block attachedTo = block.getRelative(((org.bukkit.material.Sign)sign.getData()).getAttachedFace());
|
||||
if(attachedTo.getType() == Material.AIR){
|
||||
/* Check if the rent sign is really the same as a saved rent */
|
||||
GeneralRegion region = plugin.getFileManager().getRegionBySignLocation(block.getLocation());
|
||||
if(region == null) {
|
||||
return;
|
||||
}
|
||||
region.removeSign(block.getLocation());
|
||||
plugin.getLogger().warning("A sign of region " + region.getName() + " has been removed by indirectly breaking it (block below/behind is destroyed)");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,325 @@
|
||||
package nl.evolutioncoding.areashop;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import nl.evolutioncoding.areashop.regions.BuyRegion;
|
||||
import nl.evolutioncoding.areashop.regions.GeneralRegion;
|
||||
import nl.evolutioncoding.areashop.regions.RentRegion;
|
||||
import nl.evolutioncoding.areashop.regions.GeneralRegion.RegionEvent;
|
||||
|
||||
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.SignChangeEvent;
|
||||
import org.bukkit.material.Sign;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import com.sk89q.worldedit.bukkit.selections.CuboidSelection;
|
||||
import com.sk89q.worldguard.protection.ApplicableRegionSet;
|
||||
import com.sk89q.worldguard.protection.managers.RegionManager;
|
||||
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
|
||||
|
||||
/**
|
||||
* Checks for placement of signs for this plugin
|
||||
* @author NLThijs48
|
||||
*/
|
||||
public final class SignChangeListener implements Listener {
|
||||
AreaShop plugin;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param plugin The AreaShop plugin
|
||||
*/
|
||||
public SignChangeListener(AreaShop plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a sign is changed
|
||||
* @param event The event
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onSignChange(SignChangeEvent event) {
|
||||
if(event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
Player player = event.getPlayer();
|
||||
|
||||
// Check if the sign is meant for this plugin
|
||||
if(event.getLine(0).contains(plugin.getConfig().getString("signTags.rent"))) {
|
||||
if(!player.hasPermission("areashop.createrent")) {
|
||||
plugin.message(player, "setup-noPermissionRent");
|
||||
return;
|
||||
}
|
||||
|
||||
// Get the other lines
|
||||
String secondLine = event.getLine(1);
|
||||
String thirdLine = event.getLine(2);
|
||||
String fourthLine = event.getLine(3);
|
||||
|
||||
// Get the regionManager for accessing regions
|
||||
RegionManager regionManager = plugin.getWorldGuard().getRegionManager(event.getPlayer().getWorld());
|
||||
|
||||
// If the secondLine does not contain a name try to find the region by location
|
||||
if(secondLine == null || secondLine.length() == 0) {
|
||||
ApplicableRegionSet regions = regionManager.getApplicableRegions(event.getBlock().getLocation());
|
||||
if(regions != null) {
|
||||
boolean first = true;
|
||||
ProtectedRegion candidate = null;
|
||||
for(ProtectedRegion pr : regions) {
|
||||
if(first) {
|
||||
candidate = pr;
|
||||
first = false;
|
||||
} else {
|
||||
if(pr.getPriority() > candidate.getPriority()) {
|
||||
candidate = pr;
|
||||
} else if(pr.getParent() != null && pr.getParent().equals(candidate)) {
|
||||
candidate = pr;
|
||||
} else {
|
||||
plugin.message(player, "setup-couldNotDetect", candidate.getId(), pr.getId());
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(candidate != null) {
|
||||
secondLine = candidate.getId();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
boolean priceSet = fourthLine != null && fourthLine.length() != 0;
|
||||
boolean durationSet = thirdLine != null && thirdLine.length() != 0;
|
||||
// check if all the lines are correct
|
||||
if(secondLine == null || secondLine.length() == 0) {
|
||||
plugin.message(player, "setup-noRegion");
|
||||
return;
|
||||
} else if(regionManager.getRegion(secondLine) == null) {
|
||||
plugin.message(player, "setup-wrongRegion");
|
||||
return;
|
||||
} else if(plugin.getFileManager().getRent(secondLine) != null) {
|
||||
plugin.message(player, "setup-alreadyRentSign");
|
||||
return;
|
||||
} else if(thirdLine != null && thirdLine.length() != 0 && !plugin.checkTimeFormat(thirdLine)) {
|
||||
plugin.message(player, "setup-wrongDuration");
|
||||
return;
|
||||
} else {
|
||||
double price = 0.0;
|
||||
if(priceSet) {
|
||||
// Check the fourth line
|
||||
try {
|
||||
price = Double.parseDouble(fourthLine);
|
||||
} catch (NumberFormatException e) {
|
||||
plugin.message(player, "setup-wrongPrice");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Add rent to the FileManager
|
||||
final RentRegion rent = new RentRegion(plugin, secondLine, event.getPlayer().getWorld());
|
||||
if(priceSet) {
|
||||
rent.setPrice(price);
|
||||
}
|
||||
if(durationSet) {
|
||||
rent.setDuration(thirdLine);
|
||||
}
|
||||
Sign sign = (Sign)event.getBlock().getState().getData();
|
||||
rent.addSign(event.getBlock().getLocation(), event.getBlock().getType(), sign.getFacing(), null);
|
||||
|
||||
// Run commands
|
||||
rent.runEventCommands(RegionEvent.CREATED, true);
|
||||
|
||||
plugin.getFileManager().addRent(rent);
|
||||
rent.handleSchematicEvent(RegionEvent.CREATED);
|
||||
// Update the sign later because this event will do it first
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
rent.updateSigns();
|
||||
}
|
||||
}.runTaskLater(plugin, 1);
|
||||
|
||||
// Set the flags for the region
|
||||
rent.updateRegionFlags();
|
||||
plugin.message(player, "setup-rentSuccess", rent.getName());
|
||||
// Run commands
|
||||
rent.runEventCommands(RegionEvent.CREATED, false);
|
||||
rent.saveRequired();
|
||||
}
|
||||
} else if (event.getLine(0).contains(plugin.getConfig().getString("signTags.buy"))) {
|
||||
// Check for permission
|
||||
if(!player.hasPermission("areashop.createbuy")) {
|
||||
plugin.message(player, "setup-noPermissionBuy");
|
||||
return;
|
||||
}
|
||||
|
||||
// Get the other lines
|
||||
String secondLine = event.getLine(1);
|
||||
String thirdLine = event.getLine(2);
|
||||
|
||||
// Get the regionManager for accessing regions
|
||||
RegionManager regionManager = plugin.getWorldGuard().getRegionManager(event.getPlayer().getWorld());
|
||||
|
||||
// If the secondLine does not contain a name try to find the region by location
|
||||
if(secondLine == null || secondLine.length() == 0) {
|
||||
ApplicableRegionSet regions = regionManager.getApplicableRegions(event.getBlock().getLocation());
|
||||
if(regions != null) {
|
||||
boolean first = true;
|
||||
ProtectedRegion candidate = null;
|
||||
for(ProtectedRegion pr : regions) {
|
||||
if(first) {
|
||||
candidate = pr;
|
||||
first = false;
|
||||
} else {
|
||||
if(pr.getPriority() > candidate.getPriority()) {
|
||||
candidate = pr;
|
||||
} else if(pr.getParent() != null && pr.getParent().equals(candidate)) {
|
||||
candidate = pr;
|
||||
} else if(pr.getPriority() == candidate.getPriority()) {
|
||||
plugin.message(player, "setup-couldNotDetect", candidate.getId(), pr.getId());
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(candidate != null) {
|
||||
secondLine = candidate.getId();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
boolean priceSet = thirdLine != null && thirdLine.length() != 0;
|
||||
// Check if all the lines are correct
|
||||
if(secondLine == null || secondLine.length() == 0) {
|
||||
plugin.message(player, "setup-noRegion");
|
||||
return;
|
||||
} else if(regionManager.getRegion(secondLine) == null) {
|
||||
plugin.message(player, "setup-wrongRegion");
|
||||
return;
|
||||
} else if(plugin.getFileManager().getBuy(secondLine) != null) {
|
||||
plugin.message(player, "setup-alreadyBuySign");
|
||||
return;
|
||||
} else {
|
||||
double price = 0.0;
|
||||
if(priceSet) {
|
||||
// Check the fourth line
|
||||
try {
|
||||
price = Double.parseDouble(thirdLine);
|
||||
} catch (NumberFormatException e) {
|
||||
plugin.message(player, "setup-wrongPrice");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Add buy to the FileManager
|
||||
final BuyRegion buy = new BuyRegion(plugin, secondLine, event.getPlayer().getWorld());
|
||||
if(priceSet) {
|
||||
buy.setPrice(price);
|
||||
}
|
||||
Sign sign = (Sign)event.getBlock().getState().getData();
|
||||
buy.addSign(event.getBlock().getLocation(), event.getBlock().getType(), sign.getFacing(), null);
|
||||
// Run commands
|
||||
buy.runEventCommands(RegionEvent.CREATED, true);
|
||||
|
||||
plugin.getFileManager().addBuy(buy);
|
||||
buy.handleSchematicEvent(RegionEvent.CREATED);
|
||||
// Update the sign later because this event will do it first
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
buy.updateSigns();
|
||||
}
|
||||
}.runTaskLater(plugin, 1);
|
||||
|
||||
// Set the flags for the region
|
||||
buy.updateRegionFlags();
|
||||
plugin.message(player, "setup-buySuccess", regionManager.getRegion(secondLine).getId());
|
||||
|
||||
// Run commands
|
||||
buy.runEventCommands(RegionEvent.CREATED, false);
|
||||
buy.saveRequired();
|
||||
}
|
||||
} else if(event.getLine(0).contains(plugin.getConfig().getString("signTags.add"))) {
|
||||
// Check for permission
|
||||
if(!player.hasPermission("areashop.addsign")) {
|
||||
plugin.message(player, "addsign-noPermission");
|
||||
return;
|
||||
}
|
||||
|
||||
// Get the other lines
|
||||
String secondLine = event.getLine(1);
|
||||
String thirdLine = event.getLine(2);
|
||||
|
||||
GeneralRegion region = null;
|
||||
if(secondLine != null && secondLine.length() != 0) {
|
||||
// Get region by secondLine of the sign
|
||||
region = plugin.getFileManager().getRegion(secondLine);
|
||||
if(region == null) {
|
||||
plugin.message(player, "addsign-noRegion", secondLine);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
// Get region by sign position
|
||||
List<GeneralRegion> regions = plugin.getFileManager().getASRegionsInSelection(new CuboidSelection(event.getBlock().getWorld(), event.getBlock().getLocation(), event.getBlock().getLocation()));
|
||||
if(regions.isEmpty()) {
|
||||
plugin.message(player, "addsign-noRegions");
|
||||
return;
|
||||
} else if(regions.size() > 1) {
|
||||
plugin.message(player, "addsign-couldNotDetectSign", regions.get(0).getName(), regions.get(1).getName());
|
||||
return;
|
||||
}
|
||||
region = regions.get(0);
|
||||
}
|
||||
Sign sign = (Sign)event.getBlock().getState().getData();
|
||||
if(thirdLine == null || thirdLine.length() == 0) {
|
||||
region.addSign(event.getBlock().getLocation(), event.getBlock().getType(), sign.getFacing(), null);
|
||||
plugin.message(player, "addsign-success", region.getName());
|
||||
} else {
|
||||
region.addSign(event.getBlock().getLocation(), event.getBlock().getType(), sign.getFacing(), thirdLine);
|
||||
plugin.message(player, "addsign-successProfile", region.getName(), thirdLine);
|
||||
}
|
||||
region.saveRequired();
|
||||
|
||||
// Update the sign later because this event will do it first
|
||||
final GeneralRegion regionUpdate = region;
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
regionUpdate.updateSigns();
|
||||
}
|
||||
}.runTaskLater(plugin, 1);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
package nl.evolutioncoding.areashop;
|
||||
|
||||
import nl.evolutioncoding.areashop.regions.GeneralRegion;
|
||||
import nl.evolutioncoding.areashop.regions.GeneralRegion.ClickType;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
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.player.PlayerInteractEvent;
|
||||
|
||||
public class SignClickListener implements Listener {
|
||||
AreaShop plugin;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param plugin The AreaShop plugin
|
||||
*/
|
||||
public SignClickListener(AreaShop plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a player interacts
|
||||
* @param event The event
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void onSignClick(PlayerInteractEvent event) {
|
||||
Block block = event.getClickedBlock();
|
||||
/* Check for clicking a sign and rightclicking */
|
||||
if( (event.getAction() == Action.RIGHT_CLICK_BLOCK || event.getAction() == Action.LEFT_CLICK_BLOCK)
|
||||
&& (block.getType() == Material.SIGN_POST || block.getType() == Material.WALL_SIGN)) {
|
||||
/* Check if the rent sign is really the same as a saved rent */
|
||||
GeneralRegion result = plugin.getFileManager().getRegionBySignLocation(block.getLocation());
|
||||
if(result == null) {
|
||||
return;
|
||||
}
|
||||
String signName = result.getSignName(block.getLocation());
|
||||
Player player = event.getPlayer();
|
||||
// Get the clicktype
|
||||
ClickType clickType = null;
|
||||
if(player.isSneaking() && event.getAction() == Action.LEFT_CLICK_BLOCK) {
|
||||
clickType = ClickType.SHIFTLEFTCLICK;
|
||||
} else if(!player.isSneaking() && event.getAction() == Action.LEFT_CLICK_BLOCK) {
|
||||
clickType = ClickType.LEFTCLICK;
|
||||
} else if(player.isSneaking() && event.getAction() == Action.RIGHT_CLICK_BLOCK) {
|
||||
clickType = ClickType.SHIFTRIGHTCLICK;
|
||||
} else if(!player.isSneaking() && event.getAction() == Action.RIGHT_CLICK_BLOCK) {
|
||||
clickType = ClickType.RIGHTCLICK;
|
||||
}
|
||||
// Run the commands
|
||||
boolean runned = result.runSignCommands(signName, player, clickType);
|
||||
// Only cancel event if at least one command has been executed
|
||||
event.setCancelled(runned);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
package nl.evolutioncoding.areashop;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
public class Utils {
|
||||
|
||||
// Not used
|
||||
private Utils() {}
|
||||
|
||||
|
||||
/**
|
||||
* Create a map from a location, to save it in the config
|
||||
* @param location The location to transform
|
||||
* @return The map with the location values
|
||||
*/
|
||||
public static ConfigurationSection locationToConfig(Location location, boolean setPitchYaw) {
|
||||
if(location == null) {
|
||||
return null;
|
||||
}
|
||||
ConfigurationSection result = new YamlConfiguration();
|
||||
result.set("world", location.getWorld().getName());
|
||||
result.set("x", location.getX());
|
||||
result.set("y", location.getY());
|
||||
result.set("z", location.getZ());
|
||||
if(setPitchYaw) {
|
||||
result.set("yaw", Float.toString(location.getYaw()));
|
||||
result.set("pitch", Float.toString(location.getPitch()));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
public static ConfigurationSection locationToConfig(Location location) {
|
||||
return locationToConfig(location, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a location from a map, reconstruction from the config values
|
||||
* @param map The map to reconstruct from
|
||||
* @return The location
|
||||
*/
|
||||
public static Location configToLocation(ConfigurationSection config) {
|
||||
if(config == null
|
||||
|| !config.isString("world")
|
||||
|| !config.isDouble("x")
|
||||
|| !config.isDouble("y")
|
||||
|| !config.isDouble("z")) {
|
||||
return null;
|
||||
}
|
||||
Location result = new Location(
|
||||
Bukkit.getWorld(config.getString("world")),
|
||||
(Double)config.getDouble("x"),
|
||||
(Double)config.getDouble("y"),
|
||||
(Double)config.getDouble("z"));
|
||||
if(config.isString("yaw") && config.isString("pitch")) {
|
||||
result.setPitch(Float.parseFloat(config.getString("pitch")));
|
||||
result.setYaw(Float.parseFloat(config.getString("yaw")));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static String createCommaSeparatedList(Collection<? extends Object> input) {
|
||||
String result = "";
|
||||
boolean first = true;
|
||||
for(Object object : input) {
|
||||
if(first) {
|
||||
first = false;
|
||||
result += object.toString();
|
||||
} else {
|
||||
result += ", " + object.toString();
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,171 @@
|
||||
package nl.evolutioncoding.areashop.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import nl.evolutioncoding.areashop.AreaShop;
|
||||
import nl.evolutioncoding.areashop.Utils;
|
||||
import nl.evolutioncoding.areashop.regions.BuyRegion;
|
||||
import nl.evolutioncoding.areashop.regions.GeneralRegion;
|
||||
import nl.evolutioncoding.areashop.regions.RentRegion;
|
||||
import nl.evolutioncoding.areashop.regions.GeneralRegion.RegionEvent;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.sk89q.worldedit.bukkit.selections.Selection;
|
||||
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
|
||||
|
||||
public class AddCommand extends CommandAreaShop {
|
||||
|
||||
public AddCommand(AreaShop plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandStart() {
|
||||
return "areashop add";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHelp(CommandSender target) {
|
||||
if(target.hasPermission("areashop.createrent") || target.hasPermission("areashop.createbuy")) {
|
||||
return plugin.getLanguageManager().getLang("help-add");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, Command command, String[] args) {
|
||||
if(!sender.hasPermission("areashop.createrent") && !sender.hasPermission("areashop.createbuy")) {
|
||||
plugin.message(sender, "add-noPermission");
|
||||
return;
|
||||
}
|
||||
|
||||
if(args.length < 2 || args[1] == null || (!"rent".equals(args[1].toLowerCase()) && !"buy".equals(args[1].toLowerCase()))) {
|
||||
plugin.message(sender, "add-help");
|
||||
return;
|
||||
}
|
||||
boolean isRent = "rent".equals(args[1].toLowerCase());
|
||||
if((isRent && !sender.hasPermission("areashop.createrent")) || (!isRent && !sender.hasPermission("areashop.createbuy"))) {
|
||||
plugin.message(sender, "add-noPermission");
|
||||
return;
|
||||
}
|
||||
List<ProtectedRegion> regions = new ArrayList<ProtectedRegion>();
|
||||
World world = null;
|
||||
if(args.length == 2) {
|
||||
if(!(sender instanceof Player)) {
|
||||
plugin.message(sender, "cmd-weOnlyByPlayer");
|
||||
return;
|
||||
}
|
||||
Player player = (Player)sender;
|
||||
Selection selection = plugin.getWorldEdit().getSelection(player);
|
||||
if(selection == null) {
|
||||
plugin.message(player, "cmd-noSelection");
|
||||
return;
|
||||
}
|
||||
world = selection.getWorld();
|
||||
regions = plugin.getFileManager().getWERegionsInSelection(selection);
|
||||
if(regions.size() == 0) {
|
||||
plugin.message(player, "cmd-noWERegionsFound");
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if(sender instanceof Player) {
|
||||
if(args.length == 4) {
|
||||
world = Bukkit.getWorld(args[3]);
|
||||
if(world == null) {
|
||||
plugin.message(sender, "add-incorrectWorld", args[3]);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
world = ((Player)sender).getWorld();
|
||||
}
|
||||
} else {
|
||||
if(args.length < 4) {
|
||||
plugin.message(sender, "add-specifyWorld");
|
||||
return;
|
||||
} else {
|
||||
world = Bukkit.getWorld(args[3]);
|
||||
if(world == null) {
|
||||
plugin.message(sender, "add-incorrectWorld", args[3]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
ProtectedRegion region = plugin.getWorldGuard().getRegionManager(world).getRegion(args[2]);
|
||||
if(region == null) {
|
||||
plugin.message(sender, "add-noRegion", args[2]);
|
||||
return;
|
||||
}
|
||||
regions.add(region);
|
||||
}
|
||||
|
||||
ArrayList<String> namesSuccess = new ArrayList<String>();
|
||||
ArrayList<String> namesFailed = new ArrayList<String>();
|
||||
for(ProtectedRegion region : regions) {
|
||||
GeneralRegion asRegion = plugin.getFileManager().getRegion(region.getId());
|
||||
if(asRegion != null) {
|
||||
namesFailed.add(region.getId());
|
||||
} else {
|
||||
namesSuccess.add(region.getId());
|
||||
if(isRent) {
|
||||
RentRegion rent = new RentRegion(plugin, region.getId(), world);
|
||||
// Run commands
|
||||
rent.runEventCommands(RegionEvent.CREATED, true);
|
||||
plugin.getFileManager().addRent(rent);
|
||||
rent.handleSchematicEvent(RegionEvent.CREATED);
|
||||
// Set the flags for the region
|
||||
rent.updateRegionFlags();
|
||||
// Run commands
|
||||
rent.runEventCommands(RegionEvent.CREATED, false);
|
||||
rent.saveRequired();
|
||||
} else {
|
||||
BuyRegion buy = new BuyRegion(plugin, region.getId(), world);
|
||||
// Run commands
|
||||
buy.runEventCommands(RegionEvent.CREATED, true);
|
||||
|
||||
plugin.getFileManager().addBuy(buy);
|
||||
buy.handleSchematicEvent(RegionEvent.CREATED);
|
||||
// Set the flags for the region
|
||||
buy.updateRegionFlags();
|
||||
// Run commands
|
||||
buy.runEventCommands(RegionEvent.CREATED, false);
|
||||
buy.saveRequired();
|
||||
}
|
||||
}
|
||||
}
|
||||
if(namesSuccess.size() != 0) {
|
||||
plugin.message(sender, "add-success", args[1], Utils.createCommaSeparatedList(namesSuccess));
|
||||
}
|
||||
if(namesFailed.size() != 0) {
|
||||
plugin.message(sender, "add-failed", Utils.createCommaSeparatedList(namesFailed));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getTabCompleteList(int toComplete, String[] start) {
|
||||
List<String> result = new ArrayList<String>();
|
||||
if(toComplete == 2) {
|
||||
result.add("rent");
|
||||
result.add("buy");
|
||||
} else if(toComplete == 3) {
|
||||
// can't get the world so also can't get applicable regions
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,142 @@
|
||||
package nl.evolutioncoding.areashop.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import nl.evolutioncoding.areashop.AreaShop;
|
||||
import nl.evolutioncoding.areashop.regions.BuyRegion;
|
||||
import nl.evolutioncoding.areashop.regions.GeneralRegion;
|
||||
import nl.evolutioncoding.areashop.regions.RentRegion;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class AddfriendCommand extends CommandAreaShop {
|
||||
|
||||
public AddfriendCommand(AreaShop plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandStart() {
|
||||
return "areashop addfriend";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHelp(CommandSender target) {
|
||||
if(target.hasPermission("areashop.addfriendall")) {
|
||||
return plugin.getLanguageManager().getLang("help-addFriendAll");
|
||||
} else if(target.hasPermission("areashop.addfriend")) {
|
||||
return plugin.getLanguageManager().getLang("help-addFriend");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public void execute(CommandSender sender, Command command, String[] args) {
|
||||
if(!sender.hasPermission("areashop.addfriend") && !sender.hasPermission("areashop.addfriendall")) {
|
||||
plugin.message(sender, "addfriend-noPermission");
|
||||
return;
|
||||
}
|
||||
|
||||
if(args.length < 2) {
|
||||
plugin.message(sender, "addfriend-help");
|
||||
return;
|
||||
}
|
||||
|
||||
GeneralRegion region = null;
|
||||
if(args.length <= 2) {
|
||||
if (sender instanceof Player) {
|
||||
// get the region by location
|
||||
List<GeneralRegion> regions = plugin.getFileManager().getAllApplicableRegions(((Player) sender).getLocation());
|
||||
if (regions.isEmpty()) {
|
||||
plugin.message(sender, "cmd-noRegionsAtLocation");
|
||||
return;
|
||||
} else if (regions.size() > 1) {
|
||||
plugin.message(sender, "cmd-moreRegionsAtLocation");
|
||||
return;
|
||||
} else {
|
||||
region = regions.get(0);
|
||||
}
|
||||
} else {
|
||||
plugin.message(sender, "cmd-automaticRegionOnlyByPlayer");
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
region = plugin.getFileManager().getRegion(args[2]);
|
||||
if(region == null) {
|
||||
plugin.message(sender, "cmd-notRegistered", args[2]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if(sender.hasPermission("areashop.addfriendall")) {
|
||||
if((region.isRentRegion() && !((RentRegion)region).isRented())
|
||||
|| (region.isBuyRegion() && !((BuyRegion)region).isSold())) {
|
||||
plugin.message(sender, "addfriend-noOwner");
|
||||
return;
|
||||
}
|
||||
OfflinePlayer friend = Bukkit.getOfflinePlayer(args[1]);
|
||||
if(region.getFriends().contains(friend.getUniqueId())) {
|
||||
plugin.message(sender, "addfriend-alreadyAdded", friend.getName());
|
||||
return;
|
||||
}
|
||||
if(region.isOwner(friend.getUniqueId())) {
|
||||
plugin.message(sender, "addfriend-self", friend.getName());
|
||||
return;
|
||||
}
|
||||
region.addFriend(friend.getUniqueId());
|
||||
region.saveRequired();
|
||||
region.updateRegionFlags();
|
||||
region.updateSigns();
|
||||
plugin.message(sender, "addfriend-successOther", friend.getName(), region.getName());
|
||||
} else {
|
||||
if(sender.hasPermission("areashop.addfriend") && sender instanceof Player) {
|
||||
if(region.isOwner((Player)sender)) {
|
||||
OfflinePlayer friend = Bukkit.getOfflinePlayer(args[1]);
|
||||
if(region.getFriends().contains(friend.getUniqueId())) {
|
||||
plugin.message(sender, "addfriend-alreadyAdded", friend.getName());
|
||||
return;
|
||||
}
|
||||
if(region.isOwner(friend.getUniqueId())) {
|
||||
plugin.message(sender, "addfriend-self", friend.getName());
|
||||
return;
|
||||
}
|
||||
region.addFriend(friend.getUniqueId());
|
||||
region.saveRequired();
|
||||
region.updateRegionFlags();
|
||||
region.updateSigns();
|
||||
plugin.message(sender, "addfriend-success", friend.getName(), region.getName());
|
||||
} else {
|
||||
plugin.message(sender, "addfriend-noPermissionOther");
|
||||
}
|
||||
} else {
|
||||
plugin.message(sender, "addfriend-noPermission");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getTabCompleteList(int toComplete, String[] start) {
|
||||
ArrayList<String> result = new ArrayList<String>();
|
||||
if(toComplete == 2) {
|
||||
for(Player player : Bukkit.getOnlinePlayers()) {
|
||||
result.add(player.getName());
|
||||
}
|
||||
} else if(toComplete == 3) {
|
||||
result.addAll(plugin.getFileManager().getRegionNames());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,133 @@
|
||||
package nl.evolutioncoding.areashop.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import nl.evolutioncoding.areashop.AreaShop;
|
||||
import nl.evolutioncoding.areashop.Utils;
|
||||
import nl.evolutioncoding.areashop.regions.GeneralRegion;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.material.Sign;
|
||||
import org.bukkit.util.BlockIterator;
|
||||
|
||||
import com.sk89q.worldedit.bukkit.selections.CuboidSelection;
|
||||
|
||||
public class AddsignCommand extends CommandAreaShop {
|
||||
|
||||
public AddsignCommand(AreaShop plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandStart() {
|
||||
return "areashop addsign";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHelp(CommandSender target) {
|
||||
if(target.hasPermission("areashop.addsign")) {
|
||||
return plugin.getLanguageManager().getLang("help-addsign");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, Command command, String[] args) {
|
||||
if(!sender.hasPermission("areashop.addsign")) {
|
||||
plugin.message(sender, "addsign-noPermission");
|
||||
return;
|
||||
}
|
||||
if (!(sender instanceof Player)) {
|
||||
plugin.message(sender, "cmd-onlyByPlayer");
|
||||
return;
|
||||
}
|
||||
Player player = (Player)sender;
|
||||
|
||||
// Get the sign
|
||||
Block block = null;
|
||||
BlockIterator blockIterator = new BlockIterator(player, 100);
|
||||
while(blockIterator.hasNext() && block == null) {
|
||||
Block next = blockIterator.next();
|
||||
if(next.getType() != Material.AIR) {
|
||||
block = next;
|
||||
}
|
||||
}
|
||||
if(block == null || !(block.getType() == Material.WALL_SIGN || block.getType() == Material.SIGN_POST)) {
|
||||
plugin.message(sender, "addsign-noSign");
|
||||
return;
|
||||
}
|
||||
|
||||
GeneralRegion region = null;
|
||||
if(args.length > 1) {
|
||||
// Get region by argument
|
||||
region = plugin.getFileManager().getRegion(args[1]);
|
||||
if(region == null) {
|
||||
plugin.message(sender, "addsign-noRegion", args[1]);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
// Get region by sign position
|
||||
List<GeneralRegion> regions = plugin.getFileManager().getASRegionsInSelection(new CuboidSelection(block.getWorld(), block.getLocation(), block.getLocation()));
|
||||
if(regions.isEmpty()) {
|
||||
plugin.message(sender, "addsign-noRegions");
|
||||
return;
|
||||
} else if(regions.size() > 1) {
|
||||
plugin.message(sender, "addsign-couldNotDetect", regions.get(0).getName(), regions.get(1).getName());
|
||||
return;
|
||||
}
|
||||
region = regions.get(0);
|
||||
}
|
||||
Sign sign = (Sign)block.getState().getData();
|
||||
String profile = null;
|
||||
if(args.length > 2) {
|
||||
profile = args[2];
|
||||
Set<String> profiles = plugin.getConfig().getConfigurationSection("signProfiles").getKeys(false);
|
||||
if(!profiles.contains(profile)) {
|
||||
plugin.message(sender, "addsign-wrongProfile", Utils.createCommaSeparatedList(profiles));
|
||||
return;
|
||||
}
|
||||
}
|
||||
GeneralRegion signRegion = plugin.getFileManager().getRegionBySignLocation(block.getLocation());
|
||||
if(signRegion != null) {
|
||||
plugin.message(sender, "addsign-alreadyRegistered", signRegion.getName());
|
||||
return;
|
||||
}
|
||||
|
||||
region.addSign(block.getLocation(), block.getType(), sign.getFacing(), profile);
|
||||
if(profile == null) {
|
||||
plugin.message(sender, "addsign-success", region.getName());
|
||||
} else {
|
||||
plugin.message(sender, "addsign-successProfile", region.getName(), profile);
|
||||
}
|
||||
region.updateSigns();
|
||||
region.saveRequired();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getTabCompleteList(int toComplete, String[] start) {
|
||||
List<String> result = new ArrayList<String>();
|
||||
if(toComplete == 2) {
|
||||
result.addAll(plugin.getFileManager().getRegionNames());
|
||||
} else if(toComplete == 3) {
|
||||
result.addAll(plugin.getConfig().getStringList("signProfiles"));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
package nl.evolutioncoding.areashop.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import nl.evolutioncoding.areashop.AreaShop;
|
||||
import nl.evolutioncoding.areashop.regions.BuyRegion;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class BuyCommand extends CommandAreaShop {
|
||||
|
||||
public BuyCommand(AreaShop plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandStart() {
|
||||
return "areashop buy";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHelp(CommandSender target) {
|
||||
if(target.hasPermission("areashop.buy")) {
|
||||
return plugin.getLanguageManager().getLang("help-buy");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, Command command, String[] args) {
|
||||
if(!sender.hasPermission("areashop.buy")) {
|
||||
plugin.message(sender, "buy-noPermission");
|
||||
return;
|
||||
}
|
||||
if (!(sender instanceof Player)) {
|
||||
plugin.message(sender, "cmd-onlyByPlayer");
|
||||
return;
|
||||
}
|
||||
Player player = (Player)sender;
|
||||
if(args.length > 1 && args[1] != null) {
|
||||
BuyRegion region = plugin.getFileManager().getBuy(args[1]);
|
||||
if(region == null) {
|
||||
plugin.message(player, "buy-notBuyable");
|
||||
} else {
|
||||
region.buy(player);
|
||||
}
|
||||
} else {
|
||||
// get the region by location
|
||||
List<BuyRegion> regions = plugin.getFileManager().getApplicableBuyRegions(((Player) sender).getLocation());
|
||||
if (regions.isEmpty()) {
|
||||
plugin.message(sender, "cmd-noRegionsAtLocation");
|
||||
return;
|
||||
} else if (regions.size() > 1) {
|
||||
plugin.message(sender, "cmd-moreRegionsAtLocation");
|
||||
return;
|
||||
} else {
|
||||
regions.get(0).buy(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getTabCompleteList(int toComplete, String[] start) {
|
||||
ArrayList<String> result = new ArrayList<String>();
|
||||
if(toComplete == 2) {
|
||||
for(BuyRegion region : plugin.getFileManager().getBuys()) {
|
||||
if(!region.isSold()) {
|
||||
result.add(region.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package nl.evolutioncoding.areashop.commands;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import nl.evolutioncoding.areashop.AreaShop;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
/**
|
||||
* Abstract class for generalising command classes
|
||||
*/
|
||||
public abstract class CommandAreaShop {
|
||||
AreaShop plugin;
|
||||
|
||||
/**
|
||||
* Save the instance of the main plugin class
|
||||
* @param plugin The main plugin
|
||||
*/
|
||||
public CommandAreaShop(AreaShop plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
public boolean canExecute(Command command, String[] args) {
|
||||
String commandString = command.getName();
|
||||
for(String argument : args) {
|
||||
commandString += " " + argument;
|
||||
}
|
||||
if(commandString.length() > getCommandStart().length()) {
|
||||
return commandString.toLowerCase().startsWith(getCommandStart().toLowerCase() + " ");
|
||||
}
|
||||
return commandString.toLowerCase().startsWith(getCommandStart().toLowerCase());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of string to complete a command with (raw list, not matching ones not filtered out)
|
||||
* @param toComplete The number of the argument that has to be completed
|
||||
* @param start The already given start of the command
|
||||
* @return A collection with all the possibilities for argument to complete
|
||||
*/
|
||||
public abstract List<String> getTabCompleteList(int toComplete, String[] start);
|
||||
|
||||
/**
|
||||
* Get the argument that comes after the base command that this command reacts to
|
||||
* @return
|
||||
*/
|
||||
public abstract String getCommandStart();
|
||||
|
||||
/**
|
||||
* Returns the correct help string for the reciever
|
||||
* @param target The CommandSender that the help message is for
|
||||
* @return The help message according to the permissions of the reciever
|
||||
*/
|
||||
public abstract String getHelp(CommandSender target);
|
||||
|
||||
/**
|
||||
* Execute a (sub)command if the conditions are met
|
||||
* @param sender The commandSender that executed the command
|
||||
* @param commandAreaShop The command that has been executed
|
||||
* @param args The arguments that are given
|
||||
*/
|
||||
public abstract void execute(CommandSender sender, Command command, String[] args);
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
package nl.evolutioncoding.areashop.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import nl.evolutioncoding.areashop.AreaShop;
|
||||
import nl.evolutioncoding.areashop.Utils;
|
||||
import nl.evolutioncoding.areashop.regions.BuyRegion;
|
||||
import nl.evolutioncoding.areashop.regions.GeneralRegion;
|
||||
import nl.evolutioncoding.areashop.regions.RentRegion;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.sk89q.worldedit.bukkit.selections.Selection;
|
||||
|
||||
public class DelCommand extends CommandAreaShop {
|
||||
|
||||
public DelCommand(AreaShop plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandStart() {
|
||||
return "areashop del";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHelp(CommandSender target) {
|
||||
if(target.hasPermission("areashop.destroyrent") || target.hasPermission("areashop.destroybuy")) {
|
||||
return plugin.getLanguageManager().getLang("help-del");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, Command command, String[] args) {
|
||||
if(!sender.hasPermission("areashop.destroybuy") && !sender.hasPermission("areashop.destroyrent")) {
|
||||
plugin.message(sender, "del-noPermission");
|
||||
return;
|
||||
}
|
||||
if(args.length < 2) {
|
||||
// Only players can have a selection
|
||||
if(!(sender instanceof Player)) {
|
||||
plugin.message(sender, "cmd-weOnlyByPlayer");
|
||||
return;
|
||||
}
|
||||
Player player = (Player)sender;
|
||||
Selection selection = plugin.getWorldEdit().getSelection(player);
|
||||
if(selection == null) {
|
||||
plugin.message(player, "cmd-noSelection");
|
||||
return;
|
||||
}
|
||||
List<GeneralRegion> regions = plugin.getFileManager().getASRegionsInSelection(selection);
|
||||
if(regions == null || regions.size() == 0) {
|
||||
plugin.message(player, "cmd-noRegionsFound");
|
||||
return;
|
||||
}
|
||||
// Start removing the region that he has permission for
|
||||
ArrayList<String> namesSuccess = new ArrayList<String>();
|
||||
ArrayList<String> namesFailed = new ArrayList<String>();
|
||||
for(GeneralRegion region : regions) {
|
||||
if(region.isRentRegion()) {
|
||||
if(!sender.hasPermission("areashop.destroyrent")) {
|
||||
namesFailed.add(region.getName());
|
||||
} else {
|
||||
plugin.getFileManager().removeRent((RentRegion)region, true);
|
||||
namesSuccess.add(region.getName());
|
||||
}
|
||||
} else if(region.isBuyRegion()) {
|
||||
if(!sender.hasPermission("areashop.destroybuy")) {
|
||||
namesFailed.add(region.getName());
|
||||
} else {
|
||||
plugin.getFileManager().removeBuy((BuyRegion)region, true);
|
||||
namesSuccess.add(region.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
// send messages
|
||||
if(namesSuccess.size() != 0) {
|
||||
plugin.message(sender, "del-success", Utils.createCommaSeparatedList(namesSuccess));
|
||||
}
|
||||
if(namesFailed.size() != 0) {
|
||||
plugin.message(sender, "del-failed", Utils.createCommaSeparatedList(namesFailed));
|
||||
}
|
||||
} else {
|
||||
GeneralRegion region = plugin.getFileManager().getRegion(args[1]);
|
||||
if(region == null) {
|
||||
plugin.message(sender, "del-noRegion", args[1]);
|
||||
return;
|
||||
}
|
||||
if(region.isRentRegion()) {
|
||||
/* Remove the rent if the player has permission */
|
||||
if(sender.hasPermission("areashop.destroyrent")) {
|
||||
plugin.getFileManager().removeRent((RentRegion)region, true);
|
||||
plugin.message(sender, "destroy-successRent", region.getName());
|
||||
} else {
|
||||
plugin.message(sender, "destroy-noPermissionRent");
|
||||
}
|
||||
} else if(region.isBuyRegion()) {
|
||||
/* Remove the buy if the player has permission */
|
||||
if(sender.hasPermission("areashop.destroybuy")) {
|
||||
plugin.getFileManager().removeBuy((BuyRegion)region, true);
|
||||
plugin.message(sender, "destroy-successBuy", region.getName());
|
||||
} else {
|
||||
plugin.message(sender, "destroy-noPermissionBuy");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getTabCompleteList(int toComplete, String[] start) {
|
||||
List<String> result = new ArrayList<String>();
|
||||
if(toComplete == 2) {
|
||||
result = plugin.getFileManager().getRegionNames();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,132 @@
|
||||
package nl.evolutioncoding.areashop.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import nl.evolutioncoding.areashop.AreaShop;
|
||||
import nl.evolutioncoding.areashop.regions.BuyRegion;
|
||||
import nl.evolutioncoding.areashop.regions.GeneralRegion;
|
||||
import nl.evolutioncoding.areashop.regions.RentRegion;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class DelfriendCommand extends CommandAreaShop {
|
||||
|
||||
public DelfriendCommand(AreaShop plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandStart() {
|
||||
return "areashop delfriend";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHelp(CommandSender target) {
|
||||
if(target.hasPermission("areashop.delfriendall")) {
|
||||
return plugin.getLanguageManager().getLang("help-delFriendAll");
|
||||
} else if(target.hasPermission("areashop.delfriend")) {
|
||||
return plugin.getLanguageManager().getLang("help-delFriend");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public void execute(CommandSender sender, Command command, String[] args) {
|
||||
if(!sender.hasPermission("areashop.delfriend") && !sender.hasPermission("areashop.delfriendall")) {
|
||||
plugin.message(sender, "delfriend-noPermission");
|
||||
return;
|
||||
}
|
||||
if(args.length < 2) {
|
||||
plugin.message(sender, "delfriend-help");
|
||||
return;
|
||||
}
|
||||
GeneralRegion region = null;
|
||||
if(args.length <= 2) {
|
||||
if (sender instanceof Player) {
|
||||
// get the region by location
|
||||
List<GeneralRegion> regions = plugin.getFileManager().getAllApplicableRegions(((Player) sender).getLocation());
|
||||
if (regions.isEmpty()) {
|
||||
plugin.message(sender, "cmd-noRegionsAtLocation");
|
||||
return;
|
||||
} else if (regions.size() > 1) {
|
||||
plugin.message(sender, "cmd-moreRegionsAtLocation");
|
||||
return;
|
||||
} else {
|
||||
region = regions.get(0);
|
||||
}
|
||||
} else {
|
||||
plugin.message(sender, "cmd-automaticRegionOnlyByPlayer");
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
region = plugin.getFileManager().getRegion(args[2]);
|
||||
if(region == null) {
|
||||
plugin.message(sender, "cmd-notRegistered", args[2]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if(sender.hasPermission("areashop.delfriendall")) {
|
||||
if((region.isRentRegion() && !((RentRegion)region).isRented())
|
||||
|| (region.isBuyRegion() && !((BuyRegion)region).isSold())) {
|
||||
plugin.message(sender, "delfriend-noOwner");
|
||||
return;
|
||||
}
|
||||
OfflinePlayer friend = Bukkit.getOfflinePlayer(args[1]);
|
||||
if(!region.getFriends().contains(friend.getUniqueId())) {
|
||||
plugin.message(sender, "delfriend-notAdded", friend.getName());
|
||||
return;
|
||||
}
|
||||
region.deleteFriend(friend.getUniqueId());
|
||||
region.saveRequired();
|
||||
region.updateRegionFlags();
|
||||
region.updateSigns();
|
||||
plugin.message(sender, "delfriend-successOther", friend.getName(), region.getName());
|
||||
} else {
|
||||
if(sender.hasPermission("areashop.delfriend") && sender instanceof Player) {
|
||||
if(region.isOwner((Player)sender)) {
|
||||
OfflinePlayer friend = Bukkit.getOfflinePlayer(args[1]);
|
||||
if(!region.getFriends().contains(friend.getUniqueId())) {
|
||||
plugin.message(sender, "delfriend-notAdded", friend.getName());
|
||||
return;
|
||||
}
|
||||
region.deleteFriend(friend.getUniqueId());
|
||||
region.saveRequired();
|
||||
region.updateRegionFlags();
|
||||
region.updateSigns();
|
||||
plugin.message(sender, "delfriend-success", friend.getName(), region.getName());
|
||||
} else {
|
||||
plugin.message(sender, "delfriend-noPermissionOther");
|
||||
}
|
||||
} else {
|
||||
plugin.message(sender, "delfriend-noPermission");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getTabCompleteList(int toComplete, String[] start) {
|
||||
ArrayList<String> result = new ArrayList<String>();
|
||||
if(toComplete == 2) {
|
||||
for(Player player : Bukkit.getOnlinePlayers()) {
|
||||
result.add(player.getName());
|
||||
}
|
||||
} else if(toComplete == 3) {
|
||||
result.addAll(plugin.getFileManager().getRegionNames());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
package nl.evolutioncoding.areashop.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import nl.evolutioncoding.areashop.AreaShop;
|
||||
import nl.evolutioncoding.areashop.regions.GeneralRegion;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.BlockIterator;
|
||||
|
||||
public class DelsignCommand extends CommandAreaShop {
|
||||
|
||||
public DelsignCommand(AreaShop plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandStart() {
|
||||
return "areashop delsign";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHelp(CommandSender target) {
|
||||
if(target.hasPermission("areashop.delsign")) {
|
||||
return plugin.getLanguageManager().getLang("help-delsign");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, Command command, String[] args) {
|
||||
if(!sender.hasPermission("areashop.delsign")) {
|
||||
plugin.message(sender, "delsign-noPermission");
|
||||
return;
|
||||
}
|
||||
if (!(sender instanceof Player)) {
|
||||
plugin.message(sender, "cmd-onlyByPlayer");
|
||||
return;
|
||||
}
|
||||
Player player = (Player)sender;
|
||||
|
||||
// Get the sign
|
||||
Block block = null;
|
||||
BlockIterator blockIterator = new BlockIterator(player, 100);
|
||||
while(blockIterator.hasNext() && block == null) {
|
||||
Block next = blockIterator.next();
|
||||
if(next.getType() != Material.AIR) {
|
||||
block = next;
|
||||
}
|
||||
}
|
||||
if(block == null || !(block.getType() == Material.WALL_SIGN || block.getType() == Material.SIGN_POST)) {
|
||||
plugin.message(sender, "delsign-noSign");
|
||||
return;
|
||||
}
|
||||
GeneralRegion region = plugin.getFileManager().getRegionBySignLocation(block.getLocation());
|
||||
if(region == null) {
|
||||
plugin.message(sender, "delsign-noRegion");
|
||||
return;
|
||||
}
|
||||
plugin.message(sender, "delsign-success", region.getName());
|
||||
region.removeSign(block.getLocation());
|
||||
region.updateSigns();
|
||||
region.saveRequired();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getTabCompleteList(int toComplete, String[] start) {
|
||||
return new ArrayList<String>();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,183 @@
|
||||
package nl.evolutioncoding.areashop.commands;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import nl.evolutioncoding.areashop.AreaShop;
|
||||
import nl.evolutioncoding.areashop.regions.BuyRegion;
|
||||
import nl.evolutioncoding.areashop.regions.RegionGroup;
|
||||
import nl.evolutioncoding.areashop.regions.RentRegion;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class FindCommand extends CommandAreaShop {
|
||||
|
||||
public FindCommand(AreaShop plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandStart() {
|
||||
return "areashop find";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHelp(CommandSender target) {
|
||||
if(target.hasPermission("areashop.find")) {
|
||||
return plugin.getLanguageManager().getLang("help-find");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, Command command, String[] args) {
|
||||
if(!sender.hasPermission("areashop.find")) {
|
||||
plugin.message(sender, "find-noPermission");
|
||||
return;
|
||||
}
|
||||
if (!(sender instanceof Player)) {
|
||||
plugin.message(sender, "cmd-onlyByPlayer");
|
||||
return;
|
||||
}
|
||||
if(args.length <= 1 || args[1] == null || (!args[1].equalsIgnoreCase("buy") && !args[1].equalsIgnoreCase("rent"))) {
|
||||
plugin.message(sender, "find-help");
|
||||
return;
|
||||
}
|
||||
Player player = (Player)sender;
|
||||
double balance = plugin.getEconomy().getBalance(player);
|
||||
double maxPrice = 0;
|
||||
boolean maxPriceSet = false;
|
||||
RegionGroup group = null;
|
||||
// Parse optional price argument
|
||||
if(args.length >= 3) {
|
||||
try {
|
||||
maxPrice = Double.parseDouble(args[2]);
|
||||
maxPriceSet = true;
|
||||
} catch(NumberFormatException e) {
|
||||
plugin.message(sender, "find-wrongMaxPrice", args[2]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Parse optional group argument
|
||||
if(args.length >= 4) {
|
||||
group = plugin.getFileManager().getGroup(args[3]);
|
||||
if(group == null) {
|
||||
plugin.message(sender, "find-wrongGroup", args[3]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if(args[1].equalsIgnoreCase("buy")) {
|
||||
List<BuyRegion> regions = plugin.getFileManager().getBuys();
|
||||
for(BuyRegion region : regions) {
|
||||
if(!region.isSold()
|
||||
&& ((region.getPrice() <= balance && !maxPriceSet) || (region.getPrice() <= maxPrice && maxPriceSet))
|
||||
&& (group == null || group.isMember(region))) {
|
||||
BigDecimal bigDecimal = new BigDecimal(balance);
|
||||
bigDecimal = bigDecimal.setScale(2, RoundingMode.HALF_UP);
|
||||
balance = bigDecimal.doubleValue();
|
||||
String onlyInGroup = "";
|
||||
if(group != null) {
|
||||
onlyInGroup = plugin.getLanguageManager().getLang("find-onlyInGroup", args[3]);
|
||||
}
|
||||
if(maxPriceSet) {
|
||||
plugin.message(player, "find-successMax", "buy", region.getName(), maxPrice, onlyInGroup);
|
||||
} else {
|
||||
plugin.message(player, "find-success", "buy", region.getName(), balance, onlyInGroup);
|
||||
}
|
||||
region.teleportPlayer(player, true, false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
BigDecimal bigDecimal = new BigDecimal(balance);
|
||||
bigDecimal = bigDecimal.setScale(2, RoundingMode.HALF_UP);
|
||||
balance = bigDecimal.doubleValue();
|
||||
String onlyInGroup = "";
|
||||
if(group != null) {
|
||||
onlyInGroup = plugin.getLanguageManager().getLang("find-onlyInGroup", args[3]);
|
||||
}
|
||||
if(maxPriceSet) {
|
||||
plugin.message(player, "find-noneFound", "buy", maxPrice, onlyInGroup);
|
||||
} else {
|
||||
plugin.message(player, "find-noneFoundMax", "buy", balance, onlyInGroup);
|
||||
}
|
||||
|
||||
} else {
|
||||
List<RentRegion> regions = plugin.getFileManager().getRents();
|
||||
for(RentRegion region : regions) {
|
||||
if(!region.isRented()
|
||||
&& ((region.getPrice() <= balance && !maxPriceSet) || (region.getPrice() <= maxPrice && maxPriceSet))
|
||||
&& (group == null || group.isMember(region))) {
|
||||
BigDecimal bigDecimal = new BigDecimal(balance);
|
||||
bigDecimal = bigDecimal.setScale(2, RoundingMode.HALF_UP);
|
||||
balance = bigDecimal.doubleValue();
|
||||
String onlyInGroup = "";
|
||||
if(group != null) {
|
||||
onlyInGroup = plugin.getLanguageManager().getLang("find-onlyInGroup", args[3]);
|
||||
}
|
||||
if(maxPriceSet) {
|
||||
plugin.message(player, "find-successMax", "rent", region.getName(), maxPrice, onlyInGroup);
|
||||
} else {
|
||||
plugin.message(player, "find-success", "rent", region.getName(), balance, onlyInGroup);
|
||||
}
|
||||
region.teleportPlayer(player, true, false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
BigDecimal bigDecimal = new BigDecimal(balance);
|
||||
bigDecimal = bigDecimal.setScale(2, RoundingMode.HALF_UP);
|
||||
balance = bigDecimal.doubleValue();
|
||||
String onlyInGroup = "";
|
||||
if(group != null) {
|
||||
onlyInGroup = plugin.getLanguageManager().getLang("find-onlyInGroup", args[3]);
|
||||
}
|
||||
if(maxPriceSet) {
|
||||
plugin.message(player, "find-noneFound", "rent", maxPrice, onlyInGroup);
|
||||
} else {
|
||||
plugin.message(player, "find-noneFoundMax", "rent", balance, onlyInGroup);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getTabCompleteList(int toComplete, String[] start) {
|
||||
ArrayList<String> result = new ArrayList<String>();
|
||||
if(toComplete == 2) {
|
||||
result.add("buy");
|
||||
result.add("rent");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,120 @@
|
||||
package nl.evolutioncoding.areashop.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import nl.evolutioncoding.areashop.AreaShop;
|
||||
import nl.evolutioncoding.areashop.Utils;
|
||||
import nl.evolutioncoding.areashop.regions.GeneralRegion;
|
||||
import nl.evolutioncoding.areashop.regions.RegionGroup;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.sk89q.worldedit.bukkit.selections.Selection;
|
||||
|
||||
public class GroupaddCommand extends CommandAreaShop {
|
||||
|
||||
public GroupaddCommand(AreaShop plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandStart() {
|
||||
return "areashop groupadd";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHelp(CommandSender target) {
|
||||
if(target.hasPermission("areashop.groupadd")) {
|
||||
return plugin.getLanguageManager().getLang("help-groupadd");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, Command command, String[] args) {
|
||||
if(!sender.hasPermission("areashop.groupadd")) {
|
||||
plugin.message(sender, "groupadd-noPermission");
|
||||
return;
|
||||
}
|
||||
if(args.length < 2 || args[1] == null) {
|
||||
plugin.message(sender, "groupadd-help");
|
||||
return;
|
||||
}
|
||||
RegionGroup group = plugin.getFileManager().getGroup(args[1]);
|
||||
if(group == null) {
|
||||
group = new RegionGroup(plugin, args[1]);
|
||||
plugin.getFileManager().addGroup(group);
|
||||
group.saveRequired();
|
||||
}
|
||||
if(args.length == 2) {
|
||||
if(!(sender instanceof Player)) {
|
||||
plugin.message(sender, "cmd-weOnlyByPlayer");
|
||||
return;
|
||||
}
|
||||
Player player = (Player)sender;
|
||||
Selection selection = plugin.getWorldEdit().getSelection(player);
|
||||
if(selection == null) {
|
||||
plugin.message(player, "cmd-noSelection");
|
||||
return;
|
||||
}
|
||||
List<GeneralRegion> regions = plugin.getFileManager().getASRegionsInSelection(selection);
|
||||
if(regions.size() == 0) {
|
||||
plugin.message(player, "cmd-noRegionsFound");
|
||||
return;
|
||||
}
|
||||
ArrayList<String> namesSuccess = new ArrayList<String>();
|
||||
ArrayList<String> namesFailed = new ArrayList<String>();
|
||||
for(GeneralRegion region : regions) {
|
||||
if(group.addMember(region)) {
|
||||
namesSuccess.add(region.getName());
|
||||
} else {
|
||||
namesFailed.add(region.getName());
|
||||
}
|
||||
}
|
||||
if(namesSuccess.size() != 0) {
|
||||
plugin.message(player, "groupadd-weSuccess", group.getName(), Utils.createCommaSeparatedList(namesSuccess));
|
||||
}
|
||||
if(namesFailed.size() != 0) {
|
||||
plugin.message(player, "groupadd-weFailed", group.getName(), Utils.createCommaSeparatedList(namesFailed));
|
||||
}
|
||||
group.saveRequired();
|
||||
} else {
|
||||
GeneralRegion region = plugin.getFileManager().getRegion(args[2]);
|
||||
if(region == null) {
|
||||
plugin.message(sender, "groupadd-noRegion", args[2]);
|
||||
return;
|
||||
}
|
||||
if(group.addMember(region)) {
|
||||
plugin.message(sender, "groupadd-success", region.getName(), group.getName(), group.getMembers().size());
|
||||
} else {
|
||||
plugin.message(sender, "groupadd-failed", region.getName(), group.getName());
|
||||
}
|
||||
group.saveRequired();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getTabCompleteList(int toComplete, String[] start) {
|
||||
List<String> result = new ArrayList<String>();
|
||||
if(toComplete == 2) {
|
||||
result = plugin.getFileManager().getGroupNames();
|
||||
} else if(toComplete == 3) {
|
||||
result = plugin.getFileManager().getRegionNames();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,120 @@
|
||||
package nl.evolutioncoding.areashop.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import nl.evolutioncoding.areashop.AreaShop;
|
||||
import nl.evolutioncoding.areashop.Utils;
|
||||
import nl.evolutioncoding.areashop.regions.GeneralRegion;
|
||||
import nl.evolutioncoding.areashop.regions.RegionGroup;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.sk89q.worldedit.bukkit.selections.Selection;
|
||||
|
||||
public class GroupdelCommand extends CommandAreaShop {
|
||||
|
||||
public GroupdelCommand(AreaShop plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandStart() {
|
||||
return "areashop groupdel";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHelp(CommandSender target) {
|
||||
if(target.hasPermission("areashop.groupdel")) {
|
||||
return plugin.getLanguageManager().getLang("help-groupdel");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, Command command, String[] args) {
|
||||
if(!sender.hasPermission("areashop.groupdel")) {
|
||||
plugin.message(sender, "groupdel-noPermission");
|
||||
return;
|
||||
}
|
||||
if(args.length < 2 || args[1] == null) {
|
||||
plugin.message(sender, "groupdel-help");
|
||||
return;
|
||||
}
|
||||
RegionGroup group = plugin.getFileManager().getGroup(args[1]);
|
||||
if(group == null) {
|
||||
group = new RegionGroup(plugin, args[1]);
|
||||
plugin.getFileManager().addGroup(group);
|
||||
group.saveRequired();
|
||||
}
|
||||
if(args.length == 2) {
|
||||
if(!(sender instanceof Player)) {
|
||||
plugin.message(sender, "cmd-weOnlyByPlayer");
|
||||
return;
|
||||
}
|
||||
Player player = (Player)sender;
|
||||
Selection selection = plugin.getWorldEdit().getSelection(player);
|
||||
if(selection == null) {
|
||||
plugin.message(player, "cmd-noSelection");
|
||||
return;
|
||||
}
|
||||
List<GeneralRegion> regions = plugin.getFileManager().getASRegionsInSelection(selection);
|
||||
if(regions.size() == 0) {
|
||||
plugin.message(player, "cmd-noRegionsFound");
|
||||
return;
|
||||
}
|
||||
ArrayList<String> namesSuccess = new ArrayList<String>();
|
||||
ArrayList<String> namesFailed = new ArrayList<String>();
|
||||
for(GeneralRegion region : regions) {
|
||||
if(group.removeMember(region)) {
|
||||
namesSuccess.add(region.getName());
|
||||
} else {
|
||||
namesFailed.add(region.getName());
|
||||
}
|
||||
}
|
||||
if(namesSuccess.size() != 0) {
|
||||
plugin.message(player, "groupdel-weSuccess", group.getName(), Utils.createCommaSeparatedList(namesSuccess));
|
||||
}
|
||||
if(namesFailed.size() != 0) {
|
||||
plugin.message(player, "groupdel-weFailed", group.getName(), Utils.createCommaSeparatedList(namesFailed));
|
||||
}
|
||||
group.saveRequired();
|
||||
} else {
|
||||
GeneralRegion region = plugin.getFileManager().getRegion(args[2]);
|
||||
if(region == null) {
|
||||
plugin.message(sender, "groupdel-noRegion", args[2]);
|
||||
return;
|
||||
}
|
||||
if(group.removeMember(region)) {
|
||||
plugin.message(sender, "groupdel-success", region.getName(), group.getName(), group.getMembers().size());
|
||||
} else {
|
||||
plugin.message(sender, "groupdel-failed", region.getName(), group.getName());
|
||||
}
|
||||
group.saveRequired();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getTabCompleteList(int toComplete, String[] start) {
|
||||
List<String> result = new ArrayList<String>();
|
||||
if(toComplete == 2) {
|
||||
result = plugin.getFileManager().getGroupNames();
|
||||
} else if(toComplete == 3) {
|
||||
result = plugin.getFileManager().getRegionNames();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
package nl.evolutioncoding.areashop.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import nl.evolutioncoding.areashop.AreaShop;
|
||||
import nl.evolutioncoding.areashop.Utils;
|
||||
import nl.evolutioncoding.areashop.regions.RegionGroup;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
public class GroupinfoCommand extends CommandAreaShop {
|
||||
|
||||
public GroupinfoCommand(AreaShop plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandStart() {
|
||||
return "areashop groupinfo";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHelp(CommandSender target) {
|
||||
if(target.hasPermission("areashop.groupinfo")) {
|
||||
return plugin.getLanguageManager().getLang("help-groupinfo");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, Command command, String[] args) {
|
||||
if(!sender.hasPermission("areashop.groupinfo")) {
|
||||
plugin.message(sender, "groupinfo-noPermission");
|
||||
return;
|
||||
}
|
||||
if(args.length < 2 || args[1] == null) {
|
||||
plugin.message(sender, "groupinfo-help");
|
||||
return;
|
||||
}
|
||||
RegionGroup group = plugin.getFileManager().getGroup(args[1]);
|
||||
if(group == null) {
|
||||
plugin.message(sender, "groupinfo-noGroup", args[1]);
|
||||
return;
|
||||
}
|
||||
List<String> members = group.getMembers();
|
||||
if(members.size() == 0) {
|
||||
plugin.message(sender, "groupinfo-noMembers", group.getName());
|
||||
} else {
|
||||
plugin.message(sender, "groupinfo-members", group.getName(), Utils.createCommaSeparatedList(members));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getTabCompleteList(int toComplete, String[] start) {
|
||||
List<String> result = new ArrayList<String>();
|
||||
if(toComplete == 2) {
|
||||
result = plugin.getFileManager().getGroupNames();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
package nl.evolutioncoding.areashop.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import nl.evolutioncoding.areashop.AreaShop;
|
||||
import nl.evolutioncoding.areashop.Utils;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
public class GrouplistCommand extends CommandAreaShop {
|
||||
|
||||
public GrouplistCommand(AreaShop plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandStart() {
|
||||
return "areashop grouplist";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHelp(CommandSender target) {
|
||||
if(target.hasPermission("areashop.grouplist")) {
|
||||
return plugin.getLanguageManager().getLang("help-grouplist");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, Command command, String[] args) {
|
||||
if(!sender.hasPermission("areashop.grouplist")) {
|
||||
plugin.message(sender, "grouplist-noPermission");
|
||||
return;
|
||||
}
|
||||
List<String> groups = plugin.getFileManager().getGroupNames();
|
||||
if(groups.size() == 0) {
|
||||
plugin.message(sender, "grouplist-noGroups");
|
||||
} else {
|
||||
plugin.message(sender, "grouplist-success", Utils.createCommaSeparatedList(groups));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getTabCompleteList(int toComplete, String[] start) {
|
||||
return new ArrayList<String>();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
package nl.evolutioncoding.areashop.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import nl.evolutioncoding.areashop.AreaShop;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
public class HelpCommand extends CommandAreaShop {
|
||||
|
||||
public HelpCommand(AreaShop plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandStart() {
|
||||
return "areashop help";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHelp(CommandSender target) {
|
||||
if(target.hasPermission("areashop.help")) {
|
||||
return plugin.getLanguageManager().getLang("help-help");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, Command command, String[] args) {
|
||||
plugin.getCommandManager().showHelp(sender);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getTabCompleteList(int toComplete, String[] start) {
|
||||
ArrayList<String> result = new ArrayList<String>();
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,431 @@
|
||||
package nl.evolutioncoding.areashop.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import nl.evolutioncoding.areashop.AreaShop;
|
||||
import nl.evolutioncoding.areashop.Utils;
|
||||
import nl.evolutioncoding.areashop.regions.BuyRegion;
|
||||
import nl.evolutioncoding.areashop.regions.GeneralRegion;
|
||||
import nl.evolutioncoding.areashop.regions.RentRegion;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class InfoCommand extends CommandAreaShop {
|
||||
|
||||
public InfoCommand(AreaShop plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandStart() {
|
||||
return "areashop info";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHelp(CommandSender target) {
|
||||
if(target.hasPermission("areashop.info")) {
|
||||
return plugin.getLanguageManager().getLang("help-info");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, Command command, String[] args) {
|
||||
if(!sender.hasPermission("areashop.info")) {
|
||||
plugin.message(sender, "info-noPermission");
|
||||
return;
|
||||
}
|
||||
if(args.length > 1 && args[1] != null) {
|
||||
/* List of all regions */
|
||||
if(args[1].equalsIgnoreCase("all")) {
|
||||
String message = "";
|
||||
/* Message for rents */
|
||||
Iterator<RentRegion> itRent = plugin.getFileManager().getRents().iterator();
|
||||
if(itRent.hasNext()) {
|
||||
message = itRent.next().getName();
|
||||
while(itRent.hasNext()) {
|
||||
message += ", " + itRent.next().getName();
|
||||
}
|
||||
}
|
||||
if(message.equals("")) {
|
||||
plugin.message(sender, "info-all-noRents");
|
||||
} else {
|
||||
plugin.message(sender, "info-all-rents", message);
|
||||
}
|
||||
|
||||
/* Message for buys */
|
||||
message = "";
|
||||
Iterator<BuyRegion> itBuy = plugin.getFileManager().getBuys().iterator();
|
||||
if(itBuy.hasNext()) {
|
||||
message = itBuy.next().getName();
|
||||
while(itBuy.hasNext()) {
|
||||
message += ", " + itBuy.next().getName();
|
||||
}
|
||||
}
|
||||
if(message.equals("")) {
|
||||
plugin.message(sender, "info-all-noBuys");
|
||||
} else {
|
||||
plugin.message(sender, "info-all-buys", message);
|
||||
}
|
||||
}
|
||||
/* List of rented regions */
|
||||
else if(args[1].equalsIgnoreCase("rented")) {
|
||||
String message = "";
|
||||
Iterator<RentRegion> it = plugin.getFileManager().getRents().iterator();
|
||||
boolean first = true;
|
||||
while(it.hasNext()) {
|
||||
RentRegion next = it.next();
|
||||
if(next.isRented()) {
|
||||
if(!first) {
|
||||
message += ", " + next.getName();
|
||||
} else {
|
||||
first = false;
|
||||
message += next.getName();
|
||||
}
|
||||
}
|
||||
}
|
||||
if(message.equals("")) {
|
||||
plugin.message(sender, "info-noRented");
|
||||
} else {
|
||||
plugin.message(sender, "info-rented", message);
|
||||
}
|
||||
}
|
||||
/* List of unrented regions */
|
||||
else if(args[1].equalsIgnoreCase("forrent")) {
|
||||
String message = "";
|
||||
Iterator<RentRegion> it = plugin.getFileManager().getRents().iterator();
|
||||
boolean first = true;
|
||||
while(it.hasNext()) {
|
||||
RentRegion next = it.next();
|
||||
if(!next.isRented()) {
|
||||
if(!first) {
|
||||
message += ", " + next.getName();
|
||||
} else {
|
||||
first = false;
|
||||
message = next.getName();
|
||||
}
|
||||
}
|
||||
}
|
||||
if(message.equals("")) {
|
||||
plugin.message(sender, "info-noUnrented");
|
||||
} else {
|
||||
plugin.message(sender, "info-unrented", message);
|
||||
}
|
||||
} else if(args[1].equalsIgnoreCase("sold")) {
|
||||
String message = "";
|
||||
Iterator<BuyRegion> it = plugin.getFileManager().getBuys().iterator();
|
||||
boolean first = true;
|
||||
while(it.hasNext()) {
|
||||
BuyRegion next = it.next();
|
||||
if(next.isSold()) {
|
||||
if(!first) {
|
||||
message += ", ";
|
||||
} else {
|
||||
first = false;
|
||||
}
|
||||
message += next.getName();
|
||||
}
|
||||
}
|
||||
if(message.equals("")) {
|
||||
plugin.message(sender, "info-noSold");
|
||||
} else {
|
||||
plugin.message(sender, "info-sold", message);
|
||||
}
|
||||
} else if(args[1].equalsIgnoreCase("forsale")) {
|
||||
String message = "";
|
||||
Iterator<BuyRegion> it = plugin.getFileManager().getBuys().iterator();
|
||||
boolean first = true;
|
||||
while(it.hasNext()) {
|
||||
BuyRegion next =it.next();
|
||||
if(!next.isSold()) {
|
||||
if(!first) {
|
||||
message += ", " + next.getName();
|
||||
} else {
|
||||
first = false;
|
||||
message = next.getName();
|
||||
}
|
||||
}
|
||||
}
|
||||
if(message.equals("")) {
|
||||
plugin.message(sender, "info-noForsale");
|
||||
} else {
|
||||
plugin.message(sender, "info-forsale", message);
|
||||
}
|
||||
} else if(args[1].equalsIgnoreCase("player")) {
|
||||
if(args.length > 2 && args[2] != null) {
|
||||
String message = "";
|
||||
Iterator<RentRegion> itRent = plugin.getFileManager().getRents().iterator();
|
||||
boolean first = true;
|
||||
while(itRent.hasNext()) {
|
||||
RentRegion next = itRent.next();
|
||||
if(next.isRented() && next.getPlayerName().equalsIgnoreCase(args[2])) {
|
||||
if(!first) {
|
||||
message += ", " + next.getName();
|
||||
} else {
|
||||
first = false;
|
||||
message = next.getName();
|
||||
}
|
||||
}
|
||||
}
|
||||
if(message.equals("")) {
|
||||
plugin.message(sender, "info-playerNoRents", args[2]);
|
||||
} else {
|
||||
plugin.message(sender, "info-playerRents", args[2], message);
|
||||
}
|
||||
|
||||
message = "";
|
||||
Iterator<BuyRegion> itBuy = plugin.getFileManager().getBuys().iterator();
|
||||
first = true;
|
||||
while(itBuy.hasNext()) {
|
||||
BuyRegion next = itBuy.next();
|
||||
if(next.isSold() && next.getPlayerName().equalsIgnoreCase(args[2])) {
|
||||
if(!first) {
|
||||
message += ", ";
|
||||
} else {
|
||||
first = false;
|
||||
}
|
||||
message += next.getName();
|
||||
}
|
||||
}
|
||||
if(message.equals("")) {
|
||||
plugin.message(sender, "info-playerNoBuys", args[2]);
|
||||
} else {
|
||||
plugin.message(sender, "info-playerBuys", args[2], message);
|
||||
}
|
||||
} else {
|
||||
plugin.message(sender, "info-playerHelp");
|
||||
}
|
||||
} else if(args[1].equalsIgnoreCase("region")) {
|
||||
if(args.length > 1) {
|
||||
RentRegion rent = null;
|
||||
BuyRegion buy = null;
|
||||
if(args.length > 2) {
|
||||
rent = plugin.getFileManager().getRent(args[2]);
|
||||
buy = plugin.getFileManager().getBuy(args[2]);
|
||||
} else {
|
||||
if (sender instanceof Player) {
|
||||
// get the region by location
|
||||
List<GeneralRegion> regions = plugin.getFileManager().getAllApplicableRegions(((Player) sender).getLocation());
|
||||
if (regions.isEmpty()) {
|
||||
plugin.message(sender, "cmd-noRegionsAtLocation");
|
||||
return;
|
||||
} else if (regions.size() > 1) {
|
||||
plugin.message(sender, "cmd-moreRegionsAtLocation");
|
||||
return;
|
||||
} else {
|
||||
if(regions.get(0).isRentRegion()) {
|
||||
rent = (RentRegion)regions.get(0);
|
||||
} else if(regions.get(0).isBuyRegion()) {
|
||||
buy = (BuyRegion)regions.get(0);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
plugin.message(sender, "cmd-automaticRegionOnlyByPlayer");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if(rent == null && buy == null) {
|
||||
plugin.message(sender, "info-regionNotExisting", args[2]);
|
||||
return;
|
||||
}
|
||||
|
||||
if(rent != null) {
|
||||
plugin.message(sender, "info-regionHeaderRent", rent);
|
||||
if(rent.isRented()) {
|
||||
plugin.messageNoPrefix(sender, "info-regionRented", rent);
|
||||
plugin.messageNoPrefix(sender, "info-regionExtending", rent);
|
||||
plugin.messageNoPrefix(sender, "info-regionMoneyBackRent", rent);
|
||||
if(!rent.getFriendNames().isEmpty()) {
|
||||
plugin.messageNoPrefix(sender, "info-regionFriends", rent);
|
||||
}
|
||||
} else {
|
||||
plugin.messageNoPrefix(sender, "info-regionCanBeRented", rent);
|
||||
}
|
||||
if(rent.getMaxExtends() != -1) {
|
||||
if(rent.getMaxExtends() == 0) {
|
||||
plugin.messageNoPrefix(sender, "info-regionNoExtending", rent);
|
||||
} else if(rent.isRented()) {
|
||||
plugin.messageNoPrefix(sender, "info-regionExtendsLeft", rent);
|
||||
} else {
|
||||
plugin.messageNoPrefix(sender, "info-regionMaxExtends", rent);
|
||||
}
|
||||
}
|
||||
if(rent.getMaxRentTime() != -1) {
|
||||
plugin.messageNoPrefix(sender, "info-regionMaxRentTime", rent);
|
||||
}
|
||||
if(rent.getInactiveTimeUntilUnrent() != -1) {
|
||||
plugin.messageNoPrefix(sender, "info-regionInactiveUnrent", rent);
|
||||
}
|
||||
if(sender.hasPermission("areashop.teleport") || sender.hasPermission("areashop.teleportall")) {
|
||||
Location teleport = rent.getTeleportLocation();
|
||||
if(teleport == null) {
|
||||
if(rent.isRented()) {
|
||||
plugin.messageNoPrefix(sender, "info-regionNoTeleport", rent, plugin.getLanguageManager().getLang("info-regionTeleportHint", rent));
|
||||
} else {
|
||||
plugin.messageNoPrefix(sender, "info-regionNoTeleport", rent, "");
|
||||
}
|
||||
} else {
|
||||
plugin.messageNoPrefix(sender, "info-regionTeleportAt", rent, teleport.getWorld().getName(), teleport.getBlockX(), teleport.getBlockY(), teleport.getBlockZ(), (int)teleport.getPitch(), (int)teleport.getYaw());
|
||||
}
|
||||
}
|
||||
List<String> signLocations = new ArrayList<String>();
|
||||
for(Location location : rent.getSignLocations()) {
|
||||
signLocations.add(plugin.getLanguageManager().getLang("info-regionSignLocation", location.getWorld().getName(), location.getBlockX(), location.getBlockY(), location.getBlockZ()));
|
||||
}
|
||||
if(!signLocations.isEmpty()) {
|
||||
plugin.messageNoPrefix(sender, "info-regionSigns", Utils.createCommaSeparatedList(signLocations));
|
||||
}
|
||||
if(sender.hasPermission("areashop.groupinfo") && !rent.getGroupNames().isEmpty()) {
|
||||
plugin.messageNoPrefix(sender, "info-regionGroups", Utils.createCommaSeparatedList(rent.getGroupNames()));
|
||||
}
|
||||
if(rent.isRestoreEnabled()) {
|
||||
if(sender.hasPermission("areashop.setrestore")) {
|
||||
plugin.messageNoPrefix(sender, "info-regionRestoringRent", rent, plugin.getLanguageManager().getLang("info-regionRestoringProfile", rent.getRestoreProfile()));
|
||||
} else {
|
||||
plugin.messageNoPrefix(sender, "info-regionRestoringRent", rent, "");
|
||||
}
|
||||
}
|
||||
if(!rent.isRented()) {
|
||||
if(rent.restrictedToRegion()) {
|
||||
plugin.messageNoPrefix(sender, "info-regionRestrictedRegionRent", rent);
|
||||
} else if(rent.restrictedToWorld()) {
|
||||
plugin.messageNoPrefix(sender, "info-regionRestrictedWorldRent", rent);
|
||||
}
|
||||
}
|
||||
plugin.messageNoPrefix(sender, "info-regionFooterRent", rent);
|
||||
} else if(buy != null) {
|
||||
plugin.message(sender, "info-regionHeaderBuy", buy);
|
||||
if(buy.isSold()) {
|
||||
plugin.messageNoPrefix(sender, "info-regionBought", buy);
|
||||
plugin.messageNoPrefix(sender, "info-regionMoneyBackBuy", buy);
|
||||
if(!buy.getFriendNames().isEmpty()) {
|
||||
plugin.messageNoPrefix(sender, "info-regionFriends", buy);
|
||||
}
|
||||
} else {
|
||||
plugin.messageNoPrefix(sender, "info-regionCanBeBought", buy);
|
||||
}
|
||||
if(buy.getInactiveTimeUntilSell() != -1) {
|
||||
plugin.messageNoPrefix(sender, "info-regionInactiveSell", buy);
|
||||
}
|
||||
if(sender.hasPermission("areashop.teleport") || sender.hasPermission("areashop.teleportall")) {
|
||||
Location teleport = buy.getTeleportLocation();
|
||||
if(teleport == null) {
|
||||
if(buy.isSold()) {
|
||||
plugin.messageNoPrefix(sender, "info-regionNoTeleport", buy, plugin.getLanguageManager().getLang("info-regionTeleportHint", buy));
|
||||
} else {
|
||||
plugin.messageNoPrefix(sender, "info-regionNoTeleport", buy, "");
|
||||
}
|
||||
} else {
|
||||
plugin.messageNoPrefix(sender, "info-regionTeleportAt", buy, teleport.getWorld().getName(), teleport.getBlockX(), teleport.getBlockY(), teleport.getBlockZ(), (int)teleport.getPitch(), (int)teleport.getYaw());
|
||||
}
|
||||
}
|
||||
List<String> signLocations = new ArrayList<String>();
|
||||
for(Location location : buy.getSignLocations()) {
|
||||
signLocations.add(plugin.getLanguageManager().getLang("info-regionSignLocation", location.getWorld().getName(), location.getBlockX(), location.getBlockY(), location.getBlockZ()));
|
||||
}
|
||||
if(!signLocations.isEmpty()) {
|
||||
plugin.messageNoPrefix(sender, "info-regionSigns", Utils.createCommaSeparatedList(signLocations));
|
||||
}
|
||||
if(sender.hasPermission("areashop.groupinfo") && !buy.getGroupNames().isEmpty()) {
|
||||
plugin.messageNoPrefix(sender, "info-regionGroups", Utils.createCommaSeparatedList(buy.getGroupNames()));
|
||||
}
|
||||
if(buy.isRestoreEnabled()) {
|
||||
if(sender.hasPermission("areashop.setrestore")) {
|
||||
plugin.messageNoPrefix(sender, "info-regionRestoringBuy", buy, plugin.getLanguageManager().getLang("info-regionRestoringProfile", buy.getRestoreProfile()));
|
||||
} else {
|
||||
plugin.messageNoPrefix(sender, "info-regionRestoringBuy", buy, "");
|
||||
}
|
||||
}
|
||||
if(!buy.isSold()) {
|
||||
if(buy.restrictedToRegion()) {
|
||||
plugin.messageNoPrefix(sender, "info-regionRestrictedRegionBuy", buy);
|
||||
} else if(buy.restrictedToWorld()) {
|
||||
plugin.messageNoPrefix(sender, "info-regionRestrictedWorldBuy", buy);
|
||||
}
|
||||
}
|
||||
plugin.messageNoPrefix(sender, "info-regionFooterBuy", buy);
|
||||
}
|
||||
} else {
|
||||
plugin.message(sender, "info-regionHelp");
|
||||
}
|
||||
} else {
|
||||
plugin.message(sender, "info-help");
|
||||
}
|
||||
} else {
|
||||
plugin.message(sender, "info-help");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create a comma-space separated list from a collection of strings
|
||||
* @param list The collection with strings
|
||||
* @return A comma-space separated list of the strings in the collection
|
||||
*/
|
||||
public String createCommaString(Collection<String> list) {
|
||||
String result = "";
|
||||
boolean first = true;
|
||||
for(String part : list) {
|
||||
if(first) {
|
||||
result += part;
|
||||
first = false;
|
||||
} else {
|
||||
result += ", " + part;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getTabCompleteList(int toComplete, String[] start) {
|
||||
List<String> result = new ArrayList<String>();
|
||||
if(toComplete == 2) {
|
||||
result.addAll(Arrays.asList("all", "rented", "forrent", "sold", "forsale", "player", "region"));
|
||||
} else if(toComplete == 3) {
|
||||
if(start[2].equalsIgnoreCase("player")) {
|
||||
for(Player player : Bukkit.getOnlinePlayers()) {
|
||||
result.add(player.getName());
|
||||
}
|
||||
} else if(start[2].equalsIgnoreCase("region")) {
|
||||
result.addAll(plugin.getFileManager().getBuyNames());
|
||||
result.addAll(plugin.getFileManager().getRentNames());
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,126 @@
|
||||
package nl.evolutioncoding.areashop.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import nl.evolutioncoding.areashop.AreaShop;
|
||||
import nl.evolutioncoding.areashop.regions.BuyRegion;
|
||||
import nl.evolutioncoding.areashop.regions.GeneralRegion;
|
||||
import nl.evolutioncoding.areashop.regions.RentRegion;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class MeCommand extends CommandAreaShop {
|
||||
|
||||
public MeCommand(AreaShop plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandStart() {
|
||||
return "areashop me";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHelp(CommandSender target) {
|
||||
if(target.hasPermission("areashop.me")) {
|
||||
return plugin.getLanguageManager().getLang("help-me");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, Command command, String[] args) {
|
||||
if(!sender.hasPermission("areashop.me")) {
|
||||
plugin.message(sender, "me-noPermission");
|
||||
return;
|
||||
}
|
||||
if(!(sender instanceof Player)) {
|
||||
plugin.message(sender, "me-notAPlayer");
|
||||
return;
|
||||
}
|
||||
Player player = (Player)sender;
|
||||
// Get the regions owned by the player
|
||||
Set<RentRegion> rentRegions = new HashSet<RentRegion>();
|
||||
for(RentRegion region : plugin.getFileManager().getRents()) {
|
||||
if(region.isOwner(player)) {
|
||||
rentRegions.add(region);
|
||||
}
|
||||
}
|
||||
Set<BuyRegion> buyRegions = new HashSet<BuyRegion>();
|
||||
for(BuyRegion region : plugin.getFileManager().getBuys()) {
|
||||
if(region.isOwner(player)) {
|
||||
buyRegions.add(region);
|
||||
}
|
||||
}
|
||||
// Send messages
|
||||
if(rentRegions.isEmpty()) {
|
||||
plugin.message(player, "me-noRentRegions");
|
||||
} else {
|
||||
plugin.message(player, "me-rentRegions");
|
||||
for(RentRegion region : rentRegions) {
|
||||
plugin.messageNoPrefix(player, "me-rentLine", region);
|
||||
}
|
||||
}
|
||||
if(buyRegions.isEmpty()) {
|
||||
plugin.message(player, "me-noBuyRegions");
|
||||
} else {
|
||||
plugin.message(player, "me-buyRegions");
|
||||
for(BuyRegion region : buyRegions) {
|
||||
plugin.messageNoPrefix(player, "me-buyLine", region);
|
||||
}
|
||||
}
|
||||
Set<GeneralRegion> friendRegions = new HashSet<GeneralRegion>();
|
||||
for(GeneralRegion region : plugin.getFileManager().getRegions()) {
|
||||
if(region.getFriends().contains(player.getUniqueId())) {
|
||||
friendRegions.add(region);
|
||||
}
|
||||
}
|
||||
if(friendRegions.isEmpty()) {
|
||||
plugin.message(player, "me-noFriendRegions");
|
||||
} else {
|
||||
plugin.message(player, "me-friendRegions");
|
||||
for(GeneralRegion region : friendRegions) {
|
||||
plugin.messageNoPrefix(player, "me-friendLine", region);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getTabCompleteList(int toComplete, String[] start) {
|
||||
List<String> result = new ArrayList<String>();
|
||||
// Nothing to complete
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
package nl.evolutioncoding.areashop.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import nl.evolutioncoding.areashop.AreaShop;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
public class ReloadCommand extends CommandAreaShop {
|
||||
|
||||
public ReloadCommand(AreaShop plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandStart() {
|
||||
return "areashop reload";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHelp(CommandSender target) {
|
||||
if(target.hasPermission("areashop.reload")) {
|
||||
return plugin.getLanguageManager().getLang("help-reload");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, Command command, String[] args) {
|
||||
if(sender.hasPermission("areashop.reload")) {
|
||||
plugin.reload();
|
||||
plugin.message(sender, "reload-reloaded");
|
||||
} else {
|
||||
plugin.message(sender, "reload-noPermission");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getTabCompleteList(int toComplete, String[] start) {
|
||||
ArrayList<String> result = new ArrayList<String>();
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package nl.evolutioncoding.areashop.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import nl.evolutioncoding.areashop.AreaShop;
|
||||
import nl.evolutioncoding.areashop.regions.RentRegion;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class RentCommand extends CommandAreaShop {
|
||||
|
||||
public RentCommand(AreaShop plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandStart() {
|
||||
return "areashop rent";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHelp(CommandSender target) {
|
||||
if(target.hasPermission("areashop.rent")) {
|
||||
return plugin.getLanguageManager().getLang("help-rent");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, Command command, String[] args) {
|
||||
if(!sender.hasPermission("areashop.rent")) {
|
||||
plugin.message(sender, "rent-noPermission");
|
||||
return;
|
||||
}
|
||||
if (!(sender instanceof Player)) {
|
||||
plugin.message(sender, "cmd-onlyByPlayer");
|
||||
return;
|
||||
}
|
||||
Player player = (Player)sender;
|
||||
if(args.length > 1 && args[1] != null) {
|
||||
RentRegion rent = plugin.getFileManager().getRent(args[1]);
|
||||
if(rent == null) {
|
||||
plugin.message(sender, "rent-notRentable");
|
||||
} else {
|
||||
rent.rent(player);
|
||||
}
|
||||
} else {
|
||||
// get the region by location
|
||||
List<RentRegion> regions = plugin.getFileManager().getApplicableRentRegions(((Player) sender).getLocation());
|
||||
if (regions.isEmpty()) {
|
||||
plugin.message(sender, "cmd-noRegionsAtLocation");
|
||||
return;
|
||||
} else if (regions.size() > 1) {
|
||||
plugin.message(sender, "cmd-moreRegionsAtLocation");
|
||||
return;
|
||||
} else {
|
||||
regions.get(0).rent(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getTabCompleteList(int toComplete, String[] start) {
|
||||
ArrayList<String> result = new ArrayList<String>();
|
||||
if(toComplete == 2) {
|
||||
for(RentRegion region : plugin.getFileManager().getRents()) {
|
||||
if(!region.isRented()) {
|
||||
result.add(region.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
package nl.evolutioncoding.areashop.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import nl.evolutioncoding.areashop.AreaShop;
|
||||
import nl.evolutioncoding.areashop.regions.BuyRegion;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class ResellCommand extends CommandAreaShop {
|
||||
|
||||
public ResellCommand(AreaShop plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandStart() {
|
||||
return "areashop resell";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHelp(CommandSender target) {
|
||||
if(target.hasPermission("areashop.resellall")) {
|
||||
return plugin.getLanguageManager().getLang("help-resellAll");
|
||||
} else if(target.hasPermission("areashop.resell")) {
|
||||
return plugin.getLanguageManager().getLang("help-resell");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, Command command, String[] args) {
|
||||
if(!sender.hasPermission("areashop.resell") && !sender.hasPermission("areashop.resellall")) {
|
||||
plugin.message(sender, "resell-noPermissionOther");
|
||||
return;
|
||||
}
|
||||
|
||||
if(args.length <= 1) {
|
||||
plugin.message(sender, "resell-help");
|
||||
return;
|
||||
}
|
||||
double price = 0.0;
|
||||
try {
|
||||
price = Double.parseDouble(args[1]);
|
||||
} catch(NumberFormatException e) {
|
||||
plugin.message(sender, "resell-wrongPrice", args[1]);
|
||||
return;
|
||||
}
|
||||
BuyRegion buy = null;
|
||||
if(args.length <= 2) {
|
||||
if (sender instanceof Player) {
|
||||
// get the region by location
|
||||
List<BuyRegion> regions = plugin.getFileManager().getApplicableBuyRegions(((Player) sender).getLocation());
|
||||
if (regions.isEmpty()) {
|
||||
plugin.message(sender, "cmd-noRegionsAtLocation");
|
||||
return;
|
||||
} else if (regions.size() > 1) {
|
||||
plugin.message(sender, "cmd-moreRegionsAtLocation");
|
||||
return;
|
||||
} else {
|
||||
buy = regions.get(0);
|
||||
}
|
||||
} else {
|
||||
plugin.message(sender, "cmd-automaticRegionOnlyByPlayer");
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
buy = plugin.getFileManager().getBuy(args[2]);
|
||||
if(buy == null) {
|
||||
plugin.message(sender, "resell-notRegistered", args[2]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if(buy == null) {
|
||||
plugin.message(sender, "resell-noRegionFound");
|
||||
return;
|
||||
}
|
||||
if(!buy.isSold()) {
|
||||
plugin.message(sender, "resell-notBought", buy);
|
||||
return;
|
||||
}
|
||||
if(sender.hasPermission("areashop.resellall")) {
|
||||
buy.enableReselling(price);
|
||||
buy.saveRequired();
|
||||
plugin.message(sender, "resell-success", buy);
|
||||
buy.updateSigns();
|
||||
buy.updateRegionFlags();
|
||||
} else if(sender.hasPermission("areashop.resell") && sender instanceof Player) {
|
||||
if(buy.isOwner((Player)sender)) {
|
||||
buy.enableReselling(price);
|
||||
buy.saveRequired();
|
||||
plugin.message(sender, "resell-success", buy);
|
||||
buy.updateSigns();
|
||||
buy.updateRegionFlags();
|
||||
} else {
|
||||
plugin.message(sender, "resell-noPermissionOther");
|
||||
}
|
||||
} else {
|
||||
plugin.message(sender, "resell-noPermission");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getTabCompleteList(int toComplete, String[] start) {
|
||||
ArrayList<String> result = new ArrayList<String>();
|
||||
if(toComplete == 3) {
|
||||
for(BuyRegion region : plugin.getFileManager().getBuys()) {
|
||||
if(region.isSold() && !region.isInResellingMode()) {
|
||||
result.add(region.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
package nl.evolutioncoding.areashop.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import nl.evolutioncoding.areashop.AreaShop;
|
||||
import nl.evolutioncoding.areashop.Utils;
|
||||
import nl.evolutioncoding.areashop.regions.GeneralRegion;
|
||||
import nl.evolutioncoding.areashop.regions.GeneralRegion.RegionEvent;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
public class SchematiceventCommand extends CommandAreaShop {
|
||||
|
||||
public SchematiceventCommand(AreaShop plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandStart() {
|
||||
return "areashop schemevent";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHelp(CommandSender target) {
|
||||
if(target.hasPermission("areashop.schematicevents")) {
|
||||
return plugin.getLanguageManager().getLang("help-schemevent");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, Command command, String[] args) {
|
||||
if(!sender.hasPermission("areashop.schematicevents")) {
|
||||
plugin.message(sender, "schemevent-noPermission");
|
||||
return;
|
||||
}
|
||||
|
||||
if(args.length < 3 || args[1] == null || args[2] == null) {
|
||||
plugin.message(sender, "schemevent-help");
|
||||
return;
|
||||
}
|
||||
GeneralRegion region = plugin.getFileManager().getRegion(args[1]);
|
||||
if(region == null) {
|
||||
plugin.message(sender, "schemevent-noRegion", args[1]);
|
||||
return;
|
||||
}
|
||||
|
||||
RegionEvent event = null;
|
||||
boolean exception = false;
|
||||
try {
|
||||
event = RegionEvent.valueOf(args[2].toUpperCase());
|
||||
} catch(IllegalArgumentException e) {
|
||||
exception = true;
|
||||
}
|
||||
// Check for a totally wrong event or a non matching event
|
||||
if(exception) {
|
||||
ArrayList<String> values = new ArrayList<String>();
|
||||
for(RegionEvent value : RegionEvent.values()) {
|
||||
values.add(value.getValue().toLowerCase());
|
||||
}
|
||||
plugin.message(sender, "schemevent-wrongEvent", args[2], Utils.createCommaSeparatedList(values));
|
||||
return;
|
||||
}
|
||||
region.handleSchematicEvent(event);
|
||||
plugin.message(sender, "schemevent-success", args[2], region.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getTabCompleteList(int toComplete, String[] start) {
|
||||
ArrayList<String> result = new ArrayList<String>();
|
||||
if(toComplete == 2) {
|
||||
result.addAll(plugin.getFileManager().getRegionNames());
|
||||
} else if(toComplete == 3) {
|
||||
GeneralRegion region = plugin.getFileManager().getRegion(start[2]);
|
||||
if(region != null) {
|
||||
if(region.isRentRegion()) {
|
||||
result.addAll(Arrays.asList("created", "deleted", "rented", "unrented"));
|
||||
} else if(region.isBuyRegion()) {
|
||||
result.addAll(Arrays.asList("created", "deleted", "bought", "sold"));
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
package nl.evolutioncoding.areashop.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import nl.evolutioncoding.areashop.AreaShop;
|
||||
import nl.evolutioncoding.areashop.regions.BuyRegion;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class SellCommand extends CommandAreaShop {
|
||||
|
||||
public SellCommand(AreaShop plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandStart() {
|
||||
return "areashop sell";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHelp(CommandSender target) {
|
||||
if(target.hasPermission("areashop.sell")) {
|
||||
return plugin.getLanguageManager().getLang("help-sell");
|
||||
} else if(target.hasPermission("areashop.sellown")) {
|
||||
return plugin.getLanguageManager().getLang("help-sellOwn");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, Command command, String[] args) {
|
||||
if(!sender.hasPermission("areashop.sell") && !sender.hasPermission("areashop.sellown")) {
|
||||
plugin.message(sender, "sell-noPermission");
|
||||
return;
|
||||
}
|
||||
BuyRegion buy = null;
|
||||
if(args.length <= 1) {
|
||||
if (sender instanceof Player) {
|
||||
// get the region by location
|
||||
List<BuyRegion> regions = plugin.getFileManager().getApplicableBuyRegions(((Player) sender).getLocation());
|
||||
if (regions.isEmpty()) {
|
||||
plugin.message(sender, "cmd-noRegionsAtLocation");
|
||||
return;
|
||||
} else if (regions.size() > 1) {
|
||||
plugin.message(sender, "cmd-moreRegionsAtLocation");
|
||||
return;
|
||||
} else {
|
||||
buy = regions.get(0);
|
||||
}
|
||||
} else {
|
||||
plugin.message(sender, "cmd-automaticRegionOnlyByPlayer");
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
buy = plugin.getFileManager().getBuy(args[1]);
|
||||
}
|
||||
if(buy == null) {
|
||||
plugin.message(sender, "sell-notRegistered");
|
||||
return;
|
||||
}
|
||||
if(!buy.isSold()) {
|
||||
plugin.message(sender, "sell-notBought");
|
||||
return;
|
||||
}
|
||||
if(sender.hasPermission("areashop.sell")) {
|
||||
plugin.message(sender, "sell-sold", buy.getPlayerName());
|
||||
buy.sell(true);
|
||||
} else {
|
||||
if(sender.hasPermission("areashop.sellown") && sender instanceof Player) {
|
||||
if(buy.getBuyer().equals(((Player)sender).getUniqueId())) {
|
||||
plugin.message(sender, "sell-soldYours");
|
||||
buy.sell(true);
|
||||
} else {
|
||||
plugin.message(sender, "sell-noPermissionOther");
|
||||
}
|
||||
} else {
|
||||
plugin.message(sender, "sell-noPermission");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getTabCompleteList(int toComplete, String[] start) {
|
||||
ArrayList<String> result = new ArrayList<String>();
|
||||
if(toComplete == 2) {
|
||||
for(BuyRegion region : plugin.getFileManager().getBuys()) {
|
||||
if(region.isSold()) {
|
||||
result.add(region.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
package nl.evolutioncoding.areashop.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import nl.evolutioncoding.areashop.AreaShop;
|
||||
import nl.evolutioncoding.areashop.regions.RentRegion;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class SetdurationCommand extends CommandAreaShop {
|
||||
|
||||
public SetdurationCommand(AreaShop plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandStart() {
|
||||
return "areashop setduration";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHelp(CommandSender target) {
|
||||
if(target.hasPermission("areashop.setduration")) {
|
||||
return plugin.getLanguageManager().getLang("help-setduration");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, Command command, String[] args) {
|
||||
if(!sender.hasPermission("areashop.setduration")) {
|
||||
plugin.message(sender, "setduration-noPermission");
|
||||
return;
|
||||
}
|
||||
if(args.length < 3 || args[1] == null || args[2] == null) {
|
||||
plugin.message(sender, "setduration-help");
|
||||
return;
|
||||
}
|
||||
RentRegion rent = null;
|
||||
if(args.length <= 3) {
|
||||
if (sender instanceof Player) {
|
||||
// get the region by location
|
||||
List<RentRegion> regions = plugin.getFileManager().getApplicableRentRegions(((Player) sender).getLocation());
|
||||
if (regions.isEmpty()) {
|
||||
plugin.message(sender, "cmd-noRegionsAtLocation");
|
||||
return;
|
||||
} else if (regions.size() > 1) {
|
||||
plugin.message(sender, "cmd-moreRegionsAtLocation");
|
||||
return;
|
||||
} else {
|
||||
rent = regions.get(0);
|
||||
}
|
||||
} else {
|
||||
plugin.message(sender, "cmd-automaticRegionOnlyByPlayer");
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
rent = plugin.getFileManager().getRent(args[3]);
|
||||
}
|
||||
if(rent == null) {
|
||||
plugin.message(sender, "setduration-notRegistered", args[3]);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
Integer.parseInt(args[1]);
|
||||
} catch(NumberFormatException e) {
|
||||
plugin.message(sender, "setduration-wrongAmount", args[1]);
|
||||
return;
|
||||
}
|
||||
if(!plugin.checkTimeFormat(args[1] + " " + args[2])) {
|
||||
plugin.message(sender, "setduration-wrongFormat", args[1]+" "+args[2]);
|
||||
return;
|
||||
}
|
||||
rent.setDuration(args[1]+" "+args[2]);
|
||||
rent.updateRegionFlags();
|
||||
rent.updateSigns();
|
||||
rent.saveRequired();
|
||||
plugin.message(sender, "setduration-success", rent.getName(), rent.getDurationString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getTabCompleteList(int toComplete, String[] start) {
|
||||
List<String> result = new ArrayList<String>();
|
||||
if(toComplete == 2) {
|
||||
result = plugin.getFileManager().getRentNames();
|
||||
} else if(toComplete == 4) {
|
||||
result.addAll(plugin.getConfig().getStringList("minutes"));
|
||||
result.addAll(plugin.getConfig().getStringList("hours"));
|
||||
result.addAll(plugin.getConfig().getStringList("days"));
|
||||
result.addAll(plugin.getConfig().getStringList("months"));
|
||||
result.addAll(plugin.getConfig().getStringList("years"));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,147 @@
|
||||
package nl.evolutioncoding.areashop.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import nl.evolutioncoding.areashop.AreaShop;
|
||||
import nl.evolutioncoding.areashop.regions.BuyRegion;
|
||||
import nl.evolutioncoding.areashop.regions.GeneralRegion;
|
||||
import nl.evolutioncoding.areashop.regions.RentRegion;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class SetownerCommand extends CommandAreaShop {
|
||||
|
||||
public SetownerCommand(AreaShop plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandStart() {
|
||||
return "areashop setowner";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHelp(CommandSender target) {
|
||||
if(target.hasPermission("areashop.setownerrent") || target.hasPermission("areashop.setownerbuy")) {
|
||||
return plugin.getLanguageManager().getLang("help-setowner");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, Command command, String[] args) {
|
||||
if(!sender.hasPermission("areashop.setownerrent") && !sender.hasPermission("areashop.setownerbuy")) {
|
||||
plugin.message(sender, "setowner-noPermission");
|
||||
return;
|
||||
}
|
||||
GeneralRegion region;
|
||||
if(args.length < 2) {
|
||||
plugin.message(sender, "setowner-help");
|
||||
return;
|
||||
}
|
||||
if(args.length == 2) {
|
||||
if (sender instanceof Player) {
|
||||
// get the region by location
|
||||
List<GeneralRegion> regions = plugin.getFileManager().getAllApplicableRegions(((Player) sender).getLocation());
|
||||
if (regions.isEmpty()) {
|
||||
plugin.message(sender, "cmd-noRegionsAtLocation");
|
||||
return;
|
||||
} else if (regions.size() > 1) {
|
||||
plugin.message(sender, "cmd-moreRegionsAtLocation");
|
||||
return;
|
||||
} else {
|
||||
region = regions.get(0);
|
||||
}
|
||||
} else {
|
||||
plugin.message(sender, "cmd-automaticRegionOnlyByPlayer");
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
region = plugin.getFileManager().getRegion(args[2]);
|
||||
}
|
||||
if(region == null) {
|
||||
plugin.message(sender, "setowner-notRegistered");
|
||||
return;
|
||||
}
|
||||
|
||||
if(region.isRentRegion() && !sender.hasPermission("areashop.setownerrent")) {
|
||||
plugin.message(sender, "setowner-noPermissionRent");
|
||||
return;
|
||||
}
|
||||
if(region.isBuyRegion() && !sender.hasPermission("areashop.setownerbuy")) {
|
||||
plugin.message(sender, "setowner-noPermissionBuy");
|
||||
return;
|
||||
}
|
||||
|
||||
UUID uuid = null;
|
||||
@SuppressWarnings("deprecation")
|
||||
OfflinePlayer player = Bukkit.getOfflinePlayer(args[1]);
|
||||
if(player != null) {
|
||||
uuid = player.getUniqueId();
|
||||
}
|
||||
if(uuid == null) {
|
||||
plugin.message(sender, "setowner-noPlayer", args[1]);
|
||||
return;
|
||||
}
|
||||
|
||||
if(region.isRentRegion()) {
|
||||
RentRegion rent = (RentRegion)region;
|
||||
if(rent.isRenter(uuid)) {
|
||||
// extend
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTimeInMillis(rent.getRentedUntil() + rent.getDuration());
|
||||
rent.setRentedUntil(calendar.getTimeInMillis());
|
||||
rent.setRenter(uuid);
|
||||
plugin.message(sender, "setowner-succesRentExtend", region);
|
||||
} else {
|
||||
// change
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
long current = calendar.getTimeInMillis();
|
||||
if(rent.isRented()) {
|
||||
current = rent.getRentedUntil();
|
||||
}
|
||||
calendar.setTimeInMillis(current + rent.getDuration());
|
||||
rent.setRentedUntil(calendar.getTimeInMillis());
|
||||
rent.setRenter(uuid);
|
||||
plugin.message(sender, "setowner-succesRent", region);
|
||||
}
|
||||
rent.updateRegionFlags();
|
||||
rent.updateSigns();
|
||||
}
|
||||
if(region.isBuyRegion()) {
|
||||
BuyRegion buy = (BuyRegion)region;
|
||||
buy.setBuyer(uuid);
|
||||
plugin.message(sender, "setowner-succesBuy", region);
|
||||
buy.updateRegionFlags();
|
||||
buy.updateSigns();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getTabCompleteList(int toComplete, String[] start) {
|
||||
ArrayList<String> result = new ArrayList<String>();
|
||||
if(toComplete == 2) {
|
||||
for(Player player : Bukkit.getOnlinePlayers()) {
|
||||
result.add(player.getName());
|
||||
}
|
||||
} else if(toComplete == 3) {
|
||||
result.addAll(plugin.getFileManager().getRegionNames());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
package nl.evolutioncoding.areashop.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import nl.evolutioncoding.areashop.AreaShop;
|
||||
import nl.evolutioncoding.areashop.regions.BuyRegion;
|
||||
import nl.evolutioncoding.areashop.regions.GeneralRegion;
|
||||
import nl.evolutioncoding.areashop.regions.RentRegion;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class SetpriceCommand extends CommandAreaShop {
|
||||
|
||||
public SetpriceCommand(AreaShop plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandStart() {
|
||||
return "areashop setprice";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHelp(CommandSender target) {
|
||||
if(target.hasPermission("areashop.setprice")) {
|
||||
return plugin.getLanguageManager().getLang("help-setprice");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, Command command, String[] args) {
|
||||
if(!sender.hasPermission("areashop.setprice")) {
|
||||
plugin.message(sender, "setprice-noPermission");
|
||||
return;
|
||||
}
|
||||
if(args.length < 2 || args[1] == null) {
|
||||
plugin.message(sender, "setprice-help");
|
||||
return;
|
||||
}
|
||||
GeneralRegion region = null;
|
||||
if(args.length < 3) {
|
||||
if (sender instanceof Player) {
|
||||
// get the region by location
|
||||
List<GeneralRegion> regions = plugin.getFileManager().getAllApplicableRegions(((Player) sender).getLocation());
|
||||
if (regions.isEmpty()) {
|
||||
plugin.message(sender, "cmd-noRegionsAtLocation");
|
||||
return;
|
||||
} else if (regions.size() > 1) {
|
||||
plugin.message(sender, "cmd-moreRegionsAtLocation");
|
||||
return;
|
||||
} else {
|
||||
region = regions.get(0);
|
||||
}
|
||||
} else {
|
||||
plugin.message(sender, "cmd-automaticRegionOnlyByPlayer");
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
region = plugin.getFileManager().getRegion(args[2]);
|
||||
}
|
||||
if(region == null) {
|
||||
plugin.message(sender, "setprice-notRegistered", args[2]);
|
||||
return;
|
||||
}
|
||||
double price = 0.0;
|
||||
try {
|
||||
price = Double.parseDouble(args[1]);
|
||||
} catch(NumberFormatException e) {
|
||||
plugin.message(sender, "setprice-wrongPrice", args[1]);
|
||||
return;
|
||||
}
|
||||
if(region.isRentRegion()) {
|
||||
((RentRegion)region).setPrice(price);
|
||||
plugin.message(sender, "setprice-successRent", region.getName(), ((RentRegion)region).getFormattedPrice(), ((RentRegion)region).getDurationString());
|
||||
} else if(region.isBuyRegion()) {
|
||||
((BuyRegion)region).setPrice(price);
|
||||
plugin.message(sender, "setprice-successBuy", region.getName(), ((BuyRegion)region).getFormattedPrice());
|
||||
}
|
||||
region.updateSigns();
|
||||
region.updateRegionFlags();
|
||||
region.saveRequired();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getTabCompleteList(int toComplete, String[] start) {
|
||||
List<String> result = new ArrayList<String>();
|
||||
if(toComplete == 2) {
|
||||
result = plugin.getFileManager().getRegionNames();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package nl.evolutioncoding.areashop.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import nl.evolutioncoding.areashop.AreaShop;
|
||||
import nl.evolutioncoding.areashop.regions.GeneralRegion;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
public class SetrestoreCommand extends CommandAreaShop {
|
||||
|
||||
public SetrestoreCommand(AreaShop plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandStart() {
|
||||
return "areashop setrestore";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHelp(CommandSender target) {
|
||||
if(target.hasPermission("areashop.setrestore")) {
|
||||
return plugin.getLanguageManager().getLang("help-setrestore");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, Command command, String[] args) {
|
||||
if(!sender.hasPermission("areashop.setrestore")) {
|
||||
plugin.message(sender, "setrestore-noPermission");
|
||||
return;
|
||||
}
|
||||
if(args.length <= 2 || args[1] == null || args[2] == null) {
|
||||
plugin.message(sender, "setrestore-help");
|
||||
return;
|
||||
}
|
||||
GeneralRegion region = plugin.getFileManager().getRegion(args[1]);
|
||||
if(region == null) {
|
||||
plugin.message(sender, "setrestore-notRegistered", args[1]);
|
||||
return;
|
||||
}
|
||||
String value = null;
|
||||
if(args[2].equalsIgnoreCase("true") || args[2].equalsIgnoreCase("false") || args[2].equalsIgnoreCase("general")) {
|
||||
value = args[2].toLowerCase();
|
||||
} else {
|
||||
plugin.message(sender, "setrestore-invalidSetting", args[2]);
|
||||
return;
|
||||
}
|
||||
region.setRestoreSetting(value);
|
||||
if(args.length > 3) {
|
||||
region.setRestoreProfile(args[3]);
|
||||
plugin.message(sender, "setrestore-successProfile", region.getName(), value, args[3]);
|
||||
} else {
|
||||
plugin.message(sender, "setrestore-success", region.getName(), value);
|
||||
}
|
||||
region.saveRequired();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getTabCompleteList(int toComplete, String[] start) {
|
||||
List<String> result = new ArrayList<String>();
|
||||
if(toComplete == 2) {
|
||||
result = plugin.getFileManager().getRegionNames();
|
||||
} else if(toComplete == 3) {
|
||||
result.add("true");
|
||||
result.add("false");
|
||||
result.add("general");
|
||||
} else if(toComplete == 4) {
|
||||
result.addAll(plugin.getConfig().getConfigurationSection("schematicProfiles").getKeys(false));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
package nl.evolutioncoding.areashop.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import nl.evolutioncoding.areashop.AreaShop;
|
||||
import nl.evolutioncoding.areashop.regions.BuyRegion;
|
||||
import nl.evolutioncoding.areashop.regions.GeneralRegion;
|
||||
import nl.evolutioncoding.areashop.regions.RentRegion;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
|
||||
|
||||
public class SetteleportCommand extends CommandAreaShop {
|
||||
|
||||
public SetteleportCommand(AreaShop plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandStart() {
|
||||
return "areashop settp";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHelp(CommandSender target) {
|
||||
if(target.hasPermission("areashop.teleportall")) {
|
||||
return plugin.getLanguageManager().getLang("help-setteleportAll");
|
||||
} else if(target.hasPermission("areashop.teleport")) {
|
||||
return plugin.getLanguageManager().getLang("help-setteleport");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, Command command, String[] args) {
|
||||
if(!sender.hasPermission("areashop.setteleport") && !sender.hasPermission("areashop.setteleportall")) {
|
||||
plugin.message(sender, "setteleport-noPermission");
|
||||
return;
|
||||
}
|
||||
if (!(sender instanceof Player)) {
|
||||
plugin.message(sender, "onlyByPlayer");
|
||||
return;
|
||||
}
|
||||
Player player = (Player) sender;
|
||||
GeneralRegion region = null;
|
||||
// get the region by location
|
||||
List<GeneralRegion> regions = plugin.getFileManager().getAllApplicableRegions(((Player) sender).getLocation());
|
||||
if (regions.isEmpty()) {
|
||||
plugin.message(sender, "cmd-noRegionsAtLocation");
|
||||
return;
|
||||
} else if (regions.size() > 1) {
|
||||
plugin.message(sender, "cmd-moreRegionsAtLocation");
|
||||
return;
|
||||
} else {
|
||||
region = regions.get(0);
|
||||
}
|
||||
|
||||
boolean owner = false;
|
||||
|
||||
if(region == null) {
|
||||
plugin.message(player, "setteleport-noRentOrBuy", args[1]);
|
||||
return;
|
||||
}
|
||||
if(region.isRentRegion()) {
|
||||
owner = player.getUniqueId().equals(((RentRegion)region).getRenter());
|
||||
} else {
|
||||
owner = player.getUniqueId().equals(((BuyRegion)region).getBuyer());
|
||||
}
|
||||
if(!player.hasPermission("areashop.setteleport")) {
|
||||
plugin.message(player, "setteleport-noPermission");
|
||||
return;
|
||||
} else if(!owner && !player.hasPermission("areashop.setteleportall")) {
|
||||
plugin.message(player, "setteleport-noPermissionOther");
|
||||
return;
|
||||
}
|
||||
|
||||
ProtectedRegion wgRegion = region.getRegion();
|
||||
if(args.length > 2 && args[2] != null && (args[2].equalsIgnoreCase("reset") || args[2].equalsIgnoreCase("yes") || args[2].equalsIgnoreCase("true"))) {
|
||||
region.setTeleport(null);
|
||||
plugin.message(player, "setteleport-reset", region.getName());
|
||||
return;
|
||||
}
|
||||
if(!wgRegion.contains(player.getLocation().getBlockX(), player.getLocation().getBlockY(), player.getLocation().getBlockZ()) && !player.hasPermission("areashop.setteleportoutsideregion")) {
|
||||
plugin.message(player, "setteleport-notInside", region.getName());
|
||||
return;
|
||||
}
|
||||
region.setTeleport(player.getLocation());
|
||||
plugin.message(player, "setteleport-success", region.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getTabCompleteList(int toComplete, String[] start) {
|
||||
ArrayList<String> result = new ArrayList<String>();
|
||||
if(toComplete == 2) {
|
||||
result.addAll(plugin.getFileManager().getRegionNames());
|
||||
} else if(toComplete == 3) {
|
||||
result.add("reset");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
package nl.evolutioncoding.areashop.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import nl.evolutioncoding.areashop.AreaShop;
|
||||
import nl.evolutioncoding.areashop.regions.BuyRegion;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class StopresellCommand extends CommandAreaShop {
|
||||
|
||||
public StopresellCommand(AreaShop plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandStart() {
|
||||
return "areashop stopresell";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHelp(CommandSender target) {
|
||||
if(target.hasPermission("areashop.stopresellall")) {
|
||||
return plugin.getLanguageManager().getLang("help-stopResellAll");
|
||||
} else if(target.hasPermission("areashop.stopresell")) {
|
||||
return plugin.getLanguageManager().getLang("help-stopResell");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, Command command, String[] args) {
|
||||
if(!sender.hasPermission("areashop.stopresell") && !sender.hasPermission("areashop.stopresellall")) {
|
||||
plugin.message(sender, "stopresell-noPermissionOther");
|
||||
return;
|
||||
}
|
||||
|
||||
BuyRegion buy = null;
|
||||
if(args.length <= 1) {
|
||||
if (sender instanceof Player) {
|
||||
// get the region by location
|
||||
List<BuyRegion> regions = plugin.getFileManager().getApplicableBuyRegions(((Player) sender).getLocation());
|
||||
if (regions.isEmpty()) {
|
||||
plugin.message(sender, "cmd-noRegionsAtLocation");
|
||||
return;
|
||||
} else if (regions.size() > 1) {
|
||||
plugin.message(sender, "cmd-moreRegionsAtLocation");
|
||||
return;
|
||||
} else {
|
||||
buy = regions.get(0);
|
||||
}
|
||||
} else {
|
||||
plugin.message(sender, "cmd-automaticRegionOnlyByPlayer");
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
buy = plugin.getFileManager().getBuy(args[1]);
|
||||
if(buy == null) {
|
||||
plugin.message(sender, "stopresell-notRegistered", args[1]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if(buy == null) {
|
||||
plugin.message(sender, "stopresell-noRegionFound");
|
||||
return;
|
||||
}
|
||||
if(!buy.isInResellingMode()) {
|
||||
plugin.message(sender, "stopresell-notResell", buy);
|
||||
return;
|
||||
}
|
||||
if(sender.hasPermission("areashop.stopresellall")) {
|
||||
buy.disableReselling();
|
||||
buy.saveRequired();
|
||||
plugin.message(sender, "stopresell-success", buy);
|
||||
buy.updateSigns();
|
||||
buy.updateRegionFlags();
|
||||
} else if(sender.hasPermission("areashop.stopresell") && sender instanceof Player) {
|
||||
if(buy.isOwner((Player)sender)) {
|
||||
buy.disableReselling();
|
||||
buy.saveRequired();
|
||||
plugin.message(sender, "stopresell-success", buy);
|
||||
buy.updateSigns();
|
||||
buy.updateRegionFlags();
|
||||
} else {
|
||||
plugin.message(sender, "stopresell-noPermissionOther");
|
||||
}
|
||||
} else {
|
||||
plugin.message(sender, "stopresell-noPermission");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getTabCompleteList(int toComplete, String[] start) {
|
||||
ArrayList<String> result = new ArrayList<String>();
|
||||
if(toComplete == 2) {
|
||||
for(BuyRegion region : plugin.getFileManager().getBuys()) {
|
||||
if(region.isSold() && region.isInResellingMode()) {
|
||||
result.add(region.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
package nl.evolutioncoding.areashop.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import nl.evolutioncoding.areashop.AreaShop;
|
||||
import nl.evolutioncoding.areashop.regions.GeneralRegion;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class TeleportCommand extends CommandAreaShop {
|
||||
|
||||
public TeleportCommand(AreaShop plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandStart() {
|
||||
return "areashop tp";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHelp(CommandSender target) {
|
||||
if(target.hasPermission("areashop.teleportall")) {
|
||||
return plugin.getLanguageManager().getLang("help-teleportAll");
|
||||
} else if(target.hasPermission("areashop.teleport")) {
|
||||
return plugin.getLanguageManager().getLang("help-teleport");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, Command command, String[] args) {
|
||||
if(!sender.hasPermission("areashop.teleport") && !sender.hasPermission("areashop.teleportall") && !sender.hasPermission("areashop.teleportsign") && !sender.hasPermission("areashop.teleportsignall")) {
|
||||
plugin.message(sender, "teleport-noPermission");
|
||||
return;
|
||||
}
|
||||
if (!(sender instanceof Player)) {
|
||||
plugin.message(sender, "cmd-onlyByPlayer");
|
||||
return;
|
||||
}
|
||||
if(args.length <= 1 || args[1] == null) {
|
||||
plugin.message(sender, "teleport-help");
|
||||
return;
|
||||
}
|
||||
Player player = (Player)sender;
|
||||
GeneralRegion region = plugin.getFileManager().getRegion(args[1]);
|
||||
if(region == null) {
|
||||
plugin.message(player, "teleport-noRentOrBuy", args[1]);
|
||||
return;
|
||||
}
|
||||
if(args.length >= 3 && (args[2].equalsIgnoreCase("sign") || args[2].equalsIgnoreCase("yes") || args[2].equalsIgnoreCase("true"))) {
|
||||
region.teleportPlayer(player, true);
|
||||
} else {
|
||||
region.teleportPlayer(player, false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getTabCompleteList(int toComplete, String[] start) {
|
||||
ArrayList<String> result = new ArrayList<String>();
|
||||
if(toComplete == 2) {
|
||||
result.addAll(plugin.getFileManager().getRegionNames());
|
||||
} else if(toComplete == 3) {
|
||||
result.add("sign");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
package nl.evolutioncoding.areashop.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import nl.evolutioncoding.areashop.AreaShop;
|
||||
import nl.evolutioncoding.areashop.regions.RentRegion;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class UnrentCommand extends CommandAreaShop {
|
||||
|
||||
public UnrentCommand(AreaShop plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandStart() {
|
||||
return "areashop unrent";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHelp(CommandSender target) {
|
||||
if(target.hasPermission("areashop.unrent")) {
|
||||
return plugin.getLanguageManager().getLang("help-unrent");
|
||||
} else if(target.hasPermission("areashop.unrentown")) {
|
||||
return plugin.getLanguageManager().getLang("help-unrentOwn");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, Command command, String[] args) {
|
||||
if(!sender.hasPermission("areashop.unrent") && !sender.hasPermission("areashop.unrentown")) {
|
||||
plugin.message(sender, "unrent-noPermission");
|
||||
return;
|
||||
}
|
||||
RentRegion rent = null;
|
||||
if(args.length <= 1) {
|
||||
if (sender instanceof Player) {
|
||||
// get the region by location
|
||||
List<RentRegion> regions = plugin.getFileManager().getApplicableRentRegions(((Player) sender).getLocation());
|
||||
if (regions.isEmpty()) {
|
||||
plugin.message(sender, "cmd-noRegionsAtLocation");
|
||||
return;
|
||||
} else if (regions.size() > 1) {
|
||||
plugin.message(sender, "cmd-moreRegionsAtLocation");
|
||||
return;
|
||||
} else {
|
||||
rent = regions.get(0);
|
||||
}
|
||||
} else {
|
||||
plugin.message(sender, "cmd-automaticRegionOnlyByPlayer");
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
rent = plugin.getFileManager().getRent(args[1]);
|
||||
}
|
||||
if(rent == null) {
|
||||
plugin.message(sender, "unrent-notRegistered");
|
||||
return;
|
||||
}
|
||||
if(!rent.isRented()) {
|
||||
plugin.message(sender, "unrent-notRented");
|
||||
return;
|
||||
}
|
||||
if(sender.hasPermission("areashop.unrent")) {
|
||||
plugin.message(sender, "unrent-other", rent.getPlayerName());
|
||||
rent.unRent(true);
|
||||
} else {
|
||||
if(sender.hasPermission("areashop.unrentown") && sender instanceof Player) {
|
||||
if(rent.getRenter().equals(((Player)sender).getUniqueId())) {
|
||||
plugin.message(sender, "unrent-unrented");
|
||||
rent.unRent(true);
|
||||
} else {
|
||||
plugin.message(sender, "unrent-noPermissionOther");
|
||||
}
|
||||
} else {
|
||||
plugin.message(sender, "unrent-noPermission");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getTabCompleteList(int toComplete, String[] start) {
|
||||
ArrayList<String> result = new ArrayList<String>();
|
||||
if(toComplete == 2) {
|
||||
for(RentRegion region : plugin.getFileManager().getRents()) {
|
||||
if(region.isRented()) {
|
||||
result.add(region.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
package nl.evolutioncoding.areashop.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import nl.evolutioncoding.areashop.AreaShop;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
public class UpdatebuysCommand extends CommandAreaShop {
|
||||
|
||||
public UpdatebuysCommand(AreaShop plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandStart() {
|
||||
return "areashop updatebuys";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHelp(CommandSender target) {
|
||||
if(target.hasPermission("areashop.updatebuys")) {
|
||||
return plugin.getLanguageManager().getLang("help-updatebuys");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, Command command, String[] args) {
|
||||
if(!sender.hasPermission("areashop.updatebuys")) {
|
||||
plugin.message(sender, "buys-noPermission");
|
||||
return;
|
||||
}
|
||||
plugin.getFileManager().updateBuySignsAndFlags(sender);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getTabCompleteList(int toComplete, String[] start) {
|
||||
ArrayList<String> result = new ArrayList<String>();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package nl.evolutioncoding.areashop.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import nl.evolutioncoding.areashop.AreaShop;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
public class UpdaterentsCommand extends CommandAreaShop {
|
||||
|
||||
public UpdaterentsCommand(AreaShop plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandStart() {
|
||||
return "areashop updaterents";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHelp(CommandSender target) {
|
||||
if(target.hasPermission("areashop.updaterents")) {
|
||||
return plugin.getLanguageManager().getLang("help-updaterents");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, Command command, String[] args) {
|
||||
if(!sender.hasPermission("areashop.updaterents")) {
|
||||
plugin.message(sender, "rents-noPermission");
|
||||
return;
|
||||
}
|
||||
plugin.getFileManager().updateRentSignsAndFlags(sender);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getTabCompleteList(int toComplete, String[] start) {
|
||||
ArrayList<String> result = new ArrayList<String>();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package nl.evolutioncoding.areashop.exceptions;
|
||||
|
||||
public class RegionCreateException extends Exception {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public RegionCreateException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,443 @@
|
||||
package nl.evolutioncoding.areashop.regions;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.HashMap;
|
||||
import java.util.UUID;
|
||||
|
||||
import net.milkbowl.vault.economy.EconomyResponse;
|
||||
import nl.evolutioncoding.areashop.AreaShop;
|
||||
import nl.evolutioncoding.areashop.exceptions.RegionCreateException;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class BuyRegion extends GeneralRegion {
|
||||
|
||||
public BuyRegion(AreaShop plugin, YamlConfiguration config) throws RegionCreateException {
|
||||
super(plugin, config);
|
||||
}
|
||||
|
||||
public BuyRegion(AreaShop plugin, String name, World world) {
|
||||
super(plugin, name, world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RegionType getType() {
|
||||
return RegionType.BUY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RegionState getState() {
|
||||
if(isSold() && isInResellingMode()) {
|
||||
return RegionState.RESELL;
|
||||
} else if(isSold() && !isInResellingMode()) {
|
||||
return RegionState.SOLD;
|
||||
} else {
|
||||
return RegionState.FORSALE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the UUID of the owner of this region
|
||||
* @return The UUID of the owner of this region
|
||||
*/
|
||||
public UUID getBuyer() {
|
||||
String buyer = getStringSetting("buy.buyer");
|
||||
if(buyer != null) {
|
||||
try {
|
||||
return UUID.fromString(buyer);
|
||||
} catch(IllegalArgumentException e) {}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a player is the buyer of this region
|
||||
* @param player Player to check
|
||||
* @return true if this player owns this region, otherwise false
|
||||
*/
|
||||
public boolean isBuyer(Player player) {
|
||||
if(player == null) {
|
||||
return false;
|
||||
} else {
|
||||
return isBuyer(player.getUniqueId());
|
||||
}
|
||||
}
|
||||
public boolean isBuyer(UUID player) {
|
||||
UUID buyer = getBuyer();
|
||||
if(buyer == null || player == null) {
|
||||
return false;
|
||||
} else {
|
||||
return buyer.equals(player);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the buyer of this region
|
||||
* @param buyer The UUID of the player that should be set as buyer
|
||||
*/
|
||||
public void setBuyer(UUID buyer) {
|
||||
if(buyer == null) {
|
||||
setSetting("buy.buyer", null);
|
||||
setSetting("buy.buyerName", null);
|
||||
} else {
|
||||
setSetting("buy.buyer", buyer.toString());
|
||||
setSetting("buy.buyerName", plugin.toName(buyer));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name of the player that owns this region
|
||||
* @return The name of the player that owns this region
|
||||
*/
|
||||
public String getPlayerName() {
|
||||
return plugin.toName(getBuyer());
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the region is sold
|
||||
* @return true if the region is sold, otherwise false
|
||||
*/
|
||||
public boolean isSold() {
|
||||
return getBuyer() != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the region is being resold
|
||||
* @return true if the region is available for reselling, otherwise false
|
||||
*/
|
||||
public boolean isInResellingMode() {
|
||||
return config.getBoolean("buy.resellMode");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the price of the region
|
||||
* @return The price of the region
|
||||
*/
|
||||
public double getPrice() {
|
||||
return getDoubleSetting("buy.price");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the resell price of this region
|
||||
* @return The resell price if isInResellingMode(), otherwise 0.0
|
||||
*/
|
||||
public double getResellPrice() {
|
||||
return config.getDouble("buy.resellPrice");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the formatted string of the price (includes prefix and suffix)
|
||||
* @return The formatted string of the price
|
||||
*/
|
||||
public String getFormattedPrice() {
|
||||
return plugin.formatCurrency(getPrice());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the formatted string of the resellprice (includes prefix and suffix)
|
||||
* @return The formatted string of the resellprice
|
||||
*/
|
||||
public String getFormattedResellPrice() {
|
||||
return plugin.formatCurrency(getResellPrice());
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the price of the region
|
||||
* @param price
|
||||
*/
|
||||
public void setPrice(double price) {
|
||||
setSetting("buy.price", price);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the region into resell mode with the given price
|
||||
* @param price The price this region should be put up for sale
|
||||
*/
|
||||
public void enableReselling(double price) {
|
||||
config.set("buy.resellMode", true);
|
||||
config.set("buy.resellPrice", price);
|
||||
}
|
||||
|
||||
/**
|
||||
* Stop this region from being in resell mode
|
||||
*/
|
||||
public void disableReselling() {
|
||||
config.set("buy.resellMode", null);
|
||||
config.set("buy.resellPrice", null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the moneyBack percentage
|
||||
* @return The % of money the player will get back when selling
|
||||
*/
|
||||
public double getMoneyBackPercentage() {
|
||||
return getDoubleSetting("buy.moneyBack");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the amount of money that should be paid to the player when selling the region
|
||||
* @return The amount of money the player should get back
|
||||
*/
|
||||
public double getMoneyBackAmount() {
|
||||
return getPrice() * (getMoneyBackPercentage() / 100.0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the formatted string of the amount of the moneyBack amount
|
||||
* @return String with currency symbols and proper fractional part
|
||||
*/
|
||||
public String getFormattedMoneyBackAmount() {
|
||||
return plugin.formatCurrency(getMoneyBackAmount());
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashMap<String, Object> getSpecificReplacements() {
|
||||
// Fill the replacements map with things specific to a BuyRegion
|
||||
HashMap<String, Object> result = new HashMap<String, Object>();
|
||||
result.put(AreaShop.tagPrice, getFormattedPrice());
|
||||
result.put(AreaShop.tagPlayerName, getPlayerName());
|
||||
result.put(AreaShop.tagPlayerUUID, getBuyer());
|
||||
result.put(AreaShop.tagResellPrice, getFormattedResellPrice());
|
||||
result.put(AreaShop.tagMoneyBackAmount, getFormattedMoneyBackAmount());
|
||||
double moneyBackPercent = getMoneyBackPercentage();
|
||||
if((moneyBackPercent%1.0) == 0.0) {
|
||||
result.put(AreaShop.tagMoneyBackPercentage, (int)moneyBackPercent);
|
||||
} else {
|
||||
result.put(AreaShop.tagMoneyBackPercentage, moneyBackPercent);
|
||||
}
|
||||
result.put(AreaShop.tagMaxInactiveTime, this.getFormattedInactiveTimeUntilSell());
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Minutes until automatic unrent when player is offline
|
||||
* @return The number of minutes until the region is unrented while player is offline
|
||||
*/
|
||||
public long getInactiveTimeUntilSell() {
|
||||
return getIntegerSetting("buy.inactiveTimeUntilSell");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a human readable string indicating how long the player can be offline until automatic unrent
|
||||
* @return String indicating the inactive time until unrent
|
||||
*/
|
||||
public String getFormattedInactiveTimeUntilSell() {
|
||||
return this.millisToHumanFormat(getInactiveTimeUntilSell()*60*1000);
|
||||
}
|
||||
|
||||
/**
|
||||
* Buy a region
|
||||
* @param player The player that wants to buy the region
|
||||
* @return true if it succeeded and false if not
|
||||
*/
|
||||
public boolean buy(Player player) {
|
||||
/* Check if the player has permission */
|
||||
if(player.hasPermission("areashop.buy")) {
|
||||
if(!isSold() || (isInResellingMode() && !isBuyer(player))) {
|
||||
boolean isResell = isInResellingMode();
|
||||
// Check if the players needs to be in the world or region for buying
|
||||
if(restrictedToRegion() && (!player.getWorld().getName().equals(getWorldName())
|
||||
|| !getRegion().contains(player.getLocation().getBlockX(), player.getLocation().getBlockY(), player.getLocation().getBlockZ()))) {
|
||||
plugin.message(player, "buy-restrictedToRegion", getName());
|
||||
return false;
|
||||
}
|
||||
if(restrictedToWorld() && !player.getWorld().getName().equals(getWorldName())) {
|
||||
plugin.message(player, "buy-restrictedToWorld", getWorldName(), player.getWorld().getName());
|
||||
return false;
|
||||
}
|
||||
// Check region limits
|
||||
LimitResult limitResult = this.limitsAllowBuying(player);
|
||||
AreaShop.debug("LimitResult: " + limitResult.toString());
|
||||
if(!limitResult.actionAllowed()) {
|
||||
if(limitResult.getLimitingFactor() == LimitType.TOTAL) {
|
||||
plugin.message(player, "total-maximum", limitResult.getMaximum(), limitResult.getCurrent(), limitResult.getLimitingGroup());
|
||||
return false;
|
||||
}
|
||||
if(limitResult.getLimitingFactor() == LimitType.BUYS) {
|
||||
plugin.message(player, "buy-maximum", limitResult.getMaximum(), limitResult.getCurrent(), limitResult.getLimitingGroup());
|
||||
return false;
|
||||
}
|
||||
// Should not be reached, but is safe like this
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Check if the player has enough money */
|
||||
if(plugin.getEconomy().has(player, getWorldName(), getPrice())) {
|
||||
UUID oldOwner = getBuyer();
|
||||
if(isResell && oldOwner != null) {
|
||||
clearFriends();
|
||||
double resellPrice = getResellPrice();
|
||||
/* Transfer the money to the previous owner */
|
||||
EconomyResponse r = plugin.getEconomy().withdrawPlayer(player, getWorldName(), getResellPrice());
|
||||
if(!r.transactionSuccess()) {
|
||||
plugin.message(player, "buy-payError");
|
||||
return false;
|
||||
}
|
||||
OfflinePlayer oldOwnerPlayer = Bukkit.getOfflinePlayer(oldOwner);
|
||||
if(oldOwnerPlayer != null) {
|
||||
r = plugin.getEconomy().depositPlayer(oldOwnerPlayer, getWorldName(), getResellPrice());
|
||||
if(!r.transactionSuccess()) {
|
||||
plugin.getLogger().warning("Something went wrong with paying '" + oldOwnerPlayer.getName() + "' for his resell of region " + getName());
|
||||
}
|
||||
}
|
||||
// Resell is done, disable that now
|
||||
disableReselling();
|
||||
// Run commands
|
||||
this.runEventCommands(RegionEvent.RESELL, true);
|
||||
// Set the owner
|
||||
setBuyer(player.getUniqueId());
|
||||
|
||||
// Update everything
|
||||
handleSchematicEvent(RegionEvent.RESELL);
|
||||
updateSigns();
|
||||
updateRegionFlags();
|
||||
|
||||
// Send message to the player
|
||||
plugin.message(player, "buy-successResale", getName(), oldOwnerPlayer.getName());
|
||||
Player seller = Bukkit.getPlayer(oldOwner);
|
||||
if(seller != null) {
|
||||
plugin.message(player, "buy-successSeller", getName(), getPlayerName(), resellPrice);
|
||||
}
|
||||
AreaShop.debug(player.getName() + " has bought region " + getName() + " for " + getFormattedPrice() + " from " + oldOwnerPlayer.getName());
|
||||
|
||||
this.saveRequired();
|
||||
// Run commands
|
||||
this.runEventCommands(RegionEvent.RESELL, false);
|
||||
} else {
|
||||
// Substract the money from the players balance
|
||||
EconomyResponse r = plugin.getEconomy().withdrawPlayer(player, getWorldName(), getPrice());
|
||||
if(!r.transactionSuccess()) {
|
||||
plugin.message(player, "buy-payError");
|
||||
return false;
|
||||
}
|
||||
AreaShop.debug(player.getName() + " has bought region " + getName() + " for " + getFormattedPrice());
|
||||
|
||||
// Run commands
|
||||
this.runEventCommands(RegionEvent.BOUGHT, true);
|
||||
// Set the owner
|
||||
setBuyer(player.getUniqueId());
|
||||
|
||||
// Update everything
|
||||
handleSchematicEvent(RegionEvent.BOUGHT);
|
||||
updateSigns();
|
||||
updateRegionFlags();
|
||||
|
||||
// Send message to the player
|
||||
plugin.message(player, "buy-succes", getName());
|
||||
this.saveRequired();
|
||||
// Run commands
|
||||
this.runEventCommands(RegionEvent.BOUGHT, false);
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
/* Player has not enough money */
|
||||
plugin.message(player, "buy-lowMoney", plugin.formatCurrency(plugin.getEconomy().getBalance(player, getWorldName())), getFormattedPrice());
|
||||
}
|
||||
} else {
|
||||
if(isBuyer(player)) {
|
||||
plugin.message(player, "buy-yours");
|
||||
} else {
|
||||
plugin.message(player, "buy-someoneElse");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
plugin.message(player, "buy-noPermission");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sell a buyed region, get part of the money back
|
||||
* @param regionName
|
||||
*/
|
||||
public void sell(boolean giveMoneyBack) {
|
||||
// Run commands
|
||||
this.runEventCommands(RegionEvent.SOLD, true);
|
||||
|
||||
disableReselling();
|
||||
/* Give part of the buying price back */
|
||||
double moneyBack = getMoneyBackAmount();
|
||||
if(moneyBack > 0 && giveMoneyBack) {
|
||||
/* Give back the money */
|
||||
OfflinePlayer player = Bukkit.getOfflinePlayer(getBuyer());
|
||||
if(player != null) {
|
||||
EconomyResponse response = null;
|
||||
boolean error = false;
|
||||
try {
|
||||
response = plugin.getEconomy().depositPlayer(Bukkit.getOfflinePlayer(getBuyer()), getWorldName(), moneyBack);
|
||||
} catch(Exception e) {
|
||||
error = true;
|
||||
}
|
||||
if(error || response == null || !response.transactionSuccess()) {
|
||||
plugin.getLogger().warning("Something went wrong with paying back money to " + getPlayerName() + " while selling region " + getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Debug message */
|
||||
AreaShop.debug(getPlayerName() + " has sold " + getName() + ", got " + plugin.formatCurrency(moneyBack) + " money back");
|
||||
|
||||
/* Update everything */
|
||||
handleSchematicEvent(RegionEvent.SOLD);
|
||||
updateRegionFlags(RegionState.FORSALE);
|
||||
|
||||
/* Remove friends and the owner */
|
||||
clearFriends();
|
||||
setBuyer(null);
|
||||
|
||||
updateSigns();
|
||||
|
||||
this.saveRequired();
|
||||
// Run commands
|
||||
this.runEventCommands(RegionEvent.SOLD, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkInactive() {
|
||||
if(isDeleted() || !isSold()) {
|
||||
return false;
|
||||
}
|
||||
OfflinePlayer player = Bukkit.getOfflinePlayer(getBuyer());
|
||||
//AreaShop.debug("inactive checking for " + getName() + ", player=" + player.getName() + ", currenttime=" + Calendar.getInstance().getTimeInMillis() + ", lastPlayed=" + player.getLastPlayed() + ", diff=" + (Calendar.getInstance().getTimeInMillis() - player.getLastPlayed()));
|
||||
int inactiveSetting = getIntegerSetting("buy.inactiveTimeUntilSell");
|
||||
if(inactiveSetting <= 0 || player.isOp()) {
|
||||
return false;
|
||||
}
|
||||
if(Calendar.getInstance().getTimeInMillis() > (player.getLastPlayed() + inactiveSetting * 60 * 1000)) {
|
||||
plugin.getLogger().info("Region " + getName() + " sold because of inactivity for player " + getPlayerName());
|
||||
this.sell(true);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,156 @@
|
||||
package nl.evolutioncoding.areashop.regions;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import nl.evolutioncoding.areashop.AreaShop;
|
||||
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
|
||||
public class RegionGroup {
|
||||
|
||||
private AreaShop plugin;
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* Constructor, used when creating new groups or restoring them from groups.yml at server boot
|
||||
* @param plugin The AreaShop plugin
|
||||
* @param name Name of the group, has to be unique
|
||||
*/
|
||||
public RegionGroup(AreaShop plugin, String name) {
|
||||
this.plugin = plugin;
|
||||
this.name = name;
|
||||
setSetting("name", name);
|
||||
// Delete duplicates
|
||||
List<String> members = getMembers();
|
||||
List<String> newMembers = new ArrayList<String>();
|
||||
while(!members.isEmpty()) {
|
||||
String member = members.remove(0);
|
||||
// If the region has been deleted also clean it from the group
|
||||
if(plugin.getFileManager().getRegion(member) != null) {
|
||||
newMembers.add(member);
|
||||
}
|
||||
while(members.contains(member)) {
|
||||
members.remove(member);
|
||||
}
|
||||
}
|
||||
if(newMembers.size() != members.size()) {
|
||||
setSetting("regions", newMembers);
|
||||
saveRequired();
|
||||
}
|
||||
if(getMembers().size() == 0) {
|
||||
plugin.getFileManager().removeGroup(this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a member to a group
|
||||
* @param region The region to add to the group (GeneralRegion or a subclass of it)
|
||||
* @return true if the region was not already added, otherwise false
|
||||
*/
|
||||
public boolean addMember(GeneralRegion region) {
|
||||
List<String> members = getMembers();
|
||||
if(members.contains(region.getLowerCaseName())) {
|
||||
return false;
|
||||
} else {
|
||||
members.add(region.getName());
|
||||
setSetting("regions", members);
|
||||
region.updateSigns();
|
||||
region.updateRegionFlags();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a member from the group
|
||||
* @param region The region to remove
|
||||
* @return true if the region was in the group before, otherwise false
|
||||
*/
|
||||
public boolean removeMember(GeneralRegion region) {
|
||||
List<String> members = getMembers();
|
||||
boolean result = isMember(region);
|
||||
members.remove(region.getName());
|
||||
if(members.isEmpty()) {
|
||||
plugin.getFileManager().removeGroup(this);
|
||||
} else {
|
||||
setSetting("regions", members);
|
||||
}
|
||||
region.updateSigns();
|
||||
region.updateRegionFlags();
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all members of the group
|
||||
* @return A list with the names of all members of the group
|
||||
*/
|
||||
public List<String> getMembers() {
|
||||
if(getSettings() == null || getSettings().getStringList("regions") == null) {
|
||||
return new ArrayList<String>();
|
||||
}
|
||||
return getSettings().getStringList("regions");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name of the group
|
||||
* @return The name of the group
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
/**
|
||||
* Get the lowercase name of the group (used for getting the config etc)
|
||||
* @return The name of the group in lowercase
|
||||
*/
|
||||
public String getLowerCaseName() {
|
||||
return getName().toLowerCase();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a region is member of the group
|
||||
* @param region Region to check
|
||||
* @return true if the region is in the group, otherwise false
|
||||
*/
|
||||
public boolean isMember(GeneralRegion region) {
|
||||
return getMembers().contains(region.getName());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the priority of the group (higher overwrites)
|
||||
* @return The priority of the group
|
||||
*/
|
||||
public int getPriority() {
|
||||
return getSettings().getInt("priority");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the configurationsection with the settings of this group
|
||||
* @return The ConfigurationSection with the settings of the group
|
||||
*/
|
||||
public ConfigurationSection getSettings() {
|
||||
return plugin.getFileManager().getGroupSettings(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a setting of this group
|
||||
* @param path The path to set
|
||||
* @param setting The value to set
|
||||
*/
|
||||
public void setSetting(String path, Object setting) {
|
||||
plugin.getFileManager().setGroupSetting(this, path, setting);
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates this file needs to be saved, will actually get saved later by a task
|
||||
*/
|
||||
public void saveRequired() {
|
||||
plugin.getFileManager().saveGroupsIsRequired();
|
||||
}
|
||||
|
||||
/**
|
||||
* Save the groups to disk now, normally saveRequired() is preferred because of performance
|
||||
*/
|
||||
public void saveNow() {
|
||||
plugin.getFileManager().saveGroupsNow();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,632 @@
|
||||
package nl.evolutioncoding.areashop.regions;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.UUID;
|
||||
|
||||
import net.milkbowl.vault.economy.EconomyResponse;
|
||||
import nl.evolutioncoding.areashop.AreaShop;
|
||||
import nl.evolutioncoding.areashop.exceptions.RegionCreateException;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class RentRegion extends GeneralRegion {
|
||||
private long warningsDoneUntil = Calendar.getInstance().getTimeInMillis();
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param plugin The areashop plugin
|
||||
* @param settings All settings of this region
|
||||
* @throws RegionCreateException
|
||||
*/
|
||||
public RentRegion(AreaShop plugin, YamlConfiguration config) throws RegionCreateException {
|
||||
super(plugin, config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new RentRegion
|
||||
* @param plugin The AreaShop plugin
|
||||
* @param name The name of the region (correct casing)
|
||||
* @param world The world of the WorldGuard region
|
||||
*/
|
||||
public RentRegion(AreaShop plugin, String name, World world) {
|
||||
super(plugin, name, world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RegionType getType() {
|
||||
return RegionType.RENT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RegionState getState() {
|
||||
if(isRented()) {
|
||||
return RegionState.RENTED;
|
||||
} else {
|
||||
return RegionState.FORRENT;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the UUID of the player renting the region
|
||||
* @return The UUID of the renter
|
||||
*/
|
||||
public UUID getRenter() {
|
||||
String renter = getStringSetting("rent.renter");
|
||||
if(renter != null) {
|
||||
try {
|
||||
return UUID.fromString(renter);
|
||||
} catch(IllegalArgumentException e) {}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a player is the renter of this region
|
||||
* @param player Player to check
|
||||
* @return true if this player rents this region, otherwise false
|
||||
*/
|
||||
public boolean isRenter(Player player) {
|
||||
if(player == null) {
|
||||
return false;
|
||||
} else {
|
||||
return isRenter(player.getUniqueId());
|
||||
}
|
||||
}
|
||||
public boolean isRenter(UUID player) {
|
||||
UUID renter = getRenter();
|
||||
if(player == null || renter == null) {
|
||||
return false;
|
||||
} else {
|
||||
return renter.equals(player);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the renter of this region
|
||||
* @param renter The UUID of the player that should be set as the renter
|
||||
*/
|
||||
public void setRenter(UUID renter) {
|
||||
if(renter == null) {
|
||||
setSetting("rent.renter", null);
|
||||
setSetting("rent.renterName", null);
|
||||
} else {
|
||||
setSetting("rent.renter", renter.toString());
|
||||
setSetting("rent.renterName", plugin.toName(renter));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the max number of extends of this region
|
||||
* @return -1 if infinite otherwise the maximum number
|
||||
*/
|
||||
public int getMaxExtends() {
|
||||
return getIntegerSetting("rent.maxExtends");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get how many times the rent has already been extended
|
||||
* @return The number of times extended
|
||||
*/
|
||||
public int getTimesExtended() {
|
||||
return config.getInt("rent.timesExtended");
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the number of times the region has been extended
|
||||
* @param times The number of times the region has been extended
|
||||
*/
|
||||
public void setTimesExtended(int times) {
|
||||
if(times < 0) {
|
||||
config.set("rent.timesExtended", null);
|
||||
} else {
|
||||
config.set("rent.timesExtended", times);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashMap<String, Object> getSpecificReplacements() {
|
||||
// Fill the replacements map with things specific to a RentRegion
|
||||
HashMap<String, Object> result = new HashMap<String, Object>();
|
||||
result.put(AreaShop.tagPrice, getFormattedPrice());
|
||||
result.put(AreaShop.tagDuration, getDurationString());
|
||||
result.put(AreaShop.tagPlayerName, getPlayerName());
|
||||
result.put(AreaShop.tagPlayerUUID, getRenter());
|
||||
SimpleDateFormat date = new SimpleDateFormat(plugin.getConfig().getString("timeFormatChat"));
|
||||
String dateString = date.format(new Date(getRentedUntil()));
|
||||
result.put(AreaShop.tagRentedUntil, dateString);
|
||||
date = new SimpleDateFormat(plugin.getConfig().getString("timeFormatSign"));
|
||||
dateString = date.format(new Date(getRentedUntil()));
|
||||
result.put(AreaShop.tagRentedUntilShort, dateString);
|
||||
result.put(AreaShop.tagTimeLeft, getTimeLeftString());
|
||||
result.put(AreaShop.tagMoneyBackAmount, getFormattedMoneyBackAmount());
|
||||
double moneyBackPercent = getMoneyBackPercentage();
|
||||
if((moneyBackPercent%1.0) == 0.0) {
|
||||
result.put(AreaShop.tagMoneyBackPercentage, (int)moneyBackPercent);
|
||||
} else {
|
||||
result.put(AreaShop.tagMoneyBackPercentage, moneyBackPercent);
|
||||
}
|
||||
result.put(AreaShop.tagMaxExtends, this.getMaxExtends());
|
||||
result.put(AreaShop.tagExtendsLeft, getMaxExtends() - getTimesExtended());
|
||||
result.put(AreaShop.tagMaxRentTime, this.millisToHumanFormat(getMaxRentTime()*60*1000));
|
||||
result.put(AreaShop.tagMaxInactiveTime, this.getFormattedInactiveTimeUntilUnrent());
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the region is rented
|
||||
* @return true if the region is rented, otherwise false
|
||||
*/
|
||||
public boolean isRented() {
|
||||
return getRenter() != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name of the player renting this region
|
||||
* @return Name of the player renting this region
|
||||
*/
|
||||
public String getPlayerName() {
|
||||
return plugin.toName(getRenter());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the time until this region is rented (time from 1970 epoch)
|
||||
* @return
|
||||
*/
|
||||
public long getRentedUntil() {
|
||||
return getLongSetting("rent.rentedUntil");
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the time until the region is rented (milliseconds from 1970, system time)
|
||||
* @param rentedUntil The time until the region is rented
|
||||
*/
|
||||
public void setRentedUntil(Long rentedUntil) {
|
||||
if(rentedUntil == null) {
|
||||
setSetting("rent.rentedUntil", null);
|
||||
} else {
|
||||
setSetting("rent.rentedUntil", rentedUntil);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the price of the region
|
||||
* @return The price of the region
|
||||
*/
|
||||
public double getPrice() {
|
||||
return getDoubleSetting("rent.price");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the formatted string of the price (includes prefix and suffix)
|
||||
* @return The formatted string of the price
|
||||
*/
|
||||
public String getFormattedPrice() {
|
||||
return plugin.formatCurrency(getPrice());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the duration of 1 rent period
|
||||
* @return The duration in milliseconds of 1 rent period
|
||||
*/
|
||||
public long getDuration() {
|
||||
return durationStringToLong(getDurationString());
|
||||
}
|
||||
|
||||
/**
|
||||
* Methode to tranlate a duration string to a millisecond value
|
||||
* @param duration The duration string
|
||||
* @return The duration in milliseconds translated from the durationstring, or if it is invalid then 0
|
||||
*/
|
||||
public long durationStringToLong(String duration) {
|
||||
if(duration == null) {
|
||||
return 0;
|
||||
}
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTimeInMillis(0);
|
||||
|
||||
ArrayList<String> minutes = new ArrayList<String>(plugin.getConfig().getStringList("minutes"));
|
||||
ArrayList<String> hours = new ArrayList<String>(plugin.getConfig().getStringList("hours"));
|
||||
ArrayList<String> days = new ArrayList<String>(plugin.getConfig().getStringList("days"));
|
||||
ArrayList<String> months = new ArrayList<String>(plugin.getConfig().getStringList("months"));
|
||||
ArrayList<String> years = new ArrayList<String>(plugin.getConfig().getStringList("years"));
|
||||
|
||||
String durationString = duration.substring(duration.indexOf(' ')+1, duration.length());
|
||||
int durationInt = 0;
|
||||
try {
|
||||
durationInt = Integer.parseInt(duration.substring(0, duration.indexOf(' ')));
|
||||
} catch(NumberFormatException exception) {}
|
||||
|
||||
if(minutes.contains(durationString)) {
|
||||
calendar.add(Calendar.MINUTE, durationInt);
|
||||
} else if(hours.contains(durationString)) {
|
||||
calendar.add(Calendar.HOUR, durationInt);
|
||||
} else if(days.contains(durationString)) {
|
||||
calendar.add(Calendar.DAY_OF_MONTH, durationInt);
|
||||
} else if(months.contains(durationString)) {
|
||||
calendar.add(Calendar.MONTH, durationInt);
|
||||
} else if(years.contains(durationString)) {
|
||||
calendar.add(Calendar.YEAR, durationInt);
|
||||
}
|
||||
|
||||
return calendar.getTimeInMillis();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the duration string, includes number<space>indentifier
|
||||
* @return The duration string
|
||||
*/
|
||||
public String getDurationString() {
|
||||
return getStringSetting("rent.duration");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the time that is left on the region
|
||||
* @return The time left on the region
|
||||
*/
|
||||
public long getTimeLeft() {
|
||||
if(isRented()) {
|
||||
return this.getRentedUntil() - Calendar.getInstance().getTimeInMillis();
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a formatted string indicating the rent time that is left
|
||||
* @return Time left on the rent, for example '29 days', '3 months', '1 second'
|
||||
*/
|
||||
public String getTimeLeftString() {
|
||||
return millisToHumanFormat(getTimeLeft());
|
||||
}
|
||||
|
||||
/**
|
||||
* Minutes until automatic unrent when player is offline
|
||||
* @return The number of minutes until the region is unrented while player is offline
|
||||
*/
|
||||
public long getInactiveTimeUntilUnrent() {
|
||||
return getIntegerSetting("rent.inactiveTimeUntilUnrent");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a human readable string indicating how long the player can be offline until automatic unrent
|
||||
* @return String indicating the inactive time until unrent
|
||||
*/
|
||||
public String getFormattedInactiveTimeUntilUnrent() {
|
||||
return this.millisToHumanFormat(getInactiveTimeUntilUnrent()*60*1000);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the price of the region
|
||||
* @param price
|
||||
*/
|
||||
public void setPrice(double price) {
|
||||
setSetting("rent.price", price);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the duration of the rent
|
||||
* @param duration The duration of the rent (as specified on the documentation pages)
|
||||
*/
|
||||
public void setDuration(String duration) {
|
||||
setSetting("rent.duration", duration);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the moneyBack percentage
|
||||
* @return The % of money the player will get back when unrenting
|
||||
*/
|
||||
public double getMoneyBackPercentage() {
|
||||
return getDoubleSetting("rent.moneyBack");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the amount of money that should be paid to the player when unrenting the region
|
||||
* @return The amount of money the player should get back
|
||||
*/
|
||||
public double getMoneyBackAmount() {
|
||||
Long currentTime = Calendar.getInstance().getTimeInMillis();
|
||||
Double timeLeft = (double) ((getRentedUntil() - currentTime));
|
||||
double percentage = (getMoneyBackPercentage()) / 100.0;
|
||||
Double timePeriod = (double) (getDuration());
|
||||
double periods = timeLeft / timePeriod;
|
||||
double moneyBack = periods * getPrice() * percentage;
|
||||
return moneyBack;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the formatted string of the amount of the moneyBack amount
|
||||
* @return String with currency symbols and proper fractional part
|
||||
*/
|
||||
public String getFormattedMoneyBackAmount() {
|
||||
return plugin.formatCurrency(getMoneyBackAmount());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the maximum time the player can rent the region in advance (minutes)
|
||||
* @return The maximum rent time in minutes
|
||||
*/
|
||||
public long getMaxRentTime() {
|
||||
return this.getLongSetting("rent.maxRentTime");
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the rent should expire
|
||||
* @return true if the rent has expired and has been unrented, false otherwise
|
||||
*/
|
||||
public boolean checkExpiration() {
|
||||
long now = Calendar.getInstance().getTimeInMillis();
|
||||
if(!isDeleted() && isRented() && now > getRentedUntil()) {
|
||||
/* Send message to the player if online */
|
||||
Player player = Bukkit.getPlayer(getRenter());
|
||||
if(player != null) {
|
||||
plugin.message(player, "unrent-expired", getName());
|
||||
}
|
||||
unRent(false);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send the expiration warnings from the selected profile which is specified in the config
|
||||
* Sends all warnings since previous call until now+<normal delay>, delay can be found in the config as well
|
||||
*/
|
||||
public void sendExpirationWarnings() {
|
||||
// send from warningsDoneUntil to current+delay
|
||||
if(isDeleted() || !isRented()) {
|
||||
return;
|
||||
}
|
||||
Player player = Bukkit.getPlayer(getRenter());
|
||||
if(player != null) {
|
||||
long sendUntil = Calendar.getInstance().getTimeInMillis() + (plugin.getConfig().getInt("expireWarning.delay") * 60 * 1000);
|
||||
// loop through warning defined in the config for the profile that is set for this region
|
||||
String configPath = "expirationWarningProfiles." + getStringSetting("rent.expirationWarningProfile");
|
||||
ConfigurationSection section = plugin.getConfig().getConfigurationSection(configPath);
|
||||
if(section == null) {
|
||||
return;
|
||||
}
|
||||
for(String timeBefore : section.getKeys(false)) {
|
||||
long timeBeforeParsed = this.durationStringToLong(timeBefore);
|
||||
if(timeBeforeParsed <= 0) {
|
||||
return;
|
||||
}
|
||||
long checkTime = getRentedUntil() - timeBeforeParsed;
|
||||
|
||||
if(checkTime > warningsDoneUntil && checkTime <= sendUntil) {
|
||||
if(plugin.getConfig().getBoolean(configPath + "." + timeBefore + ".warnPlayer")) {
|
||||
plugin.message(player, "rent-expireWarning", this);
|
||||
}
|
||||
this.runCommands(Bukkit.getConsoleSender(), plugin.getConfig().getStringList(configPath + "." + timeBefore + ".commands"));
|
||||
}
|
||||
}
|
||||
warningsDoneUntil = sendUntil;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Rent a region
|
||||
* @param player The player that wants to rent the region
|
||||
* @param regionName The name of the region you want to rent
|
||||
* @return true if it succeeded and false if not
|
||||
*/
|
||||
public boolean rent(Player player) {
|
||||
/* Check if the player has permission */
|
||||
if(player.hasPermission("areashop.rent")) {
|
||||
boolean extend = false;
|
||||
if(getRenter() != null && player.getUniqueId().equals(getRenter())) {
|
||||
extend = true;
|
||||
}
|
||||
// Check if the region is available for renting or if the player wants to extend the rent
|
||||
if(!isRented() || extend) {
|
||||
// Check if the players needs to be in the world or region for buying
|
||||
if(restrictedToRegion() && (!player.getWorld().getName().equals(getWorldName())
|
||||
|| !getRegion().contains(player.getLocation().getBlockX(), player.getLocation().getBlockY(), player.getLocation().getBlockZ()))) {
|
||||
plugin.message(player, "rent-restrictedToRegion", getName());
|
||||
return false;
|
||||
}
|
||||
if(restrictedToWorld() && !player.getWorld().getName().equals(getWorldName())) {
|
||||
plugin.message(player, "rent-restrictedToWorld", getWorldName(), player.getWorld().getName());
|
||||
return false;
|
||||
}
|
||||
// Check region limits if this is not extending
|
||||
if(!extend) {
|
||||
LimitResult limitResult = this.limitsAllowRenting(player);
|
||||
AreaShop.debug("LimitResult: " + limitResult.toString());
|
||||
if(!limitResult.actionAllowed()) {
|
||||
if(limitResult.getLimitingFactor() == LimitType.TOTAL) {
|
||||
plugin.message(player, "total-maximum", limitResult.getMaximum(), limitResult.getCurrent(), limitResult.getLimitingGroup());
|
||||
return false;
|
||||
}
|
||||
if(limitResult.getLimitingFactor() == LimitType.RENTS) {
|
||||
plugin.message(player, "rent-maximum", limitResult.getMaximum(), limitResult.getCurrent(), limitResult.getLimitingGroup());
|
||||
return false;
|
||||
}
|
||||
// Should not be reached, but is safe like this
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Check if the player can still extend this rent
|
||||
if(extend && !player.hasPermission("areashop.rentextendbypass")) {
|
||||
if(getMaxExtends() >= 0 && getTimesExtended() >= getMaxExtends()) {
|
||||
plugin.message(player, "rent-maxExtends", getMaxExtends());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Check if there is enough time left before hitting maxRentTime
|
||||
long timeNow = Calendar.getInstance().getTimeInMillis();
|
||||
long timeRented = 0;
|
||||
long maxRentTime = getMaxRentTime();
|
||||
if(isRented()) {
|
||||
timeRented = getRentedUntil() - timeNow;
|
||||
}
|
||||
if((timeRented + getDuration()) > (maxRentTime*60*1000)
|
||||
&& !player.hasPermission("areashop.renttimebypass")
|
||||
&& maxRentTime != -1) {
|
||||
int timeRentedMinutes = (int)(timeRented/1000.0/60.0 +1);
|
||||
plugin.message(player, "rent-maxRentTime", maxRentTime, timeRentedMinutes);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(plugin.getEconomy().has(player, getWorldName(), getPrice())) {
|
||||
/* Substract the money from the players balance */
|
||||
EconomyResponse r = plugin.getEconomy().withdrawPlayer(player, getWorldName(), getPrice());
|
||||
if(!r.transactionSuccess()) {
|
||||
plugin.message(player, "rent-payError");
|
||||
return false;
|
||||
}
|
||||
if(!extend) {
|
||||
// Run commands
|
||||
runEventCommands(RegionEvent.RENTED, true);
|
||||
} else {
|
||||
// Run commands
|
||||
runEventCommands(RegionEvent.EXTENDED, true);
|
||||
}
|
||||
|
||||
/* Get the time until the region will be rented */
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
if(extend) {
|
||||
calendar.setTimeInMillis(getRentedUntil());
|
||||
}
|
||||
calendar.setTimeInMillis(calendar.getTimeInMillis() + getDuration());
|
||||
SimpleDateFormat dateFull = new SimpleDateFormat(plugin.getConfig().getString("timeFormatChat"));
|
||||
AreaShop.debug(player.getName() + " has rented region " + getName() + " for " + getFormattedPrice() + " until " + dateFull.format(calendar.getTime()));
|
||||
|
||||
/* Add values to the rent and send it to FileManager */
|
||||
setRentedUntil(calendar.getTimeInMillis());
|
||||
setRenter(player.getUniqueId());
|
||||
|
||||
// Fire schematic event and updated times extended
|
||||
if(!extend) {
|
||||
this.handleSchematicEvent(RegionEvent.RENTED);
|
||||
setTimesExtended(0);
|
||||
} else {
|
||||
setTimesExtended(getTimesExtended() + 1);
|
||||
}
|
||||
|
||||
/* Change the sign and the region flags */
|
||||
updateSigns();
|
||||
updateRegionFlags(RegionState.RENTED);
|
||||
|
||||
/* Send message to the player */
|
||||
if(extend) {
|
||||
plugin.message(player, "rent-extended", getName(), dateFull.format(calendar.getTime()));
|
||||
} else {
|
||||
plugin.message(player, "rent-rented", getName(), dateFull.format(calendar.getTime()));
|
||||
plugin.message(player, "rent-extend");
|
||||
}
|
||||
|
||||
this.saveRequired();
|
||||
if(!extend) {
|
||||
// Run commands
|
||||
this.runEventCommands(RegionEvent.RENTED, false);
|
||||
} else {
|
||||
// Run commands
|
||||
this.runEventCommands(RegionEvent.EXTENDED, false);
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
/* Player has not enough money */
|
||||
if(extend) {
|
||||
plugin.message(player, "rent-lowMoneyExtend", plugin.formatCurrency(plugin.getEconomy().getBalance(player, getWorldName())), getFormattedPrice());
|
||||
} else {
|
||||
plugin.message(player, "rent-lowMoneyRent", plugin.formatCurrency(plugin.getEconomy().getBalance(player, getWorldName())), getFormattedPrice());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
plugin.message(player, "rent-someoneElse");
|
||||
}
|
||||
} else {
|
||||
plugin.message(player, "rent-noPermission");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unrent a region, reset to unrented
|
||||
* @param regionName Region that should be unrented
|
||||
*/
|
||||
public void unRent(boolean giveMoneyBack) {
|
||||
// Run commands
|
||||
this.runEventCommands(RegionEvent.UNRENTED, true);
|
||||
double moneyBack = getMoneyBackAmount();
|
||||
if(moneyBack > 0 && giveMoneyBack) {
|
||||
/* Give back the money */
|
||||
OfflinePlayer player = Bukkit.getOfflinePlayer(getRenter());
|
||||
if(player != null) {
|
||||
EconomyResponse r = null;
|
||||
boolean error = false;
|
||||
try {
|
||||
r = plugin.getEconomy().depositPlayer(Bukkit.getOfflinePlayer(getRenter()), getWorldName(), moneyBack);
|
||||
} catch(Exception e) {
|
||||
error = true;
|
||||
}
|
||||
if(error || r == null || !r.transactionSuccess()) {
|
||||
plugin.getLogger().warning("Something went wrong with paying back to " + getPlayerName() + " money while unrenting region " + getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Debug message */
|
||||
AreaShop.debug(getPlayerName() + " has unrented " + getName() + ", got " + plugin.formatCurrency(moneyBack) + " money back");
|
||||
|
||||
/* Update the signs and region flags */
|
||||
handleSchematicEvent(RegionEvent.UNRENTED);
|
||||
updateRegionFlags(RegionState.FORRENT);
|
||||
|
||||
/* Remove friends, the owner and renteduntil values */
|
||||
clearFriends();
|
||||
setRenter(null);
|
||||
setRentedUntil(null);
|
||||
setTimesExtended(-1);
|
||||
|
||||
updateSigns();
|
||||
|
||||
this.saveRequired();
|
||||
// Run commands
|
||||
this.runEventCommands(RegionEvent.UNRENTED, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkInactive() {
|
||||
if(isDeleted() || !isRented()) {
|
||||
return false;
|
||||
}
|
||||
OfflinePlayer player = Bukkit.getOfflinePlayer(getRenter());
|
||||
//AreaShop.debug("inactive checking for " + getName() + ", player=" + player.getName() + ", currenttime=" + Calendar.getInstance().getTimeInMillis() + ", lastPlayed=" + player.getLastPlayed() + ", diff=" + (Calendar.getInstance().getTimeInMillis() - player.getLastPlayed()));
|
||||
int inactiveSetting = getIntegerSetting("rent.inactiveTimeUntilUnrent");
|
||||
if(inactiveSetting <= 0 || player.isOp()) {
|
||||
return false;
|
||||
}
|
||||
if(Calendar.getInstance().getTimeInMillis() > (player.getLastPlayed() + inactiveSetting * 60 * 1000)) {
|
||||
plugin.getLogger().info("Region " + getName() + " unrented because of inactivity for player " + getPlayerName());
|
||||
this.unRent(true);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user