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