diff --git a/pom.xml b/pom.xml
index 070a146..24e5aa9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
me.lanzhi
BluestarGame
- 3.3.2
+ 3.4.0
jar
BluestarGame
@@ -105,17 +105,10 @@
4.11.0
provided
-
-
- de.tr7zw
- item-nbt-api-plugin
- 2.9.2
- provided
-
com.github.lanzhi6
BluestarAPI
- 2.6.3
+ 3.0.0
provided
@@ -127,7 +120,7 @@
com.github.lanzhi6
BluestarGameAPI
- 3.2.1
+ 3.4.3
provided
@@ -139,7 +132,7 @@
io.github.dreamvoid
MiraiMC-Integration
- 1.7-rc2
+ 1.7
provided
diff --git a/src/main/java/me/lanzhi/bluestargame/BluestarGamePlugin.java b/src/main/java/me/lanzhi/bluestargame/BluestarGamePlugin.java
index 1eb5f08..60cc046 100644
--- a/src/main/java/me/lanzhi/bluestargame/BluestarGamePlugin.java
+++ b/src/main/java/me/lanzhi/bluestargame/BluestarGamePlugin.java
@@ -1,8 +1,8 @@
package me.lanzhi.bluestargame;
-import me.lanzhi.bluestarapi.api.Bluestar;
-import me.lanzhi.bluestarapi.api.config.AutoSerialize;
-import me.lanzhi.bluestarapi.api.config.YamlFile;
+import me.lanzhi.api.Bluestar;
+import me.lanzhi.api.config.AutoSerialize;
+import me.lanzhi.api.config.YamlFile;
import me.lanzhi.bluestargame.Type.CompressedCoal;
import me.lanzhi.bluestargame.Type.Elevator;
import me.lanzhi.bluestargame.Type.SuperSponge;
@@ -18,8 +18,6 @@
import org.bukkit.ChatColor;
import org.bukkit.command.PluginCommand;
import org.bukkit.configuration.serialization.ConfigurationSerialization;
-import org.bukkit.event.server.PluginDisableEvent;
-import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.ServicePriority;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitTask;
diff --git a/src/main/java/me/lanzhi/bluestargame/Metrics.java b/src/main/java/me/lanzhi/bluestargame/Metrics.java
index 56a0dc8..1af0277 100644
--- a/src/main/java/me/lanzhi/bluestargame/Metrics.java
+++ b/src/main/java/me/lanzhi/bluestargame/Metrics.java
@@ -14,7 +14,7 @@
*/
package me.lanzhi.bluestargame;
-import me.lanzhi.bluestarapi.api.config.YamlFile;
+import me.lanzhi.api.config.YamlFile;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
@@ -75,7 +75,19 @@ public Metrics(BluestarGamePlugin plugin,int serviceId)
boolean logErrors=config.getBoolean("bStats.logFailedRequests",false);
boolean logSentData=config.getBoolean("bStats.logSentData",false);
boolean logResponseStatusText=config.getBoolean("bStats.logResponseStatusText",false);
- metricsBase=new MetricsBase("bukkit",serverUUID,14294,enabled,this::appendPlatformData,this::appendServiceData,submitDataTask->Bukkit.getScheduler().runTask(plugin,submitDataTask),plugin::isEnabled,(message,error)->this.plugin.getLogger().log(Level.WARNING,message,error),(message)->this.plugin.getLogger().log(Level.INFO,message),logErrors,logSentData,logResponseStatusText);
+ metricsBase=new MetricsBase("bukkit",
+ serverUUID,
+ 14294,
+ enabled,
+ this::appendPlatformData,
+ this::appendServiceData,
+ submitDataTask->Bukkit.getScheduler().runTask(plugin,submitDataTask),
+ plugin::isEnabled,
+ (message,error)->this.plugin.getLogger().log(Level.WARNING,message,error),
+ (message)->this.plugin.getLogger().log(Level.INFO,message),
+ logErrors,
+ logSentData,
+ logResponseStatusText);
}
/**
@@ -114,7 +126,9 @@ private int getPlayerAmount()
// This fixes java.lang.NoSuchMethodError:
// org.bukkit.Bukkit.getOnlinePlayers()Ljava/util/Collection;
Method onlinePlayersMethod=Class.forName("org.bukkit.Server").getMethod("getOnlinePlayers");
- return onlinePlayersMethod.getReturnType().equals(Collection.class)?((Collection>) onlinePlayersMethod.invoke(Bukkit.getServer())).size():((Player[]) onlinePlayersMethod.invoke(Bukkit.getServer())).length;
+ return onlinePlayersMethod.getReturnType()
+ .equals(Collection.class)?((Collection>) onlinePlayersMethod.invoke(Bukkit.getServer())).size():((Player[]) onlinePlayersMethod.invoke(
+ Bukkit.getServer())).length;
}
catch (Exception e)
{
@@ -131,7 +145,9 @@ public static class MetricsBase
*/
public static final String METRICS_VERSION="3.0.0";
- private static final ScheduledExecutorService scheduler=Executors.newScheduledThreadPool(1,task->new Thread(task,"bStats-Metrics"));
+ private static final ScheduledExecutorService scheduler=Executors.newScheduledThreadPool(1,
+ task->new Thread(task,
+ "bStats-Metrics"));
private static final String REPORT_URL="https://bStats.org/api/v2/data/%s";
@@ -270,7 +286,12 @@ private void submitData()
appendPlatformDataConsumer.accept(baseJsonBuilder);
final JsonObjectBuilder serviceJsonBuilder=new JsonObjectBuilder();
appendServiceDataConsumer.accept(serviceJsonBuilder);
- JsonObjectBuilder.JsonObject[] chartData=customCharts.stream().map(customChart->customChart.getRequestJsonObject(errorLogger,logErrors)).filter(Objects::nonNull).toArray(JsonObjectBuilder.JsonObject[]::new);
+ JsonObjectBuilder.JsonObject[] chartData=customCharts.stream()
+ .map(customChart->customChart.getRequestJsonObject(
+ errorLogger,
+ logErrors))
+ .filter(Objects::nonNull)
+ .toArray(JsonObjectBuilder.JsonObject[]::new);
serviceJsonBuilder.appendField("id",serviceId);
serviceJsonBuilder.appendField("customCharts",chartData);
baseJsonBuilder.appendField("service",serviceJsonBuilder.build());
@@ -278,21 +299,21 @@ private void submitData()
baseJsonBuilder.appendField("metricsVersion",METRICS_VERSION);
JsonObjectBuilder.JsonObject data=baseJsonBuilder.build();
scheduler.execute(()->
- {
- try
- {
- // Send the data
- sendData(data);
- }
- catch (Exception e)
- {
- // Something went wrong! :(
- if (logErrors)
- {
- errorLogger.accept("Could not submit bStats metrics data",e);
- }
- }
- });
+ {
+ try
+ {
+ // Send the data
+ sendData(data);
+ }
+ catch (Exception e)
+ {
+ // Something went wrong! :(
+ if (logErrors)
+ {
+ errorLogger.accept("Could not submit bStats metrics data",e);
+ }
+ }
+ });
}
private void sendData(JsonObjectBuilder.JsonObject data) throws Exception
@@ -338,7 +359,8 @@ private void sendData(JsonObjectBuilder.JsonObject data) throws Exception
private void checkRelocation()
{
// You can use the property to disable the check in your test environment
- if (System.getProperty("bstats.relocatecheck")==null||!System.getProperty("bstats.relocatecheck").equals("false"))
+ if (System.getProperty("bstats.relocatecheck")==null||!System.getProperty("bstats.relocatecheck")
+ .equals("false"))
{
// Maven's Relocate is clever and changes strings, too. So we have to use this little
// "trick" ... :D
@@ -346,7 +368,10 @@ private void checkRelocation()
final String examplePackage=new String(new byte[]{'y','o','u','r','.','p','a','c','k','a','g','e'});
// We want to make sure no one just copy & pastes the example and uses the wrong package
// names
- if (MetricsBase.class.getPackage().getName().startsWith(defaultPackage)||MetricsBase.class.getPackage().getName().startsWith(examplePackage))
+ if (MetricsBase.class.getPackage().getName().startsWith(defaultPackage)||MetricsBase.class.getPackage()
+ .getName()
+ .startsWith(
+ examplePackage))
{
throw new IllegalStateException("bStats Metrics class has not been relocated correctly!");
}
@@ -813,7 +838,9 @@ public JsonObjectBuilder appendField(String key,String[] values)
{
throw new IllegalArgumentException("JSON values must not be null");
}
- String escapedValues=Arrays.stream(values).map(value->"\""+escape(value)+"\"").collect(Collectors.joining(","));
+ String escapedValues=Arrays.stream(values)
+ .map(value->"\""+escape(value)+"\"")
+ .collect(Collectors.joining(","));
appendFieldUnescaped(key,"["+escapedValues+"]");
return this;
}
diff --git a/src/main/java/me/lanzhi/bluestargame/Type/CompressedCoal.java b/src/main/java/me/lanzhi/bluestargame/Type/CompressedCoal.java
index 38cf98c..50e39d0 100644
--- a/src/main/java/me/lanzhi/bluestargame/Type/CompressedCoal.java
+++ b/src/main/java/me/lanzhi/bluestargame/Type/CompressedCoal.java
@@ -1,7 +1,7 @@
package me.lanzhi.bluestargame.Type;
-import de.tr7zw.nbtapi.NBTCompound;
-import de.tr7zw.nbtapi.NBTItem;
+import me.lanzhi.api.nbt.NBTCompound;
+import me.lanzhi.api.nbt.NBTItem;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
@@ -41,34 +41,41 @@ public enum CompressedCoal implements ConfigurationSerializable
ItemMeta meta=itemm.getItemMeta();
switch (id)
{
- case 1 -> {
+ case 1 ->
+ {
meta.setDisplayName(ChatColor.GOLD+"烧制煤炭");
- allowRecipe=Collections.singletonList(
- new NamespacedKey(Bukkit.getPluginManager().getPlugin("BluestarGame"),"compressed_coal"));
+ allowRecipe=Collections.singletonList(new NamespacedKey(Bukkit.getPluginManager()
+ .getPlugin("BluestarGame"),
+ "compressed_coal"));
itemm.setItemMeta(meta);
item=new NBTItem(itemm);
item.addCompound("BluestarGame").setInteger("coal",id);
this.id=id;
}
- case 2 -> {
+ case 2 ->
+ {
meta.setDisplayName(ChatColor.GOLD+"压缩煤炭");
- allowRecipe=Collections.singletonList(
- new NamespacedKey(Bukkit.getPluginManager().getPlugin("BluestarGame"),"fired_compressed_coal"));
+ allowRecipe=Collections.singletonList(new NamespacedKey(Bukkit.getPluginManager()
+ .getPlugin("BluestarGame"),
+ "fired_compressed_coal"));
itemm.setItemMeta(meta);
item=new NBTItem(itemm);
item.addCompound("BluestarGame").setInteger("coal",id);
this.id=id;
}
- case 3 -> {
+ case 3 ->
+ {
meta.setDisplayName(ChatColor.GOLD+"烧制压缩煤炭");
- allowRecipe=Collections.singletonList(
- new NamespacedKey(Bukkit.getPluginManager().getPlugin("BluestarGame"),"coal_diamond"));
+ allowRecipe=Collections.singletonList(new NamespacedKey(Bukkit.getPluginManager()
+ .getPlugin("BluestarGame"),
+ "coal_diamond"));
itemm.setItemMeta(meta);
item=new NBTItem(itemm);
item.addCompound("BluestarGame").setInteger("coal",id);
this.id=id;
}
- default -> {
+ default ->
+ {
this.allowRecipe=null;
this.id=0;
this.item=null;
diff --git a/src/main/java/me/lanzhi/bluestargame/Type/Elevator.java b/src/main/java/me/lanzhi/bluestargame/Type/Elevator.java
index c5dd83d..30e53ca 100644
--- a/src/main/java/me/lanzhi/bluestargame/Type/Elevator.java
+++ b/src/main/java/me/lanzhi/bluestargame/Type/Elevator.java
@@ -1,8 +1,8 @@
package me.lanzhi.bluestargame.Type;
-import me.lanzhi.bluestarapi.api.config.AutoSerializeInterface;
-import me.lanzhi.bluestarapi.api.config.SerializeAs;
-import me.lanzhi.bluestarapi.api.config.SpecialSerialize;
+import me.lanzhi.api.config.AutoSerializeInterface;
+import me.lanzhi.api.config.SerializeAs;
+import me.lanzhi.api.config.SpecialSerialize;
import org.bukkit.Bukkit;
import org.bukkit.World;
diff --git a/src/main/java/me/lanzhi/bluestargame/Type/SuperSponge.java b/src/main/java/me/lanzhi/bluestargame/Type/SuperSponge.java
index a8ab456..38c8b8e 100644
--- a/src/main/java/me/lanzhi/bluestargame/Type/SuperSponge.java
+++ b/src/main/java/me/lanzhi/bluestargame/Type/SuperSponge.java
@@ -1,7 +1,7 @@
package me.lanzhi.bluestargame.Type;
-import me.lanzhi.bluestarapi.api.config.AutoSerializeInterface;
-import me.lanzhi.bluestarapi.api.config.SerializeAs;
+import me.lanzhi.api.config.AutoSerializeInterface;
+import me.lanzhi.api.config.SerializeAs;
import org.bukkit.Location;
@SerializeAs("BluestarGame.SuperSponge")
diff --git a/src/main/java/me/lanzhi/bluestargame/commands/BluestarGameCommand.java b/src/main/java/me/lanzhi/bluestargame/commands/BluestarGameCommand.java
index fab4ee4..6bcec2b 100644
--- a/src/main/java/me/lanzhi/bluestargame/commands/BluestarGameCommand.java
+++ b/src/main/java/me/lanzhi/bluestargame/commands/BluestarGameCommand.java
@@ -53,9 +53,8 @@ public boolean onCommand(@NotNull CommandSender sender,@NotNull Command command,
}
player.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(Double.parseDouble(args[2]));
}
- else if (args.length==2&&sender instanceof Player)
+ else if (args.length==2&&sender instanceof Player player)
{
- Player player=(Player) sender;
player.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(Double.parseDouble(args[1]));
}
else
@@ -341,8 +340,9 @@ else if (args.length==2&&sender instanceof Player)
r=Integer.parseInt(args[1]);
Location locc=((Player) (sender)).getLocation();
Location loc=new Location(locc.getWorld(),locc.getBlockX(),locc.getBlockY(),locc.getBlockZ());
- plugin.getBluestarGameManager().getSuperSpongeManager().add(
- new SuperSponge(r,loc,sender.getName(),true,true));
+ plugin.getBluestarGameManager()
+ .getSuperSpongeManager()
+ .add(new SuperSponge(r,loc,sender.getName(),true,true));
return true;
}
if ("makeboom".equals(args[0]))
@@ -401,11 +401,23 @@ public List onTabComplete(CommandSender sender,Command command,String al
{
if (args.length==1)
{
- List tablist=new ArrayList<>(
- Arrays.asList("randdamage","randchat","randsheep","24","morediamond","morecoal","morecopper",
- "moreiron","moregold","moreemerald","morelapis","respawn","all","auto","spongeR",
- "boom","onehealth"
- ));
+ List tablist=new ArrayList<>(Arrays.asList("randdamage",
+ "randchat",
+ "randsheep",
+ "24",
+ "morediamond",
+ "morecoal",
+ "morecopper",
+ "moreiron",
+ "moregold",
+ "moreemerald",
+ "morelapis",
+ "respawn",
+ "all",
+ "auto",
+ "spongeR",
+ "boom",
+ "onehealth"));
if (sender.hasPermission("bluestargame.lanzhi"))
{
tablist.add("newsponge");
diff --git a/src/main/java/me/lanzhi/bluestargame/commands/BluestarItemCommand.java b/src/main/java/me/lanzhi/bluestargame/commands/BluestarItemCommand.java
index fd80472..7745d23 100644
--- a/src/main/java/me/lanzhi/bluestargame/commands/BluestarItemCommand.java
+++ b/src/main/java/me/lanzhi/bluestargame/commands/BluestarItemCommand.java
@@ -1,11 +1,9 @@
package me.lanzhi.bluestargame.commands;
-import de.tr7zw.nbtapi.NBTCompound;
-import de.tr7zw.nbtapi.NBTItem;
-import de.tr7zw.nbtapi.NBTReflectionUtil;
-import de.tr7zw.nbtapi.NBTType;
-import me.lanzhi.bluestarapi.api.GradientColor;
-import me.lanzhi.bluestarapi.api.RGBColor;
+import me.lanzhi.api.GradientColor;
+import me.lanzhi.api.RGBColor;
+import me.lanzhi.api.nbt.NBTCompound;
+import me.lanzhi.api.nbt.NBTItem;
import me.lanzhi.bluestargame.BluestarGamePlugin;
import org.bukkit.ChatColor;
import org.bukkit.Material;
@@ -102,7 +100,11 @@ public boolean onCommand(@NotNull CommandSender sender,@NotNull Command command,
{
}
}
- ItemStack itemStack=plugin.getBluestarGameManager().getSuperSpongeManager().getWaterSponge().getItem().clone();
+ ItemStack itemStack=plugin.getBluestarGameManager()
+ .getSuperSpongeManager()
+ .getWaterSponge()
+ .getItem()
+ .clone();
itemStack.setAmount(cnt);
player.getInventory().addItem(itemStack);
player.sendMessage(plugin.getMessageHead()+ChatColor.GREEN+"已为给予您 \"超级海绵\" ×"+cnt);
@@ -121,7 +123,11 @@ public boolean onCommand(@NotNull CommandSender sender,@NotNull Command command,
{
}
}
- ItemStack itemStack=plugin.getBluestarGameManager().getSuperSpongeManager().getlavaSponge().getItem().clone();
+ ItemStack itemStack=plugin.getBluestarGameManager()
+ .getSuperSpongeManager()
+ .getlavaSponge()
+ .getItem()
+ .clone();
itemStack.setAmount(cnt);
player.getInventory().addItem(itemStack);
player.sendMessage(plugin.getMessageHead()+ChatColor.GREEN+"已为给予您 \"岩浆海绵\" ×"+cnt);
@@ -140,7 +146,11 @@ public boolean onCommand(@NotNull CommandSender sender,@NotNull Command command,
{
}
}
- ItemStack itemStack=plugin.getBluestarGameManager().getSuperSpongeManager().getUsedWaterSponge().getItem().clone();
+ ItemStack itemStack=plugin.getBluestarGameManager()
+ .getSuperSpongeManager()
+ .getUsedWaterSponge()
+ .getItem()
+ .clone();
itemStack.setAmount(cnt);
player.getInventory().addItem(setLore(itemStack));
player.sendMessage(plugin.getMessageHead()+ChatColor.GREEN+"已为给予您 \"湿超级海绵\" ×"+cnt);
@@ -159,7 +169,11 @@ public boolean onCommand(@NotNull CommandSender sender,@NotNull Command command,
{
}
}
- ItemStack itemStack=plugin.getBluestarGameManager().getSuperSpongeManager().getUsedLavaSponge().getItem().clone();
+ ItemStack itemStack=plugin.getBluestarGameManager()
+ .getSuperSpongeManager()
+ .getUsedLavaSponge()
+ .getItem()
+ .clone();
itemStack.setAmount(cnt);
player.getInventory().addItem(itemStack);
player.sendMessage(plugin.getMessageHead()+ChatColor.GREEN+"已为给予您 \"湿岩浆海绵\" ×"+cnt);
@@ -356,7 +370,9 @@ public boolean onCommand(@NotNull CommandSender sender,@NotNull Command command,
}
else
{
- NBTCompound nbtCompound=item.addCompound("BluestarGame").addCompound(mod.name()).addCompound(type.getName());
+ NBTCompound nbtCompound=item.addCompound("BluestarGame")
+ .addCompound(mod.name())
+ .addCompound(type.getName());
nbtCompound.setInteger("s",l);
nbtCompound.setInteger("time",time*20);
}
@@ -557,8 +573,9 @@ private ItemStack setLore(ItemStack itemStack)
for (String j: compound.getKeys())
{
lore.add(ChatColor.GRAY+effectLang.getString(j.toLowerCase(),
- j.toLowerCase())+" "+compound.addCompound(j).getInteger(
- "s")+" 时间: "+(compound.addCompound(j).getInteger("time")/20));
+ j.toLowerCase())+" "+compound.addCompound(j)
+ .getInteger("s")+" 时间: "+(compound.addCompound(
+ j).getInteger("time")/20));
}
}
}
@@ -627,7 +644,8 @@ private List getNBT(Object object,String prefix)
case NBTTagDouble -> o=compound.getDouble(s);
case NBTTagByteArray -> o=compound.getByteArray(s);
case NBTTagString -> o=compound.getString(s);
- case NBTTagList -> {
+ case NBTTagList ->
+ {
switch (compound.getListType(s))
{
case NBTTagCompound -> o=compound.getCompoundList(s);
@@ -657,11 +675,12 @@ private List getNBT(Object object,String prefix)
}
return Collections.singletonList(prefix+object);
}
+
private String getToString(Object object)
{
if (object instanceof Object[])
{
- return Arrays.toString((Object[])object);
+ return Arrays.toString((Object[]) object);
}
return object.toString();
}
diff --git a/src/main/java/me/lanzhi/bluestargame/commands/ElevatorCommand.java b/src/main/java/me/lanzhi/bluestargame/commands/ElevatorCommand.java
index d962490..45819d9 100644
--- a/src/main/java/me/lanzhi/bluestargame/commands/ElevatorCommand.java
+++ b/src/main/java/me/lanzhi/bluestargame/commands/ElevatorCommand.java
@@ -47,7 +47,13 @@ public boolean onCommand(@NotNull CommandSender sender,@NotNull Command command,
Elevator elevator;
try
{
- elevator=new Elevator(((Player) sender).getLocation().getWorld(),Integer.parseInt(args[2]),Integer.parseInt(args[3]),Integer.parseInt(args[4]),Integer.parseInt(args[5]),Integer.parseInt(args[6]),Integer.parseInt(args[7]));
+ elevator=new Elevator(((Player) sender).getLocation().getWorld(),
+ Integer.parseInt(args[2]),
+ Integer.parseInt(args[3]),
+ Integer.parseInt(args[4]),
+ Integer.parseInt(args[5]),
+ Integer.parseInt(args[6]),
+ Integer.parseInt(args[7]));
}
catch (NumberFormatException e)
{
@@ -101,7 +107,7 @@ public List onTabComplete(@NotNull CommandSender sender,@NotNull Command
{
if (args.length==2)
{
- return Arrays.asList("电梯名称");
+ return List.of("电梯名称");
}
if (args.length==3)
{
diff --git a/src/main/java/me/lanzhi/bluestargame/commands/MutedCommand.java b/src/main/java/me/lanzhi/bluestargame/commands/MutedCommand.java
index 538b868..98e7481 100644
--- a/src/main/java/me/lanzhi/bluestargame/commands/MutedCommand.java
+++ b/src/main/java/me/lanzhi/bluestargame/commands/MutedCommand.java
@@ -59,7 +59,8 @@ public boolean onCommand(CommandSender sender,Command command,String label,Strin
}
if (mutedtime==null||mutedtime.after(date))
{
- sender.sendMessage("玩家: "+Bukkit.getOfflinePlayer(UUID.fromString(i)).getName()+" 截止日期:"+(mutedtime==null?"永远":time));
+ sender.sendMessage("玩家: "+Bukkit.getOfflinePlayer(UUID.fromString(i))
+ .getName()+" 截止日期:"+(mutedtime==null?"永远":time));
}
else
{
diff --git a/src/main/java/me/lanzhi/bluestargame/commands/XiaoMoBankCommand.java b/src/main/java/me/lanzhi/bluestargame/commands/XiaoMoBankCommand.java
index eaa643b..6939bb3 100644
--- a/src/main/java/me/lanzhi/bluestargame/commands/XiaoMoBankCommand.java
+++ b/src/main/java/me/lanzhi/bluestargame/commands/XiaoMoBankCommand.java
@@ -74,12 +74,11 @@ public XiaoMoBankCommand(BluestarGamePlugin plugin)
@Override
public boolean onCommand(@NotNull CommandSender sender,@NotNull Command command,@NotNull String label,@NotNull String[] args)
{
- if (!(sender instanceof Player))
+ if (!(sender instanceof Player player))
{
sender.sendMessage("此指令仅允许玩家输入");
return true;
}
- Player player=(Player) sender;
if (args.length<1)
{
sender.sendMessage(" ");
@@ -94,7 +93,9 @@ public boolean onCommand(@NotNull CommandSender sender,@NotNull Command command,
sender.sendMessage(plugin.getMessageHead()+"---------------------");
sender.sendMessage(plugin.getMessageHead());
sender.sendMessage(plugin.getMessageHead());
- sender.sendMessage(plugin.getMessageHead()+"你拥有的钱: "+plugin.getNumberFormat().format(plugin.getEcon().getBalance(player)));
+ sender.sendMessage(plugin.getMessageHead()+"你拥有的钱: "+plugin.getNumberFormat()
+ .format(plugin.getEcon()
+ .getBalance(player)));
sender.sendMessage(plugin.getMessageHead()+"小末银行的业务:");
sender.sendMessage(plugin.getMessageHead());
sender.spigot().sendMessage(saveGui);
@@ -131,7 +132,9 @@ public boolean onCommand(@NotNull CommandSender sender,@NotNull Command command,
}
if (plugin.getData().getLong("bank.borrow."+player.getUniqueId()+".money")!=0)
{
- sender.sendMessage(plugin.getMessageHead()+ChatColor.RED+"您似乎有一笔金额为"+plugin.getData().getLong("bank.borrow."+player.getUniqueId()+".money")+"的贷款还未偿还,请向偿还再尝试贷款");
+ sender.sendMessage(plugin.getMessageHead()+ChatColor.RED+"您似乎有一笔金额为"+plugin.getData()
+ .getLong(
+ "bank.borrow."+player.getUniqueId()+".money")+"的贷款还未偿还,请向偿还再尝试贷款");
return true;
}
if (money>1000000)
@@ -142,7 +145,9 @@ public boolean onCommand(@NotNull CommandSender sender,@NotNull Command command,
plugin.getEcon().depositPlayer(player,money);
plugin.getData().set("bank.borrow."+player.getUniqueId()+".money",money);
Calendar calendar=Calendar.getInstance();
- plugin.getData().set("bank.borrow."+player.getUniqueId()+".time",new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(calendar.getTime()));
+ plugin.getData()
+ .set("bank.borrow."+player.getUniqueId()+".time",
+ new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(calendar.getTime()));
player.chat("/xmbank borrowgui");
break;
}
@@ -161,7 +166,10 @@ public boolean onCommand(@NotNull CommandSender sender,@NotNull Command command,
}
plugin.getEcon().withdrawPlayer(player,repayMoney);
plugin.getData().set("bank.borrow."+player.getUniqueId(),null);
- player.spigot().sendMessage(ChatMessageType.ACTION_BAR,new TextComponent(ChatColor.GREEN+"你成功还款: "+plugin.getNumberFormat().format(repayMoney)));
+ player.spigot()
+ .sendMessage(ChatMessageType.ACTION_BAR,
+ new TextComponent(ChatColor.GREEN+"你成功还款: "+plugin.getNumberFormat()
+ .format(repayMoney)));
player.playSound(player.getLocation(),Sound.ENTITY_PLAYER_LEVELUP,1,1);
break;
}
@@ -184,7 +192,9 @@ public boolean onCommand(@NotNull CommandSender sender,@NotNull Command command,
}
if (plugin.getData().getLong("bank.save."+player.getUniqueId()+".money")!=0)
{
- sender.sendMessage(plugin.getMessageHead()+ChatColor.RED+"您似乎有一笔金额为"+plugin.getData().getLong("bank.save."+player.getUniqueId()+".money")+"的存款还未取出,请向取出再尝试存款");
+ sender.sendMessage(plugin.getMessageHead()+ChatColor.RED+"您似乎有一笔金额为"+plugin.getData()
+ .getLong(
+ "bank.save."+player.getUniqueId()+".money")+"的存款还未取出,请向取出再尝试存款");
return true;
}
if (!plugin.getEcon().has(player,money))
@@ -195,7 +205,9 @@ public boolean onCommand(@NotNull CommandSender sender,@NotNull Command command,
plugin.getEcon().withdrawPlayer(player,money);
plugin.getData().set("bank.save."+player.getUniqueId()+".money",money);
Calendar calendar=Calendar.getInstance();
- plugin.getData().set("bank.save."+player.getUniqueId()+".time",new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(calendar.getTime()));
+ plugin.getData()
+ .set("bank.save."+player.getUniqueId()+".time",
+ new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(calendar.getTime()));
player.chat("/xmbank savegui");
break;
}
@@ -209,7 +221,10 @@ public boolean onCommand(@NotNull CommandSender sender,@NotNull Command command,
double getMoney=bank.getShoutGet(player);
plugin.getEcon().depositPlayer(player,getMoney);
plugin.getData().set("bank.save."+player.getUniqueId(),null);
- player.spigot().sendMessage(ChatMessageType.ACTION_BAR,new TextComponent(ChatColor.GREEN+"你成功取出存款: "+plugin.getNumberFormat().format(getMoney)));
+ player.spigot()
+ .sendMessage(ChatMessageType.ACTION_BAR,
+ new TextComponent(ChatColor.GREEN+"你成功取出存款: "+plugin.getNumberFormat()
+ .format(getMoney)));
player.playSound(player.getLocation(),Sound.ENTITY_PLAYER_LEVELUP,1,1);
break;
}
@@ -220,7 +235,9 @@ public boolean onCommand(@NotNull CommandSender sender,@NotNull Command command,
long money=bank.getBorrow(player);
double repayMoney=bank.getShoutRepay(player);
BaseComponent cmp=new TextComponent(ChatColor.DARK_GRAY+"["+ChatColor.RED+"还款"+ChatColor.DARK_GRAY+"]");
- cmp.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,new Text("您需要还款"+plugin.getNumberFormat().format(repayMoney))));
+ cmp.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,
+ new Text("您需要还款"+plugin.getNumberFormat()
+ .format(repayMoney))));
cmp.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND,"/cmdbag repay&gui"));
BaseComponent repay=new TextComponent(plugin.getMessageHead()+" ");
repay.addExtra(cmp);
@@ -235,7 +252,9 @@ public boolean onCommand(@NotNull CommandSender sender,@NotNull Command command,
sender.sendMessage(plugin.getMessageHead()+ChatColor.RED+" [小末银行]");
sender.sendMessage(plugin.getMessageHead()+"---------------------");
sender.spigot().sendMessage(back);
- sender.sendMessage(plugin.getMessageHead()+"你拥有的钱: "+plugin.getNumberFormat().format(plugin.getEcon().getBalance(player)));
+ sender.sendMessage(plugin.getMessageHead()+"你拥有的钱: "+plugin.getNumberFormat()
+ .format(plugin.getEcon()
+ .getBalance(player)));
sender.sendMessage(plugin.getMessageHead());
sender.sendMessage(plugin.getMessageHead()+"你在银行的贷款: "+money);
sender.sendMessage(plugin.getMessageHead());
@@ -258,7 +277,9 @@ public boolean onCommand(@NotNull CommandSender sender,@NotNull Command command,
sender.sendMessage(plugin.getMessageHead()+ChatColor.RED+" [小末银行]");
sender.sendMessage(plugin.getMessageHead()+"---------------------");
sender.spigot().sendMessage(back);
- sender.sendMessage(plugin.getMessageHead()+"你拥有的钱: "+plugin.getNumberFormat().format(plugin.getEcon().getBalance(player)));
+ sender.sendMessage(plugin.getMessageHead()+"你拥有的钱: "+plugin.getNumberFormat()
+ .format(plugin.getEcon()
+ .getBalance(player)));
sender.sendMessage(plugin.getMessageHead());
sender.sendMessage(plugin.getMessageHead()+"你目前没有贷款(人生赢家)");
sender.sendMessage(plugin.getMessageHead());
@@ -277,7 +298,8 @@ public boolean onCommand(@NotNull CommandSender sender,@NotNull Command command,
long money=bank.getSave(player);
double getMoney=bank.getShoutGet(player);
BaseComponent cmp=new TextComponent(ChatColor.DARK_GRAY+"["+ChatColor.GREEN+"取款"+ChatColor.DARK_GRAY+"]");
- cmp.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,new Text("您将会取出"+plugin.getNumberFormat().format(getMoney))));
+ cmp.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT,
+ new Text("您将会取出"+plugin.getNumberFormat().format(getMoney))));
cmp.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND,"/cmdbag get&gui"));
BaseComponent get=new TextComponent(plugin.getMessageHead()+" ");
get.addExtra(cmp);
@@ -292,7 +314,9 @@ public boolean onCommand(@NotNull CommandSender sender,@NotNull Command command,
sender.sendMessage(plugin.getMessageHead()+ChatColor.RED+" [小末银行]");
sender.sendMessage(plugin.getMessageHead()+"---------------------");
sender.spigot().sendMessage(back);
- sender.sendMessage(plugin.getMessageHead()+"你拥有的钱: "+plugin.getNumberFormat().format(plugin.getEcon().getBalance(player)));
+ sender.sendMessage(plugin.getMessageHead()+"你拥有的钱: "+plugin.getNumberFormat()
+ .format(plugin.getEcon()
+ .getBalance(player)));
sender.sendMessage(plugin.getMessageHead());
sender.sendMessage(plugin.getMessageHead()+"你在银行的存款: "+money);
sender.sendMessage(plugin.getMessageHead());
@@ -315,7 +339,9 @@ public boolean onCommand(@NotNull CommandSender sender,@NotNull Command command,
sender.sendMessage(plugin.getMessageHead()+ChatColor.RED+" [小末银行]");
sender.sendMessage(plugin.getMessageHead()+"---------------------");
sender.spigot().sendMessage(back);
- sender.sendMessage(plugin.getMessageHead()+"你拥有的钱: "+plugin.getNumberFormat().format(plugin.getEcon().getBalance(player)));
+ sender.sendMessage(plugin.getMessageHead()+"你拥有的钱: "+plugin.getNumberFormat()
+ .format(plugin.getEcon()
+ .getBalance(player)));
sender.sendMessage(plugin.getMessageHead());
sender.sendMessage(plugin.getMessageHead()+"你目前没有存款(好穷qwq)");
sender.sendMessage(plugin.getMessageHead());
@@ -343,7 +369,7 @@ public List onTabComplete(@NotNull CommandSender sender,@NotNull Command
}
else if (args.length==2&&("borrow".equals(args[0])||"save".equals(args[0])))
{
- return Arrays.asList("<金额>");
+ return List.of("<金额>");
}
return new ArrayList<>();
}
diff --git a/src/main/java/me/lanzhi/bluestargame/commands/setNickCommand.java b/src/main/java/me/lanzhi/bluestargame/commands/setNickCommand.java
index 57c9fec..2fd6fb8 100644
--- a/src/main/java/me/lanzhi/bluestargame/commands/setNickCommand.java
+++ b/src/main/java/me/lanzhi/bluestargame/commands/setNickCommand.java
@@ -1,8 +1,8 @@
package me.lanzhi.bluestargame.commands;
-import me.lanzhi.bluestarapi.api.GradientColor;
-import me.lanzhi.bluestarapi.api.RGBColor;
-import me.lanzhi.bluestarapi.api.player.input.PlayerChatInput;
+import me.lanzhi.api.GradientColor;
+import me.lanzhi.api.RGBColor;
+import me.lanzhi.api.player.input.PlayerChatInput;
import me.lanzhi.bluestargame.BluestarGamePlugin;
import net.milkbowl.vault.chat.Chat;
import net.milkbowl.vault.economy.Economy;
@@ -19,7 +19,7 @@
import java.util.Collections;
import java.util.List;
-public class setNickCommand implements CommandExecutor, TabExecutor
+public final class setNickCommand implements CommandExecutor, TabExecutor
{
private final BluestarGamePlugin plugin;
private final Chat chat;
@@ -61,8 +61,8 @@ public boolean onCommand(@NotNull CommandSender sender,@NotNull Command command,
player.sendMessage(plugin.getMessageHead()+"请在 聊天中 直接发送昵称,支持颜色");
player.sendMessage(plugin.getMessageHead()+"支持颜色符号:§1&1§2&2§3&3§4&4§5&5§6&6§7&7§8&8§9&9§0&0§a&a§b&b§c&c§d&d§e&e§f&f"+ChatColor.GOLD+",支持RGB:"+RGBColor.setColor(
"#098765")+"#098765"+ChatColor.GOLD+"支持渐变色: #abcdef-654321<"+GradientColor.colorText("abcdef",
- "654321",
- "需要染色的文本")+ChatColor.GOLD+">");
+ "654321",
+ "需要染色的文本")+ChatColor.GOLD+">");
player.sendMessage(plugin.getErrorMessageHead()+"设置昵称将花费1000,在聊天区发送需要的昵称后立即生效,概不退款。再次设置昵称可以覆盖,需要重新付款");
setNickInput.open(player);
@@ -83,8 +83,7 @@ private void setNick(Player player,String nick)
player.sendMessage(plugin.getErrorMessageHead()+"你的钱不足1000");
return;
}
- if (plugin.getEcon()
- .withdrawPlayer(player,1000).type!=EconomyResponse.ResponseType.SUCCESS)
+ if (plugin.getEcon().withdrawPlayer(player,1000).type!=EconomyResponse.ResponseType.SUCCESS)
{
player.sendMessage(plugin.getErrorMessageHead()+"出现错误,请重试,或通知腐竹");
return;
diff --git a/src/main/java/me/lanzhi/bluestargame/listener/ChatColorListener.java b/src/main/java/me/lanzhi/bluestargame/listener/ChatColorListener.java
index 01c101a..d45375f 100644
--- a/src/main/java/me/lanzhi/bluestargame/listener/ChatColorListener.java
+++ b/src/main/java/me/lanzhi/bluestargame/listener/ChatColorListener.java
@@ -1,15 +1,12 @@
package me.lanzhi.bluestargame.listener;
-import me.lanzhi.bluestarapi.api.GradientColor;
-import me.lanzhi.bluestarapi.api.RGBColor;
+import me.lanzhi.api.GradientColor;
import org.bukkit.ChatColor;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.AsyncPlayerChatEvent;
-import java.util.regex.Pattern;
-
public final class ChatColorListener implements Listener
{
@EventHandler(ignoreCancelled=true, priority=EventPriority.LOWEST)
diff --git a/src/main/java/me/lanzhi/bluestargame/listener/CompostListener.java b/src/main/java/me/lanzhi/bluestargame/listener/CompostListener.java
index 1754498..03cc9fd 100644
--- a/src/main/java/me/lanzhi/bluestargame/listener/CompostListener.java
+++ b/src/main/java/me/lanzhi/bluestargame/listener/CompostListener.java
@@ -1,6 +1,6 @@
package me.lanzhi.bluestargame.listener;
-import me.lanzhi.bluestarapi.api.Bluestar;
+import me.lanzhi.api.Bluestar;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.data.Levelled;
diff --git a/src/main/java/me/lanzhi/bluestargame/listener/EasterEggListener.java b/src/main/java/me/lanzhi/bluestargame/listener/EasterEggListener.java
index 83110d6..250ce84 100644
--- a/src/main/java/me/lanzhi/bluestargame/listener/EasterEggListener.java
+++ b/src/main/java/me/lanzhi/bluestargame/listener/EasterEggListener.java
@@ -1,12 +1,12 @@
package me.lanzhi.bluestargame.listener;
import io.papermc.paper.event.player.PlayerNameEntityEvent;
-import me.lanzhi.bluestarapi.api.RGBColor;
+import me.lanzhi.api.RGBColor;
import net.kyori.adventure.text.TextComponent;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
-public class EasterEggListener implements Listener
+public final class EasterEggListener implements Listener
{
@EventHandler(ignoreCancelled=true)
public void onPlayerNameEntity(PlayerNameEntityEvent event)
@@ -15,8 +15,8 @@ public void onPlayerNameEntity(PlayerNameEntityEvent event)
{
if (name.content().toLowerCase().contains("bluestar"))
{
- event.getPlayer().sendMessage(
- RGBColor.random()+"你好!恭喜你发现了一个隐藏的"+RGBColor.random()+"彩"+RGBColor.random()+"蛋!");
+ event.getPlayer()
+ .sendMessage(RGBColor.random()+"你好!恭喜你发现了一个隐藏的"+RGBColor.random()+"彩"+RGBColor.random()+"蛋!");
}
}
}
diff --git a/src/main/java/me/lanzhi/bluestargame/listener/HealthFixListener.java b/src/main/java/me/lanzhi/bluestargame/listener/HealthFixListener.java
index 98b566b..0b8cba1 100644
--- a/src/main/java/me/lanzhi/bluestargame/listener/HealthFixListener.java
+++ b/src/main/java/me/lanzhi/bluestargame/listener/HealthFixListener.java
@@ -1,15 +1,13 @@
package me.lanzhi.bluestargame.listener;
-import me.lanzhi.bluestarapi.api.config.YamlFile;
+import me.lanzhi.api.config.YamlFile;
import me.lanzhi.bluestargame.BluestarGamePlugin;
-import me.lanzhi.bluestargame.managers.RandomEventManger;
import org.bukkit.attribute.Attribute;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
-import org.bukkit.event.player.PlayerLoginEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.scheduler.BukkitRunnable;
@@ -29,7 +27,8 @@ public void onPlayerJoin(PlayerJoinEvent event)
{
Player player=event.getPlayer();
player.setHealthScaled(false);
- YamlFile playerData=YamlFile.loadYamlFile(new File(plugin.getPlayerData(),event.getPlayer().getUniqueId()+".yml"));
+ YamlFile playerData=YamlFile.loadYamlFile(new File(plugin.getPlayerData(),
+ event.getPlayer().getUniqueId()+".yml"));
double health=playerData.getDouble("health");
double maxHealth=playerData.getDouble("maxhealth");
if (maxHealth!=0)
@@ -57,11 +56,13 @@ public void run()
@EventHandler(priority=EventPriority.HIGHEST)
public void onPlayerQuit(PlayerQuitEvent event)
{
- YamlFile playerData=YamlFile.loadYamlFile(new File(plugin.getPlayerData(),event.getPlayer().getUniqueId()+".yml"));
+ YamlFile playerData=YamlFile.loadYamlFile(new File(plugin.getPlayerData(),
+ event.getPlayer().getUniqueId()+".yml"));
double maxhealth=event.getPlayer().getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue();
if (plugin.getBluestarGameManager().getRandomEventManger().oneHealth())
{
- maxhealth=plugin.getBluestarGameManager().getRandomEventManger().oneHealth_playerHealth.get(event.getPlayer());
+ maxhealth=plugin.getBluestarGameManager()
+ .getRandomEventManger().oneHealth_playerHealth.get(event.getPlayer());
}
playerData.set("health",Math.min(event.getPlayer().getHealth(),maxhealth));
playerData.set("maxhealth",maxhealth);
diff --git a/src/main/java/me/lanzhi/bluestargame/listener/arrowListener.java b/src/main/java/me/lanzhi/bluestargame/listener/arrowListener.java
index 35676ee..715dab7 100644
--- a/src/main/java/me/lanzhi/bluestargame/listener/arrowListener.java
+++ b/src/main/java/me/lanzhi/bluestargame/listener/arrowListener.java
@@ -1,7 +1,7 @@
package me.lanzhi.bluestargame.listener;
-import de.tr7zw.nbtapi.NBTCompound;
-import de.tr7zw.nbtapi.NBTItem;
+import me.lanzhi.api.nbt.NBTCompound;
+import me.lanzhi.api.nbt.NBTItem;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.event.EventHandler;
diff --git a/src/main/java/me/lanzhi/bluestargame/listener/breakBedrockListener.java b/src/main/java/me/lanzhi/bluestargame/listener/breakBedrockListener.java
index ce14aeb..a6ac3cd 100644
--- a/src/main/java/me/lanzhi/bluestargame/listener/breakBedrockListener.java
+++ b/src/main/java/me/lanzhi/bluestargame/listener/breakBedrockListener.java
@@ -1,6 +1,6 @@
package me.lanzhi.bluestargame.listener;
-import me.lanzhi.bluestarapi.api.Bluestar;
+import me.lanzhi.api.Bluestar;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.block.Block;
@@ -50,7 +50,7 @@ public void run()
}
};
- @EventHandler(ignoreCancelled=true,priority=EventPriority.MONITOR)
+ @EventHandler(ignoreCancelled=true, priority=EventPriority.MONITOR)
public void onPlayerDamageBlock(BlockDamageEvent event)
{
if (!event.getBlock().getType().equals(Material.BEDROCK))
@@ -61,10 +61,11 @@ public void onPlayerDamageBlock(BlockDamageEvent event)
{
return;
}
- playerList.put(event.getPlayer(),new AbstractMap.SimpleEntry<>(Calendar.getInstance().getTime(),event.getBlock()));
+ playerList.put(event.getPlayer(),
+ new AbstractMap.SimpleEntry<>(Calendar.getInstance().getTime(),event.getBlock()));
}
- @EventHandler(ignoreCancelled=true,priority=EventPriority.MONITOR)
+ @EventHandler(ignoreCancelled=true, priority=EventPriority.MONITOR)
public void onPlayerDamageBlock(BlockDamageAbortEvent event)
{
playerList.remove(event.getPlayer());
diff --git a/src/main/java/me/lanzhi/bluestargame/listener/effectListener.java b/src/main/java/me/lanzhi/bluestargame/listener/effectListener.java
index e7d236c..84f5bc5 100644
--- a/src/main/java/me/lanzhi/bluestargame/listener/effectListener.java
+++ b/src/main/java/me/lanzhi/bluestargame/listener/effectListener.java
@@ -1,9 +1,9 @@
package me.lanzhi.bluestargame.listener;
-import de.tr7zw.nbtapi.NBTCompound;
-import de.tr7zw.nbtapi.NBTEntity;
-import de.tr7zw.nbtapi.NBTItem;
-import me.lanzhi.bluestarapi.api.RGBColor;
+import me.lanzhi.api.RGBColor;
+import me.lanzhi.api.nbt.NBTCompound;
+import me.lanzhi.api.nbt.NBTEntity;
+import me.lanzhi.api.nbt.NBTItem;
import org.bukkit.Bukkit;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
@@ -100,9 +100,9 @@ private void setEffect(Entity entity,ItemStack itemStack,effectEventType type)
NBTCompound effect=new NBTItem(itemStack).addCompound("BluestarGame").addCompound(type.name());
for (String i: effect.getKeys())
{
- ((LivingEntity) entity).addPotionEffect(
- new PotionEffect(PotionEffectType.getByName(i),effect.addCompound(i).getInteger("time"),
- effect.addCompound(i).getInteger("s")));
+ ((LivingEntity) entity).addPotionEffect(new PotionEffect(PotionEffectType.getByName(i),
+ effect.addCompound(i).getInteger("time"),
+ effect.addCompound(i).getInteger("s")));
}
}
diff --git a/src/main/java/me/lanzhi/bluestargame/listener/elevatorListener.java b/src/main/java/me/lanzhi/bluestargame/listener/elevatorListener.java
index 68416ff..d738170 100644
--- a/src/main/java/me/lanzhi/bluestargame/listener/elevatorListener.java
+++ b/src/main/java/me/lanzhi/bluestargame/listener/elevatorListener.java
@@ -14,7 +14,6 @@
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.player.PlayerTeleportEvent;
import org.bukkit.event.player.PlayerToggleSneakEvent;
-import org.jetbrains.annotations.NotNull;
public final class elevatorListener implements Listener
{
@@ -38,7 +37,9 @@ public void onPlayerMove(PlayerMoveEvent event)
if (to!=null)
{
player.teleport(to,PlayerTeleportEvent.TeleportCause.CHORUS_FRUIT);
- event.getPlayer().spigot().sendMessage(ChatMessageType.ACTION_BAR,new TextComponent(ChatColor.GREEN+"UP UPP UPPP!"));
+ event.getPlayer()
+ .spigot()
+ .sendMessage(ChatMessageType.ACTION_BAR,new TextComponent(ChatColor.GREEN+"UP UPP UPPP!"));
event.getPlayer().playSound(event.getPlayer().getLocation(),Sound.ENTITY_PLAYER_LEVELUP,1,1);
}
}
@@ -56,7 +57,9 @@ public void onPlayerSneak(PlayerToggleSneakEvent event)
if (to!=null)
{
player.teleport(to,PlayerTeleportEvent.TeleportCause.CHORUS_FRUIT);
- event.getPlayer().spigot().sendMessage(ChatMessageType.ACTION_BAR,new TextComponent(ChatColor.GREEN+"DOWN DOWWN DOWWWN!"));
+ event.getPlayer()
+ .spigot()
+ .sendMessage(ChatMessageType.ACTION_BAR,new TextComponent(ChatColor.GREEN+"DOWN DOWWN DOWWWN!"));
event.getPlayer().playSound(event.getPlayer().getLocation(),Sound.ENTITY_PLAYER_LEVELUP,1,1);
}
}
@@ -72,8 +75,16 @@ private Location getTeleportLocation(Location loc,long cnt)
locc.setY(y);
Location loccc=loc.clone();
loccc.setY(y-1);
- if ((!locc.getBlock().getType().isSolid()||locc.getBlock().getType().name().endsWith("SIGN"))&&(loccc.getBlock().getType().isSolid()&&!loccc.getBlock().getType().name().endsWith(
- "SIGN")))
+ if ((!locc.getBlock().getType().isSolid()||locc.getBlock()
+ .getType()
+ .name()
+ .endsWith("SIGN"))&&(loccc.getBlock()
+ .getType()
+ .isSolid()&&!loccc.getBlock()
+ .getType()
+ .name()
+ .endsWith(
+ "SIGN")))
{
return locc;
}
diff --git a/src/main/java/me/lanzhi/bluestargame/listener/muteListener.java b/src/main/java/me/lanzhi/bluestargame/listener/muteListener.java
index 1785b5f..c2b5bf8 100644
--- a/src/main/java/me/lanzhi/bluestargame/listener/muteListener.java
+++ b/src/main/java/me/lanzhi/bluestargame/listener/muteListener.java
@@ -28,13 +28,19 @@ public void onChatForMuted(AsyncPlayerChatEvent event)
{
return;
}
- if (plugin.getBluestarGameManager().getMuted().getKeys(false).contains(event.getPlayer().getUniqueId().toString()))
+ if (plugin.getBluestarGameManager()
+ .getMuted()
+ .getKeys(false)
+ .contains(event.getPlayer().getUniqueId().toString()))
{
boolean isMuted=false;
Date muted;
try
{
- muted=plugin.getDateFormat().parse(plugin.getBluestarGameManager().getMuted().getString(event.getPlayer().getUniqueId().toString()));
+ muted=plugin.getDateFormat()
+ .parse(plugin.getBluestarGameManager()
+ .getMuted()
+ .getString(event.getPlayer().getUniqueId().toString()));
}
catch (Throwable e)
{
diff --git a/src/main/java/me/lanzhi/bluestargame/listener/opSwordListener.java b/src/main/java/me/lanzhi/bluestargame/listener/opSwordListener.java
index 95c1e22..eb6da42 100644
--- a/src/main/java/me/lanzhi/bluestargame/listener/opSwordListener.java
+++ b/src/main/java/me/lanzhi/bluestargame/listener/opSwordListener.java
@@ -1,13 +1,16 @@
package me.lanzhi.bluestargame.listener;
-import de.tr7zw.nbtapi.NBTCompound;
-import de.tr7zw.nbtapi.NBTEntity;
-import de.tr7zw.nbtapi.NBTItem;
+import me.lanzhi.api.nbt.NBTCompound;
+import me.lanzhi.api.nbt.NBTEntity;
+import me.lanzhi.api.nbt.NBTItem;
import me.lanzhi.bluestargame.BluestarGamePlugin;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.attribute.Attribute;
-import org.bukkit.entity.*;
+import org.bukkit.entity.Damageable;
+import org.bukkit.entity.LivingEntity;
+import org.bukkit.entity.Player;
+import org.bukkit.entity.Projectile;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
@@ -29,11 +32,10 @@ public opSwordListener(BluestarGamePlugin plugin)
@EventHandler(priority=EventPriority.HIGHEST)
public void onPlayerDamage(EntityDamageEvent event)
{
- if (!(event.getEntity() instanceof LivingEntity)||event.isCancelled())
+ if (!(event.getEntity() instanceof LivingEntity entity)||event.isCancelled())
{
return;
}
- LivingEntity entity=(LivingEntity) event.getEntity();
if (entity.getEquipment()==null)
{
return;
@@ -69,9 +71,8 @@ public void onPlayerDamage(EntityDamageEvent event)
catch (Throwable e)
{
}
- if (event instanceof EntityDamageByEntityEvent)
+ if (event instanceof EntityDamageByEntityEvent event1)
{
- EntityDamageByEntityEvent event1=(EntityDamageByEntityEvent) event;
if (event1.getDamager() instanceof Damageable)
{
((Damageable) event1.getDamager()).damage(Integer.MAX_VALUE,entity);
@@ -79,17 +80,18 @@ public void onPlayerDamage(EntityDamageEvent event)
}
if (event1.getDamager() instanceof Projectile)
{
- ((Damageable) Bukkit.getEntity(new NBTEntity(event1.getDamager()).getUUID("Owner"))).damage(Integer.MAX_VALUE,entity);
+ ((Damageable) Bukkit.getEntity(new NBTEntity(event1.getDamager()).getUUID("Owner"))).damage(Integer.MAX_VALUE,
+ entity);
return;
}
- System.out.println(event1.getDamager().getType().toString());
+ System.out.println(event1.getDamager().getType());
}
}
@EventHandler(priority=EventPriority.HIGHEST)
public void onEntityDamageByPlayer(EntityDamageByEntityEvent event)
{
- if (!(event.getDamager() instanceof LivingEntity))
+ if (!(event.getDamager() instanceof LivingEntity entity))
{
return;
}
@@ -97,7 +99,6 @@ public void onEntityDamageByPlayer(EntityDamageByEntityEvent event)
{
return;
}
- LivingEntity entity=(LivingEntity) event.getDamager();
if (entity.getEquipment()==null)
{
return;
diff --git a/src/main/java/me/lanzhi/bluestargame/listener/randoms/moreMineralListener.java b/src/main/java/me/lanzhi/bluestargame/listener/randoms/moreMineralListener.java
index ccf346b..e33b91f 100644
--- a/src/main/java/me/lanzhi/bluestargame/listener/randoms/moreMineralListener.java
+++ b/src/main/java/me/lanzhi/bluestargame/listener/randoms/moreMineralListener.java
@@ -21,12 +21,13 @@ public moreMineralListener(BluestarGamePlugin plugin)
this.randomEventManger=plugin.getBluestarGameManager().getRandomEventManger();
}
- @EventHandler(ignoreCancelled=true,priority=EventPriority.MONITOR)
+ @EventHandler(ignoreCancelled=true, priority=EventPriority.MONITOR)
public void onBlockDropItem(BlockDropItemEvent event)
{
if (randomEventManger.morediamond())
{
- if ((event.getBlockState().getType()!=Material.DIAMOND_ORE)&&(event.getBlockState().getType()!=Material.DEEPSLATE_DIAMOND_ORE))
+ if ((event.getBlockState().getType()!=Material.DIAMOND_ORE)&&(event.getBlockState()
+ .getType()!=Material.DEEPSLATE_DIAMOND_ORE))
{
return;
}
@@ -48,7 +49,8 @@ public void onBlockDropItem(BlockDropItemEvent event)
}
if (randomEventManger.morecoal())
{
- if ((event.getBlockState().getType()!=Material.COAL_ORE)&&(event.getBlockState().getType()!=Material.DEEPSLATE_COAL_ORE))
+ if ((event.getBlockState().getType()!=Material.COAL_ORE)&&(event.getBlockState()
+ .getType()!=Material.DEEPSLATE_COAL_ORE))
{
return;
}
@@ -70,7 +72,8 @@ public void onBlockDropItem(BlockDropItemEvent event)
}
if (randomEventManger.moreredstone())
{
- if ((event.getBlockState().getType()!=Material.REDSTONE_ORE)&&(event.getBlockState().getType()!=Material.DEEPSLATE_REDSTONE_ORE))
+ if ((event.getBlockState().getType()!=Material.REDSTONE_ORE)&&(event.getBlockState()
+ .getType()!=Material.DEEPSLATE_REDSTONE_ORE))
{
return;
}
@@ -92,7 +95,8 @@ public void onBlockDropItem(BlockDropItemEvent event)
}
if (randomEventManger.morecopper())
{
- if ((event.getBlockState().getType()!=Material.COPPER_ORE)&&(event.getBlockState().getType()!=Material.DEEPSLATE_COPPER_ORE))
+ if ((event.getBlockState().getType()!=Material.COPPER_ORE)&&(event.getBlockState()
+ .getType()!=Material.DEEPSLATE_COPPER_ORE))
{
return;
}
@@ -114,7 +118,8 @@ public void onBlockDropItem(BlockDropItemEvent event)
}
if (randomEventManger.moregold())
{
- if ((event.getBlockState().getType()!=Material.GOLD_ORE)&&(event.getBlockState().getType()!=Material.DEEPSLATE_GOLD_ORE))
+ if ((event.getBlockState().getType()!=Material.GOLD_ORE)&&(event.getBlockState()
+ .getType()!=Material.DEEPSLATE_GOLD_ORE))
{
return;
}
@@ -136,7 +141,8 @@ public void onBlockDropItem(BlockDropItemEvent event)
}
if (randomEventManger.moreemerald())
{
- if ((event.getBlockState().getType()!=Material.EMERALD_ORE)&&(event.getBlockState().getType()!=Material.DEEPSLATE_EMERALD_ORE))
+ if ((event.getBlockState().getType()!=Material.EMERALD_ORE)&&(event.getBlockState()
+ .getType()!=Material.DEEPSLATE_EMERALD_ORE))
{
return;
}
@@ -158,7 +164,8 @@ public void onBlockDropItem(BlockDropItemEvent event)
}
if (randomEventManger.morelapis())
{
- if ((event.getBlockState().getType()!=Material.LAPIS_ORE)&&(event.getBlockState().getType()!=Material.DEEPSLATE_LAPIS_ORE))
+ if ((event.getBlockState().getType()!=Material.LAPIS_ORE)&&(event.getBlockState()
+ .getType()!=Material.DEEPSLATE_LAPIS_ORE))
{
return;
}
@@ -180,7 +187,8 @@ public void onBlockDropItem(BlockDropItemEvent event)
}
if (randomEventManger.moreiron())
{
- if ((event.getBlockState().getType()!=Material.IRON_ORE)&&(event.getBlockState().getType()!=Material.DEEPSLATE_IRON_ORE))
+ if ((event.getBlockState().getType()!=Material.IRON_ORE)&&(event.getBlockState()
+ .getType()!=Material.DEEPSLATE_IRON_ORE))
{
return;
}
diff --git a/src/main/java/me/lanzhi/bluestargame/listener/randoms/oneHealthListener.java b/src/main/java/me/lanzhi/bluestargame/listener/randoms/oneHealthListener.java
index 23c05f9..a3f9ab2 100644
--- a/src/main/java/me/lanzhi/bluestargame/listener/randoms/oneHealthListener.java
+++ b/src/main/java/me/lanzhi/bluestargame/listener/randoms/oneHealthListener.java
@@ -1,6 +1,6 @@
package me.lanzhi.bluestargame.listener.randoms;
-import me.lanzhi.bluestarapi.api.config.YamlFile;
+import me.lanzhi.api.config.YamlFile;
import me.lanzhi.bluestargame.BluestarGamePlugin;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
@@ -25,8 +25,10 @@ public void onPlayerJoin(PlayerJoinEvent event)
{
return;
}
- double maxHealth=YamlFile.loadYamlFile(new File(plugin.getPlayerData(),event.getPlayer().getUniqueId()+".yml")).getDouble("maxhealth");
- plugin.getBluestarGameManager().getRandomEventManger().oneHealth_playerHealth.put(event.getPlayer(),maxHealth!=0?maxHealth:20);
+ double maxHealth=YamlFile.loadYamlFile(new File(plugin.getPlayerData(),event.getPlayer().getUniqueId()+".yml"))
+ .getDouble("maxhealth");
+ plugin.getBluestarGameManager().getRandomEventManger().oneHealth_playerHealth.put(event.getPlayer(),
+ maxHealth!=0?maxHealth:20);
}
@EventHandler
diff --git a/src/main/java/me/lanzhi/bluestargame/listener/randoms/randChatColorListener.java b/src/main/java/me/lanzhi/bluestargame/listener/randoms/randChatColorListener.java
index 23fbf88..47e915a 100644
--- a/src/main/java/me/lanzhi/bluestargame/listener/randoms/randChatColorListener.java
+++ b/src/main/java/me/lanzhi/bluestargame/listener/randoms/randChatColorListener.java
@@ -1,20 +1,17 @@
package me.lanzhi.bluestargame.listener.randoms;
-import me.lanzhi.bluestarapi.api.GradientColor;
-import me.lanzhi.bluestarapi.api.RGBColor;
+import me.lanzhi.api.GradientColor;
+import me.lanzhi.api.RGBColor;
import me.lanzhi.bluestargame.BluestarGamePlugin;
import me.lanzhi.bluestargame.managers.RandomEventManger;
import org.bukkit.ChatColor;
import org.bukkit.event.EventHandler;
-import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.AsyncPlayerChatEvent;
-import java.util.concurrent.ThreadLocalRandom;
-
public final class randChatColorListener implements Listener
{
- private RandomEventManger randomEventManger;
+ private final RandomEventManger randomEventManger;
public randChatColorListener(BluestarGamePlugin plugin)
{
diff --git a/src/main/java/me/lanzhi/bluestargame/listener/randoms/randDamageListener.java b/src/main/java/me/lanzhi/bluestargame/listener/randoms/randDamageListener.java
index f997ae0..572b772 100644
--- a/src/main/java/me/lanzhi/bluestargame/listener/randoms/randDamageListener.java
+++ b/src/main/java/me/lanzhi/bluestargame/listener/randoms/randDamageListener.java
@@ -25,7 +25,7 @@ public randDamageListener(BluestarGamePlugin plugin)
randomEventManger=plugin.getBluestarGameManager().getRandomEventManger();
}
- @EventHandler(ignoreCancelled=true,priority=EventPriority.HIGHEST)
+ @EventHandler(ignoreCancelled=true, priority=EventPriority.HIGHEST)
synchronized public void onEntityDamage(EntityDamageEvent event)
{
if (event.equals(lastEvent))
@@ -49,7 +49,9 @@ synchronized public void onEntityDamage(EntityDamageEvent event)
else if (entity instanceof Damageable)
{
event.setCancelled(true);
- ((Damageable) entity).setHealth(Double.min(((Damageable) entity).getHealth()-hurt,((Attributable) entity).getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue()));
+ ((Damageable) entity).setHealth(Double.min(((Damageable) entity).getHealth()-hurt,
+ ((Attributable) entity).getAttribute(Attribute.GENERIC_MAX_HEALTH)
+ .getValue()));
}
else
{
diff --git a/src/main/java/me/lanzhi/bluestargame/listener/randoms/the24PointListener.java b/src/main/java/me/lanzhi/bluestargame/listener/randoms/the24PointListener.java
index e6fe6b4..3a3c973 100644
--- a/src/main/java/me/lanzhi/bluestargame/listener/randoms/the24PointListener.java
+++ b/src/main/java/me/lanzhi/bluestargame/listener/randoms/the24PointListener.java
@@ -35,12 +35,14 @@ public void run()
{
if (decide(event.getMessage()))
{
- org.bukkit.Bukkit.getServer().broadcastMessage(
- plugin.getMessageHead()+ChatColor.YELLOW+event.getPlayer().getName()+"答案正确!");
- org.bukkit.Bukkit.getServer().broadcastMessage(plugin.getMessageHead()+ChatColor.YELLOW+"获得1000!");
- me.lanzhi.bluestarapi.api.Bluestar.useCommand(org.bukkit.Bukkit.getConsoleSender(),
- "eco give "+event.getPlayer().getName()+" 1000",
- plugin);
+ org.bukkit.Bukkit.getServer()
+ .broadcastMessage(plugin.getMessageHead()+ChatColor.YELLOW+event.getPlayer()
+ .getName()+"答案正确!");
+ org.bukkit.Bukkit.getServer()
+ .broadcastMessage(plugin.getMessageHead()+ChatColor.YELLOW+"获得1000!");
+ me.lanzhi.api.Bluestar.useCommand(org.bukkit.Bukkit.getConsoleSender(),
+ "eco give "+event.getPlayer().getName()+" 1000",
+ plugin);
randomEventManger.the24(false);
}
}
@@ -60,22 +62,21 @@ public void run()
UUID uuid=MiraiMC.getBind(event.getSenderId());
if (uuid==null||"".equals(uuid))
{
- event.getGroup().sendMessageMirai(
- "[mirai:at:"+event.getSenderId()+"] 您可能在参与24点,且答案正确,但您还未绑定Minecraft账号,请绑定");
- org.bukkit.Bukkit.getServer().broadcastMessage(
- plugin.getMessageHead()+ChatColor.YELLOW+event.getSenderName()+"答案正确!");
+ event.getGroup()
+ .sendMessageMirai("[mirai:at:"+event.getSenderId()+"] 您可能在参与24点,且答案正确,但您还未绑定Minecraft账号,请绑定");
+ org.bukkit.Bukkit.getServer()
+ .broadcastMessage(plugin.getMessageHead()+ChatColor.YELLOW+event.getSenderName()+"答案正确!");
}
else
{
- org.bukkit.Bukkit.getServer().broadcastMessage(
- plugin.getMessageHead()+ChatColor.YELLOW+Bukkit.getOfflinePlayer(
- uuid).getName()+"答案正确!");
- org.bukkit.Bukkit.getServer().broadcastMessage(
- plugin.getMessageHead()+ChatColor.YELLOW+"获得1000!");
- me.lanzhi.bluestarapi.api.Bluestar.useCommand(org.bukkit.Bukkit.getConsoleSender(),
- "eco give "+Bukkit.getOfflinePlayer(
- uuid).getName()+" 1000",
- plugin);
+ org.bukkit.Bukkit.getServer()
+ .broadcastMessage(plugin.getMessageHead()+ChatColor.YELLOW+Bukkit.getOfflinePlayer(
+ uuid).getName()+"答案正确!");
+ org.bukkit.Bukkit.getServer()
+ .broadcastMessage(plugin.getMessageHead()+ChatColor.YELLOW+"获得1000!");
+ me.lanzhi.api.Bluestar.useCommand(org.bukkit.Bukkit.getConsoleSender(),
+ "eco give "+Bukkit.getOfflinePlayer(uuid).getName()+" 1000",
+ plugin);
}
randomEventManger.the24(false);
}
diff --git a/src/main/java/me/lanzhi/bluestargame/listener/superSpongeListener.java b/src/main/java/me/lanzhi/bluestargame/listener/superSpongeListener.java
index 9b1734b..9d123cb 100644
--- a/src/main/java/me/lanzhi/bluestargame/listener/superSpongeListener.java
+++ b/src/main/java/me/lanzhi/bluestargame/listener/superSpongeListener.java
@@ -1,7 +1,7 @@
package me.lanzhi.bluestargame.listener;
-import de.tr7zw.nbtapi.NBTCompound;
-import de.tr7zw.nbtapi.NBTItem;
+import me.lanzhi.api.nbt.NBTCompound;
+import me.lanzhi.api.nbt.NBTItem;
import me.lanzhi.bluestargame.BluestarGamePlugin;
import me.lanzhi.bluestargame.Type.SuperSponge;
import org.bukkit.event.EventHandler;
@@ -41,14 +41,24 @@ public void onPlayerPlaceBlock(BlockPlaceEvent event)
{
return;
}
- plugin.getBluestarGameManager().getSuperSpongeManager().add(new SuperSponge(plugin.getConfig().getInt("spongeR"),event.getBlock().getLocation(),event.getPlayer().getName(),bluestar.getInteger("lavaSponge")==1,bluestar.getInteger("waterSponge")==1));
+ plugin.getBluestarGameManager()
+ .getSuperSpongeManager()
+ .add(new SuperSponge(plugin.getConfig().getInt("spongeR"),
+ event.getBlock().getLocation(),
+ event.getPlayer().getName(),
+ bluestar.getInteger("lavaSponge")==1,
+ bluestar.getInteger("waterSponge")==1));
if (bluestar.getInteger("lavaSponge")==1)
{
- event.getPlayer().getInventory().addItem(plugin.getBluestarGameManager().getSuperSpongeManager().getUsedLavaSponge().getItem());
+ event.getPlayer()
+ .getInventory()
+ .addItem(plugin.getBluestarGameManager().getSuperSpongeManager().getUsedLavaSponge().getItem());
}
else
{
- event.getPlayer().getInventory().addItem(plugin.getBluestarGameManager().getSuperSpongeManager().getUsedWaterSponge().getItem());
+ event.getPlayer()
+ .getInventory()
+ .addItem(plugin.getBluestarGameManager().getSuperSpongeManager().getUsedWaterSponge().getItem());
}
}
}
diff --git a/src/main/java/me/lanzhi/bluestargame/managers/BluestarGameManager.java b/src/main/java/me/lanzhi/bluestargame/managers/BluestarGameManager.java
index 83a08c7..08e76fb 100644
--- a/src/main/java/me/lanzhi/bluestargame/managers/BluestarGameManager.java
+++ b/src/main/java/me/lanzhi/bluestargame/managers/BluestarGameManager.java
@@ -1,7 +1,7 @@
package me.lanzhi.bluestargame.managers;
-import de.tr7zw.nbtapi.NBTCompound;
-import de.tr7zw.nbtapi.NBTItem;
+import me.lanzhi.api.nbt.NBTCompound;
+import me.lanzhi.api.nbt.NBTItem;
import me.lanzhi.bluestargame.BluestarGamePlugin;
import me.lanzhi.bluestargame.Type.Elevator;
import me.lanzhi.bluestargame.api.BluestarGameApi;
@@ -18,7 +18,6 @@
import org.bukkit.scheduler.BukkitTask;
import org.jetbrains.annotations.Nullable;
-import java.util.ArrayList;
import java.util.Set;
public final class BluestarGameManager implements BluestarGameManagerInterface
@@ -73,7 +72,8 @@ public Elevator getElevator(Location loc)
{
continue;
}
- if (elevator.getWorld().equals(loc.getWorld())&&elevator.getMaxX()>=loc.getBlockX()&&elevator.getMinX()<=loc.getBlockX()&&elevator.getMaxZ()>=loc.getBlockZ()&&elevator.getMinZ()<=loc.getBlockZ()&&elevator.getMaxY()>=loc.getBlockY()&&elevator.getMinY()<=loc.getBlockY())
+ if (elevator.getWorld()
+ .equals(loc.getWorld())&&elevator.getMaxX()>=loc.getBlockX()&&elevator.getMinX()<=loc.getBlockX()&&elevator.getMaxZ()>=loc.getBlockZ()&&elevator.getMinZ()<=loc.getBlockZ()&&elevator.getMaxY()>=loc.getBlockY()&&elevator.getMinY()<=loc.getBlockY())
{
return elevator;
}
@@ -116,7 +116,7 @@ private static void set(Player player,ItemStack itemStack)
}
NBTItem item=new NBTItem(itemStack);
NBTCompound compound=item.addCompound("BluestarGame").addCompound("effect");
- for (String i:compound.getKeys())
+ for (String i: compound.getKeys())
{
PotionEffectType type=PotionEffectType.getByName(i);
if (type==null)
@@ -135,7 +135,7 @@ public void run()
PlayerInventory inventory=player.getInventory();
set(player,inventory.getItemInMainHand());
set(player,inventory.getItemInOffHand());
- for (ItemStack itemStack:inventory.getArmorContents())
+ for (ItemStack itemStack: inventory.getArmorContents())
{
set(player,itemStack);
}
diff --git a/src/main/java/me/lanzhi/bluestargame/managers/RandomEventManger.java b/src/main/java/me/lanzhi/bluestargame/managers/RandomEventManger.java
index bd4851b..40760f6 100644
--- a/src/main/java/me/lanzhi/bluestargame/managers/RandomEventManger.java
+++ b/src/main/java/me/lanzhi/bluestargame/managers/RandomEventManger.java
@@ -438,7 +438,7 @@ public void oneHealth(boolean b)
plugin.getData().set("oneHealth",b);
if (b)
{
- for (Player player:Bukkit.getOnlinePlayers())
+ for (Player player: Bukkit.getOnlinePlayers())
{
oneHealth_playerHealth.put(player,player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getBaseValue());
player.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(1);
@@ -448,7 +448,7 @@ public void oneHealth(boolean b)
@Override
public void run()
{
- for (Player player:oneHealth_playerHealth.keySet())
+ for (Player player: oneHealth_playerHealth.keySet())
{
player.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(1);
}
@@ -460,7 +460,7 @@ public void run()
else
{
oneHealthTask.cancel();
- for (Map.Entry i:oneHealth_playerHealth.entrySet())
+ for (Map.Entry i: oneHealth_playerHealth.entrySet())
{
i.getKey().getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(i.getValue());
}
diff --git a/src/main/java/me/lanzhi/bluestargame/managers/RandomEventsChange.java b/src/main/java/me/lanzhi/bluestargame/managers/RandomEventsChange.java
index b8becbc..40fa595 100644
--- a/src/main/java/me/lanzhi/bluestargame/managers/RandomEventsChange.java
+++ b/src/main/java/me/lanzhi/bluestargame/managers/RandomEventsChange.java
@@ -1,6 +1,6 @@
package me.lanzhi.bluestargame.managers;
-import me.lanzhi.bluestarapi.api.Bluestar;
+import me.lanzhi.api.Bluestar;
import me.lanzhi.bluestargame.BluestarGamePlugin;
import org.bukkit.Bukkit;
import org.bukkit.scheduler.BukkitRunnable;
@@ -36,19 +36,22 @@ public void run()
if (Bukkit.getServer().getOnlinePlayers().size()<=0&&on!=4)
{
randomEventManger.randomEvents=new RandomEventsChange(plugin,on);
- randomEventManger.randomEventChangeTask=randomEventManger.randomEvents.runTaskLaterAsynchronously(plugin,12000);
+ randomEventManger.randomEventChangeTask=randomEventManger.randomEvents.runTaskLaterAsynchronously(plugin,
+ 12000);
return;
}
this.change(true);
randomEventManger.randomEvents=new RandomEventsChange(plugin,on);
- randomEventManger.randomEventChangeTask=randomEventManger.randomEvents.runTaskLaterAsynchronously(plugin,12000);
+ randomEventManger.randomEventChangeTask=randomEventManger.randomEvents.runTaskLaterAsynchronously(plugin,
+ 12000);
}
else
{
this.change(false);
on=0;
randomEventManger.randomEvents=new RandomEventsChange(plugin,on);
- randomEventManger.randomEventChangeTask=randomEventManger.randomEvents.runTaskLaterAsynchronously(plugin,24000);
+ randomEventManger.randomEventChangeTask=randomEventManger.randomEvents.runTaskLaterAsynchronously(plugin,
+ 24000);
}
}
@@ -77,7 +80,9 @@ public synchronized void change(boolean b)
case 11 -> randomEventManger.moreiron(b);
case 12 -> randomEventManger.moreredstone(b);
case 13 -> randomEventManger.oneHealth(b);
- default -> {}
+ default ->
+ {
+ }
}
}
diff --git a/src/main/java/me/lanzhi/bluestargame/managers/SuperSpongeManager.java b/src/main/java/me/lanzhi/bluestargame/managers/SuperSpongeManager.java
index e7bd82e..a1fee1b 100644
--- a/src/main/java/me/lanzhi/bluestargame/managers/SuperSpongeManager.java
+++ b/src/main/java/me/lanzhi/bluestargame/managers/SuperSpongeManager.java
@@ -1,8 +1,8 @@
package me.lanzhi.bluestargame.managers;
-import de.tr7zw.nbtapi.NBTCompound;
-import de.tr7zw.nbtapi.NBTItem;
-import me.lanzhi.bluestarapi.api.Bluestar;
+import me.lanzhi.api.Bluestar;
+import me.lanzhi.api.nbt.NBTCompound;
+import me.lanzhi.api.nbt.NBTItem;
import me.lanzhi.bluestargame.BluestarGamePlugin;
import me.lanzhi.bluestargame.Type.SuperSponge;
import me.lanzhi.bluestargameapi.managers.SuperSpongeManagerInterface;
@@ -40,12 +40,36 @@ public void run()
boolean islava=sponge.getIslava();
if (age>1)
{
- decide(new Location(loc.getWorld(),loc.getX()+1.0D,loc.getY(),loc.getZ()),age,sponge.getPlayer(),iswater,islava);
- decide(new Location(loc.getWorld(),loc.getX()-1.0D,loc.getY(),loc.getZ()),age,sponge.getPlayer(),iswater,islava);
- decide(new Location(loc.getWorld(),loc.getX(),loc.getY()+1.0D,loc.getZ()),age,sponge.getPlayer(),iswater,islava);
- decide(new Location(loc.getWorld(),loc.getX(),loc.getY()-1.0D,loc.getZ()),age,sponge.getPlayer(),iswater,islava);
- decide(new Location(loc.getWorld(),loc.getX(),loc.getY(),loc.getZ()+1.0D),age,sponge.getPlayer(),iswater,islava);
- decide(new Location(loc.getWorld(),loc.getX(),loc.getY(),loc.getZ()-1.0D),age,sponge.getPlayer(),iswater,islava);
+ decide(new Location(loc.getWorld(),loc.getX()+1.0D,loc.getY(),loc.getZ()),
+ age,
+ sponge.getPlayer(),
+ iswater,
+ islava);
+ decide(new Location(loc.getWorld(),loc.getX()-1.0D,loc.getY(),loc.getZ()),
+ age,
+ sponge.getPlayer(),
+ iswater,
+ islava);
+ decide(new Location(loc.getWorld(),loc.getX(),loc.getY()+1.0D,loc.getZ()),
+ age,
+ sponge.getPlayer(),
+ iswater,
+ islava);
+ decide(new Location(loc.getWorld(),loc.getX(),loc.getY()-1.0D,loc.getZ()),
+ age,
+ sponge.getPlayer(),
+ iswater,
+ islava);
+ decide(new Location(loc.getWorld(),loc.getX(),loc.getY(),loc.getZ()+1.0D),
+ age,
+ sponge.getPlayer(),
+ iswater,
+ islava);
+ decide(new Location(loc.getWorld(),loc.getX(),loc.getY(),loc.getZ()-1.0D),
+ age,
+ sponge.getPlayer(),
+ iswater,
+ islava);
}
}
sponges=nextSponges;
diff --git a/src/main/java/me/lanzhi/bluestargame/register/RecipeRegister.java b/src/main/java/me/lanzhi/bluestargame/register/RecipeRegister.java
index 546b26d..ba9236e 100644
--- a/src/main/java/me/lanzhi/bluestargame/register/RecipeRegister.java
+++ b/src/main/java/me/lanzhi/bluestargame/register/RecipeRegister.java
@@ -25,42 +25,86 @@ public void registerRecipes()
/* 9海绵->超级海绵 */
NamespacedKey super_sponge_key=new NamespacedKey(plugin,"super_sponge");
recipes.add(super_sponge_key);
- ShapelessRecipe super_sponge=new ShapelessRecipe(super_sponge_key,plugin.getBluestarGameManager().getSuperSpongeManager().getWaterSponge().getItem());
+ ShapelessRecipe super_sponge=new ShapelessRecipe(super_sponge_key,
+ plugin.getBluestarGameManager()
+ .getSuperSpongeManager()
+ .getWaterSponge()
+ .getItem());
super_sponge=super_sponge.addIngredient(9,Material.SPONGE);
Bukkit.addRecipe(super_sponge);
/* 岩浆海绵->水海绵 */
NamespacedKey water_sponge_key=new NamespacedKey(plugin,"water_sponge");
recipes.add(water_sponge_key);
- ShapedRecipe water_sponge=new ShapedRecipe(water_sponge_key,plugin.getBluestarGameManager().getSuperSpongeManager().getWaterSponge().getItem());
+ ShapedRecipe water_sponge=new ShapedRecipe(water_sponge_key,
+ plugin.getBluestarGameManager()
+ .getSuperSpongeManager()
+ .getWaterSponge()
+ .getItem());
water_sponge=water_sponge.shape("a");
- water_sponge=water_sponge.setIngredient('a',new RecipeChoice.ExactChoice(plugin.getBluestarGameManager().getSuperSpongeManager().getlavaSponge().getItem()));
+ water_sponge=water_sponge.setIngredient('a',
+ new RecipeChoice.ExactChoice(plugin.getBluestarGameManager()
+ .getSuperSpongeManager()
+ .getlavaSponge()
+ .getItem()));
Bukkit.addRecipe(water_sponge);
/* 水海绵->岩浆海绵 */
NamespacedKey lava_sponge_key=new NamespacedKey(plugin,"lava_sponge");
recipes.add(lava_sponge_key);
- ShapedRecipe lava_sponge=new ShapedRecipe(lava_sponge_key,plugin.getBluestarGameManager().getSuperSpongeManager().getlavaSponge().getItem());
+ ShapedRecipe lava_sponge=new ShapedRecipe(lava_sponge_key,
+ plugin.getBluestarGameManager()
+ .getSuperSpongeManager()
+ .getlavaSponge()
+ .getItem());
lava_sponge=lava_sponge.shape("a");
- lava_sponge=lava_sponge.setIngredient('a',new RecipeChoice.ExactChoice(plugin.getBluestarGameManager().getSuperSpongeManager().getWaterSponge().getItem()));
+ lava_sponge=lava_sponge.setIngredient('a',
+ new RecipeChoice.ExactChoice(plugin.getBluestarGameManager()
+ .getSuperSpongeManager()
+ .getWaterSponge()
+ .getItem()));
Bukkit.addRecipe(lava_sponge);
/* 使用过的水海绵烧制 */
NamespacedKey used_water_sponge_key=new NamespacedKey(plugin,"used_water_sponge");
recipes.add(used_water_sponge_key);
- FurnaceRecipe used_water_sponge=new FurnaceRecipe(used_water_sponge_key,plugin.getBluestarGameManager().getSuperSpongeManager().getWaterSponge().getItem(),new RecipeChoice.ExactChoice(plugin.getBluestarGameManager().getSuperSpongeManager().getUsedWaterSponge().getItem()),5,200);
+ FurnaceRecipe used_water_sponge=new FurnaceRecipe(used_water_sponge_key,
+ plugin.getBluestarGameManager()
+ .getSuperSpongeManager()
+ .getWaterSponge()
+ .getItem(),
+ new RecipeChoice.ExactChoice(plugin.getBluestarGameManager()
+ .getSuperSpongeManager()
+ .getUsedWaterSponge()
+ .getItem()),
+ 5,
+ 200);
Bukkit.addRecipe(used_water_sponge);
/* 使用过的岩浆海绵烧制 */
NamespacedKey used_lava_sponge_key=new NamespacedKey(plugin,"used_lava_sponge");
recipes.add(used_lava_sponge_key);
- FurnaceRecipe used_lava_sponge=new FurnaceRecipe(used_lava_sponge_key,plugin.getBluestarGameManager().getSuperSpongeManager().getlavaSponge().getItem(),new RecipeChoice.ExactChoice(plugin.getBluestarGameManager().getSuperSpongeManager().getUsedLavaSponge().getItem()),5,200);
+ FurnaceRecipe used_lava_sponge=new FurnaceRecipe(used_lava_sponge_key,
+ plugin.getBluestarGameManager()
+ .getSuperSpongeManager()
+ .getlavaSponge()
+ .getItem(),
+ new RecipeChoice.ExactChoice(plugin.getBluestarGameManager()
+ .getSuperSpongeManager()
+ .getUsedLavaSponge()
+ .getItem()),
+ 5,
+ 200);
Bukkit.addRecipe(used_lava_sponge);
/*烧制煤炭块*/
NamespacedKey fired_coal_block_key=new NamespacedKey(plugin,"fired_coal_block");
recipes.add(fired_coal_block_key);
- BlastingRecipe fired_coal_block=new BlastingRecipe(fired_coal_block_key,CompressedCoal.FIRED_COAL_BLOCK.getItem(),new RecipeChoice.ExactChoice(new ItemStack(Material.COAL_BLOCK)),2,200);
+ BlastingRecipe fired_coal_block=new BlastingRecipe(fired_coal_block_key,
+ CompressedCoal.FIRED_COAL_BLOCK.getItem(),
+ new RecipeChoice.ExactChoice(new ItemStack(Material.COAL_BLOCK)),
+ 2,
+ 200);
Bukkit.addRecipe(fired_coal_block);
/*压缩煤炭*/
@@ -74,7 +118,11 @@ public void registerRecipes()
/*烧制压缩煤炭*/
NamespacedKey fired_compressed_coal_key=new NamespacedKey(plugin,"fired_compressed_coal");
recipes.add(fired_compressed_coal_key);
- BlastingRecipe fired_compressed_coal=new BlastingRecipe(fired_compressed_coal_key,CompressedCoal.FIRED_COMPRESSED_COAL.getItem(),new RecipeChoice.ExactChoice(CompressedCoal.COMPRESSED_COAL.getItem()),2,200);
+ BlastingRecipe fired_compressed_coal=new BlastingRecipe(fired_compressed_coal_key,
+ CompressedCoal.FIRED_COMPRESSED_COAL.getItem(),
+ new RecipeChoice.ExactChoice(CompressedCoal.COMPRESSED_COAL.getItem()),
+ 2,
+ 200);
Bukkit.addRecipe(fired_compressed_coal);
/*合成钻石*/