Skip to content

Commit

Permalink
[3.0.1]一些微调
Browse files Browse the repository at this point in the history
  • Loading branch information
nullaqua committed May 5, 2022
1 parent 0b4dd05 commit 1ae3788
Show file tree
Hide file tree
Showing 34 changed files with 174 additions and 139 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>me.lanzhi</groupId>
<artifactId>BluestarGame</artifactId>
<version>3.0.0</version>
<version>3.0.1</version>
<packaging>jar</packaging>

<name>BluestarGame</name>
Expand Down Expand Up @@ -133,14 +133,14 @@
<scope>system</scope>
<systemPath>${project.basedir}/lib/purpur-1.18.2.jar</systemPath>
</dependency>
<!--
<dependency>
<groupId>com.github.lanzhi6</groupId>
<artifactId>BluestarTpsControl</artifactId>
<version>1.5</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/BluestarTpsControl-spigotPlugin-1.5.jar</systemPath>
</dependency>
<!--
<dependency>
<groupId>com.github.lanzhi6</groupId>
<artifactId>BlggguestaasdrTpsControl</artifactId>
Expand Down
30 changes: 19 additions & 11 deletions src/main/java/me/lanzhi/bluestargame/BluestarGamePlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,18 @@ public final class BluestarGamePlugin extends JavaPlugin implements BluestarGame
private final File PlayerData;
private final YamlFile PlayerMap;
private final YamlFile Data;
private final Economy econ;
private Economy econ;
private final String messageHead=ChatColor.GOLD+"["+ChatColor.DARK_AQUA+"BluestarGame"+ChatColor.GOLD+"]";
private final String errorMessageHead=messageHead+ChatColor.RED;
private final SimpleDateFormat BluestarDateFormat;
private final NumberFormat BluestarNF;
private final BluestarGameManager bluestarGameManager;
private final CommandRegister commandRegister;
private final ListenersRegister listenersRegister;
private final RecipeRegister recipeRegister;
private BluestarGameManager bluestarGameManager;
private CommandRegister commandRegister;
private ListenersRegister listenersRegister;
private RecipeRegister recipeRegister;
private BukkitTask spongeTask;
private BukkitTask bedrockTask;
private boolean isEnable=false;

public BluestarGamePlugin()
{
Expand All @@ -53,14 +54,9 @@ public BluestarGamePlugin()
Data=new YamlFile(new File(this.getDataFolder(),"data.yml"));
PlayerData=new File(this.getDataFolder(),"PlayerData");
PlayerData.mkdirs();
econ=getServer().getServicesManager().load(Economy.class);
BluestarDateFormat=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
BluestarNF=NumberFormat.getInstance();
BluestarNF.setGroupingUsed(false);
bluestarGameManager=new BluestarGameManager(this);
commandRegister=new CommandRegister(this);
listenersRegister=new ListenersRegister(this);
recipeRegister=new RecipeRegister(this);
}

@Override
Expand All @@ -69,6 +65,11 @@ public void onEnable()
config.reload();
PlayerMap.reload();
Data.reload();
bluestarGameManager=new BluestarGameManager(this);
commandRegister=new CommandRegister(this);
listenersRegister=new ListenersRegister(this);
recipeRegister=new RecipeRegister(this);
econ=getServer().getServicesManager().load(Economy.class);

new Metrics(this,14294);

Expand All @@ -87,6 +88,7 @@ public void onEnable()

Bukkit.getServicesManager().register(BluestarGamePluginInterface.class,this,this,ServicePriority.Normal);

isEnable=true;
System.out.println("BluestarGame已加载");
}

Expand All @@ -98,11 +100,12 @@ public void onDisable()
getBluestarGameManager().getRandomEventManger().end();
getBluestarGameManager().getRandomEventManger().all(false);
recipeRegister.cancellationRecipes();
Data.set("superSponges",getBluestarGameManager().getSuperSpongeManager());
Data.set("superSponges",getBluestarGameManager().getSuperSpongeManager().getSponges());
Data.save();
PlayerMap.save();
config.save();
Bukkit.getServicesManager().unregisterAll(this);
isEnable=false;
System.out.println("BluestarGame已卸载");
}

Expand Down Expand Up @@ -193,6 +196,11 @@ public BluestarGamePlugin getPlugin()
{
return this;
}

public boolean isEnable()
{
return this.isEnable;
}
}


Expand Down
50 changes: 25 additions & 25 deletions src/main/java/me/lanzhi/bluestargame/Type/CompressedCoal.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,26 +80,6 @@ public enum CompressedCoal implements ConfigurationSerializable
}
}

public NBTItem getNbtItem()
{
return item;
}

public ItemStack getItem()
{
return item.getItem();
}

public int getId()
{
return id;
}

public boolean canUseInRecipe(NamespacedKey key)
{
return allowRecipe.contains(key);
}

public static CompressedCoal getFromId(int id)
{
switch (id)
Expand Down Expand Up @@ -139,6 +119,31 @@ public static CompressedCoal getFromNbtItem(@Nullable NBTItem item)
return compound==null?null:getFromId(compound.getInteger("coal"));
}

public static CompressedCoal deserialize(Map<String, Object> map)
{
return getFromId((int) map.get("id"));
}

public NBTItem getNbtItem()
{
return item;
}

public ItemStack getItem()
{
return item.getItem();
}

public int getId()
{
return id;
}

public boolean canUseInRecipe(NamespacedKey key)
{
return allowRecipe.contains(key);
}

@NotNull
@Override
public Map<String, Object> serialize()
Expand All @@ -147,9 +152,4 @@ public Map<String, Object> serialize()
map.put("id",getId());
return map;
}

public static CompressedCoal deserialize(Map<String, Object> map)
{
return getFromId((int) map.get("id"));
}
}
11 changes: 0 additions & 11 deletions src/main/java/me/lanzhi/bluestargame/Type/SuperSponge.java
Original file line number Diff line number Diff line change
@@ -1,19 +1,8 @@
package me.lanzhi.bluestargame.Type;

import de.tr7zw.nbtapi.NBTCompound;
import de.tr7zw.nbtapi.NBTItem;
import me.lanzhi.bluestarapi.Api.config.AutoSerializeInterface;
import me.lanzhi.bluestarapi.Api.config.SerializeAs;
import me.lanzhi.bluestarapi.Api.config.SpecialSerialize;
import me.lanzhi.bluestargame.BluestarGamePlugin;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;

import java.util.ArrayList;
import java.util.List;

@SerializeAs("BluestarGame.SuperSponge")
public final class SuperSponge implements AutoSerializeInterface
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import me.lanzhi.bluestargame.BluestarGamePlugin;
import me.lanzhi.bluestargameapi.api.PluginApiInterface;

public class BluestarGameApi implements PluginApiInterface
public final class BluestarGameApi implements PluginApiInterface
{
private final xiaoMoBank xmBank;
private final BluestarGamePlugin plugin;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/me/lanzhi/bluestargame/api/xiaoMoBank.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import java.util.Date;
import java.util.UUID;

public class xiaoMoBank implements XiaoMoBankInterface
public final class xiaoMoBank implements XiaoMoBankInterface
{
private final BluestarGamePlugin plugin;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
public class BluestarGameCommand implements CommandExecutor, TabExecutor

public final class BluestarGameCommand implements CommandExecutor, TabExecutor
{
private final BluestarGamePlugin plugin;
private final RandomEventManger randomEventManger;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,17 @@
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;

public class BluestarGameListCommand implements CommandExecutor
public final class BluestarGameListCommand implements CommandExecutor
{
private final BluestarGamePlugin plugin;
private final RandomEventManger randomEventManger;

public BluestarGameListCommand(BluestarGamePlugin plugin)
{
this.plugin=plugin;
randomEventManger=plugin.getBluestarGameManager().getRandomEventManger();
}

@Override
public boolean onCommand(CommandSender sender,Command command,String label,String[] args)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,31 +21,36 @@
import java.util.Collections;
import java.util.List;

public class BluestarItemCommand implements CommandExecutor, TabExecutor
public final class BluestarItemCommand implements CommandExecutor, TabExecutor
{
private final BluestarGamePlugin plugin;
public BluestarItemCommand(BluestarGamePlugin plugin)
{
this.plugin=plugin;
}
private static List<String>entityType=new ArrayList<>();
private static List<String> entityType=new ArrayList<>();

static
{
try
{
for (EntityType i:EntityType.values())
for (EntityType i: EntityType.values())
{
if (i.getName()==null)
{
continue;
}
entityType.add(i.getName());
}
}catch (Throwable e)
}
catch (Throwable e)
{
System.out.println("错误在初始化");
}
}

private final BluestarGamePlugin plugin;

public BluestarItemCommand(BluestarGamePlugin plugin)
{
this.plugin=plugin;
}

@Override
public boolean onCommand(@NotNull CommandSender sender,@NotNull Command command,@NotNull String label,@NotNull String[] args)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@
import java.util.ArrayList;
import java.util.List;

public class ChatCommand implements CommandExecutor, TabExecutor
public final class ChatCommand implements CommandExecutor, TabExecutor
{
private final BluestarGamePlugin plugin;

public ChatCommand(BluestarGamePlugin plugin)
{
this.plugin=plugin;
}

@Override
public boolean onCommand(CommandSender sender,Command command,String label,String[] args)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;

public class CmdBagCommand implements CommandExecutor
public final class CmdBagCommand implements CommandExecutor
{

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import java.util.Arrays;
import java.util.List;

public class ElevatorCommand implements CommandExecutor, TabExecutor
public final class ElevatorCommand implements CommandExecutor, TabExecutor
{
private final BluestarGamePlugin plugin;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@

import java.util.*;

public class MutedCommand implements CommandExecutor, TabExecutor
public final class MutedCommand implements CommandExecutor, TabExecutor
{
private final ConfigurationSection muted;
private final BluestarGamePlugin plugin;

public MutedCommand(BluestarGamePlugin plugin)
{
this.plugin=plugin;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import java.util.Calendar;
import java.util.List;

public class XiaoMoBankCommand implements CommandExecutor, TabExecutor
public final class XiaoMoBankCommand implements CommandExecutor, TabExecutor
{
private final BaseComponent borrowGui;
private final BaseComponent saveGui;
Expand Down Expand Up @@ -67,7 +67,7 @@ public XiaoMoBankCommand(BluestarGamePlugin plugin)
cmp.setClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND,"/xmbank save "));
save=new TextComponent(plugin.getMessageHead()+" ");
save.addExtra(cmp);

bank=plugin.getBluestarGameManager().getApi().getXiaoMoBank();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import java.io.File;

public class HealthFixListener implements Listener
public final class HealthFixListener implements Listener
{
private final BluestarGamePlugin plugin;
private final RandomEventManger randomEventManger;
Expand All @@ -24,6 +24,7 @@ public HealthFixListener(BluestarGamePlugin plugin)
this.plugin=plugin;
randomEventManger=plugin.getBluestarGameManager().getRandomEventManger();
}

@EventHandler(priority=EventPriority.HIGHEST)
public void onPlayerJoin(PlayerLoginEvent event)
{
Expand Down
Loading

0 comments on commit 1ae3788

Please sign in to comment.