diff --git a/pom.xml b/pom.xml
index 9fdb91b..80afe30 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,6 +5,7 @@
SimpleEssential
1.1
SimpleEssential
+ 轻量级基础插件
${project.name}
@@ -27,6 +28,7 @@
maven-shade-plugin
2.3
+ flase
true
@@ -72,5 +74,4 @@
UTF-8
- 轻量级基础插件
\ No newline at end of file
diff --git a/src/main/java/cn/citycraft/SimpleEssential/SimpleEssential.java b/src/main/java/cn/citycraft/SimpleEssential/SimpleEssential.java
index 0a358ca..308dcb2 100644
--- a/src/main/java/cn/citycraft/SimpleEssential/SimpleEssential.java
+++ b/src/main/java/cn/citycraft/SimpleEssential/SimpleEssential.java
@@ -29,8 +29,6 @@ import cn.citycraft.SimpleEssential.command.CommandTpdeny;
import cn.citycraft.SimpleEssential.command.CommandTphere;
import cn.citycraft.SimpleEssential.command.CommandWorkBench;
import cn.citycraft.SimpleEssential.config.Language;
-import cn.citycraft.SimpleEssential.inventory.InventoryControl;
-import cn.citycraft.SimpleEssential.listen.PlayerInventoryViewListen;
import cn.citycraft.SimpleEssential.listen.PlayerLocationListen;
import cn.citycraft.SimpleEssential.teleport.TeleportControl;
import cn.citycraft.config.FileConfig;
@@ -47,22 +45,11 @@ public class SimpleEssential extends JavaPlugin {
* 传送控制
*/
public TeleportControl tpcontrol;
- /**
- * 容器界面控制
- */
- public InventoryControl invcontrol;
/**
* 命令监听列表
*/
private List commandlist;
- /**
- *
- */
- private void initInventoryControl() {
- invcontrol = new InventoryControl(this);
- }
-
private void initTeleportControl() {
int tpdelay = config.getInt("Teleport.delay", 3);
String tpcontorlname = config.getMessage("Teleport.name");
@@ -92,15 +79,9 @@ public class SimpleEssential extends JavaPlugin {
return false;
}
- @Override
- public void onDisable() {
- invcontrol.clearAllEnchantBench();
- }
-
@Override
public void onEnable() {
this.initTeleportControl();
- this.initInventoryControl();
this.registerCommands();
this.registerEvents();
new VersionChecker(this);
@@ -158,6 +139,5 @@ public class SimpleEssential extends JavaPlugin {
*/
private void registerEvents() {
registerEvent(new PlayerLocationListen(this));
- registerEvent(new PlayerInventoryViewListen(this));
}
}
diff --git a/src/main/java/cn/citycraft/SimpleEssential/command/CommandEnchantBench.java b/src/main/java/cn/citycraft/SimpleEssential/command/CommandEnchantBench.java
index b4e4495..6e87ec0 100644
--- a/src/main/java/cn/citycraft/SimpleEssential/command/CommandEnchantBench.java
+++ b/src/main/java/cn/citycraft/SimpleEssential/command/CommandEnchantBench.java
@@ -26,7 +26,7 @@ public class CommandEnchantBench extends BaseCommand {
@Override
public void execute(CommandSender sender, String label, String[] args) throws CommandException {
Player p = (Player) sender;
- plugin.invcontrol.openEnchantBench(p);
+ p.openEnchanting(null, true);
}
@Override
diff --git a/src/main/java/cn/citycraft/SimpleEssential/config/Language.java b/src/main/java/cn/citycraft/SimpleEssential/config/Language.java
index 3d8d4eb..69aec4e 100644
--- a/src/main/java/cn/citycraft/SimpleEssential/config/Language.java
+++ b/src/main/java/cn/citycraft/SimpleEssential/config/Language.java
@@ -13,11 +13,7 @@ public class Language {
}
public static String getMessage(String path, Object... args) {
- return String.format(config.getMessage(path), args);
- }
-
- public static String[] getStringArray(String path) {
- return config.getStringList(path).toArray(new String[0]);
+ return String.format(getMessage(path), args);
}
public static void load(Plugin p) {
diff --git a/src/main/java/cn/citycraft/SimpleEssential/config/PlayerConfig.java b/src/main/java/cn/citycraft/SimpleEssential/config/PlayerConfig.java
deleted file mode 100644
index 0656317..0000000
--- a/src/main/java/cn/citycraft/SimpleEssential/config/PlayerConfig.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package cn.citycraft.SimpleEssential.config;
-
-import java.io.File;
-
-import org.bukkit.plugin.Plugin;
-
-import cn.citycraft.config.FileConfig;
-
-public class PlayerConfig {
- private static String CONFIG_FOLDER = "userdate";
- private static FileConfig config;
-
- public static String[] getStringArray(String path) {
- return config.getStringList(path).toArray(new String[0]);
- }
-
- public void load(Plugin p, String player) {
- config = new FileConfig(p, new File(p.getDataFolder(), CONFIG_FOLDER + "/" + player));
- }
-
-}
diff --git a/src/main/java/cn/citycraft/SimpleEssential/inventory/InventoryControl.java b/src/main/java/cn/citycraft/SimpleEssential/inventory/InventoryControl.java
deleted file mode 100644
index 1ebbf62..0000000
--- a/src/main/java/cn/citycraft/SimpleEssential/inventory/InventoryControl.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/**
- *
- */
-package cn.citycraft.SimpleEssential.inventory;
-
-import java.util.HashMap;
-import java.util.Map.Entry;
-
-import org.bukkit.Location;
-import org.bukkit.Material;
-import org.bukkit.entity.Player;
-
-import cn.citycraft.SimpleEssential.SimpleEssential;
-
-/**
- * @author 蒋天蓓
- *
- */
-public class InventoryControl {
- SimpleEssential plugin;
- HashMap enchantbench = new HashMap();
-
- public InventoryControl(SimpleEssential main) {
- this.plugin = main;
- }
-
- public void clearAllEnchantBench() {
- for (Entry item : enchantbench.entrySet()) {
- setRange(item.getValue(), Material.AIR);
- }
- }
-
- public void clearEnchantBench(Player player) {
- if (!isOpenEnchantBench(player))
- return;
- Location loc = enchantbench.get(player.getName());
- setRange(loc, Material.AIR);
- loc.getBlock().setType(Material.AIR);
- }
-
- public boolean isOpenEnchantBench(Player player) {
- return enchantbench.containsKey(player.getName());
- }
-
- public void openEnchantBench(Player player) {
- Location loc = player.getLocation();
- loc.setY(250);
- setEnchatRange(loc);
- player.openEnchanting(loc, true);
- enchantbench.put(player.getName(), loc);
- };
-
- protected void setBlock(Location loc, int x, int y, int z, Material ma) {
- new Location(loc.getWorld(), loc.getBlockX() + x, loc.getBlockY() + y, loc.getBlockZ() + z).getBlock().setType(ma);
- }
-
- protected void setEnchatRange(Location loc) {
- setRange(loc, Material.BOOKSHELF);
- loc.getBlock().setType(Material.ENCHANTMENT_TABLE);
- }
-
- protected void setRange(Location loc, Material ma) {
- for (int i = -2; i < 3; i++) {
- for (int j = 0; j < 2; j++) {
- for (int k = -2; k < 3; k++) {
- if (!((i * k == 0) || (i * k * i * k == 1))) {
- setBlock(loc, i, j, k, ma);
- }
- }
- }
- }
- }
-}
diff --git a/src/main/java/cn/citycraft/SimpleEssential/listen/PlayerInventoryViewListen.java b/src/main/java/cn/citycraft/SimpleEssential/listen/PlayerInventoryViewListen.java
deleted file mode 100644
index faad633..0000000
--- a/src/main/java/cn/citycraft/SimpleEssential/listen/PlayerInventoryViewListen.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- *
- */
-package cn.citycraft.SimpleEssential.listen;
-
-import org.bukkit.entity.Player;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.EventPriority;
-import org.bukkit.event.Listener;
-import org.bukkit.event.inventory.InventoryCloseEvent;
-import org.bukkit.event.inventory.InventoryType;
-import org.bukkit.inventory.Inventory;
-
-import cn.citycraft.SimpleEssential.SimpleEssential;
-
-/**
- * 玩家随身附魔台记录监听
- *
- * @author 蒋天蓓 2015年8月12日下午8:19:33
- *
- */
-public class PlayerInventoryViewListen implements Listener {
- SimpleEssential plugin;
-
- public PlayerInventoryViewListen(SimpleEssential main) {
- this.plugin = main;
- }
-
- @EventHandler(priority = EventPriority.MONITOR)
- public void onInventoryClose(InventoryCloseEvent e) {
- if (!(e.getPlayer() instanceof Player))
- return;
- Player player = (Player) e.getPlayer();
- Inventory inv = e.getInventory();
- if (inv.getType() == InventoryType.ENCHANTING) {
- plugin.invcontrol.clearEnchantBench(player);
- }
- }
-}