Fixed Some Bugs and Added Some More Values In The Configuration Files
This commit is contained in:
parent
be529195df
commit
faa11415e0
@ -4,6 +4,7 @@ import com.loganmagnan.eventcore.EventCore;
|
||||
import com.loganmagnan.eventcore.managers.hotbar.types.StaffModeHotBar;
|
||||
import com.loganmagnan.eventcore.utils.CachedInventory;
|
||||
import com.loganmagnan.eventcore.utils.ColorUtils;
|
||||
import com.loganmagnan.eventcore.utils.Constants;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.bukkit.GameMode;
|
||||
@ -55,7 +56,7 @@ public class StaffManager {
|
||||
this.setVanish(player, true);
|
||||
this.staffModeHotBar.applyToPlayer(player, true);
|
||||
|
||||
player.sendMessage(ColorUtils.getMessageType("&bYou've &aenabled &bstaff mode"));
|
||||
player.sendMessage(ColorUtils.getMessageType(Constants.COMMAND_MESSAGES.get("staff-mode.enabled").get(0)));
|
||||
} else {
|
||||
this.playersInStaffMode.remove(player.getUniqueId());
|
||||
this.cachedInventories.get(player.getUniqueId()).applyToPlayer(player, false);
|
||||
@ -64,7 +65,7 @@ public class StaffManager {
|
||||
|
||||
this.setVanish(player, false);
|
||||
|
||||
player.sendMessage(ColorUtils.getMessageType("&bYou've &cdisabled &bstaff mode"));
|
||||
player.sendMessage(ColorUtils.getMessageType(Constants.COMMAND_MESSAGES.get("staff-mode.disabled").get(0)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,8 +6,6 @@ import lombok.RequiredArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@ -21,59 +19,4 @@ public class ClickableItem {
|
||||
private boolean moveable = false;
|
||||
private boolean placeable = false;
|
||||
private boolean droppable = false;
|
||||
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
if (object == this) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!(object instanceof ClickableItem)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ClickableItem clickableItem = (ClickableItem) object;
|
||||
|
||||
if (!clickableItem.canEqual(this)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Object thisClickHandler = this.clickHandler;
|
||||
Object otherClickHandler = clickableItem.getClickHandler();
|
||||
|
||||
if (!Objects.equals(thisClickHandler, otherClickHandler)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Object thisItemStack = getItemStack();
|
||||
Object otherItemStack = clickableItem.getItemStack();
|
||||
|
||||
return (Objects.equals(thisItemStack, otherItemStack)) && (this.droppable == clickableItem.isDroppable() && (this.moveable == clickableItem.isMoveable() && (this.placeable == clickableItem.isPlaceable())));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = 1;
|
||||
|
||||
Object clickHandler = this.clickHandler;
|
||||
|
||||
result = result * 59 + ((clickHandler == null) ? 43 : clickHandler.hashCode());
|
||||
|
||||
Object itemStack = this.itemStack;
|
||||
|
||||
result = result * 59 + ((itemStack == null) ? 43 : itemStack.hashCode());
|
||||
result = result * 59 + (this.droppable ? 79 : 97);
|
||||
result = result * 59 + (this.moveable ? 79 : 97);
|
||||
|
||||
return result * 59 + (this.placeable ? 79 : 97);
|
||||
}
|
||||
|
||||
protected boolean canEqual(Object object) {
|
||||
return object instanceof ClickableItem;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ClickableItem(clickHandler=" + this.clickHandler + ", itemStack=" + this.itemStack + ", droppable=" + this.droppable + ", moveable=" + this.moveable + ", placeable=" + this.placeable + ")";
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import com.loganmagnan.eventcore.EventCore;
|
||||
import com.loganmagnan.eventcore.managers.hotbar.ClickableItem;
|
||||
import com.loganmagnan.eventcore.managers.hotbar.HotBar;
|
||||
import com.loganmagnan.eventcore.utils.ColorUtils;
|
||||
import com.loganmagnan.eventcore.utils.Constants;
|
||||
import com.loganmagnan.eventcore.utils.ItemBuilder;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
@ -29,12 +30,12 @@ public class StaffModeHotBar extends HotBar {
|
||||
Map<Integer, ClickableItem> clickableItems = new HashMap<Integer, ClickableItem>();
|
||||
clickableItems.put(0, this.getClickableItem("teleport-compass"));
|
||||
clickableItems.put(1, this.getClickableItem("inventory-inspect"));
|
||||
clickableItems.put(2, this.getClickableItem("better-looking"));
|
||||
|
||||
if (player.hasPermission("worldedit.wand")) {
|
||||
clickableItems.put(2, this.getClickableItem("world-edit-wand"));
|
||||
clickableItems.put(3, this.getClickableItem("world-edit-wand"));
|
||||
}
|
||||
|
||||
clickableItems.put(3, this.getClickableItem("better-looking"));
|
||||
clickableItems.put(7, this.getClickableItem("staff-online"));
|
||||
clickableItems.put(8, this.getClickableItem("unvanish"));
|
||||
|
||||
@ -66,14 +67,14 @@ public class StaffModeHotBar extends HotBar {
|
||||
this.applyToPlayer(player, this.getClickableItem("unvanish"), 8);
|
||||
this.main.getStaffManager().setVanish(player, true);
|
||||
|
||||
player.sendMessage(ColorUtils.getMessageType("&bYou've &aenabled &bvanish"));
|
||||
player.sendMessage(ColorUtils.getMessageType(Constants.STAFF_MANAGEMENT_MESSAGES.get("vanish.enabled").get(0)));
|
||||
}, new ItemBuilder(Material.GRAY_DYE).name(ColorUtils.getMessageType("&bVanish")).build(), false, false, false));
|
||||
|
||||
this.addClickableItem("unvanish", new ClickableItem(player -> {
|
||||
this.applyToPlayer(player, this.getClickableItem("vanish"), 8);
|
||||
this.main.getStaffManager().setVanish(player, false);
|
||||
|
||||
player.sendMessage(ColorUtils.getMessageType("&bYou've &cdisabled &bvanish"));
|
||||
player.sendMessage(ColorUtils.getMessageType(Constants.STAFF_MANAGEMENT_MESSAGES.get("vanish.disabled").get(0)));
|
||||
}, new ItemBuilder(Material.LIME_DYE).name(ColorUtils.getMessageType("&bUnvanish")).build(), false, false, false));
|
||||
}
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ public class Constants {
|
||||
public static Map<String, List<String>> COMMAND_MESSAGES = new HashMap<String, List<String>>();
|
||||
public static Map<String, List<String>> LISTENER_MESSAGES = new HashMap<String, List<String>>();
|
||||
public static Map<String, List<String>> CHAT_MANAGEMENT_MESSAGES = new HashMap<String, List<String>>();
|
||||
public static Map<String, List<String>> STAFF_MANAGEMENT_MESSAGES = new HashMap<String, List<String>>();
|
||||
public static Map<String, String> PERMISSION_NODES = new HashMap<String, String>();
|
||||
|
||||
public Constants() {
|
||||
@ -23,6 +24,10 @@ public class Constants {
|
||||
// /setspawn
|
||||
COMMAND_MESSAGES.put("set-spawn.spawn-set", Collections.singletonList(this.main.getMessagesConfig().getConfig().getString("MESSAGES.COMMANDS.SET-SPAWN.SPAWN-SET")));
|
||||
|
||||
// //staffmode
|
||||
COMMAND_MESSAGES.put("staff-mode.enabled", Collections.singletonList(this.main.getMessagesConfig().getConfig().getString("MESSAGES.COMMANDS.STAFF-MODE.ENABLED")));
|
||||
COMMAND_MESSAGES.put("staff-mode.disabled", Collections.singletonList(this.main.getMessagesConfig().getConfig().getString("MESSAGES.COMMANDS.STAFF-MODE.DISABLED")));
|
||||
|
||||
// AsyncPlayerChatEvent
|
||||
LISTENER_MESSAGES.put("chat-muted", Collections.singletonList(this.main.getMessagesConfig().getConfig().getString("MESSAGES.LISTENERS.CHAT-MUTED")));
|
||||
LISTENER_MESSAGES.put("chat-cooldown", this.main.getMessagesConfig().getConfig().getStringList("MESSAGES.LISTENERS.CHAT-COOLDOWN"));
|
||||
@ -33,6 +38,10 @@ public class Constants {
|
||||
CHAT_MANAGEMENT_MESSAGES.put("slowed", Collections.singletonList(this.main.getMessagesConfig().getConfig().getString("MESSAGES.CHAT-MANAGEMENT.SLOWED")));
|
||||
CHAT_MANAGEMENT_MESSAGES.put("cleared", Collections.singletonList(this.main.getMessagesConfig().getConfig().getString("MESSAGES.CHAT-MANAGEMENT.CLEARED")));
|
||||
|
||||
// Staff Management System
|
||||
STAFF_MANAGEMENT_MESSAGES.put("vanish.enabled", Collections.singletonList(this.main.getMessagesConfig().getConfig().getString("MESSAGES.STAFF-MANAGEMENT.VANISH.ENABLED")));
|
||||
STAFF_MANAGEMENT_MESSAGES.put("vanish.disabled", Collections.singletonList(this.main.getMessagesConfig().getConfig().getString("MESSAGES.STAFF-MANAGEMENT.VANISH.DISABLED")));
|
||||
|
||||
// Permission Nodes
|
||||
PERMISSION_NODES.put("chat-bypass", this.main.getMainConfig().getConfig().getString("PERMISSION-NODES.CHAT-BYPASS"));
|
||||
}
|
||||
|
@ -30,4 +30,8 @@ MESSAGES:
|
||||
MUTED: "&cChat has been muted by &c&l%player%"
|
||||
UNMUTED: "&aChat has been unmuted by &a&l%player%"
|
||||
SLOWED: "&cChat has been slowed for &c&l%amount% by &c&l%player%"
|
||||
CLEARED: "&cChat has been cleared by &c&l%player%"
|
||||
CLEARED: "&cChat has been cleared by &c&l%player%"
|
||||
STAFF-MANAGEMENT:
|
||||
VANISH:
|
||||
ENABLED: "&bYou've &aenabled &bvanish"
|
||||
DISABLED: "&bYou've &cdisabled &bvanish"
|
Loading…
Reference in New Issue
Block a user