Skip to content

Commit

Permalink
[3.3.0]早就该更新了
Browse files Browse the repository at this point in the history
  • Loading branch information
nullaqua committed Jul 6, 2022
1 parent 5eb22c4 commit 9ae2206
Show file tree
Hide file tree
Showing 29 changed files with 382 additions and 188 deletions.
43 changes: 36 additions & 7 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.2.0</version>
<version>3.3.0</version>
<packaging>jar</packaging>

<name>BluestarGame</name>
Expand Down Expand Up @@ -57,6 +57,14 @@
<id>spigotmc-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>purpur</id>
<url>https://repo.purpurmc.org/snapshots</url>
</repository>
<repository>
<id>papermc</id>
<url>https://repo.papermc.io/repository/maven-public/</url>
</repository>
<repository>
<id>sonatype</id>
<url>https://oss.sonatype.org/content/groups/public/</url>
Expand All @@ -77,12 +85,26 @@
</repositories>

<dependencies>
<!--
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.18.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
-->
<dependency>
<groupId>io.papermc.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.18.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-api</artifactId>
<version>4.11.0</version>
</dependency>

<dependency>
<groupId>de.tr7zw</groupId>
<artifactId>item-nbt-api-plugin</artifactId>
Expand All @@ -92,19 +114,19 @@
<dependency>
<groupId>com.github.lanzhi6</groupId>
<artifactId>BluestarAPI</artifactId>
<version>2.1.2</version>
<version>2.4.0-pre1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.lanzhi6</groupId>
<artifactId>BluestarQQ</artifactId>
<version>1.0.4</version>
<version>1.1.3</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.lanzhi6</groupId>
<artifactId>BluestarGameAPI</artifactId>
<version>3.2</version>
<version>3.2.1</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand All @@ -116,7 +138,7 @@
<dependency>
<groupId>com.github.DreamVoid.MiraiMC</groupId>
<artifactId>MiraiMC-Integration</artifactId>
<version>1.6</version>
<version>1.7-pre2</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand All @@ -131,15 +153,22 @@
<artifactId>purpur</artifactId>
<version>1.18.2</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/purpur-1.18.2.jar</systemPath>
<systemPath>${project.basedir}/lib/DeEnchantment-1.3.0-all.jar</systemPath>
</dependency>
<!--
<dependency>
<groupId>org.purpur</groupId>
<artifactId>citizens</artifactId>
<version>1.18.2</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/PlayerPoints-3.2.4.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>
<systemPath>${project.basedir}/lib/GMusic.jar</systemPath>
</dependency>
<dependency>
<groupId>com.github.lanzhi6</groupId>
Expand Down
13 changes: 11 additions & 2 deletions src/main/java/me/lanzhi/bluestargame/BluestarGamePlugin.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package me.lanzhi.bluestargame;

import me.lanzhi.bluestarapi.Api.config.AutoSerialize;
import me.lanzhi.bluestarapi.Api.config.YamlFile;
import me.lanzhi.bluestarapi.api.config.AutoSerialize;
import me.lanzhi.bluestarapi.api.config.YamlFile;
import me.lanzhi.bluestargame.Type.CompressedCoal;
import me.lanzhi.bluestargame.Type.Elevator;
import me.lanzhi.bluestargame.Type.SuperSponge;
Expand All @@ -11,6 +11,7 @@
import me.lanzhi.bluestargame.register.ListenersRegister;
import me.lanzhi.bluestargame.register.RecipeRegister;
import me.lanzhi.bluestargameapi.BluestarGamePluginInterface;
import net.milkbowl.vault.chat.Chat;
import net.milkbowl.vault.economy.Economy;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
Expand All @@ -37,6 +38,7 @@ public final class BluestarGamePlugin extends JavaPlugin implements BluestarGame
private final SimpleDateFormat BluestarDateFormat;
private final NumberFormat BluestarNF;
private Economy econ;
private Chat chat;
private BluestarGameManager bluestarGameManager;
private CommandRegister commandRegister;
private ListenersRegister listenersRegister;
Expand Down Expand Up @@ -73,6 +75,8 @@ public void onEnable()
listenersRegister=new ListenersRegister(this);
recipeRegister=new RecipeRegister(this);
econ=getServer().getServicesManager().load(Economy.class);
System.out.println(econ==null);
chat=getServer().getServicesManager().load(Chat.class);

new Metrics(this,14294);

Expand Down Expand Up @@ -118,6 +122,11 @@ public Economy getEcon()
return econ;
}

public Chat getChat()
{
return chat;
}

@Override
public File getPlayerData()
{
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/me/lanzhi/bluestargame/Metrics.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*/
package me.lanzhi.bluestargame;

import me.lanzhi.bluestarapi.Api.config.YamlFile;
import me.lanzhi.bluestarapi.api.config.YamlFile;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
Expand Down
24 changes: 10 additions & 14 deletions src/main/java/me/lanzhi/bluestargame/Type/CompressedCoal.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,38 +41,34 @@ 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;
break;
}
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;
break;
}
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;
break;
}
default:
{
default -> {
this.allowRecipe=null;
this.id=0;
this.item=null;
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/me/lanzhi/bluestargame/Type/Elevator.java
Original file line number Diff line number Diff line change
@@ -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.bluestarapi.api.config.AutoSerializeInterface;
import me.lanzhi.bluestarapi.api.config.SerializeAs;
import me.lanzhi.bluestarapi.api.config.SpecialSerialize;
import org.bukkit.Bukkit;
import org.bukkit.World;

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/me/lanzhi/bluestargame/Type/SuperSponge.java
Original file line number Diff line number Diff line change
@@ -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.bluestarapi.api.config.AutoSerializeInterface;
import me.lanzhi.bluestarapi.api.config.SerializeAs;
import org.bukkit.Location;

@SerializeAs("BluestarGame.SuperSponge")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;

import java.util.ArrayList;
import java.util.Arrays;
Expand All @@ -27,14 +28,14 @@ public final class BluestarGameCommand implements CommandExecutor, TabExecutor
private final BluestarGamePlugin plugin;
private final RandomEventManger randomEventManger;

public BluestarGameCommand(BluestarGamePlugin plugin)
public BluestarGameCommand(@NotNull BluestarGamePlugin plugin)
{
this.plugin=plugin;
randomEventManger=plugin.getBluestarGameManager().getRandomEventManger();
}

@Override
public boolean onCommand(CommandSender sender,Command command,String label,String[] args)
public boolean onCommand(@NotNull CommandSender sender,@NotNull Command command,@NotNull String label,@NotNull String[] args)
{
if ("reload".equals(args[0])&&sender.hasPermission("bluestargame.lanzhi"))
{
Expand Down Expand Up @@ -340,7 +341,8 @@ 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]))
Expand Down Expand Up @@ -399,24 +401,11 @@ public List<String> onTabComplete(CommandSender sender,Command command,String al
{
if (args.length==1)
{
List<String> tablist=new ArrayList<>();
tablist.add("randdamage");
tablist.add("randchat");
tablist.add("randsheep");
tablist.add("24");
tablist.add("morediamond");
tablist.add("morecoal");
tablist.add("morecopper");
tablist.add("moreiron");
tablist.add("moregold");
tablist.add("moreemerald");
tablist.add("morelapis");
tablist.add("respawn");
tablist.add("all");
tablist.add("auto");
tablist.add("spongeR");
tablist.add("boom");
tablist.add("onehealth");
List<String> 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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import de.tr7zw.nbtapi.NBTCompound;
import de.tr7zw.nbtapi.NBTItem;
import me.lanzhi.bluestarapi.Api.RGBChat;
import me.lanzhi.bluestarapi.api.RGBColor;
import me.lanzhi.bluestargame.BluestarGamePlugin;
import org.bukkit.ChatColor;
import org.bukkit.Material;
Expand All @@ -13,22 +13,21 @@
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.entity.Sheep;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.potion.PotionEffectType;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import static me.lanzhi.bluestargame.listener.effectListener.effectEventType;

import java.util.*;

import static me.lanzhi.bluestargame.listener.effectListener.effectEventType;

public final class BluestarItemCommand implements CommandExecutor, TabExecutor
{
private final List<String> entityType=new ArrayList<>();
private final List<String> potionEffectType=new ArrayList<>();
private final Map<String,effectEventType> effectEvents=new HashMap<>();
private final Map<String, effectEventType> effectEvents=new HashMap<>();
private final BluestarGamePlugin plugin;
private ConfigurationSection effectLang;
private ConfigurationSection entityLang;
Expand Down Expand Up @@ -356,7 +355,8 @@ 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);
}
Expand All @@ -383,7 +383,7 @@ public boolean onCommand(@NotNull CommandSender sender,@NotNull Command command,
builder.append(args[i]);
}
ItemMeta itemMeta=itemStack.getItemMeta();
itemMeta.setDisplayName(RGBChat.setColor(builder.toString().replaceAll("\"\""," ")));
itemMeta.setDisplayName(RGBColor.setColor(builder.toString().replaceAll("\"\""," ")));
itemStack.setItemMeta(itemMeta);
player.getInventory().setItemInMainHand(itemStack);
return true;
Expand All @@ -402,7 +402,8 @@ public List<String> onTabComplete(@NotNull CommandSender sender,@NotNull Command
{
if (args.length==1)
{
return Arrays.asList("watersponge","lavasponge","usedwatersponge","usedlavasponge","effect","effectEvent","sword","bow","setname");
return Arrays.asList("watersponge","lavasponge","usedwatersponge","usedlavasponge","effect","effectEvent",
"sword","bow","setname");
}
if ("bow".equals(args[0]))
{
Expand Down Expand Up @@ -460,25 +461,28 @@ private ItemStack setLore(ItemStack itemStack)
{
return itemStack;
}
String c=RGBChat.toColorCode("888888");
String c=RGBColor.toColorCode("888888");
if (bluestarGame.getCompound("effect")!=null)
{
lore.add(c+"<===--- "+RGBChat.toColorCode("abcdef")+"手持或佩戴时效果"+c+" ---===>");
lore.add(c+"<===--- "+RGBColor.toColorCode("abcdef")+"手持或佩戴时效果"+c+" ---===>");
NBTCompound compound=bluestarGame.getCompound("effect");
for (String i: compound.getKeys())
{
lore.add(ChatColor.GRAY+effectLang.getString(i.toLowerCase(),i.toLowerCase())+" "+compound.getInteger(i));
lore.add(ChatColor.GRAY+effectLang.getString(i.toLowerCase(),i.toLowerCase())+" "+compound.getInteger(
i));
}
}
for (effectEventType i:effectEventType.values())
for (effectEventType i: effectEventType.values())
{
if (bluestarGame.getCompound(i.name())!=null)
{
lore.add(c+"<===--- "+i.getName()+c+" ---===>");
NBTCompound compound=bluestarGame.getCompound(i.name());
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));
lore.add(ChatColor.GRAY+effectLang.getString(j.toLowerCase(),
j.toLowerCase())+" "+compound.addCompound(
j).getInteger("s")+" 时间: "+(compound.addCompound(j).getInteger("time")/20));
}
}
}
Expand Down
Loading

0 comments on commit 9ae2206

Please sign in to comment.