diff options
author | KHobbits <rob@khobbits.co.uk> | 2012-08-26 17:12:18 +0100 |
---|---|---|
committer | KHobbits <rob@khobbits.co.uk> | 2012-08-26 17:16:22 +0100 |
commit | 2b6d41ac5fbfbf6e2f114c302545abff89a35938 (patch) | |
tree | af98519fe448dea10316ab06d696e992661efb14 | |
parent | a4936355b5bcf79ee2dde7aaf4b155361f7497d0 (diff) | |
download | Essentials-2b6d41ac5fbfbf6e2f114c302545abff89a35938.tar Essentials-2b6d41ac5fbfbf6e2f114c302545abff89a35938.tar.gz Essentials-2b6d41ac5fbfbf6e2f114c302545abff89a35938.tar.lz Essentials-2b6d41ac5fbfbf6e2f114c302545abff89a35938.tar.xz Essentials-2b6d41ac5fbfbf6e2f114c302545abff89a35938.zip |
More work on /fly command - Still incomplete
Updated and fixed messages files for missing keys.
-rw-r--r-- | Essentials/src/com/earth2me/essentials/ISettings.java | 10 | ||||
-rw-r--r-- | Essentials/src/com/earth2me/essentials/Settings.java | 14 | ||||
-rw-r--r-- | Essentials/src/com/earth2me/essentials/commands/Commandspeed.java | 55 | ||||
-rw-r--r-- | Essentials/src/config.yml | 8 | ||||
-rw-r--r-- | Essentials/src/messages.properties | 2 | ||||
-rw-r--r-- | Essentials/src/messages_cs.properties | 2 | ||||
-rw-r--r-- | Essentials/src/messages_da.properties | 2 | ||||
-rw-r--r-- | Essentials/src/messages_de.properties | 2 | ||||
-rw-r--r-- | Essentials/src/messages_en.properties | 2 | ||||
-rw-r--r-- | Essentials/src/messages_es.properties | 2 | ||||
-rw-r--r-- | Essentials/src/messages_fi.properties | 32 | ||||
-rw-r--r-- | Essentials/src/messages_fr.properties | 2 | ||||
-rw-r--r-- | Essentials/src/messages_it.properties | 2 | ||||
-rw-r--r-- | Essentials/src/messages_nl.properties | 2 | ||||
-rw-r--r-- | Essentials/src/messages_pl.properties | 2 | ||||
-rw-r--r-- | Essentials/src/messages_pt.properties | 2 | ||||
-rw-r--r-- | Essentials/src/messages_se.properties | 36 |
17 files changed, 131 insertions, 46 deletions
diff --git a/Essentials/src/com/earth2me/essentials/ISettings.java b/Essentials/src/com/earth2me/essentials/ISettings.java index 71fc7f5dd..e1781cb46 100644 --- a/Essentials/src/com/earth2me/essentials/ISettings.java +++ b/Essentials/src/com/earth2me/essentials/ISettings.java @@ -159,7 +159,7 @@ public interface ISettings extends IConf boolean getRepairEnchanted(); boolean isWorldTeleportPermissions(); - + boolean isWorldHomePermissions(); boolean registerBackInListener(); @@ -177,8 +177,12 @@ public interface ISettings extends IConf long getTeleportInvulnerability(); boolean isTeleportInvulnerability(); - + long getLoginAttackDelay(); - + int getSignUsePerSecond(); + + double getMaxFlySpeed(); + + double getMaxWalkSpeed(); } diff --git a/Essentials/src/com/earth2me/essentials/Settings.java b/Essentials/src/com/earth2me/essentials/Settings.java index 30cfc9dab..c5bef5f92 100644 --- a/Essentials/src/com/earth2me/essentials/Settings.java +++ b/Essentials/src/com/earth2me/essentials/Settings.java @@ -912,4 +912,18 @@ public class Settings implements ISettings { return signUsePerSecond; } + + @Override + public double getMaxFlySpeed() + { + double maxSpeed = config.getDouble("max-fly-speed", 1.0); + return maxSpeed > 1.0 ? 1.0 : Math.abs(maxSpeed); + } + + @Override + public double getMaxWalkSpeed() + { + double maxSpeed = config.getDouble("max-walk-speed", 0.8); + return maxSpeed > 1.0 ? 1.0 : Math.abs(maxSpeed); + } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandspeed.java b/Essentials/src/com/earth2me/essentials/commands/Commandspeed.java index eeed03dcb..31911ca6c 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandspeed.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandspeed.java @@ -1,5 +1,6 @@ package com.earth2me.essentials.commands; +import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.User; import org.bukkit.Server; import org.bukkit.command.CommandSender; @@ -21,7 +22,7 @@ public class Commandspeed extends EssentialsCommand throw new NotEnoughArgumentsException(); } final boolean isFly = isFlyMode(args[0]); - final float speed = isMoveSpeed(args[1]); + final float speed = getMoveSpeed(args[1]); speedOtherPlayers(server, sender, isFly, speed, args[2]); } @@ -38,28 +39,30 @@ public class Commandspeed extends EssentialsCommand if (args.length == 1) { isFly = user.isFlying(); - speed = isMoveSpeed(args[0]); + speed = getMoveSpeed(args[0]); } else if (args.length == 2) { isFly = isFlyMode(args[0]); - speed = isMoveSpeed(args[1]); + speed = getMoveSpeed(args[1]); } else { isFly = isFlyMode(args[0]); - speed = isMoveSpeed(args[1]); + speed = getMoveSpeed(args[1]); speedOtherPlayers(server, user, isFly, speed, args[2]); return; } if (isFly) { - user.setFlySpeed(speed); + user.setFlySpeed(getRealMoveSpeed(speed, isFly)); + user.sendMessage(_("moveSpeed", _("flying"), speed, user.getDisplayName())); } else { - user.setWalkSpeed(speed); + user.setWalkSpeed(getRealMoveSpeed(speed, isFly)); + user.sendMessage(_("moveSpeed", _("walking"), speed, user.getDisplayName())); } } @@ -69,16 +72,18 @@ public class Commandspeed extends EssentialsCommand { if (isFly) { - matchPlayer.setFlySpeed(speed); + matchPlayer.setFlySpeed(getRealMoveSpeed(speed, isFly)); + sender.sendMessage(_("moveSpeed", _("flying"), speed, matchPlayer.getDisplayName())); } else { - matchPlayer.setWalkSpeed(speed); + matchPlayer.setWalkSpeed(getRealMoveSpeed(speed, isFly)); + sender.sendMessage(_("moveSpeed", _("walking"), speed, matchPlayer.getDisplayName())); } } } - private boolean isFlyMode(String modeString) throws NotEnoughArgumentsException + private boolean isFlyMode(final String modeString) throws NotEnoughArgumentsException { boolean isFlyMode; if (modeString.contains("fly") || modeString.equalsIgnoreCase("f")) @@ -97,17 +102,41 @@ public class Commandspeed extends EssentialsCommand return isFlyMode; } - private float isMoveSpeed(String moveSpeed) throws NotEnoughArgumentsException + private float getMoveSpeed(final String moveSpeed) throws NotEnoughArgumentsException { - float speed; + float userSpeed; try { - speed = Float.parseFloat(moveSpeed); + userSpeed = Float.parseFloat(moveSpeed); + if (userSpeed > 10f) + { + userSpeed = 10f; + } + else if (userSpeed < 0f) + { + userSpeed = 0f; + } } catch (NumberFormatException e) { throw new NotEnoughArgumentsException(); } - return speed; + return userSpeed; + } + + private float getRealMoveSpeed(final float userSpeed, final boolean isFly) + { + float maxSpeed = (float)(isFly ? ess.getSettings().getMaxFlySpeed() : ess.getSettings().getMaxWalkSpeed()); + float defaultSpeed = isFly ? 0.1f : 0.2f; + + if (userSpeed < 1f) + { + return defaultSpeed * userSpeed; + } + else + { + float ratio = ((userSpeed - 1) / 9) * (maxSpeed - defaultSpeed); + return ratio + defaultSpeed; + } } } diff --git a/Essentials/src/config.yml b/Essentials/src/config.yml index e7813af8b..1b6d28758 100644 --- a/Essentials/src/config.yml +++ b/Essentials/src/config.yml @@ -233,7 +233,7 @@ enabledSigns: # Lower numbers will reduce the possibility of lag, but may annoy players. sign-use-per-second: 4 -# Backup runs a command while saving is disabled +# Backup runs a batch/bash command while saving is disabled backup: # Interval in minutes interval: 30 @@ -321,6 +321,12 @@ register-back-in-listener: false #Delay to wait before people can cause attack damage after logging in login-attack-delay: 5 +#Set the max fly speed, values range from 0.1 to 1.0 +max-fly-speed: 1.0 + +#Set the max walk speed, values range from 0.1 to 1.0 +max-walk-speed: 0.8 + ############################################################ # +------------------------------------------------------+ # # | EssentialsHome | # diff --git a/Essentials/src/messages.properties b/Essentials/src/messages.properties index 9e274c165..25d6b6b3a 100644 --- a/Essentials/src/messages.properties +++ b/Essentials/src/messages.properties @@ -443,3 +443,5 @@ youAreHealed=\u00a77You have been healed. youHaveNewMail=\u00a7cYou have {0} messages!\u00a7f Type \u00a77/mail read\u00a7f to view your mail. hatRemoved=\u00a7eYour hat has been removed. banFormat=Banned: {0} +moveSpeed=\u00a77Set {0} speed to {1} for {2}. +walking=walking diff --git a/Essentials/src/messages_cs.properties b/Essentials/src/messages_cs.properties index 5a85918c6..241bb8ac3 100644 --- a/Essentials/src/messages_cs.properties +++ b/Essentials/src/messages_cs.properties @@ -446,3 +446,5 @@ year=rok years=roky youAreHealed=\u00a77Byl jsi uzdraven. youHaveNewMail=\u00a7cMas {0} zprav!\u00a7f Napis \u00a77/mail read\u00a7f aby jsi si precetl sve zpravy. +moveSpeed=\u00a77Set {0} speed to {1} for {2}. +walking=walking diff --git a/Essentials/src/messages_da.properties b/Essentials/src/messages_da.properties index b33fa99e2..d030fe59d 100644 --- a/Essentials/src/messages_da.properties +++ b/Essentials/src/messages_da.properties @@ -443,3 +443,5 @@ youAreHealed=\u00a77Du er blevet healed. Halleluja! youHaveNewMail=\u00a7cDu har {0} flaskeposter!\u00a7f Type \u00a77/mail read for at se din flaskepost. hatRemoved=\u00a7eYour hat has been removed. banFormat=Banned: {0} +moveSpeed=\u00a77Set {0} speed to {1} for {2}. +walking=walking diff --git a/Essentials/src/messages_de.properties b/Essentials/src/messages_de.properties index 22a6d84f9..90f4c9d84 100644 --- a/Essentials/src/messages_de.properties +++ b/Essentials/src/messages_de.properties @@ -443,3 +443,5 @@ youAreHealed=\u00a77Du wurdest geheilt. youHaveNewMail=\u00a7cDu hast {0} Nachrichten!\u00a7f Schreibe \u00a77/mail read\u00a7f um deine Nachrichten anzuzeigen. hatRemoved=\u00a7eYour hat has been removed. banFormat=Banned: {0} +moveSpeed=\u00a77Set {0} speed to {1} for {2}. +walking=walking diff --git a/Essentials/src/messages_en.properties b/Essentials/src/messages_en.properties index 9e274c165..25d6b6b3a 100644 --- a/Essentials/src/messages_en.properties +++ b/Essentials/src/messages_en.properties @@ -443,3 +443,5 @@ youAreHealed=\u00a77You have been healed. youHaveNewMail=\u00a7cYou have {0} messages!\u00a7f Type \u00a77/mail read\u00a7f to view your mail. hatRemoved=\u00a7eYour hat has been removed. banFormat=Banned: {0} +moveSpeed=\u00a77Set {0} speed to {1} for {2}. +walking=walking diff --git a/Essentials/src/messages_es.properties b/Essentials/src/messages_es.properties index e64670496..3f6db8c4b 100644 --- a/Essentials/src/messages_es.properties +++ b/Essentials/src/messages_es.properties @@ -443,3 +443,5 @@ youAreHealed=\u00a77Has sido curado. youHaveNewMail=\u00a7cTienes {0} mensajes!\u00a7f Pon \u00a77/mail read\u00a7f para ver tus emails no leidos!. hatRemoved=\u00a7eYour hat has been removed. banFormat=Banned: {0} +moveSpeed=\u00a77Set {0} speed to {1} for {2}. +walking=walking diff --git a/Essentials/src/messages_fi.properties b/Essentials/src/messages_fi.properties index a2ce13b34..7a32d2ced 100644 --- a/Essentials/src/messages_fi.properties +++ b/Essentials/src/messages_fi.properties @@ -414,20 +414,16 @@ weatherStorm=\u00a77Laitoit myrskyn maailmaan {0} weatherStormFor=\u00a77Laitoit myrskyn maailmaan {0} {1} sekunniksi weatherSun=\u00a77Laitoit auringon paistamaan maailmaan {0} weatherSunFor=\u00a77Laitoit auringon paistamaan maailmaan {0} {1} sekunniksi -whoisBanned=\u00a79 - Bannattu: {0} -whoisExp=\u00a79 - Exp: {0} (Taso {1}) -whoisGamemode=\u00a79 - Pelimuoto: {0} -whoisGeoLocation=\u00a79 - Sijainti: {0} -whoisGod=\u00a79 - God muoto: {0} -whoisHealth=\u00a79 - Terveys: {0}/20 -whoisIPAddress=\u00a79 - IP Osoite: {0} -whoisIs={0} on {1} -whoisJail=\u00a79 - Vankila: {0} -whoisLocation=\u00a79 - Sijainti: ({0}, {1}, {2}, {3}) -whoisMoney=\u00a79 - Raha: {0} -whoisOP=\u00a79 - OP: {0} -whoisStatusAvailable=\u00a79 - Tilanne: Saatavilla -whoisStatusAway=\u00a79 - Tilanne: \u00a7cPoissa\u00a7f +whoisBanned=\u00a76 - Banned:\u00a7f {0} +whoisExp=\u00a76 - Exp:\u00a7f {0} (Level {1}) +whoisGamemode=\u00a76 - Gamemode:\u00a7f {0} +whoisGeoLocation=\u00a76 - Location:\u00a7f {0} +whoisGod=\u00a76 - God mode:\u00a7f {0} +whoisHealth=\u00a76 - Health:\u00a7f {0}/20 +whoisIPAddress=\u00a76 - IP Address:\u00a7f {0} +whoisJail=\u00a76 - Jail:\u00a7f {0} +whoisLocation=\u00a76 - Location:\u00a7f ({0}, {1}, {2}, {3}) +whoisMoney=\u00a76 - Money:\u00a7f {0} worth=\u00a77Pino tavaraa "{0}" on arvoltaan \u00a7c{1}\u00a77 ({2} tavara(a) = {3} kappale) worthMeta=\u00a77Pino tavaraa "{0}" metadatan kanssa {1} on arvoltaan \u00a7c{2}\u00a77 ({3} tavara(a) = {4} kappale) worthSet=Arvo asetettu @@ -437,3 +433,11 @@ youAreHealed=\u00a77Sinut on parannettu. youHaveNewMail=\u00a7cSinulla on {0} viesti(\u00e4)!\u00a7f Kirjoita \u00a77/mail read\u00a7f lukeaksesi viestit. hatRemoved=\u00a7eYour hat has been removed. banFormat=Banned: {0} +moveSpeed=\u00a77Set {0} speed to {1} for {2}. +whoisAFK=\u00a76 - AFK:\u00a7f {0} +whoisFly=\u00a76 - Fly mode:\u00a7f {0} ({1}) +whoisMuted=\u00a76 - Muted:\u00a7f {0} +whoisNick=\u00a76 - Nick:\u00a7f {0} +whoisOp=\u00a76 - OP:\u00a7f {0} +whoisTop=\u00a76 ====== WhoIs:\u00a7f {0} \u00a76====== +walking=walking diff --git a/Essentials/src/messages_fr.properties b/Essentials/src/messages_fr.properties index 33fbc4356..0cb35f9c8 100644 --- a/Essentials/src/messages_fr.properties +++ b/Essentials/src/messages_fr.properties @@ -443,3 +443,5 @@ youAreHealed=\u00a77Vous avez \u00e9t\u00e9 soign\u00e9. youHaveNewMail=\u00a7cVous avez {0} messages ! \u00a7fEntrez \u00a77/mail read\u00a7f pour voir votre courrier. hatRemoved=\u00a7eYour hat has been removed. banFormat=Banned: {0} +moveSpeed=\u00a77Set {0} speed to {1} for {2}. +walking=walking diff --git a/Essentials/src/messages_it.properties b/Essentials/src/messages_it.properties index b5be7ff6c..05f5c3e50 100644 --- a/Essentials/src/messages_it.properties +++ b/Essentials/src/messages_it.properties @@ -443,3 +443,5 @@ youAreHealed=\u00a77Sei stato curato. youHaveNewMail=\u00a7cHai {0} messaggi!\u00a7f digita \u00a77/mail read\u00a7f per consultare la tua mail. hatRemoved=\u00a7eYour hat has been removed. banFormat=Banned: {0} +moveSpeed=\u00a77Set {0} speed to {1} for {2}. +walking=walking diff --git a/Essentials/src/messages_nl.properties b/Essentials/src/messages_nl.properties index fcf90035d..b1cb2590c 100644 --- a/Essentials/src/messages_nl.properties +++ b/Essentials/src/messages_nl.properties @@ -443,3 +443,5 @@ youAreHealed=\u00a77Je bent genezen. youHaveNewMail=\u00a7cJe hebt {0} berichten!\u00a7f Type \u00a77/mail read\u00a7f om je berichten te bekijken. hatRemoved=\u00a7eYour hat has been removed. banFormat=Banned: {0} +moveSpeed=\u00a77Set {0} speed to {1} for {2}. +walking=walking diff --git a/Essentials/src/messages_pl.properties b/Essentials/src/messages_pl.properties index 8c177f987..84b7cc82e 100644 --- a/Essentials/src/messages_pl.properties +++ b/Essentials/src/messages_pl.properties @@ -443,3 +443,5 @@ youAreHealed=\u00a77Zostales/as uleczony/na. youHaveNewMail=\u00a7cMasz {0} wiadomosci!\u00a7f napisz \u00a77/mail read\u00a7f aby je przeczytac. hatRemoved=\u00a7eYour hat has been removed. banFormat=Banned: {0} +moveSpeed=\u00a77Set {0} speed to {1} for {2}. +walking=walking diff --git a/Essentials/src/messages_pt.properties b/Essentials/src/messages_pt.properties index 056428eb2..8b6868695 100644 --- a/Essentials/src/messages_pt.properties +++ b/Essentials/src/messages_pt.properties @@ -443,3 +443,5 @@ youAreHealed=\u00a77Voc\u00ea foi curado. youHaveNewMail=\u00a7cVoc\u00ea tem {0} mensagens!\u00a7f Digite \u00a77/mail read\u00a7f para ver seu email. hatRemoved=\u00a7eYour hat has been removed. banFormat=Banned: {0} +moveSpeed=\u00a77Set {0} speed to {1} for {2}. +walking=walking diff --git a/Essentials/src/messages_se.properties b/Essentials/src/messages_se.properties index dd7bf3846..e9c5800b6 100644 --- a/Essentials/src/messages_se.properties +++ b/Essentials/src/messages_se.properties @@ -414,24 +414,30 @@ weatherStorm=\u00a77Du har st\u00e4llt in v\u00e4dret till storm i {0} weatherStormFor=\u00a77Du har st\u00e4llt in v\u00e4dret till storm i {0} f\u00f6r {1} sekunder weatherSun=\u00a77Du har st\u00e4llt in v\u00e4dret till sol i {0} weatherSunFor=\u00a77Du har st\u00e4llt in v\u00e4dret till sol i {0} f\u00f6r {1} sekunder -whoisBanned=\u00a79 - Bannade spelare: {0} -whoisExp=\u00a79 - Erfarenhet: {0} (Niv\u00e5 {1}) -whoisGamemode=\u00a79 - Spell\u00e4ge: {0} -whoisGeoLocation=\u00a79 - Plats: {0} -whoisGod=\u00a79 - Od\u00f6dlighet: {0} -whoisHealth=\u00a79 - H\u00e4lsa: {0}/20 -whoisIPAddress=\u00a79 - IP-Adress: {0} -whoisIs={0} \u00e4r {1} -whoisJail=\u00a79 - F\u00e4ngelse: {0} -whoisLocation=\u00a79 - Plats: ({0}, {1}, {2}, {3}) -whoisMoney=\u00a79 - Pengar: {0} -whoisOP=\u00a79 - Operat\u00f6rer: {0} -whoisStatusAvailable=\u00a79 - Status: Tillg\u00e4nglig -whoisStatusAway=\u00a79 - Status: \u00a7cBorta\u00a7f +whoisBanned=\u00a76 - Banned:\u00a7f {0} +whoisExp=\u00a76 - Exp:\u00a7f {0} (Level {1}) +whoisGamemode=\u00a76 - Gamemode:\u00a7f {0} +whoisGeoLocation=\u00a76 - Location:\u00a7f {0} +whoisGod=\u00a76 - God mode:\u00a7f {0} +whoisHealth=\u00a76 - Health:\u00a7f {0}/20 +whoisIPAddress=\u00a76 - IP Address:\u00a7f {0} +whoisJail=\u00a76 - Jail:\u00a7f {0} +whoisLocation=\u00a76 - Location:\u00a7f ({0}, {1}, {2}, {3}) +whoisMoney=\u00a76 - Money:\u00a7f {0} worth=\u00a77Stapeln med {0} ({2} objekt) \u00e4r v\u00e4rd \u00a7c{1}\u00a77 ({3} styck) worthMeta=\u00a77Stapeln med {0} av typ {1} ({3} objekt) \u00e4r v\u00e4rd \u00a7c{2}\u00a77 ({4} styck) worthSet=V\u00e4rdet inst\u00e4llt year=\u00e5r years=\u00e5r youAreHealed=\u00a77Du har blivit l\u00e4kt. -youHaveNewMail=\u00a7cDu har {0} meddelanden!\u00a7f Skriv \u00a77/mail read\u00a7f f\u00f6r att l\u00e4sa dina meddelanden.
\ No newline at end of file +youHaveNewMail=\u00a7cDu har {0} meddelanden!\u00a7f Skriv \u00a77/mail read\u00a7f f\u00f6r att l\u00e4sa dina meddelanden. +moveSpeed=\u00a77Set {0} speed to {1} for {2}. +whoisMuted=\u00a76 - Muted:\u00a7f {0} +whoisNick=\u00a76 - Nick:\u00a7f {0} +whoisOp=\u00a76 - OP:\u00a7f {0} +whoisTop=\u00a76 ====== WhoIs:\u00a7f {0} \u00a76====== +whoisAFK=\u00a76 - AFK:\u00a7f {0} +whoisFly=\u00a76 - Fly mode:\u00a7f {0} ({1}) +hatRemoved=\u00a7eYour hat has been removed. +banFormat=Banned: {0} +walking=walking |