Weather sign

This commit is contained in:
snowleo 2011-07-06 00:55:05 +02:00
parent e92aeee91b
commit 526df76ca9
7 changed files with 62 additions and 0 deletions

View File

@ -0,0 +1,56 @@
package com.earth2me.essentials.signs;
import com.earth2me.essentials.ChargeException;
import com.earth2me.essentials.IEssentials;
import com.earth2me.essentials.Trade;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
public class SignWeather extends EssentialsSign
{
public SignWeather()
{
super("Weather");
}
@Override
protected boolean onSignCreate(final ISign sign, final User player, final String username, final IEssentials ess) throws SignException
{
validateTrade(sign, 2, ess);
final String timeString = sign.getLine(1);
if ("Sun".equalsIgnoreCase(timeString))
{
sign.setLine(1, "§2Sun");
return true;
}
if ("Storm".equalsIgnoreCase(timeString))
{
sign.setLine(1, "§2Storm");
return true;
}
throw new SignException(Util.i18n("onlySunStorm"));
}
@Override
protected boolean onSignInteract(final ISign sign, final User player, final String username, final IEssentials ess) throws SignException, ChargeException
{
final Trade charge = getTrade(sign, 2, ess);
charge.isAffordableFor(player);
final String weatherString = sign.getLine(1);
if ("§2Sun".equalsIgnoreCase(weatherString))
{
player.getWorld().setStorm(false);
charge.charge(player);
return true;
}
if ("§2Storm".equalsIgnoreCase(weatherString))
{
player.getWorld().setStorm(true);
charge.charge(player);
return true;
}
throw new SignException(Util.i18n("onlySunStorm"));
}
}

View File

@ -199,6 +199,7 @@ now = now
numberRequired = A number goes there, silly.
onlyDayNight = /time only supports day/night.
onlyPlayers = Only in-game players can use {0}.
onlySunStorm = /weather only supports sun/storm.
parseError = Error parsing {0} on line {1}
pendingTeleportCancelled = \u00a7cPending teleportation request cancelled.
permissionsError = Missing Permissions/GroupManager; chat prefixes/suffixes will be disabled.

View File

@ -201,6 +201,7 @@ now = nu
numberRequired = Der skal v\u00e6re et nummer, fjolle.
onlyDayNight = /time underst\u00f8tter kun day/night.
onlyPlayers = Kun in-game spillere kan bruge {0}.
onlySunStorm = /weather only supports sun/storm.
parseError = Fejl ved parsing {0} p\u00e5 linje {1}
pendingTeleportCancelled = \u00a7cVentende teleportations anmodning aflyst.
permissionsError = Mangler Permissions/GroupManager; chat pr\u00e6fikser/suffikser vil v\u00e6re sl\u00e5et fra.

View File

@ -199,6 +199,7 @@ now = jetzt
numberRequired = Ein Zahl wird ben\u00f6tigt.
onlyDayNight = /time unterst\u00fctzt nur day/night.
onlyPlayers = Nur Spieler k\u00f6nnen {0} benutzen.
onlySunStorm = /weather unterst\u00fctzt nur sun/storm.
parseError = Fehler beim Parsen von {0} in Zeile {1}
pendingTeleportCancelled = \u00a7cLaufende Teleportierung abgebrochen.
permissionsError = Permissions/GroupManager fehlt; Chat-Prefixe/-Suffixe sind ausgeschaltet.

View File

@ -199,6 +199,7 @@ now = now
numberRequired = A number goes there, silly.
onlyDayNight = /time only supports day/night.
onlyPlayers = Only in-game players can use {0}.
onlySunStorm = /weather only supports sun/storm.
parseError = Error parsing {0} on line {1}
pendingTeleportCancelled = \u00a7cPending teleportation request cancelled.
permissionsError = Missing Permissions/GroupManager; chat prefixes/suffixes will be disabled.

View File

@ -199,6 +199,7 @@ now = maintenant
numberRequired = On a besoin d''un nombre ici, idiot.
onlyDayNight = /time ne supporte que (jour) day/night (nuit).
onlyPlayers = Seulement les joueurs en jeu peuvent utiliser {0}.
onlySunStorm = /weather only supports sun/storm.
parseError = Erreur de conversion {0} \u00e0 la ligne {1}
pendingTeleportCancelled = \u00a7cRequete de t\u00e9l\u00e9portation annul\u00e9e.
permissionsError = Permissions/GroupManager manquant, les pr\u00e9fixes et suffixes ne seront pas affich\u00e9s.

View File

@ -200,6 +200,7 @@ now = nu
numberRequired = Er moet daar een nummer, grapjas.
onlyDayNight = /time oondersteund alleen day/night.
onlyPlayers = Alleen in-game spelers kunnen {0} gebruiken.
onlySunStorm = /weather only supports sun/storm.
parseError = Fout bij ontleding {0} op regel {1}
pendingTeleportCancelled = \u00a7cAangevraagde teleportatie afgelast.
permissionsError = Vermisde Permissions/GroupManager; chat prefixes/suffixes worden uitgeschakeld.