mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-12-22 17:18:37 +01:00
Add way for time and weather signs to display the time/weather (#4131)
This commit is contained in:
parent
83ca7d2574
commit
16627d10b6
@ -3,6 +3,7 @@ package com.earth2me.essentials.signs;
|
||||
import com.earth2me.essentials.ChargeException;
|
||||
import com.earth2me.essentials.Trade;
|
||||
import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.utils.DescParseTickFormat;
|
||||
import net.ess3.api.IEssentials;
|
||||
|
||||
import static com.earth2me.essentials.I18n.tl;
|
||||
@ -14,6 +15,10 @@ public class SignTime extends EssentialsSign {
|
||||
|
||||
@Override
|
||||
protected boolean onSignCreate(final ISign sign, final User player, final String username, final IEssentials ess) throws SignException {
|
||||
if (sign.getLine(1).isEmpty() && sign.getLine(2).isEmpty() && sign.getLine(3).isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
validateTrade(sign, 2, ess);
|
||||
final String timeString = sign.getLine(1);
|
||||
if ("Day".equalsIgnoreCase(timeString)) {
|
||||
@ -29,6 +34,11 @@ public class SignTime extends EssentialsSign {
|
||||
|
||||
@Override
|
||||
protected boolean onSignInteract(final ISign sign, final User player, final String username, final IEssentials ess) throws SignException, ChargeException {
|
||||
if (sign.getLine(1).isEmpty() && sign.getLine(2).isEmpty() && sign.getLine(3).isEmpty()) {
|
||||
player.sendMessage(tl("timeWorldCurrentSign", DescParseTickFormat.format(player.getWorld().getTime())));
|
||||
return true;
|
||||
}
|
||||
|
||||
final Trade charge = getTrade(sign, 2, ess);
|
||||
charge.isAffordableFor(player);
|
||||
final String timeString = sign.getLine(1);
|
||||
|
@ -14,6 +14,10 @@ public class SignWeather extends EssentialsSign {
|
||||
|
||||
@Override
|
||||
protected boolean onSignCreate(final ISign sign, final User player, final String username, final IEssentials ess) throws SignException {
|
||||
if (sign.getLine(1).isEmpty() && sign.getLine(2).isEmpty() && sign.getLine(3).isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
validateTrade(sign, 2, ess);
|
||||
final String timeString = sign.getLine(1);
|
||||
if ("Sun".equalsIgnoreCase(timeString)) {
|
||||
@ -30,6 +34,15 @@ public class SignWeather extends EssentialsSign {
|
||||
|
||||
@Override
|
||||
protected boolean onSignInteract(final ISign sign, final User player, final String username, final IEssentials ess) throws SignException, ChargeException {
|
||||
if (sign.getLine(1).isEmpty() && sign.getLine(2).isEmpty() && sign.getLine(3).isEmpty()) {
|
||||
if (player.getWorld().hasStorm()) {
|
||||
player.sendMessage(tl("weatherSignStorm"));
|
||||
} else {
|
||||
player.sendMessage(tl("weatherSignSun"));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
final Trade charge = getTrade(sign, 2, ess);
|
||||
charge.isAffordableFor(player);
|
||||
final String weatherString = sign.getLine(1);
|
||||
|
@ -840,6 +840,7 @@ timeSetPermission=\u00a74You are not authorized to set the time.
|
||||
timeSetWorldPermission=\u00a74You are not authorized to set the time in world ''{0}''.
|
||||
timeWorldAdd=\u00a76The time was moved forward by\u00a7c {0} \u00a76in\: \u00a7c{1}\u00a76.
|
||||
timeWorldCurrent=\u00a76The current time in\u00a7c {0} \u00a76is \u00a7c{1}\u00a76.
|
||||
timeWorldCurrentSign=\u00a76The current time is \u00a7c{0}\u00a76.
|
||||
timeWorldSet=\u00a76The time was set to\u00a7c {0} \u00a76in\: \u00a7c{1}\u00a76.
|
||||
togglejailCommandDescription=Jails/Unjails a player, TPs them to the jail specified.
|
||||
togglejailCommandUsage=/<command> <player> <jailname> [datediff]
|
||||
@ -979,6 +980,8 @@ weatherCommandUsage=/<command> <storm/sun> [duration]
|
||||
warpSet=\u00a76Warp\u00a7c {0} \u00a76set.
|
||||
warpUsePermission=\u00a74You do not have permission to use that warp.
|
||||
weatherInvalidWorld=World named {0} not found\!
|
||||
weatherSignStorm=\u00a76Weather: \u00a7cstormy\u00a76.
|
||||
weatherSignSun=\u00a76Weather: \u00a7csunny\u00a76.
|
||||
weatherStorm=\u00a76You set the weather to \u00a7cstorm\u00a76 in\u00a7c {0}\u00a76.
|
||||
weatherStormFor=\u00a76You set the weather to \u00a7cstorm\u00a76 in\u00a7c {0} \u00a76for\u00a7c {1} seconds\u00a76.
|
||||
weatherSun=\u00a76You set the weather to \u00a7csun\u00a76 in\u00a7c {0}\u00a76.
|
||||
|
Loading…
Reference in New Issue
Block a user