diff --git a/.classpath b/.classpath
index 2c705bb..bea39b1 100644
--- a/.classpath
+++ b/.classpath
@@ -1,7 +1,16 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
@@ -12,5 +21,11 @@
+
+
+
+
+
+
diff --git a/pom.xml b/pom.xml
index 442f932..05c318c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -22,17 +22,65 @@
1.7
+
+ org.apache.maven.plugins
+ maven-shade-plugin
+ 2.3
+
+ false
+ true
+
+
+ cn.citycraft:PluginHelper
+
+
+
+
+ cn.citycraft.PluginHelper
+ ${project.groupId}.${project.artifactId}
+
+
+
+
+
+ package
+
+ shade
+
+
+
+
+
+ http://ci.citycraft.cn:8080
+
+
+ DEBUG
+ UTF-8
+
+
+
+ spigot-repo
+ https://hub.spigotmc.org/nexus/content/groups/public/
+
+
+ citycraft-repo
+ ${jenkins.url}/plugin/repository/everything/
+
+
org.spigotmc
spigot-api
jar
- 1.8.3-R0.1-SNAPSHOT
+ 1.8.8-R0.1-SNAPSHOT
+
+
+ cn.citycraft
+ PluginHelper
+ jar
+ 1.0
-
- UTF-8
-
\ No newline at end of file
diff --git a/src/main/java/cn/citycraft/RocketJump/Listen.java b/src/main/java/cn/citycraft/RocketJump/Listen.java
index 2899e17..3696814 100644
--- a/src/main/java/cn/citycraft/RocketJump/Listen.java
+++ b/src/main/java/cn/citycraft/RocketJump/Listen.java
@@ -18,95 +18,102 @@ import org.bukkit.event.player.PlayerToggleFlightEvent;
* Created by a08381 on 15-3-28.
*/
public class Listen implements Listener {
- RocketJump plugin;
- List fall = new ArrayList();
- List efc = new ArrayList();
- int trng;
+ RocketJump plugin;
+ List fall = new ArrayList();
+ List efc = new ArrayList();
+ int trng;
- public Listen(RocketJump main) {
- plugin = main;
- }
+ public Listen(final RocketJump main) {
+ plugin = main;
+ }
- public void add(String p) {
- if (!fall.contains(p))
- fall.add(p);
- }
+ public void add(final String p) {
+ if (!fall.contains(p)) {
+ fall.add(p);
+ }
+ }
- public void efcadd(String p) {
- if (!efc.contains(p))
- efc.add(p);
- }
+ public void efcadd(final String p) {
+ if (!efc.contains(p)) {
+ efc.add(p);
+ }
+ }
- @EventHandler(ignoreCancelled = true)
- public void MoveEvent(PlayerMoveEvent e) {
- Player p = e.getPlayer();
- if (efc.contains(p.getName())) {
- trng -= 1;
- pEffect(p.getLocation(), trng);
- }
- if (p.getLocation().add(0, -1, 0).getBlock().getType() != (Material.AIR))
- if (plugin.Dante.contains(p.getName())) {
- p.setAllowFlight(true);
- if (fall.contains(p.getName()))
- fall.remove(p.getName());
- }
- }
+ @EventHandler(ignoreCancelled = true)
+ public void MoveEvent(final PlayerMoveEvent e) {
+ final Player p = e.getPlayer();
+ if (efc.contains(p.getName())) {
+ trng -= 1;
+ pEffect(p.getLocation(), trng);
+ }
+ if (p.getLocation().add(0, -1, 0).getBlock().getType() != (Material.AIR)) {
+ if (plugin.Dante.contains(p.getName())) {
+ p.setAllowFlight(true);
+ if (fall.contains(p.getName())) {
+ fall.remove(p.getName());
+ }
+ }
+ }
+ }
- @EventHandler
- public void onFallDamage(EntityDamageEvent e) {
- if (e.getEntity() instanceof Player) {
- Player p = (Player) e.getEntity();
- if (e.getCause() == DamageCause.FALL)
- if (fall.contains(p.getName())) {
- fall.remove(p.getName());
- e.setCancelled(true);
- }
- }
- }
+ @EventHandler
+ public void onFallDamage(final EntityDamageEvent e) {
+ if (e.getEntity() instanceof Player) {
+ final Player p = (Player) e.getEntity();
+ if (e.getCause() == DamageCause.FALL) {
+ if (fall.contains(p.getName())) {
+ fall.remove(p.getName());
+ e.setCancelled(true);
+ }
+ }
+ }
+ }
- void pEffect(Location loc, int range) {
- int i;
- if (range < 2)
- range = 2;
- for (i = 0; i < range; i++) {
- loc.getWorld().playEffect(loc, Effect.LAVA_POP, 10, 100);
- loc.getWorld().playEffect(loc, Effect.PORTAL, 10, 100);
- }
- }
+ @EventHandler(ignoreCancelled = true)
+ public void ToggleFlightEvent(final PlayerToggleFlightEvent e) {
+ final Player p = e.getPlayer();
+ if (plugin.Dante.contains(p.getName())) {
+ if (p.getLocation().add(0, -1, 0).getBlock().getType() == (Material.AIR) && p.getLocation().add(0, -2, 0).getBlock().getType() == (Material.AIR)) {
+ e.setCancelled(true);
+ return;
+ }
+ if (!p.isFlying()) {
+ e.setCancelled(true);
+ pEffect(p.getLocation(), 80);
+ p.setVelocity(p.getVelocity().setY(1));
+ p.setAllowFlight(false);
+ plugin.getServer().getScheduler().runTaskLaterAsynchronously(plugin, new Runnable() {
+ @Override
+ public void run() {
+ if (p.isOnline()) {
+ p.setVelocity(p.getVelocity().setY(10));
+ final String name = p.getName();
+ efcadd(name);
+ add(name);
+ plugin.getServer().getScheduler().runTaskLaterAsynchronously(plugin, new Runnable() {
+ @Override
+ public void run() {
+ if (efc.contains(name)) {
+ efc.remove(name);
+ }
+ }
+ }, 30);
+ }
+ }
+ }, 10);
+ trng = 30;
+ }
+ }
+ }
- @EventHandler(ignoreCancelled = true)
- public void ToggleFlightEvent(PlayerToggleFlightEvent e) {
- final Player p = e.getPlayer();
- if (plugin.Dante.contains(p.getName())) {
- if (p.getLocation().add(0, -1, 0).getBlock().getType() == (Material.AIR) && p.getLocation().add(0, -2, 0).getBlock().getType() == (Material.AIR)) {
- e.setCancelled(true);
- return;
- }
- if (!p.isFlying()) {
- e.setCancelled(true);
- pEffect(p.getLocation(), 80);
- p.setVelocity(p.getVelocity().setY(1));
- p.setAllowFlight(false);
- plugin.getServer().getScheduler().runTaskLaterAsynchronously(plugin, new Runnable() {
- @Override
- public void run() {
- if (p.isOnline()) {
- p.setVelocity(p.getVelocity().setY(10));
- final String name = p.getName();
- efcadd(name);
- add(name);
- plugin.getServer().getScheduler().runTaskLaterAsynchronously(plugin, new Runnable() {
- @Override
- public void run() {
- if (efc.contains(name))
- efc.remove(name);
- }
- }, 30);
- }
- }
- }, 10);
- trng = 30;
- }
- }
- }
+ void pEffect(final Location loc, int range) {
+ int i;
+ if (range < 2) {
+ range = 2;
+ }
+ for (i = 0; i < range; i++) {
+ loc.getWorld().playEffect(loc, Effect.LAVA_POP, 10, 100);
+ loc.getWorld().playEffect(loc, Effect.PORTAL, 10, 100);
+ }
+ }
}
diff --git a/src/main/java/cn/citycraft/RocketJump/RocketJump.java b/src/main/java/cn/citycraft/RocketJump/RocketJump.java
index 635fe83..d359d89 100644
--- a/src/main/java/cn/citycraft/RocketJump/RocketJump.java
+++ b/src/main/java/cn/citycraft/RocketJump/RocketJump.java
@@ -3,51 +3,57 @@ package cn.citycraft.RocketJump;
import java.util.ArrayList;
import java.util.List;
+import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
+
+import cn.citycraft.PluginHelper.commands.HandlerCommand;
+import cn.citycraft.PluginHelper.commands.HandlerCommands;
+import cn.citycraft.PluginHelper.commands.HandlerSubCommand;
+import cn.citycraft.PluginHelper.utils.VersionChecker;
+
/**
- * Created by a08381 on 15-3-28.
+ * 火箭跳跃主类
+ *
+ * @author 喵♂呜
+ * @since 2016年2月9日 下午8:50:50
*/
-public class RocketJump extends JavaPlugin {
+public class RocketJump extends JavaPlugin implements HandlerCommands {
- List Dante = new ArrayList() ;
+ List Dante = new ArrayList();
- @Override
- public boolean onCommand(CommandSender sender, Command cmd, String string,
- String[] args) {
- Player p = (Player) sender;
- if (args.length == 1) {
- if (args[0].equalsIgnoreCase("on")) {
- this.Dante.add(p.getName());
- sender.sendMessage("§6[RocketJump]§a火箭跳跃已开启,双击空格启动。。。");
- p.setAllowFlight(true);
- return true;
- }
- if (args[0].equalsIgnoreCase("off")) {
- this.Dante.remove(p.getName());
- sender.sendMessage("§6[RocketJump]§4已关闭...");
- if (p.getGameMode() == GameMode.SURVIVAL) {
- p.setAllowFlight(false);
- }
- return true;
- }
- }
- return false;
- }
+ @HandlerCommand(name = "off", description = "§a开启火箭跳跃", permission = "rj.use", onlyPlayerExecutable = true)
+ public void off(final CommandSender sender, final Command cmd, final String string, final String[] args) {
+ final Player p = (Player) sender;
+ this.Dante.remove(p.getName());
+ sender.sendMessage("§6[RocketJump]§4已关闭...");
+ if (p.getGameMode() == GameMode.SURVIVAL) {
+ p.setAllowFlight(false);
+ }
+ }
- @Override
- public void onDisable() {
- getLogger().info( "§4RocketJump已卸载...");
- }
+ @HandlerCommand(name = "on", description = "§c关闭火箭跳跃", permission = "rj.use", onlyPlayerExecutable = true)
+ public void on(final CommandSender sender, final Command cmd, final String string, final String[] args) {
+ final Player p = (Player) sender;
+ this.Dante.add(p.getName());
+ sender.sendMessage("§6[RocketJump]§a火箭跳跃已开启,双击空格启动。。。");
+ p.setAllowFlight(true);
+ }
+ @Override
+ public void onDisable() {
+ Bukkit.getConsoleSender().sendMessage("§4RocketJump已卸载...");
+ }
- @Override
- public void onEnable() {
- getServer().getPluginManager().registerEvents(new Listen(this), this);
- getLogger().info("§aRocketJump已加载...");
- }
+ @Override
+ public void onEnable() {
+ new HandlerSubCommand(this, "rj").registerCommands(this);
+ getServer().getPluginManager().registerEvents(new Listen(this), this);
+ Bukkit.getConsoleSender().sendMessage("§aRocketJump已加载...");
+ new VersionChecker(this);
+ }
}