Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ public final class Permissions {

public static final String ADMIN = "woodworking.admin";

/** Shown when a player without the woodworking profession tries to use a bench. */
public static final String NOT_SKILLED = "搂cYou are not skilled enough to work wood.";

private Permissions() {
}

Expand All @@ -31,7 +34,7 @@ public static boolean requireAdmin(CommandSender sender) {

public static boolean requireUse(Player player) {
if (canUse(player)) return true;
player.sendMessage("搂cYou do not have permission to use woodworking.");
player.sendMessage(NOT_SKILLED);
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public void onInteract(PlayerInteractEvent e) {
if (!Permissions.canUse(player)) {
e.setCancelled(true);
if (!onCooldown(player)) {
player.sendMessage("搂cYou do not have permission to use woodworking.");
player.sendMessage(Permissions.NOT_SKILLED);
markCooldown(player);
}
return;
Expand Down Expand Up @@ -352,7 +352,7 @@ private void handleLeftClick(PlayerInteractEvent e) {
p.sendMessage("搂cYou have to add all the items before working");
p.playSound(p.getLocation(), Sound.ENTITY_VILLAGER_NO, 1f, 1f);
} else {
p.sendMessage("搂cThis item cannot be used for woodworking hits");
p.sendMessage("搂cYou cannot work the piece with that tool");
p.playSound(p.getLocation(), Sound.ENTITY_VILLAGER_NO, 1f, 1f);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import java.util.*;
import net.tfminecraft.tlibs.TLibs;
import net.tfminecraft.tlibs.objects.api.BlockAPI;
import net.tfminecraft.woodworking.command.Permissions;
import net.tfminecraft.woodworking.cache.Cache;
import net.tfminecraft.woodworking.database.*;
import net.tfminecraft.woodworking.gui.InventoryManager;
Expand Down Expand Up @@ -173,7 +174,7 @@ void interactionGuardsPermissionsCooldownAndMenuOpening() throws Exception {
e = event(Action.RIGHT_CLICK_BLOCK);
manager.onInteract(e);
manager.onInteract(e);
verify(p).sendMessage(contains("permission"));
verify(p).sendMessage(Permissions.NOT_SKILLED);
Cache.permission = null;
manager.onInteract(e);
verify(p, never()).openInventory(any(Inventory.class));
Expand Down Expand Up @@ -218,7 +219,7 @@ void materialsStatusAndToolHitsFollowProgress() throws Exception {
HitLoader.get().put("none", untyped);
when(nbt.getString("MMOITEMS_ITEM_ID")).thenReturn("BAD");
click(Action.LEFT_CLICK_BLOCK);
verify(p).sendMessage(contains("cannot be used"));
verify(p).sendMessage(contains("cannot work the piece"));
var empty = new WoodStation(loc, project);
manager.put(empty);
when(nbt.getString("MMOITEMS_ITEM_ID")).thenReturn("KNIFE");
Expand Down