mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-22 18:45:29 +01:00
Add new setting for global shop view permission, add insert after selected waypoint functionality
This commit is contained in:
parent
7e3f628b55
commit
ee77512185
@ -241,6 +241,9 @@ public class Settings {
|
|||||||
SELECTION_ITEM("The default item in hand to select an NPC", "npc.selection.item", "stick"),
|
SELECTION_ITEM("The default item in hand to select an NPC", "npc.selection.item", "stick"),
|
||||||
SELECTION_MESSAGE("npc.selection.message", "Selected [[<npc>]] (ID [[<id>]])."),
|
SELECTION_MESSAGE("npc.selection.message", "Selected [[<npc>]] (ID [[<id>]])."),
|
||||||
SERVER_OWNS_NPCS("Whether the server owns NPCs rather than individual players", "npc.server-ownership", false),
|
SERVER_OWNS_NPCS("Whether the server owns NPCs rather than individual players", "npc.server-ownership", false),
|
||||||
|
SHOP_GLOBAL_VIEW_PERMISSION(
|
||||||
|
"The global view permission that players need to view any NPC shop. Defaults to empty (no permission required).",
|
||||||
|
"npc.shops.global-view-permission", ""),
|
||||||
STORAGE_FILE("storage.file", "saves.yml"),
|
STORAGE_FILE("storage.file", "saves.yml"),
|
||||||
STORAGE_TYPE("Although technically Citizens can use NBT storage, it is not well tested and YAML is recommended",
|
STORAGE_TYPE("Although technically Citizens can use NBT storage, it is not well tested and YAML is recommended",
|
||||||
"storage.type", "yaml"),
|
"storage.type", "yaml"),
|
||||||
|
@ -24,6 +24,7 @@ import com.google.common.collect.Iterables;
|
|||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
|
|
||||||
|
import net.citizensnpcs.Settings.Setting;
|
||||||
import net.citizensnpcs.StoredShops;
|
import net.citizensnpcs.StoredShops;
|
||||||
import net.citizensnpcs.api.CitizensAPI;
|
import net.citizensnpcs.api.CitizensAPI;
|
||||||
import net.citizensnpcs.api.gui.CitizensInventoryClickEvent;
|
import net.citizensnpcs.api.gui.CitizensInventoryClickEvent;
|
||||||
@ -97,6 +98,10 @@ public class ShopTrait extends Trait {
|
|||||||
public void onRightClick(Player player) {
|
public void onRightClick(Player player) {
|
||||||
if (rightClickShop == null || rightClickShop.isEmpty())
|
if (rightClickShop == null || rightClickShop.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
if (!Setting.SHOP_GLOBAL_VIEW_PERMISSION.asString().isEmpty()
|
||||||
|
&& !player.hasPermission(Setting.SHOP_GLOBAL_VIEW_PERMISSION.asString()))
|
||||||
|
return;
|
||||||
|
|
||||||
NPCShop shop = shops.globalShops.getOrDefault(rightClickShop, getDefaultShop());
|
NPCShop shop = shops.globalShops.getOrDefault(rightClickShop, getDefaultShop());
|
||||||
shop.display(player);
|
shop.display(player);
|
||||||
}
|
}
|
||||||
|
@ -372,12 +372,18 @@ public class LinearWaypointProvider implements EnumerableWaypointProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Waypoint element = new Waypoint(at);
|
Waypoint element = new Waypoint(at);
|
||||||
waypoints.add(element);
|
int idx = waypoints.size();
|
||||||
|
if (waypoints.indexOf(selectedWaypoint) != -1) {
|
||||||
|
idx = waypoints.indexOf(selectedWaypoint);
|
||||||
|
waypoints.add(idx, element);
|
||||||
|
} else {
|
||||||
|
waypoints.add(element);
|
||||||
|
}
|
||||||
|
|
||||||
if (showingMarkers) {
|
if (showingMarkers) {
|
||||||
markers.createMarker(element, element.getLocation().clone());
|
markers.createMarker(element, element.getLocation().clone());
|
||||||
}
|
}
|
||||||
Messaging.sendTr(player, Messages.LINEAR_WAYPOINT_EDITOR_ADDED_WAYPOINT, formatLoc(at),
|
Messaging.sendTr(player, Messages.LINEAR_WAYPOINT_EDITOR_ADDED_WAYPOINT, formatLoc(at), idx);
|
||||||
waypoints.size());
|
|
||||||
} else if (waypoints.size() > 0 && !event.getPlayer().isSneaking()) {
|
} else if (waypoints.size() > 0 && !event.getPlayer().isSneaking()) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user