diff --git a/src/main/java/com/yaohun/farmingwar/game/Region.java b/src/main/java/com/yaohun/farmingwar/game/Region.java index da34ed2..f2061b4 100644 --- a/src/main/java/com/yaohun/farmingwar/game/Region.java +++ b/src/main/java/com/yaohun/farmingwar/game/Region.java @@ -37,6 +37,24 @@ public class Region { return new Location(world,x,(y+5),z,-90,90); } + + public Location getHub(BackPointType backPointType){ + double z = (min.getZ() + max.getZ()) / 2; + double y = min.getY(); + if(max.getY() > y){ + y = max.getY(); + } + if(backPointType == BackPointType.初始){ + double x = (min.getX() + 1); + return new Location(world,x,(y+5),z,-90,45); + }else if(backPointType == BackPointType.尽头){ + double x = (max.getX() - 1); + return new Location(world,x,(y+5),z,90,45); + } + double x = (min.getX() + max.getX()) / 2; + return new Location(world,x,(y+5),z,-90,90); + } + public World getWorld() { return world; } diff --git a/src/main/java/com/yaohun/farmingwar/liveevent/GiftEventHandler.java b/src/main/java/com/yaohun/farmingwar/liveevent/GiftEventHandler.java index 53e799b..b4f2ab5 100644 --- a/src/main/java/com/yaohun/farmingwar/liveevent/GiftEventHandler.java +++ b/src/main/java/com/yaohun/farmingwar/liveevent/GiftEventHandler.java @@ -21,8 +21,6 @@ public class GiftEventHandler { BigWindill.apply(game,zhubo,5); }else if (eventName.equalsIgnoreCase("大风车60秒")) { BigWindill.apply(game,zhubo,60); - }else if (eventName.equalsIgnoreCase("场地重置")) { - game.reset(); } else if (eventName.equalsIgnoreCase("关灯100秒")) { PotionBlindness.apply(game,zhubo,100); } else if (eventName.contains("羊羊")) { diff --git a/src/main/java/com/yaohun/farmingwar/liveevent/KeyInputListener.java b/src/main/java/com/yaohun/farmingwar/liveevent/KeyInputListener.java index 8f30d2b..99e1b41 100644 --- a/src/main/java/com/yaohun/farmingwar/liveevent/KeyInputListener.java +++ b/src/main/java/com/yaohun/farmingwar/liveevent/KeyInputListener.java @@ -1,6 +1,9 @@ package com.yaohun.farmingwar.liveevent; import com.io.yutian.pixelliveplugin.event.KeyInputEvent; +import com.yaohun.farmingwar.FarmingWar; +import com.yaohun.farmingwar.game.Game; +import com.yaohun.farmingwar.util.BackPointType; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; @@ -10,6 +13,13 @@ public class KeyInputListener implements Listener { @EventHandler//点赞 public void onDianZan(KeyInputEvent e) { Player zhubo = e.getPlayer(); - zhubo.sendMessage("RawCode = "+e.getRawCode()+" KeyCode = "+e.getKeyCode()); + if(e.getRawCode() == 71 && e.getKeyCode() == 34){ + Game game = FarmingWar.getGame(); + zhubo.teleport(game.getRegion().getHub(BackPointType.中间)); + } + if(e.getRawCode() == 72 && e.getKeyCode() == 35){ + Game game = FarmingWar.getGame(); + zhubo.teleport(game.getRegion().getHub(BackPointType.尽头)); + } } }