Add new signs for recently added virtual commands (#3961)

Co-authored-by: MD <1917406+mdcfe@users.noreply.github.com>

Closes #3919.
This commit is contained in:
Josh Roy 2021-02-20 10:59:30 -05:00 committed by GitHub
parent 8cbd9b7935
commit f3c347424b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 165 additions and 2 deletions

View File

@ -0,0 +1,27 @@
package com.earth2me.essentials.signs;
import com.earth2me.essentials.User;
import net.ess3.api.IEssentials;
import static com.earth2me.essentials.I18n.tl;
public class SignAnvil extends EssentialsSign {
public SignAnvil() {
super("Anvil");
}
@Override
protected boolean onSignCreate(final ISign sign, final User player, final String username, final IEssentials ess) {
if (ess.getContainerProvider() == null) {
player.sendMessage(tl("unsupportedBrand"));
return false;
}
return true;
}
@Override
protected boolean onSignInteract(final ISign sign, final User player, final String username, final IEssentials ess) {
ess.getContainerProvider().openAnvil(player.getBase());
return true;
}
}

View File

@ -0,0 +1,27 @@
package com.earth2me.essentials.signs;
import com.earth2me.essentials.User;
import net.ess3.api.IEssentials;
import static com.earth2me.essentials.I18n.tl;
public class SignCartography extends EssentialsSign {
public SignCartography() {
super("Cartography");
}
@Override
protected boolean onSignCreate(final ISign sign, final User player, final String username, final IEssentials ess) {
if (ess.getContainerProvider() == null) {
player.sendMessage(tl("unsupportedBrand"));
return false;
}
return true;
}
@Override
protected boolean onSignInteract(final ISign sign, final User player, final String username, final IEssentials ess) {
ess.getContainerProvider().openCartographyTable(player.getBase());
return true;
}
}

View File

@ -0,0 +1,27 @@
package com.earth2me.essentials.signs;
import com.earth2me.essentials.User;
import net.ess3.api.IEssentials;
import static com.earth2me.essentials.I18n.tl;
public class SignGrindstone extends EssentialsSign {
public SignGrindstone() {
super("Grindstone");
}
@Override
protected boolean onSignCreate(final ISign sign, final User player, final String username, final IEssentials ess) {
if (ess.getContainerProvider() == null) {
player.sendMessage(tl("unsupportedBrand"));
return false;
}
return true;
}
@Override
protected boolean onSignInteract(final ISign sign, final User player, final String username, final IEssentials ess) {
ess.getContainerProvider().openGrindstone(player.getBase());
return true;
}
}

View File

@ -0,0 +1,27 @@
package com.earth2me.essentials.signs;
import com.earth2me.essentials.User;
import net.ess3.api.IEssentials;
import static com.earth2me.essentials.I18n.tl;
public class SignLoom extends EssentialsSign {
public SignLoom() {
super("Loom");
}
@Override
protected boolean onSignCreate(final ISign sign, final User player, final String username, final IEssentials ess) {
if (ess.getContainerProvider() == null) {
player.sendMessage(tl("unsupportedBrand"));
return false;
}
return true;
}
@Override
protected boolean onSignInteract(final ISign sign, final User player, final String username, final IEssentials ess) {
ess.getContainerProvider().openLoom(player.getBase());
return true;
}
}

View File

@ -0,0 +1,27 @@
package com.earth2me.essentials.signs;
import com.earth2me.essentials.User;
import net.ess3.api.IEssentials;
import static com.earth2me.essentials.I18n.tl;
public class SignSmithing extends EssentialsSign {
public SignSmithing() {
super("Smithing");
}
@Override
protected boolean onSignCreate(final ISign sign, final User player, final String username, final IEssentials ess) {
if (ess.getContainerProvider() == null) {
player.sendMessage(tl("unsupportedBrand"));
return false;
}
return true;
}
@Override
protected boolean onSignInteract(final ISign sign, final User player, final String username, final IEssentials ess) {
ess.getContainerProvider().openSmithingTable(player.getBase());
return true;
}
}

View File

@ -0,0 +1,16 @@
package com.earth2me.essentials.signs;
import com.earth2me.essentials.User;
import net.ess3.api.IEssentials;
public class SignWorkbench extends EssentialsSign {
public SignWorkbench() {
super("Workbench");
}
@Override
protected boolean onSignInteract(final ISign sign, final User player, final String username, final IEssentials ess) {
player.getBase().openWorkbench(null, true);
return true;
}
}

View File

@ -2,24 +2,30 @@ package com.earth2me.essentials.signs;
//This enum is used when checking to see what signs are enabled
public enum Signs {
ANVIL(new SignAnvil()),
BALANCE(new SignBalance()),
BUY(new SignBuy()),
CARTOGRAPHY(new SignCartography()),
DISPOSAL(new SignDisposal()),
ENCHANT(new SignEnchant()),
FREE(new SignFree()),
GAMEMODE(new SignGameMode()),
GRINDSTONE(new SignGrindstone()),
HEAL(new SignHeal()),
INFO(new SignInfo()),
KIT(new SignKit()),
LOOM(new SignLoom()),
MAIL(new SignMail()),
PROTECTION(new SignProtection()),
REPAIR(new SignRepair()),
SELL(new SignSell()),
SMITHING(new SignSmithing()),
SPAWNMOB(new SignSpawnmob()),
TIME(new SignTime()),
TRADE(new SignTrade()),
WARP(new SignWarp()),
WEATHER(new SignWeather());
WEATHER(new SignWeather()),
WORKBENCH(new SignWorkbench());
private final EssentialsSign sign;
Signs(final EssentialsSign sign) {

View File

@ -347,7 +347,6 @@ enabledSigns:
#- sell
#- trade
#- free
#- disposal
#- warp
#- kit
#- mail
@ -359,6 +358,13 @@ enabledSigns:
#- repair
#- time
#- weather
#- anvil
#- cartography
#- disposal
#- grindstone
#- loom
#- smithing
#- workbench
# How many times per second can Essentials signs be interacted with per player.
# Values should be between 1-20, 20 being virtually no lag protection.