This commit is contained in:
yaohunya 2024-09-24 19:35:52 +08:00
parent 12112bc94e
commit 040127d26e
3 changed files with 29 additions and 3 deletions

View File

@ -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;
}

View File

@ -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("羊羊")) {

View File

@ -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.尽头));
}
}
}