mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-12-23 09:37:50 +01:00
Disallow negative number input for /pay
.
This commit is contained in:
parent
944ddf8d70
commit
e5b5994593
@ -26,6 +26,10 @@ public class Commandpay extends EssentialsLoopCommand {
|
||||
if (args.length < 2) {
|
||||
throw new NotEnoughArgumentsException();
|
||||
}
|
||||
|
||||
if (args[1].contains("-")) {
|
||||
throw new Exception(tl("payMustBePositive"));
|
||||
}
|
||||
|
||||
String stringAmount = args[1].replaceAll("[^0-9\\.]", "");
|
||||
|
||||
|
@ -311,6 +311,7 @@ orderBalances=\u00a76Ordering balances of\u00a7c {0} \u00a76users, please wait..
|
||||
oversizedTempban=\u00a74You may not ban a player for this period of time.
|
||||
payToggleOn=\u00a76You are now accepting payments.
|
||||
payToggleOff=\u00a76You are no longer accepting payments.
|
||||
payMustBePositive=\u00a74Amount to pay must be positive.
|
||||
pTimeCurrent=\u00a7c{0}\u00a76''s time is\u00a7c {1}\u00a76.
|
||||
pTimeCurrentFixed=\u00a7c{0}\u00a76''s time is fixed to\u00a7c {1}\u00a76.
|
||||
pTimeNormal=\u00a7c{0}\u00a76''s time is normal and matches the server.
|
||||
|
@ -309,6 +309,7 @@ orderBalances=Usporadavam bohatstvi {0} hracu, prosim vydrz ...
|
||||
oversizedTempban=\u00a74Nemuzes potrestat hrace ne tak dlouhou dobu.
|
||||
payToggleOn=\u00a76You are now accepting payments.
|
||||
payToggleOff=\u00a76You are no longer accepting payments.
|
||||
payMustBePositive=\u00a74Amount to pay must be positive.
|
||||
pTimeCurrent=\u00a7eCas hrace u00a7f je {1}. //???
|
||||
pTimeCurrentFixed=\u00a7eCas hrace {0} u00a7f je nastaven na {1}.
|
||||
pTimeNormal=\u00a7eCas hrace {0}\u00a7f je normalni a souhlasi s casem serveru.
|
||||
|
@ -309,6 +309,7 @@ orderBalances=\u00a76Tjekker saldi af\u00a7c {0} \u00a76brugere. Vent venligst..
|
||||
oversizedTempban=\u00a74Du kan ikke bandlyse den spiller i det tidsrum.
|
||||
payToggleOn=\u00a76You are now accepting payments.
|
||||
payToggleOff=\u00a76You are no longer accepting payments.
|
||||
payMustBePositive=\u00a74Amount to pay must be positive.
|
||||
pTimeCurrent=\u00a7c{0}\u00a76''s tid er\u00a7c {1}\u00a76.
|
||||
pTimeCurrentFixed=\u00a7c{0}\u00a76''s tid er fastsat til\u00a7c {1}\u00a76.
|
||||
pTimeNormal=\u00a7c{0}\u00a76''s tid er normal og matcher serverens tid.
|
||||
|
@ -311,6 +311,7 @@ orderBalances=\u00a76Ordne die Kontost\u00e4nde von\u00a7c {0} \u00a76Benutzern,
|
||||
oversizedTempban=\u00a74Du darfst einen Spieler nicht f\u00fcr so eine lange Zeit verbannen.
|
||||
payToggleOn=\u00a76Du akzeptierst nun Zahlungen.
|
||||
payToggleOff=\u00a76Du akzeptierst keine Zahlungen mehr.
|
||||
payMustBePositive=\u00a74Amount to pay must be positive.
|
||||
pTimeCurrent=\u00a76Die Zeit f\u00fcr\u00a7c {0} \u00a76ist\u00a7c {1}\u00a76.
|
||||
pTimeCurrentFixed=\u00a76Die Zeit f\u00fcr \u00a7c{0}\u00a76 wurde auf \u00a7c{1}\u00a76 gesetzt.
|
||||
pTimeNormal=\u00a76Die Zeit f\u00fcr \u00a7c{0}\u00a76 ist normal und entspricht der Serverzeit.
|
||||
|
@ -310,6 +310,7 @@ orderBalances=\u00a76Ordering balances of\u00a7c {0} \u00a76users, please wait..
|
||||
oversizedTempban=\u00a74You may not ban a player for this period of time.
|
||||
payToggleOn=\u00a76You are now accepting payments.
|
||||
payToggleOff=\u00a76You are no longer accepting payments.
|
||||
payMustBePositive=\u00a74Amount to pay must be positive.
|
||||
pTimeCurrent=\u00a7c{0}\u00a76''s time is\u00a7c {1}\u00a76.
|
||||
pTimeCurrentFixed=\u00a7c{0}\u00a76''s time is fixed to\u00a7c {1}\u00a76.
|
||||
pTimeNormal=\u00a7c{0}\u00a76''s time is normal and matches the server.
|
||||
|
@ -309,6 +309,7 @@ orderBalances=Creando un ranking de {0} usuarios segun su presupuesto, espera...
|
||||
oversizedTempban=\u00a74No puedes banear por ese periodo de tiempo.
|
||||
payToggleOn=\u00a76You are now accepting payments.
|
||||
payToggleOff=\u00a76You are no longer accepting payments.
|
||||
payMustBePositive=\u00a74Amount to pay must be positive.
|
||||
pTimeCurrent=\u00a76La hora de \u00a7c{0} es\u00a7c {1}\u00a76.
|
||||
pTimeCurrentFixed=\u00a7c{0}\u00a76 la hora ha sido corregida a\u00a7c {1}\u00a76.
|
||||
pTimeNormal=\u00a7c{0} \u00a77\: el tiempo es normal (coincide con el del servidor).
|
||||
|
@ -309,6 +309,7 @@ orderBalances=\u00a76J\u00e4rjestan\u00a7c {0} \u00a76m\u00e4ngija raha, palun o
|
||||
oversizedTempban=\u00a74Sa ei saa blokeerida m\u00e4ngijat nii pikaks ajaks.
|
||||
payToggleOn=\u00a76You are now accepting payments.
|
||||
payToggleOff=\u00a76You are no longer accepting payments.
|
||||
payMustBePositive=\u00a74Amount to pay must be positive.
|
||||
pTimeCurrent=\u00a7c{0}\u00a76''i aeg on\u00a7c {1}\u00a76.
|
||||
pTimeCurrentFixed=\u00a7c{0}\u00a76''i aeg on peatatud\u00a7c {1}\u00a76.
|
||||
pTimeNormal=\u00a7c{0}\u00a76''i aeg on normaalne ja kattub serveriga.
|
||||
|
@ -309,6 +309,7 @@ orderBalances=J\u00e4rjestet\u00e4\u00e4n rahatilanteita {0}, odota...
|
||||
oversizedTempban=\u00a74You may not ban a player for this period of time.
|
||||
payToggleOn=\u00a76You are now accepting payments.
|
||||
payToggleOff=\u00a76You are no longer accepting payments.
|
||||
payMustBePositive=\u00a74Amount to pay must be positive.
|
||||
pTimeCurrent=Pelaajan \u00a7e{0}\u00a7f aika on {1}.
|
||||
pTimeCurrentFixed=Pelaajan \u00a7e{0}\u00a7f aika on korjattu {1}.
|
||||
pTimeNormal=Pelaajan \u00a7e{0}\u00a7f aika on normaali ja vastaa palvelimen aikaa.
|
||||
|
@ -310,6 +310,7 @@ orderBalances=Classement des soldes des {0} joueurs, patientez...
|
||||
oversizedTempban=\u00a74Vous ne pouvez pas bannir un joueur pour cette p\u00e9riode.
|
||||
payToggleOn=\u00a76You are now accepting payments.
|
||||
payToggleOff=\u00a76You are no longer accepting payments.
|
||||
payMustBePositive=\u00a74Amount to pay must be positive.
|
||||
pTimeCurrent=Pour \u00a7e{0}\u00a7f l''heure est {1}.
|
||||
pTimeCurrentFixed=L''heure de \u00a7e{0}\u00a7f est fix\u00e9e \u00e0 {1}.
|
||||
pTimeNormal=\u00a7fPour \u00a7e{0}\u00a7f l''heure est normale et correspond au serveur.
|
||||
|
@ -309,6 +309,7 @@ orderBalances=\u00a76Egyenlegek \u00f6sszegy\u00fcjt\u00e9se\u00a7c {0} \u00a76j
|
||||
oversizedTempban=\u00a74You may not ban a player for this period of time.
|
||||
payToggleOn=\u00a76You are now accepting payments.
|
||||
payToggleOff=\u00a76You are no longer accepting payments.
|
||||
payMustBePositive=\u00a74Amount to pay must be positive.
|
||||
pTimeCurrent=\u00a7c{0}\u00a76''s time is\u00a7c {1}\u00a76.
|
||||
pTimeCurrentFixed=\u00a7c{0}\u00a76''s time is fixed to\u00a7c {1}\u00a76.
|
||||
pTimeNormal=\u00a7c{0}\u00a76''s time is normal and matches the server.
|
||||
|
@ -309,6 +309,7 @@ orderBalances=\u00a76Ordinamento bilanci di\u00a7c {0} \u00a76utenti, attendere
|
||||
oversizedTempban=\u00a74Non potrai esiliare giocatori in questo arco di tempo.
|
||||
payToggleOn=\u00a76You are now accepting payments.
|
||||
payToggleOff=\u00a76You are no longer accepting payments.
|
||||
payMustBePositive=\u00a74Amount to pay must be positive.
|
||||
pTimeCurrent=\u00a76L''orario di \u00a7c{0}\u00a76 e''\u00a7c {1}\u00a76.
|
||||
pTimeCurrentFixed=L''orario di \u00a7e{0}\u00a7f e'' fissato alle {1}.
|
||||
pTimeNormal=L''orario di \u00a7e{0}\u00a7f e'' normale e corrisponde a quello del server.
|
||||
|
@ -309,6 +309,7 @@ orderBalances=\u00a76Ordering balances of\u00a7c {0} \u00a76users, please wait..
|
||||
oversizedTempban=\u00a74You may not \ucc28\ub2e8 a player for this period of time.
|
||||
payToggleOn=\u00a76You are now accepting payments.
|
||||
payToggleOff=\u00a76You are no longer accepting payments.
|
||||
payMustBePositive=\u00a74Amount to pay must be positive.
|
||||
pTimeCurrent=\u00a7c{0}\u00a76''s time is\u00a7c {1}\u00a76.
|
||||
pTimeCurrentFixed=\u00a7c{0}\u00a76''s time is fixed to\u00a7c {1}\u00a76.
|
||||
pTimeNormal=\u00a7c{0}\u00a76''s time is normal and matches the server.
|
||||
|
@ -309,6 +309,7 @@ orderBalances=\u00a76Ordering balances of\u00a7c {0} \u00a76users, please wait..
|
||||
oversizedTempban=\u00a74Tu negali u\u017eblokuoti \u017eaid\u0117jo laikinai.
|
||||
payToggleOn=\u00a76You are now accepting payments.
|
||||
payToggleOff=\u00a76You are no longer accepting payments.
|
||||
payMustBePositive=\u00a74Amount to pay must be positive.
|
||||
pTimeCurrent=\u00a7c{0}\u00a76''s time is\u00a7c {1}\u00a76.
|
||||
pTimeCurrentFixed=\u00a7c{0}\u00a76''s time is fixed to\u00a7c {1}\u00a76.
|
||||
pTimeNormal=\u00a7c{0}\u00a76''s time is normal and matches the server.
|
||||
|
@ -309,6 +309,7 @@ orderBalances=\u00a76Saldo''s bestellen van\u00a7c {0} \u00a76gebruikers, een mo
|
||||
oversizedTempban=\u00a74U kunt een speler niet verbannen voor deze lange period van tijd.
|
||||
payToggleOn=\u00a76You are now accepting payments.
|
||||
payToggleOff=\u00a76You are no longer accepting payments.
|
||||
payMustBePositive=\u00a74Amount to pay must be positive.
|
||||
pTimeCurrent=\u00a7c{0}\u00a76''s tijd is\u00a7c {1}\u00a76.
|
||||
pTimeCurrentFixed=\u00a7cc{0}\u00a76''s tijd is vastgezet op\u00a7c {1}\u00a76.
|
||||
pTimeNormal=\u00a7c{0}\u00a76''s tijd is normaal en komt overeen met de server.
|
||||
|
@ -309,6 +309,7 @@ orderBalances=Pobieram fundusze {0} graczy, prosze czekac ...
|
||||
oversizedTempban=\u00a74Nie mozesz teraz zbanowac tego gracza.
|
||||
payToggleOn=\u00a76You are now accepting payments.
|
||||
payToggleOff=\u00a76You are no longer accepting payments.
|
||||
payMustBePositive=\u00a74Amount to pay must be positive.
|
||||
pTimeCurrent=Czas \u00a7e{0} u00a7f to {1}.
|
||||
pTimeCurrentFixed=\u00a77Czas \u00a7c{0}\u00a77 przywrocony do\u00a7c {1}\u00a77.
|
||||
pTimeNormal=\u00a77Czas \u00a7c{0}''s\u00a77 jest normalny i odpowiada serwerowemu.
|
||||
|
@ -309,6 +309,7 @@ orderBalances=\u00A76A organizar saldos de\u00A7c {0} \u00A76jogadores, aguarda.
|
||||
oversizedTempban=\u00A74N\u00E3o podes banir um jogador por tanto tempo.
|
||||
payToggleOn=\u00a76You are now accepting payments.
|
||||
payToggleOff=\u00a76You are no longer accepting payments.
|
||||
payMustBePositive=\u00a74Amount to pay must be positive.
|
||||
pTimeCurrent=\u00A76O tempo para \u00A7c{0}\u00A76 e \u00A7c {1}\u00A76.
|
||||
pTimeCurrentFixed=\u00A76O tempo para \u00A7c{0}\u00A76 foi bloqueado para\u00A7c {1}\u00A76.
|
||||
pTimeNormal=\u00A76O tempo de \u00A7c{0}\u00A76 est\u00E1 normal e corresponde ao do servidor.
|
||||
|
@ -309,6 +309,7 @@ orderBalances=\u00A76Organizando saldos de\u00A7c {0} \u00A76usu\u00E1rios, agua
|
||||
oversizedTempban=\u00A74Voc\u00EA n\u00E3o pode banir um jogador por esse per\u00EDodo de tempo.
|
||||
payToggleOn=\u00a76Voc\u00EA agora est\u00E1 aceitando pagamentos.
|
||||
payToggleOff=\u00a76Voc\u00EA n\u00E3o est\u00E1 mais aceitando pagamentos.
|
||||
payMustBePositive=\u00a74Amount to pay must be positive.
|
||||
pTimeCurrent=\u00A76O tempo para \u00A7c{0}\u00A76 e \u00A7c {1}\u00A76.
|
||||
pTimeCurrentFixed=\u00A76O tempo para \u00A7c{0}\u00A76 foi arrumado para\u00A7c {1}\u00A76.
|
||||
pTimeNormal=\u00A76O tempo de \u00A7c{0}\u00A76 est\u00E1 normal e correspondendo ao do servidor.
|
||||
|
@ -309,6 +309,7 @@ orderBalances=\u00a76Se ordoneaza balantele a\u00a7c {0} \u00a76jucatori, te rog
|
||||
oversizedTempban=\u00a74Nu poti interzice un jucator pentru asa o perioada de timp.
|
||||
payToggleOn=\u00a76You are now accepting payments.
|
||||
payToggleOff=\u00a76You are no longer accepting payments.
|
||||
payMustBePositive=\u00a74Amount to pay must be positive.
|
||||
pTimeCurrent=\u00a76Timpul jucatorului \u00a7c{0}\u00a76 este\u00a7c {1}\u00a76.
|
||||
pTimeCurrentFixed=\u00a76Timpul jucatorului \u00a7c{0}\u00a76 a fost fixat la\u00a7c {1}\u00a76.
|
||||
pTimeNormal=\u00a76Timpul jucatorului \u00a7c{0}\u00a76 este timpul normal si potrivit serverului.
|
||||
|
@ -309,6 +309,7 @@ orderBalances=\u00a76\u041f\u043e\u0434\u0441\u0447\u0435\u0442 \u0431\u0430\u04
|
||||
oversizedTempban=\u00a74\u0412\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u0442\u0435 \u0437\u0430\u0431\u0430\u043d\u0438\u0442\u044c \u0438\u0433\u0440\u043e\u043a\u0430 \u043d\u0430 \u0442\u0430\u043a\u043e\u0439 \u0441\u0440\u043e\u043a.
|
||||
payToggleOn=\u00a76You are now accepting payments.
|
||||
payToggleOff=\u00a76You are no longer accepting payments.
|
||||
payMustBePositive=\u00a74Amount to pay must be positive.
|
||||
pTimeCurrent=\u00a76\u0412\u0440\u0435\u043c\u044f \u0438\u0433\u0440\u043e\u043a\u0430 \u00a7c{0} - {1}\u00a76.
|
||||
pTimeCurrentFixed=\u00a76\u0412\u0440\u0435\u043c\u044f \u0438\u0433\u0440\u043e\u043a\u0430 \u00a7c{0}\u00a76 \u0437\u0430\u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043e \u043d\u0430\u00a7c {1}\u00a76.
|
||||
pTimeNormal=\u00a76\u0412\u0440\u0435\u043c\u044f \u0438\u0433\u0440\u043e\u043a\u0430 \u00a7c{0}\u00a76 \u0442\u0435\u043f\u0435\u0440\u044c \u0442\u0430\u043a\u043e\u0435 \u0436\u0435, \u043a\u0430\u043a \u0438 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435.
|
||||
|
@ -307,6 +307,9 @@ onlyPlayers=\u00a74Bara spelare kan anv\u00e4nda \u00a7c{0}\u00a74.
|
||||
onlySunStorm=/weather st\u00f6der bara sun(sol) eller storm(storm).
|
||||
orderBalances=Best\u00e4ller balanser av {0} anv\u00e4ndare, v\u00e4nligen v\u00e4nta...
|
||||
oversizedTempban=\u00a74Du kan inte banna en spelare just vid denna tidpunkt.
|
||||
payToggleOn=\u00a76You are now accepting payments.
|
||||
payToggleOff=\u00a76You are no longer accepting payments.
|
||||
payMustBePositive=\u00a74Amount to pay must be positive.
|
||||
pTimeCurrent=\u00a7e{0}''*s\u00a7f klockan \u00e4r {1}.
|
||||
pTimeCurrentFixed=\u00a7e{0}''s\u00a7f tiden \u00e4r fixerad till {1}.
|
||||
pTimeNormal=\u00a7e{0}''s\u00a7f tiden \u00e4r normal och matchar servern.
|
||||
|
@ -309,6 +309,7 @@ orderBalances=\u00a7c {0} \u00a76Adli oyuncularin bakiyesi listeleniyor, l\u00fc
|
||||
oversizedTempban=\u00a74Oyunculari bu kadar sure yasaklayamazsin.
|
||||
payToggleOn=\u00a76You are now accepting payments.
|
||||
payToggleOff=\u00a76You are no longer accepting payments.
|
||||
payMustBePositive=\u00a74Amount to pay must be positive.
|
||||
pTimeCurrent=\u00a7c{0}\u00a76''in zaman\u0131\:\u00a7c {1}\u00a76.
|
||||
pTimeCurrentFixed=\u00a7c{0}\u00a76''in zaman\u0131 {1}\u00a76''a ayarland\u0131.
|
||||
pTimeNormal=\u00a7c{0}\u00a76''in zaman\u0131 do\u011fru ve sunucuya uyuyor.
|
||||
|
@ -309,6 +309,7 @@ orderBalances=\u00a76\u6392\u5e8f {0} \u00a76\u4e2a\u73a9\u5bb6\u7684\u8d44\u91d
|
||||
oversizedTempban=\u00a74\u4f60\u53ef\u80fd\u6ca1\u6709\u5728\u8fd9\u4e2a\u65f6\u6bb5\u5c01\u7981\u73a9\u5bb6.
|
||||
payToggleOn=\u00a76You are now accepting payments.
|
||||
payToggleOff=\u00a76You are no longer accepting payments.
|
||||
payMustBePositive=\u00a74Amount to pay must be positive.
|
||||
pTimeCurrent=\u00a76{0}\u00a7c \u00a76\u7684\u65f6\u95f4\u662f \u00a7c{1}
|
||||
pTimeCurrentFixed=\u00a7c{0}\u00a76 \u7684\u65f6\u95f4\u88ab\u8fde\u63a5\u5230 \u00a7c{1}
|
||||
pTimeNormal=\u00a7c{0}\u00a76 \u7684\u65f6\u95f4\u662f\u6b63\u5e38\u7684\u5e76\u4e0e\u670d\u52a1\u5668\u540c\u6b65
|
||||
|
@ -309,6 +309,7 @@ orderBalances=\u00a76\u6392\u5e8f {0} \u00a76\u500b\u73a9\u5bb6\u7684\u8cc7\u91d
|
||||
oversizedTempban=\u00a74\u4f60\u53ef\u80fd\u6c92\u6709\u5728\u9019\u500b\u6642\u6bb5\u5c01\u7981\u73a9\u5bb6.
|
||||
payToggleOn=\u00a76You are now accepting payments.
|
||||
payToggleOff=\u00a76You are no longer accepting payments.
|
||||
payMustBePositive=\u00a74Amount to pay must be positive.
|
||||
pTimeCurrent=\u00a76{0}\u00a7c \u00a76\u7684\u6642\u9593\u662f \u00a7c{1}
|
||||
pTimeCurrentFixed=\u00a7c{0}\u00a76 \u7684\u6642\u9593\u88ab\u9023\u63a5\u5230 \u00a7c{1}
|
||||
pTimeNormal=\u00a7c{0}\u00a76 \u7684\u6642\u9593\u662f\u6b63\u5e38\u7684\u4e26\u8207\u670d\u52d9\u5668\u540c\u6b65
|
||||
|
@ -309,6 +309,7 @@ orderBalances=\u00a76\u6392\u5e8f {0} \u00a76\u500b\u73a9\u5bb6\u7684\u8cc7\u91d
|
||||
oversizedTempban=\u00a74\u4f60\u53ef\u80fd\u6c92\u6709\u5728\u9019\u500b\u6642\u6bb5\u5c01\u7981\u73a9\u5bb6.
|
||||
payToggleOn=\u00a76You are now accepting payments.
|
||||
payToggleOff=\u00a76You are no longer accepting payments.
|
||||
payMustBePositive=\u00a74Amount to pay must be positive.
|
||||
pTimeCurrent=\u00a76{0}\u00a7c \u00a76\u7684\u6642\u9593\u662f \u00a7c{1}
|
||||
pTimeCurrentFixed=\u00a7c{0}\u00a76 \u7684\u6642\u9593\u88ab\u9023\u63a5\u5230 \u00a7c{1}
|
||||
pTimeNormal=\u00a7c{0}\u00a76 \u7684\u6642\u9593\u662f\u6b63\u5e38\u7684\u4e26\u8207\u4f3a\u670d\u5668\u540c\u6b65
|
||||
|
@ -2,9 +2,13 @@ package com.earth2me.essentials;
|
||||
|
||||
import com.earth2me.essentials.api.NoLoanPermittedException;
|
||||
import com.earth2me.essentials.api.UserDoesNotExistException;
|
||||
import com.earth2me.essentials.commands.IEssentialsCommand;
|
||||
import com.earth2me.essentials.commands.NoChargeException;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import net.ess3.api.Economy;
|
||||
import org.bukkit.World.Environment;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.plugin.InvalidDescriptionException;
|
||||
import org.junit.Test;
|
||||
|
||||
@ -15,10 +19,12 @@ public class EconomyTest extends TestCase {
|
||||
private final transient Essentials ess;
|
||||
private static final String NPCNAME = "npc1";
|
||||
private static final String PLAYERNAME = "testPlayer1";
|
||||
private static final String PLAYERNAME2 = "testPlayer2";
|
||||
private final FakeServer server;
|
||||
|
||||
public EconomyTest(final String testName) {
|
||||
super(testName);
|
||||
final FakeServer server = new FakeServer();
|
||||
this.server = new FakeServer();
|
||||
server.createWorld("testWorld", Environment.NORMAL);
|
||||
ess = new Essentials(server);
|
||||
try {
|
||||
@ -29,6 +35,7 @@ public class EconomyTest extends TestCase {
|
||||
fail("IOException");
|
||||
}
|
||||
server.addPlayer(new OfflinePlayer(PLAYERNAME, ess.getServer()));
|
||||
server.addPlayer(new OfflinePlayer(PLAYERNAME2, ess.getServer()));
|
||||
}
|
||||
|
||||
// only one big test, since we use static instances
|
||||
@ -96,4 +103,48 @@ public class EconomyTest extends TestCase {
|
||||
} catch (UserDoesNotExistException ex) {
|
||||
}
|
||||
}
|
||||
|
||||
private void runCommand(String command, User user, String args) throws Exception {
|
||||
runCommand(command, user, args.split("\\s+"));
|
||||
}
|
||||
|
||||
private void runCommand(String command, User user, String[] args) throws Exception {
|
||||
IEssentialsCommand cmd;
|
||||
|
||||
try {
|
||||
cmd = (IEssentialsCommand) Essentials.class.getClassLoader()
|
||||
.loadClass("com.earth2me.essentials.commands.Command" + command).newInstance();
|
||||
cmd.setEssentials(ess);
|
||||
cmd.run(server, user, command, null, args);
|
||||
} catch (NoChargeException ex) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void runConsoleCommand(String command, String args) throws Exception {
|
||||
runConsoleCommand(command, args.split("\\s+"));
|
||||
}
|
||||
|
||||
private void runConsoleCommand(String command, String[] args) throws Exception {
|
||||
IEssentialsCommand cmd;
|
||||
|
||||
CommandSender sender = server.getConsoleSender();
|
||||
|
||||
try {
|
||||
cmd = (IEssentialsCommand) Essentials.class.getClassLoader()
|
||||
.loadClass("com.earth2me.essentials.commands.Command" + command).newInstance();
|
||||
cmd.setEssentials(ess);
|
||||
cmd.run(server, new CommandSource(sender), command, null, args);
|
||||
} catch (NoChargeException ex) {
|
||||
}
|
||||
}
|
||||
|
||||
public void testNegativePayCommand() throws Exception {
|
||||
User user1 = ess.getUser(PLAYERNAME);
|
||||
try {
|
||||
runCommand("pay", user1, PLAYERNAME2 + " -123");
|
||||
} catch (Exception e) {
|
||||
assertEquals(I18n.tl("payMustBePositive"), e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -570,6 +570,8 @@ public class FakeServer implements Server {
|
||||
public UUID getUniqueId() {
|
||||
if (string == "testPlayer1") {
|
||||
return UUID.fromString("3c9ebe1a-9098-43fd-bc0c-a369b76817ba");
|
||||
} else if (string == "testPlayer2") {
|
||||
return UUID.fromString("2c9ebe1a-9098-43fd-bc0c-a369b76817ba");
|
||||
} else if (string == "npc1") {
|
||||
return null;
|
||||
}
|
||||
@ -820,6 +822,11 @@ public class FakeServer implements Server {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Merchant createMerchant(String s) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getWorldType() {
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
|
Loading…
Reference in New Issue
Block a user