v3.0
This commit is contained in:
parent
7083ff6c6b
commit
12112bc94e
|
@ -12,6 +12,7 @@ import com.yaohun.farmingwar.game.Region;
|
|||
import com.yaohun.farmingwar.listener.*;
|
||||
import com.yaohun.farmingwar.liveevent.GiftEventHandler;
|
||||
import com.yaohun.farmingwar.liveevent.GiftListener;
|
||||
import com.yaohun.farmingwar.liveevent.KeyInputListener;
|
||||
import com.yaohun.farmingwar.liveevent.LikeListener;
|
||||
import com.yaohun.farmingwar.manager.GameManager;
|
||||
import org.bukkit.Bukkit;
|
||||
|
@ -46,6 +47,7 @@ public class FarmingWar extends JavaPlugin {
|
|||
Bukkit.getPluginManager().registerEvents(new PlayerListener(this), this);
|
||||
Bukkit.getPluginManager().registerEvents(new JoinListener(this), this);
|
||||
Bukkit.getPluginManager().registerEvents(new KeepEntitiesOnDeath(), this);
|
||||
Bukkit.getPluginManager().registerEvents(new KeyInputListener(), this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,15 +1,19 @@
|
|||
package com.yaohun.farmingwar.data;
|
||||
|
||||
import tools.GameUtil;
|
||||
|
||||
public class LikeData {
|
||||
|
||||
private String effectKey;
|
||||
private int needAmount;
|
||||
private int nowAmount;
|
||||
private String sound;
|
||||
|
||||
public LikeData(String effectKey, int needAmount){
|
||||
public LikeData(String effectKey, int needAmount, String sound){
|
||||
this.effectKey = effectKey;
|
||||
this.needAmount = needAmount;
|
||||
this.nowAmount = 0;
|
||||
this.sound = sound;
|
||||
}
|
||||
|
||||
public String getEffectKey() {
|
||||
|
@ -38,4 +42,7 @@ public class LikeData {
|
|||
public void setNowAmount(int nowAmount) {
|
||||
this.nowAmount = nowAmount;
|
||||
}
|
||||
public void OutPlaySoundsEvent() {
|
||||
GameUtil.sendAllSound(this.sound);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ import org.bukkit.Particle;
|
|||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.data.Ageable;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.block.data.type.Farmland;
|
||||
import org.bukkit.entity.Cow;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -73,7 +74,7 @@ public class SummonTheCow {
|
|||
BukkitTask task = new BukkitRunnable() {
|
||||
private int i = 0;
|
||||
// 计算将在多少i后自动消失
|
||||
private double remove_x_i = (region.getMax().getX() - region.getMin().getX()) * 7;
|
||||
private double remove_x_i = (region.getMax().getX() - region.getMin().getX()) * 4;
|
||||
private List<Integer> integerList = new ArrayList<>();
|
||||
@Override
|
||||
public void run() {
|
||||
|
@ -92,7 +93,7 @@ public class SummonTheCow {
|
|||
}
|
||||
Vector vector0 = new Vector(1, 0, 0);
|
||||
vector0.normalize();
|
||||
vector0.multiply(0.15);
|
||||
vector0.multiply(FarmingWar.getGameManager().getMovespeeds());
|
||||
entity.setRotation(-90, 0);
|
||||
entity.setVelocity(vector0);
|
||||
location.setY(region.getMax().getY());
|
||||
|
|
|
@ -76,7 +76,7 @@ public class SummonTheDragon {
|
|||
BukkitTask task = new BukkitRunnable() {
|
||||
private int i = 0;
|
||||
// 计算将在多少i后自动消失
|
||||
private double remove_x_i = (region.getMax().getX() - region.getMin().getX()) * 7;
|
||||
private double remove_x_i = (region.getMax().getX() - region.getMin().getX()) * 4;
|
||||
private List<Integer> integerList = new ArrayList<>();
|
||||
@Override
|
||||
public void run() {
|
||||
|
@ -97,7 +97,7 @@ public class SummonTheDragon {
|
|||
}
|
||||
Vector vector0 = new Vector(1, 0, 0);
|
||||
vector0.normalize();
|
||||
vector0.multiply(0.15);
|
||||
vector0.multiply(FarmingWar.getGameManager().getMovespeeds());
|
||||
Location location1 = entity.getLocation().add(vector0);
|
||||
location1.setYaw(90);
|
||||
location1.setPitch(0);
|
||||
|
|
|
@ -73,7 +73,7 @@ public class SummonTheGiant {
|
|||
BukkitTask task = new BukkitRunnable() {
|
||||
private int i = 0;
|
||||
// 计算将在多少i后自动消失
|
||||
private double remove_x_i = (region.getMax().getX() - region.getMin().getX()) * 7;
|
||||
private double remove_x_i = (region.getMax().getX() - region.getMin().getX()) * 4;
|
||||
private List<Integer> integerList = new ArrayList<>();
|
||||
@Override
|
||||
public void run() {
|
||||
|
@ -94,7 +94,7 @@ public class SummonTheGiant {
|
|||
}
|
||||
Vector vector0 = new Vector(1, 0, 0);
|
||||
vector0.normalize();
|
||||
vector0.multiply(0.15);
|
||||
vector0.multiply(FarmingWar.getGameManager().getMovespeeds());
|
||||
Location location1 = entity.getLocation().add(vector0);
|
||||
location1.setYaw(-90);
|
||||
location1.setPitch(0);
|
||||
|
|
|
@ -82,7 +82,7 @@ public class SummonTheHorse {
|
|||
BukkitTask task = new BukkitRunnable() {
|
||||
private int i = 0;
|
||||
// 计算将在多少i后自动消失
|
||||
private double remove_x_i = (region.getMax().getX() - region.getMin().getX()) * 7;
|
||||
private double remove_x_i = (region.getMax().getX() - region.getMin().getX()) * 4;
|
||||
private List<Integer> integerList = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
|
@ -102,7 +102,7 @@ public class SummonTheHorse {
|
|||
}
|
||||
Vector vector0 = new Vector(1, 0, 0);
|
||||
vector0.normalize();
|
||||
vector0.multiply(0.15);
|
||||
vector0.multiply(FarmingWar.getGameManager().getMovespeeds());
|
||||
entity.setVelocity(vector0);
|
||||
entity.setRotation(-90, 0);
|
||||
location.setY(region.getMax().getY());
|
||||
|
|
|
@ -90,7 +90,7 @@ public class SummonTheIrongolem {
|
|||
}
|
||||
Vector vector0 = new Vector(1, 0, 0);
|
||||
vector0.normalize();
|
||||
vector0.multiply(0.32);
|
||||
vector0.multiply(FarmingWar.getGameManager().getMovespeeds());
|
||||
entity.setRotation(-90, 0);
|
||||
entity.setVelocity(vector0);
|
||||
i++;
|
||||
|
|
|
@ -78,7 +78,7 @@ public class SummonTheMagmacube {
|
|||
BukkitTask task = new BukkitRunnable() {
|
||||
private int i = 0;
|
||||
// 计算将在多少i后自动消失
|
||||
private double remove_x_i = (region.getMax().getX() - region.getMin().getX()) * 10;
|
||||
private double remove_x_i = (region.getMax().getX() - region.getMin().getX()) * 4;
|
||||
private List<Integer> integerList = new ArrayList<>();
|
||||
@Override
|
||||
public void run() {
|
||||
|
@ -97,7 +97,7 @@ public class SummonTheMagmacube {
|
|||
}
|
||||
Vector vector0 = new Vector(1, 0, 0);
|
||||
vector0.normalize();
|
||||
vector0.multiply(0.12);
|
||||
vector0.multiply(FarmingWar.getGameManager().getMovespeeds());
|
||||
entity.setTarget(null);
|
||||
entity.setRotation(-90, 0);
|
||||
entity.setVelocity(vector0);
|
||||
|
|
|
@ -70,7 +70,7 @@ public class SummonThePanda {
|
|||
BukkitTask task = new BukkitRunnable() {
|
||||
private int i = 0;
|
||||
// 计算将在多少i后自动消失
|
||||
private double remove_x_i = (region.getMax().getX() - region.getMin().getX()) * 7;
|
||||
private double remove_x_i = (region.getMax().getX() - region.getMin().getX()) * 4;
|
||||
private List<Integer> integerList = new ArrayList<>();
|
||||
@Override
|
||||
public void run() {
|
||||
|
@ -89,7 +89,7 @@ public class SummonThePanda {
|
|||
}
|
||||
Vector vector0 = new Vector(1, 0, 0);
|
||||
vector0.normalize();
|
||||
vector0.multiply(0.20);
|
||||
vector0.multiply(FarmingWar.getGameManager().getMovespeeds());
|
||||
entity.setTarget(null);
|
||||
entity.setRotation(-90, 0);
|
||||
entity.setVelocity(vector0);
|
||||
|
|
|
@ -69,7 +69,7 @@ public class SummonThePolarBear {
|
|||
BukkitTask task = new BukkitRunnable() {
|
||||
private int i = 0;
|
||||
// 计算将在多少i后自动消失
|
||||
private double remove_x_i = (region.getMax().getX() - region.getMin().getX()) * 7;
|
||||
private double remove_x_i = (region.getMax().getX() - region.getMin().getX()) * 4;
|
||||
private List<Integer> integerList = new ArrayList<>();
|
||||
@Override
|
||||
public void run() {
|
||||
|
@ -88,7 +88,7 @@ public class SummonThePolarBear {
|
|||
}
|
||||
Vector vector0 = new Vector(1, 0, 0);
|
||||
vector0.normalize();
|
||||
vector0.multiply(0.2);
|
||||
vector0.multiply(FarmingWar.getGameManager().getMovespeeds());
|
||||
entity.setTarget(null);
|
||||
entity.setRotation(-90, 0);
|
||||
entity.setVelocity(vector0);
|
||||
|
|
|
@ -75,7 +75,7 @@ public class SummonTheSheep {
|
|||
BukkitTask task = new BukkitRunnable() {
|
||||
private int i = 0;
|
||||
// 计算将在多少i后自动消失
|
||||
private double remove_x_i = (region.getMax().getX() - region.getMin().getX()) * 7;
|
||||
private double remove_x_i = (region.getMax().getX() - region.getMin().getX()) * 4;
|
||||
private List<Integer> integerList = new ArrayList<>();
|
||||
@Override
|
||||
public void run() {
|
||||
|
@ -94,7 +94,7 @@ public class SummonTheSheep {
|
|||
}
|
||||
Vector vector0 = new Vector(1, 0, 0);
|
||||
vector0.normalize();
|
||||
vector0.multiply(0.15);
|
||||
vector0.multiply(FarmingWar.getGameManager().getMovespeeds());
|
||||
entity.setVelocity(vector0);
|
||||
entity.setRotation(-90, 0);
|
||||
location.setY(region.getMax().getY());
|
||||
|
|
|
@ -94,7 +94,7 @@ public class SummonTheTraderllama {
|
|||
}
|
||||
Vector vector0 = new Vector(1, 0, 0);
|
||||
vector0.normalize();
|
||||
vector0.multiply(0.32);
|
||||
vector0.multiply(FarmingWar.getGameManager().getMovespeeds());
|
||||
entity.setRotation(-90, 0);
|
||||
entity.setVelocity(vector0);
|
||||
i++;
|
||||
|
|
|
@ -74,7 +74,7 @@ public class SummonTheVillager {
|
|||
BukkitTask task = new BukkitRunnable() {
|
||||
private int i = 0;
|
||||
// 计算将在多少i后自动消失
|
||||
private double remove_x_i = (region.getMax().getX() - region.getMin().getX()) * 7;
|
||||
private double remove_x_i = (region.getMax().getX() - region.getMin().getX()) * 4;
|
||||
private List<Integer> integerList = new ArrayList<>();
|
||||
@Override
|
||||
public void run() {
|
||||
|
@ -93,7 +93,7 @@ public class SummonTheVillager {
|
|||
}
|
||||
Vector vector0 = new Vector(1, 0, 0);
|
||||
vector0.normalize();
|
||||
vector0.multiply(0.15);
|
||||
vector0.multiply(FarmingWar.getGameManager().getMovespeeds());
|
||||
entity.setRotation(-90, 0);
|
||||
entity.setVelocity(vector0);
|
||||
// 获取生物当前所在位置的方块
|
||||
|
|
|
@ -81,7 +81,7 @@ public class SummonTheWither {
|
|||
BukkitTask task = new BukkitRunnable() {
|
||||
private int i = 0;
|
||||
// 计算将在多少i后自动消失
|
||||
private double remove_x_i = (region.getMax().getX() - region.getMin().getX()) * 7;
|
||||
private double remove_x_i = (region.getMax().getX() - region.getMin().getX()) * 4;
|
||||
private List<Integer> integerList = new ArrayList<>();
|
||||
@Override
|
||||
public void run() {
|
||||
|
@ -102,7 +102,7 @@ public class SummonTheWither {
|
|||
}
|
||||
Vector vector0 = new Vector(1, 0, 0);
|
||||
vector0.normalize();
|
||||
vector0.multiply(0.15);
|
||||
vector0.multiply(FarmingWar.getGameManager().getMovespeeds());
|
||||
Location location1 = entity.getLocation().add(vector0);
|
||||
location1.setYaw(-90);
|
||||
location1.setPitch(0);
|
||||
|
|
|
@ -21,6 +21,8 @@ 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("羊羊")) {
|
||||
|
|
|
@ -27,8 +27,5 @@ public class GiftListener implements Listener {
|
|||
}
|
||||
String show_userName = GameUtil.hideName(userName);
|
||||
GiftUtil.simulatedGiftEffect(zhubo,show_userName,giftName,amount);
|
||||
for (Player player : Bukkit.getOnlinePlayers()){
|
||||
player.sendMessage("§a礼物: §e"+ show_userName+" §d送来了 §e"+giftName+"x"+amount);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
package com.yaohun.farmingwar.liveevent;
|
||||
|
||||
import com.io.yutian.pixelliveplugin.event.KeyInputEvent;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
public class KeyInputListener implements Listener {
|
||||
|
||||
@EventHandler//点赞
|
||||
public void onDianZan(KeyInputEvent e) {
|
||||
Player zhubo = e.getPlayer();
|
||||
zhubo.sendMessage("RawCode = "+e.getRawCode()+" KeyCode = "+e.getKeyCode());
|
||||
}
|
||||
}
|
|
@ -31,7 +31,9 @@ public class LikeListener implements Listener {
|
|||
if(likeData.meetTheQuantityRequirement()){
|
||||
String eventName = likeData.getEffectKey();
|
||||
String title = "§c"+eventName;
|
||||
String subtitle = "§9双击屏幕x"+likeData.getNeedAmount();
|
||||
//String subtitle = "§9双击屏幕x"+likeData.getNeedAmount();
|
||||
String subtitle = "§r";
|
||||
likeData.OutPlaySoundsEvent();
|
||||
zhubo.sendTitle(title, subtitle,0, 30, 10);
|
||||
GiftEventHandler.SendHandLer(zhubo,userName,eventName);
|
||||
likeData.setNowAmount(0);
|
||||
|
|
|
@ -18,6 +18,7 @@ public class GameManager {
|
|||
|
||||
private File manageFile;
|
||||
private FileConfiguration manageConfig;
|
||||
private double movespeeds = 0.32;
|
||||
private int gameGoal;
|
||||
private long gameTime;
|
||||
private BackPointType backPointType;
|
||||
|
@ -39,7 +40,8 @@ public class GameManager {
|
|||
for (String key : likeSection.getKeys(false)) {
|
||||
String effect = likeSection.getString(key+".效果");
|
||||
int likeAmount = likeSection.getInt(key+".点赞次数");
|
||||
likeDataMap.put(effect,new LikeData(effect,likeAmount));
|
||||
String likesounds = likeSection.getString(key+".声音","wau");
|
||||
likeDataMap.put(effect,new LikeData(effect,likeAmount,likesounds));
|
||||
String message = "事件: "+effect+" 条件: 点赞x"+likeAmount;
|
||||
Bukkit.getConsoleSender().sendMessage(message);
|
||||
}
|
||||
|
@ -88,6 +90,10 @@ public class GameManager {
|
|||
}
|
||||
}
|
||||
|
||||
public double getMovespeeds() {
|
||||
return movespeeds;
|
||||
}
|
||||
|
||||
public long getGameTime() {
|
||||
return gameTime;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user