diff --git a/.idea/compiler.xml b/.idea/compiler.xml
index 569a41b..6555f73 100644
--- a/.idea/compiler.xml
+++ b/.idea/compiler.xml
@@ -11,4 +11,9 @@
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/lib__6_.xml b/.idea/libraries/lib__6_.xml
new file mode 100644
index 0000000..6503974
--- /dev/null
+++ b/.idea/libraries/lib__6_.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/lib__7_.xml b/.idea/libraries/lib__7_.xml
new file mode 100644
index 0000000..c82f178
--- /dev/null
+++ b/.idea/libraries/lib__7_.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/dependency-reduced-pom.xml b/dependency-reduced-pom.xml
index 1144558..138e361 100644
--- a/dependency-reduced-pom.xml
+++ b/dependency-reduced-pom.xml
@@ -21,6 +21,17 @@
${java.version}
+
+ maven-compiler-plugin
+
+ 1.8
+ 1.8
+ UTF-8
+
+ lib
+
+
+
maven-shade-plugin
3.2.4
diff --git a/pom.xml b/pom.xml
index edd273b..55b0113 100644
--- a/pom.xml
+++ b/pom.xml
@@ -27,6 +27,18 @@
${java.version}
+
+ maven-compiler-plugin
+
+ 1.8
+ 1.8
+ UTF-8
+
+ lib
+
+
+
+
org.apache.maven.plugins
maven-shade-plugin
@@ -78,11 +90,6 @@
mysql-connector-java
8.0.28
-
- org.mybatis
- mybatis
- 3.5.7
-
junit
junit
diff --git a/src/main/java/com/yuyu/srdisassemble/SrDisassemble.java b/src/main/java/com/yuyu/srdisassemble/SrDisassemble.java
index f5d6f21..3592d12 100644
--- a/src/main/java/com/yuyu/srdisassemble/SrDisassemble.java
+++ b/src/main/java/com/yuyu/srdisassemble/SrDisassemble.java
@@ -2,15 +2,16 @@ package com.yuyu.srdisassemble;
import com.sakurarealm.sritem.bukkit.command.CommandBase;
import com.yuyu.srdisassemble.command.DisCommand;
-import com.yuyu.srdisassemble.command.MeltCommand;
-import com.yuyu.srdisassemble.command.RepairCommand;
import com.yuyu.srdisassemble.config.ConfigManager;
import com.yuyu.srdisassemble.data.JdbcSqlClass;
import com.yuyu.srdisassemble.disassemeble.TemporarilyBox;
import lombok.Getter;
+import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.plugin.java.JavaPlugin;
+import java.util.logging.Level;
+
public final class SrDisassemble extends JavaPlugin {
@@ -30,6 +31,7 @@ public final class SrDisassemble extends JavaPlugin {
commandBase.registerSubCommand("open",new DisCommand());
commandBase.registerSubCommand("reload",new DisCommand());
+ Bukkit.getServer().getPluginManager().registerEvents(new TemporarilyBox(),this);
//读取暂存箱
JdbcSqlClass.createPauseBoxTable();
@@ -37,11 +39,12 @@ public final class SrDisassemble extends JavaPlugin {
TemporarilyBox.getPauseBoxData();
+
}
@Override
public void onDisable() {
- JdbcSqlClass.clearPauseBoxTable();
+ JdbcSqlClass.clearPauseBoxTable("TemporarilyBox-disassemble");
// Plugin shutdown logic
TemporarilyBox.savePauseBoxData();
}
diff --git a/src/main/java/com/yuyu/srdisassemble/command/DisCommand.java b/src/main/java/com/yuyu/srdisassemble/command/DisCommand.java
index c835670..92aa7f0 100644
--- a/src/main/java/com/yuyu/srdisassemble/command/DisCommand.java
+++ b/src/main/java/com/yuyu/srdisassemble/command/DisCommand.java
@@ -1,10 +1,8 @@
package com.yuyu.srdisassemble.command;
-import com.germ.germplugin.api.dynamic.gui.GermGuiScreen;
import com.sakurarealm.sritem.bukkit.command.SubCommand;
import com.yuyu.srdisassemble.SrDisassemble;
import com.yuyu.srdisassemble.disassemeble.DisassembleManager;
-import com.yuyu.srdisassemble.disassemeble.SassembleGuiService;
import com.yuyu.srdisassemble.disassemeble.TemporarilyBox;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
@@ -27,6 +25,11 @@ public class DisCommand implements SubCommand {
//重载文件
SrDisassemble.getConfigManager().reload();
return;
+ } else if (strings[0].equalsIgnoreCase("clear")) {
+ commandSender.sendMessage(ChatColor.GREEN+"分解gui缓存清空");
+ TemporarilyBox.temporarilyBoxHashMap.clear();
+ TemporarilyBox.getPauseBoxData();
+ return;
}
}
@@ -43,7 +46,7 @@ public class DisCommand implements SubCommand {
}
//为玩家打开GUI列表
- DisassembleManager.getInstance().open(player);
+ DisassembleManager.getInstance().open(player);
}
}
diff --git a/src/main/java/com/yuyu/srdisassemble/config/ConfigManager.java b/src/main/java/com/yuyu/srdisassemble/config/ConfigManager.java
index 596180a..9137faa 100644
--- a/src/main/java/com/yuyu/srdisassemble/config/ConfigManager.java
+++ b/src/main/java/com/yuyu/srdisassemble/config/ConfigManager.java
@@ -50,19 +50,21 @@ public class ConfigManager {
List disProductConfigStringList = disProductConfig.getStringList("SrDisassemble");
for (String disProductConfigString : disProductConfigStringList) {
HashMap disProductHashMap = new HashMap<>();
+ int countWeight = 0;
//循环读取每个需要分解的产物
int anInt = disToItemProduct.getInt("SrDisassemble." + disProductConfigString + ".disTime");
String tagetIndex = disToItemProduct.getString("SrDisassemble." + disProductConfigString + ".index");
CanDisItem canDisItem = new CanDisItem(disProductConfigString, anInt,disProductConfigString,tagetIndex);
List stringList = disToItemProduct.getStringList("SrDisassemble." + disProductConfigString +".disProduct");
for (String product : stringList) {
- Double proMax = itemDetailProduct.getDouble("SrDisassemble."+disProductConfigString+"."+product+".probabilityMax");
- Double proMin = itemDetailProduct.getDouble("SrDisassemble."+disProductConfigString+"."+product+".probabilityMin");
+ int proMax = itemDetailProduct.getInt("SrDisassemble."+disProductConfigString+"."+product+".weight");
String index = itemDetailProduct.getString("SrDisassemble."+disProductConfigString+"."+product+".index");
- DisProduct disPojo = new DisProduct(product, index, proMax, proMin);
+ DisProduct disPojo = new DisProduct(product, index, proMax);
+ countWeight+= proMax;
logger.info(ChatColor.GREEN+disPojo.toString());
disProductHashMap.put(product,disPojo);
}
+ canDisItem.setCoutWeight(countWeight);
canDisItem.setDisProductHashMap(disProductHashMap);
this.disProductHashMap.put(disProductConfigString,canDisItem);
@@ -119,15 +121,17 @@ public class ConfigManager {
int anInt = disToItemProduct.getInt("SrDisassemble." + disProductConfigString + ".disTime");
String tagetIndex = disToItemProduct.getString("SrDisassemble." + disProductConfigString + ".index");
CanDisItem canDisItem = new CanDisItem(disProductConfigString, anInt,disProductConfigString,tagetIndex);
+ int countWeight = 0;
List stringList = disToItemProduct.getStringList("SrDisassemble." + disProductConfigString +".disProduct");
for (String product : stringList) {
- Double proMax = itemDetailProduct.getDouble("SrDisassemble."+disProductConfigString+"."+product+".probabilityMax");
- Double proMin = itemDetailProduct.getDouble("SrDisassemble."+disProductConfigString+"."+product+".probabilityMin");
+ int proMax = itemDetailProduct.getInt("SrDisassemble."+disProductConfigString+"."+product+".weight");
String index = itemDetailProduct.getString("SrDisassemble."+disProductConfigString+"."+product+".index");
- DisProduct disPojo = new DisProduct(product, index, proMax, proMin);
+ DisProduct disPojo = new DisProduct(product, index, proMax);
+ countWeight+= proMax;
logger.info(ChatColor.GREEN+disPojo.toString());
disProductHashMap.put(product,disPojo);
}
+ canDisItem.setCoutWeight(countWeight);
canDisItem.setDisProductHashMap(disProductHashMap);
this.disProductHashMap.put(disProductConfigString,canDisItem);
diff --git a/src/main/java/com/yuyu/srdisassemble/data/JdbcSqlClass.java b/src/main/java/com/yuyu/srdisassemble/data/JdbcSqlClass.java
index c423c65..c20cae8 100644
--- a/src/main/java/com/yuyu/srdisassemble/data/JdbcSqlClass.java
+++ b/src/main/java/com/yuyu/srdisassemble/data/JdbcSqlClass.java
@@ -21,6 +21,7 @@ public class JdbcSqlClass {
private static String user;
private static String password;
private static Connection con;
+ private static boolean bool = false;
public static void openConnection() {
@@ -240,19 +241,21 @@ public class JdbcSqlClass {
/**
* 清空数据
*/
- public static void clearPauseBoxTable(){
+ public static void clearPauseBoxTable(String guiname){
try {
Statement statement = getConnection();
- String sql = "delete from pausebox";
+ String sql = "delete from pausebox where guiname = '"+guiname+"'";
statement.executeUpdate(sql);
} catch (SQLException e) {
throw new RuntimeException(e);
}
+ bool = true;
+
}
public static int addColumnPauseBox(String columns){
@@ -446,12 +449,12 @@ public class JdbcSqlClass {
}
}
- public static List getPlayerList(){
+ public static List getPlayerList(String guiname){
List userList = new ArrayList<>();
Statement statement = getConnection();
- String sql = "select username from pausebox";
+ String sql = "select username from pausebox where guiname = '"+guiname+"'";
try {
ResultSet resultSet = statement.executeQuery(sql);
while (resultSet.next()){
@@ -503,11 +506,11 @@ public class JdbcSqlClass {
* @param player
* @return
*/
- public static List getPauseBoxData(String player) {
+ public static List getPauseBoxData(String player,String guiname) {
List pauseBoxList = new ArrayList<>();
Statement statement = getConnection();
- String sql = "select * from pausebox where username = '"+player+"' and guiname = 'TemporarilyBox'";
+ String sql = "select * from pausebox where username = '"+player+"' and guiname = '"+guiname+"'";
try {
ResultSet resultSet = statement.executeQuery(sql);
while (resultSet.next()){
diff --git a/src/main/java/com/yuyu/srdisassemble/disassemeble/DisassembleManager.java b/src/main/java/com/yuyu/srdisassemble/disassemeble/DisassembleManager.java
index 86852e1..72c6c84 100644
--- a/src/main/java/com/yuyu/srdisassemble/disassemeble/DisassembleManager.java
+++ b/src/main/java/com/yuyu/srdisassemble/disassemeble/DisassembleManager.java
@@ -50,7 +50,7 @@ public class DisassembleManager {
public static ConfigurationSection getTemporarilyBox(){
- return DisassembleManager.getGermGui( "disassemble","TemporarilyBox");
+ return DisassembleManager.getGermGui( "disassemble","TemporarilyBox-disassemble");
}
//用于打开gui
@@ -65,8 +65,6 @@ public class DisassembleManager {
return;
}
}
-
-
//分解gui
SassembleGuiService sassembleGuiService = new SassembleGuiService(getDisassembleGui(), "disassemble", player);
@@ -75,20 +73,4 @@ public class DisassembleManager {
sassembleGuiService.openGui(player);
packscreen.openChildGui(player);
}
-
- /**
- * 用于打开回炉gui
- * @param player
- */
- public void openMeltAgain(Player player) {
-
- }
-
- /**
- * 用于打开维修gui
- * @param player
- */
- public void openRepair(Player player) {
-
- }
}
diff --git a/src/main/java/com/yuyu/srdisassemble/disassemeble/SassembleGuiService.java b/src/main/java/com/yuyu/srdisassemble/disassemeble/SassembleGuiService.java
index 24dd41d..a5e7d18 100644
--- a/src/main/java/com/yuyu/srdisassemble/disassemeble/SassembleGuiService.java
+++ b/src/main/java/com/yuyu/srdisassemble/disassemeble/SassembleGuiService.java
@@ -11,6 +11,7 @@ import com.yuyu.srdisassemble.pojo.CanDisItem;
import com.yuyu.srdisassemble.pojo.DisProduct;
import com.yuyu.srdisassemble.pojo.DisassembleData;
import com.yuyu.srdisassemble.utils.MinUtil;
+import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Color;
import org.bukkit.Material;
@@ -53,6 +54,10 @@ public class SassembleGuiService extends GermGuiScreen {
this.savePauseSlots();
this.boolGui();
this.openPauseBox();
+// this.setOpenedHandler((((player, germGuiScreen) -> {
+// this.getTemporarilyBox();
+// this.openPauseBox();
+// })));
this.setClosedHandler(((player, germGuiScreen) -> {
//窗口关闭事件
this.returnItemStacks(player);
@@ -75,17 +80,14 @@ public class SassembleGuiService extends GermGuiScreen {
* 获取暂存箱对象
*/
public void getTemporarilyBox(){
- this.temporarilyBoxScreen = TemporarilyBox.getGermGuiScreen(playerHost.getName(), "TemporarilyBox");
+ this.temporarilyBoxScreen = TemporarilyBox.getGermGuiScreen(playerHost.getName(), "TemporarilyBox-disassemble");
if (temporarilyBoxScreen == null) {
- temporarilyBoxScreen = GermGuiScreen.getGermGuiScreen("TemporarilyBox", DisassembleManager.getTemporarilyBox());
- TemporarilyBox.addGuiScreen(playerHost.getName(),"TemporarilyBox",temporarilyBoxScreen);
+ temporarilyBoxScreen = GermGuiScreen.getGermGuiScreen("TemporarilyBox-disassemble", DisassembleManager.getTemporarilyBox());
+ TemporarilyBox.addGuiScreen(playerHost.getName(),"TemporarilyBox-disassemble",temporarilyBoxScreen);
}
}
synchronized public void setItemToPauseBox(ItemStack item){
-// if (!this.disassembleFlag){
-// return;
-// }
for (int i = 0; i <= 15 ; i++){
GermGuiSlot germGuiSlot = guiSlots.get(i);
if (germGuiSlot.getItemStack().getType() == Material.AIR){
@@ -106,7 +108,7 @@ public class SassembleGuiService extends GermGuiScreen {
* gui关闭时保存暂存箱
*/
public void saveTemporarilyBox(){
- TemporarilyBox.addGuiScreen(playerHost.getName(), "TemporarilyBox",this.temporarilyBoxScreen);
+ TemporarilyBox.addGuiScreen(playerHost.getName(), "TemporarilyBox-disassemble",this.temporarilyBoxScreen);
TemporarilyBox.addGuiScreen(playerHost.getName(),"disassemble",this);
}
@@ -128,7 +130,7 @@ public class SassembleGuiService extends GermGuiScreen {
men1.setEnable(false);
fire.setEnable(true);
doorPause.setEnable(true);
- int calculateMinutesDifference = MinUtil.calculateMinutesDifference(data.getDisassembleTime());
+ int calculateMinutesDifference = MinUtil.calculateMinutesDifference(data.getDisassembleTime()) + 1;
if (calculateMinutesDifference <= 0) {
//执行语句说明分解完成
this.disassembleComplete();
@@ -152,7 +154,7 @@ public class SassembleGuiService extends GermGuiScreen {
label.setTexts(texts);
label.setEnable(true);
executor.scheduleWithFixedDelay(() -> {
- int nums = MinUtil.calculateMinutesDifference(data.getDisassembleTime());
+ int nums = MinUtil.calculateMinutesDifference(data.getDisassembleTime()) + 1;
String text = "##ACDA70D6还有"+nums+"分钟";
texts.remove(1);
@@ -184,7 +186,7 @@ public class SassembleGuiService extends GermGuiScreen {
}
}
- },1, 1, TimeUnit.MINUTES);
+ },60,10 , TimeUnit.SECONDS);
//1分钟延迟,minTime分钟后执行
}
@@ -233,8 +235,8 @@ public class SassembleGuiService extends GermGuiScreen {
GermGuiSlot disassembleSlot = (GermGuiSlot) bgCanvas.getGuiPart("disassembleSlot");
confirmButton.registerCallbackHandler((player, btn) -> {
- this.disassemble(player);
cCanvas.setEnable(false);
+ this.disassemble(player);
},GermGuiButton.EventType.LEFT_CLICK);
//取消事件
@@ -246,7 +248,20 @@ public class SassembleGuiService extends GermGuiScreen {
//油壶按钮绑定的事件触发画布显示
germGuiButton.registerCallbackHandler((player, btn) -> {
if ((boolean)disassembleSlot.getInteract()) {
- cCanvas.setEnable(true);
+ GermGuiLabel label = cCanvas.getGuiPart("label", GermGuiLabel.class);
+ List texts = label.getTexts();
+ if (disassembleSlot.getItemStack().getType() == Material.AIR){
+ texts.clear();
+ texts.add("请放入分解物品!");
+ label.setTexts(texts);
+ cCanvas.setEnable(true);
+ }else {
+ texts.clear();
+ texts.add("点击确定分解");
+ texts.add("#ACDA70D6" + disassembleSlot.getItemStack().getItemMeta().getDisplayName());
+ label.setTexts(texts);
+ cCanvas.setEnable(true);
+ }
}
},GermGuiButton.EventType.LEFT_CLICK);
}
@@ -315,7 +330,7 @@ public class SassembleGuiService extends GermGuiScreen {
GermGuiLabel label = (GermGuiLabel) bgCanvas.getGuiPart("label");
List texts = new ArrayList<>();
texts.add("#C80800FF距离分解完成");
- int minTime = MinUtil.calculateMinutesDifference(data.getDisassembleTime());
+ int minTime = MinUtil.calculateMinutesDifference(data.getDisassembleTime()) + 1;
texts.add("#ACDA70D6还有"+minTime+"分钟");
label.setTexts(texts);
label.setEnable(true);
@@ -331,7 +346,7 @@ public class SassembleGuiService extends GermGuiScreen {
},2,TimeUnit.SECONDS);
executor.scheduleWithFixedDelay(() -> {
- int calculateMinutesDifference = MinUtil.calculateMinutesDifference(data.getDisassembleTime());
+ int calculateMinutesDifference = MinUtil.calculateMinutesDifference(data.getDisassembleTime()) + 1;
String text = "#ACDA70D6还有"+calculateMinutesDifference+"分钟";
texts.remove(1);
texts.add(text);
@@ -352,12 +367,13 @@ public class SassembleGuiService extends GermGuiScreen {
fire.setEnable(false);
door.setEnable(false);
men1.setEnable(true);
+ doorPause.setEnable(false);
this.temporarilyBoxScreen.openChildGui(this.playerHost);
executor.shutdown();
}
}
- },1, 1, TimeUnit.MINUTES);
+ },60,10 , TimeUnit.SECONDS);
//1分钟延迟,minTime分钟后执行
@@ -383,12 +399,21 @@ public class SassembleGuiService extends GermGuiScreen {
HashMap disProducts = canDisItem.getDisProductHashMap();
float v = random.nextFloat();
ItemStack product = null;
- for (DisProduct disProduct : disProducts.values()) {
- if (disProduct.getProMax() > v && disProduct.getProMin() <= v){
- product = SrItemAPI.getItem(disProduct.getIndexName(),new HashMap<>(),null,true,true);
- break;
- }
+// for (DisProduct disProduct : disProducts.values()) {
+// if (disProduct.getProMax() > v && disProduct.getProMin() <= v){
+// product = SrItemAPI.getItem(disProduct.getIndexName(),new HashMap<>(),null,true,true);
+// break;
+// }
+// }
+ String index = getIndex(canDisItem.getCoutWeight(),canDisItem.getDisProductHashMap());
+
+ if (index != null) {
+ product = SrItemAPI.getItem(index,new HashMap<>(),null,true,true);
+ }else {
+ Bukkit.getPluginManager().getPlugin("SrDisassemble").getLogger().info(ChatColor.RED+itemName+"分解出错");
+ return;
}
+
disassembleSlot.setInteract(true);
//赋予产物
// disassembleSlot.setItemStack(product);
@@ -437,4 +462,24 @@ public class SassembleGuiService extends GermGuiScreen {
}
}
+ public String getIndex(int coutWeight,HashMap disProductHashMap){
+ if (coutWeight == 0 || disProductHashMap.size() == 0){
+ return null;
+ }
+
+ int ranNum = random.nextInt(coutWeight) + 1;
+ int start = 0;//起始为0
+
+ for (DisProduct disProduct : disProductHashMap.values()){
+ //确定权重位置
+ if (ranNum >= start && ranNum <= start + disProduct.getWeight() ){
+ //符合表示确定
+ return disProduct.getIndexName();
+ }
+ start+=disProduct.getWeight();
+ }
+
+ return null;
+ }
+
}
diff --git a/src/main/java/com/yuyu/srdisassemble/disassemeble/TemporarilyBox.java b/src/main/java/com/yuyu/srdisassemble/disassemeble/TemporarilyBox.java
index c2e0a88..89fb3ee 100644
--- a/src/main/java/com/yuyu/srdisassemble/disassemeble/TemporarilyBox.java
+++ b/src/main/java/com/yuyu/srdisassemble/disassemeble/TemporarilyBox.java
@@ -12,6 +12,9 @@ import com.yuyu.srdisassemble.data.JdbcSqlClass;
import com.yuyu.srdisassemble.pojo.PauseBox;
import org.bukkit.Bukkit;
import org.bukkit.Material;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
@@ -25,7 +28,7 @@ import java.util.List;
* @date 2024/6/21 18:50:18
* @description 用于存放暂存箱
*/
-public class TemporarilyBox {
+public class TemporarilyBox implements Listener {
public static HashMap> temporarilyBoxHashMap = new HashMap<>();
public static GermGuiScreen getGermGuiScreen(String playname,String guiName) {
@@ -41,6 +44,26 @@ public class TemporarilyBox {
}
}
+ /**
+ * 清空缓存gui
+ */
+ public void clearPauseGui(){
+ JdbcSqlClass.clearPauseBoxTable("TemporarilyBox-disassemble");
+ // Plugin shutdown logic
+ TemporarilyBox.savePauseBoxData();
+ temporarilyBoxHashMap.clear();
+ }
+
+ @EventHandler
+ public void clearDisassembleGui(PlayerQuitEvent event){
+ String name = event.getPlayer().getName();
+ if(isHasGui(name,"disassemble")) {
+ deleteGuiScreen(name,"disassemble");
+ }else {
+ return;
+ }
+ }
+
public static void deleteGuiScreen(String playname,String guiName) {
if(temporarilyBoxHashMap.containsKey(playname)) {
temporarilyBoxHashMap.get(playname).remove(guiName);
@@ -74,13 +97,16 @@ public class TemporarilyBox {
* 用于插件启动时,读取玩家的数据库存储
*/
public static void getPauseBoxData(){
- List playerList = JdbcSqlClass.getPlayerList();
+ List playerList = JdbcSqlClass.getPlayerList("TemporarilyBox-disassemble");
for (String player : playerList){
- List pauseBoxData = JdbcSqlClass.getPauseBoxData(player);
+ if (isHasGui(player,"TemporarilyBox-disassemble")) {
+ continue;
+ }
+ List pauseBoxData = JdbcSqlClass.getPauseBoxData(player,"TemporarilyBox-disassemble");
//暂存箱gui
- GermGuiScreen pauseBox = GermGuiScreen.getGermGuiScreen("TemporarilyBox", DisassembleManager.getTemporarilyBox());
+ GermGuiScreen pauseBox = GermGuiScreen.getGermGuiScreen("TemporarilyBox-disassemble", DisassembleManager.getTemporarilyBox());
GermGuiCanvas canvas = (GermGuiCanvas) pauseBox.getGuiPart("canvas");
GermGuiScroll scroll = (GermGuiScroll) canvas.getGuiPart("scroll");
@@ -107,7 +133,7 @@ public class TemporarilyBox {
}
//循环完毕之后封存
- TemporarilyBox.addGuiScreen(player,"TemporarilyBox",pauseBox);
+ TemporarilyBox.addGuiScreen(player,"TemporarilyBox-disassemble",pauseBox);
}
}
@@ -116,7 +142,7 @@ public class TemporarilyBox {
*/
public static void savePauseBoxData(){
for (String username : temporarilyBoxHashMap.keySet()){
- GermGuiScreen temporarilyBox = temporarilyBoxHashMap.get(username).get("TemporarilyBox");
+ GermGuiScreen temporarilyBox = temporarilyBoxHashMap.get(username).get("TemporarilyBox-disassemble");
GermGuiCanvas canvas = (GermGuiCanvas) temporarilyBox.getGuiPart("canvas");
GermGuiScroll scroll = (GermGuiScroll) canvas.getGuiPart("scroll");
for (int i = 1 ; i <= 16 ; i++){
@@ -132,7 +158,7 @@ public class TemporarilyBox {
for (String s : lore){
lores = lores+s+"|";
}
- JdbcSqlClass.insertPauseBoxData(username,i,itemStack.getAmount(),index,"TemporarilyBox",lores);
+ JdbcSqlClass.insertPauseBoxData(username,i,itemStack.getAmount(),index,"TemporarilyBox-disassemble",lores);
}
}
}
diff --git a/src/main/java/com/yuyu/srdisassemble/pojo/CanDisItem.java b/src/main/java/com/yuyu/srdisassemble/pojo/CanDisItem.java
index 183cc62..de7e194 100644
--- a/src/main/java/com/yuyu/srdisassemble/pojo/CanDisItem.java
+++ b/src/main/java/com/yuyu/srdisassemble/pojo/CanDisItem.java
@@ -16,6 +16,7 @@ public class CanDisItem {
private String target;
private String targetIndex;
private HashMap disProductHashMap;
+ private int coutWeight;
public void setTarget(String target) {
this.target = target;
@@ -64,9 +65,18 @@ public class CanDisItem {
this.targetIndex = targetIndex;
}
- public CanDisItem(String itemName, int disTime, HashMap disProductHashMap) {
+ public CanDisItem(String itemName, int disTime, HashMap disProductHashMap,int coutWeight) {
this.itemName = itemName;
this.disTime = disTime;
this.disProductHashMap = disProductHashMap;
+ this.coutWeight = coutWeight;
+ }
+
+ public int getCoutWeight() {
+ return coutWeight;
+ }
+
+ public void setCoutWeight(int coutWeight) {
+ this.coutWeight = coutWeight;
}
}
diff --git a/src/main/java/com/yuyu/srdisassemble/pojo/DisProduct.java b/src/main/java/com/yuyu/srdisassemble/pojo/DisProduct.java
index 0c8426e..561214e 100644
--- a/src/main/java/com/yuyu/srdisassemble/pojo/DisProduct.java
+++ b/src/main/java/com/yuyu/srdisassemble/pojo/DisProduct.java
@@ -19,10 +19,7 @@ public class DisProduct {
private final String ItemName;
//物品的索引
private final String indexName;
- //最大的概率
- private final double ProMax;
- //最小的概率
- private final double ProMin;
+ private int weight;
//获取ItemStack
private final ItemStack itemStack;
@@ -34,22 +31,22 @@ public class DisProduct {
return indexName;
}
- public double getProMax() {
- return ProMax;
- }
- public double getProMin() {
- return ProMin;
- }
-
- public DisProduct(String itemName, String indexName, double proMax, double proMin) {
+ public DisProduct(String itemName, String indexName,int weight) {
ItemName = itemName;
this.indexName = indexName;
- ProMax = proMax;
- ProMin = proMin;
+ this.weight = weight;
this.itemStack = SrItemAPI.getItem(indexName,new HashMap<>(),null,true,true);
}
+ public int getWeight() {
+ return weight;
+ }
+
+ public void setWeight(int weight) {
+ this.weight = weight;
+ }
+
public ItemStack getItemStack() {
return itemStack;
}
@@ -59,8 +56,6 @@ public class DisProduct {
return "DisProduct{" +
"ItemName='" + ItemName + '\'' +
", indexName='" + indexName + '\'' +
- ", ProMax=" + ProMax +
- ", ProMin=" + ProMin +
", itemStack=" + itemStack +
'}';
}
diff --git a/src/main/java/com/yuyu/srdisassemble/utils/MybatisUtil.java b/src/main/java/com/yuyu/srdisassemble/utils/MybatisUtil.java
deleted file mode 100644
index 112dc78..0000000
--- a/src/main/java/com/yuyu/srdisassemble/utils/MybatisUtil.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package com.yuyu.srdisassemble.utils;
-
-import org.apache.ibatis.io.Resources;
-import org.apache.ibatis.session.SqlSession;
-import org.apache.ibatis.session.SqlSessionFactory;
-import org.apache.ibatis.session.SqlSessionFactoryBuilder;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-public class MybatisUtil {
- private static final SqlSessionFactory factory;
-
- static {
-
-
- InputStream inputStream = null;
- try {
- inputStream = Resources.getResourceAsStream("mybatis-config.xml");
- factory = new SqlSessionFactoryBuilder().build(inputStream);
- } catch (IOException e) {
- throw new RuntimeException("Failed to initialize MyBatis SqlSessionFactory", e);
- } finally {
- if (inputStream != null) {
- try {
- inputStream.close();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- }
- }
-
- public MybatisUtil( ) {
-
-
-
-
- }
-
- public static SqlSession getSqlSession() {
- return factory.openSession();
- }
-
- public static void close(SqlSession sqlSession) {
- if (sqlSession != null) {
- sqlSession.close();
- }
- }
-
-}
\ No newline at end of file
diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml
index 51c878e..055c7f8 100644
--- a/src/main/resources/plugin.yml
+++ b/src/main/resources/plugin.yml
@@ -8,13 +8,6 @@ depend:
commands:
srdisassemble:
description: srdisassemble command
- aliases: [ srd ]
+ aliases: [ srdm ]
permission: srdisassemble.command
- srmeltagain:
- description: srmeltagain command
- aliases: [ srm ]
- permission: srmeltagain.command
- srrepair:
- description: srrepair command
- aliases: [ srr ]
- permission: srrepair.command
+