mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-08-03 19:15:44 +00:00
Add way for time and weather signs to display the time/weather (#4131)
This commit is contained in:
parent
83ca7d2574
commit
16627d10b6
3 changed files with 26 additions and 0 deletions
|
@ -3,6 +3,7 @@ package com.earth2me.essentials.signs;
|
||||||
import com.earth2me.essentials.ChargeException;
|
import com.earth2me.essentials.ChargeException;
|
||||||
import com.earth2me.essentials.Trade;
|
import com.earth2me.essentials.Trade;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
|
import com.earth2me.essentials.utils.DescParseTickFormat;
|
||||||
import net.ess3.api.IEssentials;
|
import net.ess3.api.IEssentials;
|
||||||
|
|
||||||
import static com.earth2me.essentials.I18n.tl;
|
import static com.earth2me.essentials.I18n.tl;
|
||||||
|
@ -14,6 +15,10 @@ public class SignTime extends EssentialsSign {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean onSignCreate(final ISign sign, final User player, final String username, final IEssentials ess) throws SignException {
|
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);
|
validateTrade(sign, 2, ess);
|
||||||
final String timeString = sign.getLine(1);
|
final String timeString = sign.getLine(1);
|
||||||
if ("Day".equalsIgnoreCase(timeString)) {
|
if ("Day".equalsIgnoreCase(timeString)) {
|
||||||
|
@ -29,6 +34,11 @@ public class SignTime extends EssentialsSign {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean onSignInteract(final ISign sign, final User player, final String username, final IEssentials ess) throws SignException, ChargeException {
|
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);
|
final Trade charge = getTrade(sign, 2, ess);
|
||||||
charge.isAffordableFor(player);
|
charge.isAffordableFor(player);
|
||||||
final String timeString = sign.getLine(1);
|
final String timeString = sign.getLine(1);
|
||||||
|
|
|
@ -14,6 +14,10 @@ public class SignWeather extends EssentialsSign {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean onSignCreate(final ISign sign, final User player, final String username, final IEssentials ess) throws SignException {
|
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);
|
validateTrade(sign, 2, ess);
|
||||||
final String timeString = sign.getLine(1);
|
final String timeString = sign.getLine(1);
|
||||||
if ("Sun".equalsIgnoreCase(timeString)) {
|
if ("Sun".equalsIgnoreCase(timeString)) {
|
||||||
|
@ -30,6 +34,15 @@ public class SignWeather extends EssentialsSign {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean onSignInteract(final ISign sign, final User player, final String username, final IEssentials ess) throws SignException, ChargeException {
|
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);
|
final Trade charge = getTrade(sign, 2, ess);
|
||||||
charge.isAffordableFor(player);
|
charge.isAffordableFor(player);
|
||||||
final String weatherString = sign.getLine(1);
|
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}''.
|
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.
|
timeWorldAdd=\u00a76The time was moved forward by\u00a7c {0} \u00a76in\: \u00a7c{1}\u00a76.
|
||||||
timeWorldCurrent=\u00a76The current time in\u00a7c {0} \u00a76is \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.
|
timeWorldSet=\u00a76The time was set to\u00a7c {0} \u00a76in\: \u00a7c{1}\u00a76.
|
||||||
togglejailCommandDescription=Jails/Unjails a player, TPs them to the jail specified.
|
togglejailCommandDescription=Jails/Unjails a player, TPs them to the jail specified.
|
||||||
togglejailCommandUsage=/<command> <player> <jailname> [datediff]
|
togglejailCommandUsage=/<command> <player> <jailname> [datediff]
|
||||||
|
@ -979,6 +980,8 @@ weatherCommandUsage=/<command> <storm/sun> [duration]
|
||||||
warpSet=\u00a76Warp\u00a7c {0} \u00a76set.
|
warpSet=\u00a76Warp\u00a7c {0} \u00a76set.
|
||||||
warpUsePermission=\u00a74You do not have permission to use that warp.
|
warpUsePermission=\u00a74You do not have permission to use that warp.
|
||||||
weatherInvalidWorld=World named {0} not found\!
|
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.
|
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.
|
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.
|
weatherSun=\u00a76You set the weather to \u00a7csun\u00a76 in\u00a7c {0}\u00a76.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue