code refactoring
This commit is contained in:
parent
4513e0bafd
commit
fc9db70d90
4 changed files with 18 additions and 13 deletions
|
@ -14,15 +14,15 @@ public enum Attribute {
|
|||
;
|
||||
|
||||
private final String name;
|
||||
private final String ID;
|
||||
private final String id;
|
||||
private final double defaultValue;
|
||||
private final int maxValue;
|
||||
private final int minValue;
|
||||
private final NamespacedKey key;
|
||||
|
||||
Attribute(
|
||||
String ID, String name, int defaultValue, int maxValue, int minValue, NamespacedKey key) {
|
||||
this.ID = ID;
|
||||
String id, String name, int defaultValue, int maxValue, int minValue, NamespacedKey key) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.defaultValue = defaultValue;
|
||||
this.maxValue = maxValue;
|
||||
|
@ -34,8 +34,8 @@ public enum Attribute {
|
|||
return name;
|
||||
}
|
||||
|
||||
public String getID() {
|
||||
return ID;
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public double getDefaultValue() {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package me.unurled.sacredrealms.sr.components.clientbuild;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
@ -17,7 +18,7 @@ public class ClientBuild {
|
|||
return this.name;
|
||||
}
|
||||
|
||||
public HashMap<Location, BlockData> getBlocks() {
|
||||
public Map<Location, BlockData> getBlocks() {
|
||||
return this.blocks;
|
||||
}
|
||||
|
||||
|
@ -25,15 +26,18 @@ public class ClientBuild {
|
|||
this.blocks.put(loc, state);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public void removeBlock(@NotNull Location loc) {
|
||||
this.blocks.remove(loc);
|
||||
}
|
||||
|
||||
public void clearBlocks() {
|
||||
this.blocks.clear();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public boolean containsBlock(@NotNull Location loc, @NotNull BlockData data) {
|
||||
return this.blocks.containsKey(loc) && this.blocks.get(loc).matches(data);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public void clearBlocks() {
|
||||
this.blocks.clear();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ import com.google.gson.GsonBuilder;
|
|||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.UUID;
|
||||
import me.unurled.sacredrealms.sr.SR;
|
||||
|
@ -207,7 +208,7 @@ public class ClientBuildManager extends Manager {
|
|||
}
|
||||
}
|
||||
|
||||
public HashMap<Location, BlockData> getTemporaryBlocks(@NotNull Player p) {
|
||||
public Map<Location, BlockData> getTemporaryBlocks(@NotNull Player p) {
|
||||
return temporaryBlocks.get(p.getUniqueId());
|
||||
}
|
||||
|
||||
|
@ -223,7 +224,7 @@ public class ClientBuildManager extends Manager {
|
|||
temporaryBlocks.remove(p.getUniqueId());
|
||||
}
|
||||
|
||||
public HashMap<Location, BlockData> getTemporaryPreviousBlocks(@NotNull Player p) {
|
||||
public Map<Location, BlockData> getTemporaryPreviousBlocks(@NotNull Player p) {
|
||||
return temporaryPreviousBlocks.get(p.getUniqueId());
|
||||
}
|
||||
|
||||
|
|
|
@ -124,7 +124,7 @@ public class SRPlayer {
|
|||
+ ") Value "
|
||||
+ d
|
||||
+ " for attribute "
|
||||
+ attribute.getID()
|
||||
+ attribute.getId()
|
||||
+ " is out of bounds. Min: "
|
||||
+ attribute.getMinValue()
|
||||
+ " Max: "
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue