diff --git a/Essentials/src/main/java/com/earth2me/essentials/signs/SignAnvil.java b/Essentials/src/main/java/com/earth2me/essentials/signs/SignAnvil.java new file mode 100644 index 000000000..09b9b77ae --- /dev/null +++ b/Essentials/src/main/java/com/earth2me/essentials/signs/SignAnvil.java @@ -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; + } +} diff --git a/Essentials/src/main/java/com/earth2me/essentials/signs/SignCartography.java b/Essentials/src/main/java/com/earth2me/essentials/signs/SignCartography.java new file mode 100644 index 000000000..c5aaa3ed4 --- /dev/null +++ b/Essentials/src/main/java/com/earth2me/essentials/signs/SignCartography.java @@ -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; + } +} diff --git a/Essentials/src/main/java/com/earth2me/essentials/signs/SignGrindstone.java b/Essentials/src/main/java/com/earth2me/essentials/signs/SignGrindstone.java new file mode 100644 index 000000000..001d94b62 --- /dev/null +++ b/Essentials/src/main/java/com/earth2me/essentials/signs/SignGrindstone.java @@ -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; + } +} diff --git a/Essentials/src/main/java/com/earth2me/essentials/signs/SignLoom.java b/Essentials/src/main/java/com/earth2me/essentials/signs/SignLoom.java new file mode 100644 index 000000000..d2531b517 --- /dev/null +++ b/Essentials/src/main/java/com/earth2me/essentials/signs/SignLoom.java @@ -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; + } +} diff --git a/Essentials/src/main/java/com/earth2me/essentials/signs/SignSmithing.java b/Essentials/src/main/java/com/earth2me/essentials/signs/SignSmithing.java new file mode 100644 index 000000000..9debfbe80 --- /dev/null +++ b/Essentials/src/main/java/com/earth2me/essentials/signs/SignSmithing.java @@ -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; + } +} diff --git a/Essentials/src/main/java/com/earth2me/essentials/signs/SignWorkbench.java b/Essentials/src/main/java/com/earth2me/essentials/signs/SignWorkbench.java new file mode 100644 index 000000000..061c2958c --- /dev/null +++ b/Essentials/src/main/java/com/earth2me/essentials/signs/SignWorkbench.java @@ -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; + } +} diff --git a/Essentials/src/main/java/com/earth2me/essentials/signs/Signs.java b/Essentials/src/main/java/com/earth2me/essentials/signs/Signs.java index 138fb4ede..1d2fab980 100644 --- a/Essentials/src/main/java/com/earth2me/essentials/signs/Signs.java +++ b/Essentials/src/main/java/com/earth2me/essentials/signs/Signs.java @@ -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) { diff --git a/Essentials/src/main/resources/config.yml b/Essentials/src/main/resources/config.yml index fdde19667..fece3f482 100644 --- a/Essentials/src/main/resources/config.yml +++ b/Essentials/src/main/resources/config.yml @@ -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.