Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
PrinzPizza42 committed Jan 9, 2025
1 parent 1cdf5e1 commit d4c336c
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
10 changes: 5 additions & 5 deletions src/main/java/de/j/deathMinigames/listeners/AnvilListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ public void onAnvilPrepare(PrepareAnvilEvent event) {
}
String renameText = anvilView.getRenameText();
if(MainMenu.getSetHost().compareLocIDTo(loc)) {
finishAnvilInvAfterOpening(event, player, hostName);
finishAnvilInvAfterOpening(event, player);
if(renameText == null) return;
hostName = renameText;
}
else if(MainMenu.getSetServerName().compareLocIDTo(loc)) {
finishAnvilInvAfterOpening(event, player, serverName);
finishAnvilInvAfterOpening(event, player);
if(renameText == null) return;
serverName = renameText;
}
Expand Down Expand Up @@ -98,9 +98,9 @@ else if(MainMenu.getSetServerName().compareLocIDTo(loc)) {
}
}

private void finishAnvilInvAfterOpening(PrepareAnvilEvent event, Player player, String inputSlotTitle) {
if(event == null || player == null || inputSlotTitle == null) {
Main.getMainLogger().warning("parameters are null: " + event + " " + player + " " + inputSlotTitle + "!");
private void finishAnvilInvAfterOpening(PrepareAnvilEvent event, Player player) {
if(event == null || player == null) {
Main.getMainLogger().warning("parameters are null: " + event + " " + player + "!");
return;
}
ItemStack output = new ItemStack(Material.GREEN_CONCRETE);
Expand Down
16 changes: 8 additions & 8 deletions src/main/java/de/j/deathMinigames/main/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,11 @@ public void cloneConfigToPlugin() {
}
//Tablist
if(config.contains("Tablist")) {
if(config.contains("Tablist.ServerName")) {
if(config.contains("Tablist.ServerName") && config.get("Tablist.ServerName") != null) {
Tablist.setServerName(config.getString("Tablist.ServerName"));
}
if(config.contains("Tablist.HostetBy")) {
Tablist.setHostedBy(config.getString("Tablist.HostetBy"));
if(config.contains("Tablist.HostedBy") && config.get("Tablist.HostedBy") != null) {
Tablist.setHostedBy(config.getString("Tablist.HostedBy"));
}
}
}
Expand Down Expand Up @@ -343,18 +343,18 @@ public String getServerName() {
}

public synchronized void setHostedBy(String serverName) {
if(!Main.getPlugin().getConfig().contains("Tablist.HostetBy") || !Main.getPlugin().getConfig().getString("Tablist.HostetBy").equals(serverName)) {
Main.getPlugin().getConfig().set("Tablist.HostetBy", serverName);
if(!Main.getPlugin().getConfig().contains("Tablist.HostedBy") || !Main.getPlugin().getConfig().getString("Tablist.HostedBy").equals(serverName)) {
Main.getPlugin().getConfig().set("Tablist.HostedBy", serverName);
Main.getPlugin().saveConfig();
}
}

public String getHostedBy() {
if(Main.getPlugin().getConfig().contains("Tablist.HostetBy")) {
return Main.getPlugin().getConfig().getString("Tablist.HostetBy");
if(Main.getPlugin().getConfig().contains("Tablist.HostedBy")) {
return Main.getPlugin().getConfig().getString("Tablist.HostedBy");
}
else {
Main.getMainLogger().warning("HostetBy not found in config!");
Main.getMainLogger().warning("HostedBy not found in config!");
return null;
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/de/j/deathMinigames/settings/AnvilUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public void showInventory(Player playerToShowTheInvTo) {
if(playerToShowTheInvTo == null) return;
this.player = playerToShowTheInvTo;
playerToShowTheInvTo.openAnvil(loc, true);
setInputMeta();
setInputMeta(playerToShowTheInvTo);
playerToShowTheInvTo.getOpenInventory().getTopInventory().setItem(0, input);
}

Expand All @@ -58,7 +58,7 @@ public boolean compareLocIDTo(Location loc) {
return loc.getBlockX() == this.loc.getBlockX() && loc.getBlockZ() == this.loc.getBlockZ();
}

private void setInputMeta() {
private void setInputMeta(Player player) {
ItemMeta inputMeta = input.getItemMeta();
String inputItemName = null;
if(player == null) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/de/j/stationofdoom/util/Tablist.java
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ else if(!Config.getInstance().getServerName().equals(serverName)) {

public static void setHostedBy(String hostedBy) {
if(hostedBy == null) {
Main.getMainLogger().warning("Hostet by is null");
Main.getMainLogger().warning("Hosted by is null");
return;
}
Tablist.hostedBy = hostedBy;
Expand Down

0 comments on commit d4c336c

Please sign in to comment.