Adjust module name and items

This commit is contained in:
PikaMug 2021-10-10 03:29:35 -04:00
parent 3d20f41add
commit 9da6fe3b4d
3 changed files with 46 additions and 29 deletions

View File

@ -33,7 +33,7 @@ public abstract class CustomObjective implements Listener {
private String name = null;
private String author = null;
private String display = "Progress: %count%";
private final Map<String, Short> items = new HashMap<>();
private Entry<String, Short> item = new AbstractMap.SimpleEntry<>("BOOK", (short) 0);
private final LinkedList<Entry<String, Object>> data = new LinkedList<>();
private final Map<String, String> descriptions = new HashMap<>();
private String countPrompt = "Enter number";
@ -45,10 +45,8 @@ public abstract class CustomObjective implements Listener {
.replace(".jar", "");
}
public Map<String, Short> getModuleItem() {
final Map<String, Short> moduleItems = new HashMap<>();
moduleItems.put("IRON_INGOT", (short) 0);
return moduleItems;
public Entry<String, Short> getModuleItem() {
return new AbstractMap.SimpleEntry<>("IRON_INGOT", (short) 0);
}
public String getName() {
@ -75,12 +73,19 @@ public abstract class CustomObjective implements Listener {
this.display = display;
}
public Map<String, Short> getItems() {
return items;
public Entry<String, Short> getItem() {
return item;
}
/**
* @deprecated Use {@link #setItem(String, short)}
*/
public void addItem(final String type, final short durability) {
this.items.put(type, durability);
setItem(type, durability);
}
public void setItem(final String type, final short durability) {
this.item = new AbstractMap.SimpleEntry<>(type, durability);
}
public LinkedList<Entry<String, Object>> getData() {

View File

@ -15,6 +15,7 @@ package me.blackvein.quests;
import org.bukkit.entity.Player;
import java.io.File;
import java.util.AbstractMap;
import java.util.HashMap;
import java.util.Map;
@ -23,7 +24,7 @@ public abstract class CustomRequirement {
private String name = null;
private String author = null;
private String display = null;
private final Map<String, Short> items = new HashMap<>();
private Map.Entry<String, Short> item = new AbstractMap.SimpleEntry<>("BOOK", (short) 0);
private final Map<String, Object> data = new HashMap<>();
private final Map<String, String> descriptions = new HashMap<>();
@ -34,10 +35,8 @@ public abstract class CustomRequirement {
.replace(".jar", "");
}
public Map<String, Short> getModuleItem() {
final Map<String, Short> moduleItems = new HashMap<>();
moduleItems.put("IRON_INGOT", (short) 0);
return moduleItems;
public Map.Entry<String, Short> getModuleItem() {
return new AbstractMap.SimpleEntry<>("IRON_INGOT", (short) 0);
}
public String getName() {
@ -63,13 +62,20 @@ public abstract class CustomRequirement {
public void setDisplay(final String display) {
this.display = display;
}
public Map<String, Short> getItems() {
return items;
public Map.Entry<String, Short> getItem() {
return item;
}
/**
* @deprecated Use {@link #setItem(String, short)}
*/
public void addItem(final String type, final short durability) {
this.items.put(type, durability);
setItem(type, durability);
}
public void setItem(final String type, final short durability) {
this.item = new AbstractMap.SimpleEntry<>(type, durability);
}
public Map<String, Object> getData() {

View File

@ -15,6 +15,7 @@ package me.blackvein.quests;
import org.bukkit.entity.Player;
import java.io.File;
import java.util.AbstractMap;
import java.util.HashMap;
import java.util.Map;
@ -23,7 +24,7 @@ public abstract class CustomReward {
private String name = null;
private String author = null;
private String display = null;
private final Map<String, Short> items = new HashMap<>();
private Map.Entry<String, Short> item = new AbstractMap.SimpleEntry<>("BOOK", (short) 0);
private final Map<String, Object> data = new HashMap<>();
private final Map<String, String> descriptions = new HashMap<>();
@ -34,10 +35,8 @@ public abstract class CustomReward {
.replace(".jar", "");
}
public Map<String, Short> getModuleItem() {
final Map<String, Short> moduleItems = new HashMap<>();
moduleItems.put("IRON_INGOT", (short) 0);
return moduleItems;
public Map.Entry<String, Short> getModuleItem() {
return new AbstractMap.SimpleEntry<>("IRON_INGOT", (short) 0);
}
public String getName() {
@ -63,13 +62,20 @@ public abstract class CustomReward {
public void setDisplay(final String display) {
this.display = display;
}
public Map<String, Short> getItems() {
return items;
public Map.Entry<String, Short> getItem() {
return item;
}
/**
* @deprecated Use {@link #setItem(String, short)}
*/
public void addItem(final String type, final short durability) {
this.items.put(type, durability);
setItem(type, durability);
}
public void setItem(final String type, final short durability) {
this.item = new AbstractMap.SimpleEntry<>(type, durability);
}
/**