Skip to content

Commit

Permalink
[3.3.1]例行提交
Browse files Browse the repository at this point in the history
  • Loading branch information
nullaqua committed Jul 28, 2022
1 parent 9ae2206 commit cb9d2fa
Show file tree
Hide file tree
Showing 9 changed files with 98 additions and 36 deletions.
27 changes: 15 additions & 12 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.3.0</version>
<version>3.3.1</version>
<packaging>jar</packaging>

<name>BluestarGame</name>
Expand Down Expand Up @@ -57,10 +57,6 @@
<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>
Expand Down Expand Up @@ -96,7 +92,7 @@
<dependency>
<groupId>io.papermc.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.18.2-R0.1-SNAPSHOT</version>
<version>1.19-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand All @@ -114,7 +110,7 @@
<dependency>
<groupId>com.github.lanzhi6</groupId>
<artifactId>BluestarAPI</artifactId>
<version>2.4.0-pre1</version>
<version>2.5.2</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand All @@ -136,9 +132,9 @@
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.DreamVoid.MiraiMC</groupId>
<groupId>io.github.dreamvoid</groupId>
<artifactId>MiraiMC-Integration</artifactId>
<version>1.7-pre2</version>
<version>1.7-rc2</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand All @@ -150,10 +146,17 @@
</dependency>
<dependency>
<groupId>org.purpur</groupId>
<artifactId>purpur</artifactId>
<version>1.18.2</version>
<artifactId>purpur9</artifactId>
<version>1.19</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/purpur-1.19.jar</systemPath>
</dependency>
<dependency>
<groupId>org.purpur</groupId>
<artifactId>purpur8</artifactId>
<version>1.18</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/DeEnchantment-1.3.0-all.jar</systemPath>
<systemPath>${project.basedir}/lib/purpur-1.18.2.jar</systemPath>
</dependency>
<!--
<dependency>
Expand Down
6 changes: 5 additions & 1 deletion src/main/java/me/lanzhi/bluestargame/BluestarGamePlugin.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
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.bluestargame.Type.CompressedCoal;
Expand All @@ -15,6 +16,7 @@
import net.milkbowl.vault.economy.Economy;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.PluginCommand;
import org.bukkit.configuration.serialization.ConfigurationSerialization;
import org.bukkit.plugin.ServicePriority;
import org.bukkit.plugin.java.JavaPlugin;
Expand Down Expand Up @@ -61,6 +63,9 @@ public BluestarGamePlugin()
BluestarDateFormat=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
BluestarNF=NumberFormat.getInstance();
BluestarNF.setGroupingUsed(false);

PluginCommand pluginCommand=Bluestar.getCommandManager().newPluginCommand("test",this);
Bluestar.getCommandManager().registerPluginCommand(pluginCommand);
}

@Override
Expand All @@ -75,7 +80,6 @@ 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
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import de.tr7zw.nbtapi.NBTCompound;
import de.tr7zw.nbtapi.NBTItem;
import me.lanzhi.bluestarapi.api.GradientColor;
import me.lanzhi.bluestarapi.api.RGBColor;
import me.lanzhi.bluestargame.BluestarGamePlugin;
import org.bukkit.ChatColor;
Expand Down Expand Up @@ -383,7 +384,52 @@ public boolean onCommand(@NotNull CommandSender sender,@NotNull Command command,
builder.append(args[i]);
}
ItemMeta itemMeta=itemStack.getItemMeta();
itemMeta.setDisplayName(RGBColor.setColor(builder.toString().replaceAll("\"\""," ")));
itemMeta.setDisplayName(GradientColor.setColor(builder.toString().replaceAll("\"\""," ")));
itemStack.setItemMeta(itemMeta);
player.getInventory().setItemInMainHand(itemStack);
return true;
}
case "addlore":
{
ItemStack itemStack=player.getInventory().getItemInMainHand();
if (itemStack==null||itemStack.getType().isAir())
{
player.sendMessage(plugin.getErrorMessageHead()+"请手持任意物品");
return true;
}
if (args.length<2)
{
player.sendMessage(plugin.getErrorMessageHead()+"请输入物品说明");
return true;
}
StringBuilder builder=new StringBuilder(args[1]);
for (int i=2;i<args.length;i++)
{
builder.append(' ');
builder.append(args[i]);
}
ItemMeta itemMeta=itemStack.getItemMeta();
List<String> lore=itemMeta.getLore();
if (lore==null)
{
lore=new ArrayList<>();
}
lore.add(GradientColor.setColor(builder.toString().replaceAll("\"\""," ")));
itemMeta.setLore(lore);
itemStack.setItemMeta(itemMeta);
player.getInventory().setItemInMainHand(itemStack);
return true;
}
case "clearlore":
{
ItemStack itemStack=player.getInventory().getItemInMainHand();
if (itemStack==null||itemStack.getType().isAir())
{
player.sendMessage(plugin.getErrorMessageHead()+"请手持任意物品");
return true;
}
ItemMeta itemMeta=itemStack.getItemMeta();
itemMeta.setLore(null);
itemStack.setItemMeta(itemMeta);
player.getInventory().setItemInMainHand(itemStack);
return true;
Expand All @@ -396,14 +442,14 @@ public boolean onCommand(@NotNull CommandSender sender,@NotNull Command command,
}
}

@Nullable
@Override
@NotNull
public List<String> onTabComplete(@NotNull CommandSender sender,@NotNull Command command,@NotNull String label,@NotNull String[] args)
{
if (args.length==1)
{
return Arrays.asList("watersponge","lavasponge","usedwatersponge","usedlavasponge","effect","effectEvent",
"sword","bow","setname");
"sword","bow","setname","addlore","clearlore");
}
if ("bow".equals(args[0]))
{
Expand Down Expand Up @@ -445,6 +491,10 @@ public List<String> onTabComplete(@NotNull CommandSender sender,@NotNull Command
{
return Collections.singletonList("名字");
}
if ("addlore".equals(args[0]))
{
return Collections.singletonList("内容");
}
if (args.length==2)
{
return Collections.singletonList("数量");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package me.lanzhi.bluestargame.commands;

import me.lanzhi.bluestarapi.api.GradientColor;
import me.lanzhi.bluestarapi.api.RGBColor;
import me.lanzhi.bluestargame.BluestarGamePlugin;
import net.milkbowl.vault.chat.Chat;
Expand Down Expand Up @@ -51,7 +52,7 @@ 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");
"#098765")+"#098765"+ChatColor.GOLD+"支持渐变色: #abcdef-654321<"+GradientColor.colorText("abcdef","654321","需要染色的文本")+ChatColor.GOLD+">");
player.sendMessage(plugin.getErrorMessageHead()+"设置昵称将花费1000,在聊天区发送需要的昵称后立即生效,概不退款。再次设置昵称可以覆盖,需要重新付款");
player.sendMessage(plugin.getErrorMessageHead()+"若想取消此操作,请再次输入指令");
players.add(player);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package me.lanzhi.bluestargame.listener;

import me.lanzhi.bluestarapi.api.GradientColor;
import me.lanzhi.bluestarapi.api.RGBColor;
import org.bukkit.ChatColor;
import org.bukkit.event.EventHandler;
Expand All @@ -11,23 +12,17 @@

public final class ChatColorListener implements Listener
{
private Pattern hex=Pattern.compile("#([0-9A-Fa-fK-Ok-oRr]{6})");

@EventHandler(ignoreCancelled=true, priority=EventPriority.LOWEST)
public void onPlyaerChat(AsyncPlayerChatEvent event)
{
if (event.isCancelled())
{
return;
}
boolean canUseColor=event.getPlayer().hasPermission("bluestargame.color");
if (canUseColor)
{
event.setMessage(RGBColor.setColor(event.getMessage()));
event.setMessage(GradientColor.setColor(event.getMessage()));
}
else
{
event.setMessage(ChatColor.stripColor(RGBColor.setColor(event.getMessage())));
event.setMessage(ChatColor.stripColor(GradientColor.setColor(event.getMessage())));
}
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package me.lanzhi.bluestargame.listener.randoms;

import me.lanzhi.bluestarapi.api.GradientColor;
import me.lanzhi.bluestarapi.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;
Expand All @@ -19,15 +21,19 @@ public randChatColorListener(BluestarGamePlugin plugin)
randomEventManger=plugin.getBluestarGameManager().getRandomEventManger();
}

@EventHandler(priority=EventPriority.LOW)
@EventHandler
public void onChatForRand(AsyncPlayerChatEvent event)
{

String message=event.getMessage();
if (!randomEventManger.randchat())
{
return;
}
event.setMessage(new RGBColor(Math.abs(ThreadLocalRandom.current().nextInt()%0xffffff))+message);
if (!message.equals(ChatColor.stripColor(message)))
{
return;
}
event.setMessage(GradientColor.colorText(RGBColor.random(),RGBColor.random(),message));
//event.setMessage(new RGBColor(Math.abs(ThreadLocalRandom.current().nextInt()%0xffffff))+message);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public the24PointListener(BluestarGamePlugin plugin)
randomEventManger=plugin.getBluestarGameManager().getRandomEventManger();
}

@EventHandler(ignoreCancelled=true, priority=EventPriority.MONITOR)
@EventHandler(ignoreCancelled=true, priority=EventPriority.LOWEST)
public void onChatFor24(AsyncPlayerChatEvent event)
{
new BukkitRunnable()
Expand Down Expand Up @@ -57,7 +57,7 @@ public void run()
{
if (decide(event.getMessage()))
{
String uuid=MiraiMC.getBinding(event.getSenderId());
UUID uuid=MiraiMC.getBind(event.getSenderId());
if (uuid==null||"".equals(uuid))
{
event.getGroup().sendMessageMirai(
Expand All @@ -69,12 +69,12 @@ public void run()
{
org.bukkit.Bukkit.getServer().broadcastMessage(
plugin.getMessageHead()+ChatColor.YELLOW+Bukkit.getOfflinePlayer(
UUID.fromString(uuid)).getName()+"答案正确!");
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.fromString(uuid)).getName()+" 1000",
uuid).getName()+" 1000",
plugin);
}
randomEventManger.the24(false);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package me.lanzhi.bluestargame.listener;

import me.lanzhi.bluestarapi.api.GradientColor;
import me.lanzhi.bluestarapi.api.RGBColor;
import me.lanzhi.bluestargame.BluestarGamePlugin;
import net.milkbowl.vault.economy.EconomyResponse;
Expand Down Expand Up @@ -39,7 +40,7 @@ public void onPlayerMessage(@NotNull AsyncPlayerChatEvent event)
event.getPlayer().sendMessage(plugin.getErrorMessageHead()+"出现错误,请重试,或通知腐竹");
return;
}
String nick=RGBColor.setColor(event.getMessage());
String nick=GradientColor.setColor(event.getMessage());
if (nick.indexOf(' ')>=0)
{
event.getPlayer().sendMessage(plugin.getErrorMessageHead()+"错误!,名称中不能饱和空格");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public void run()
{
Location loc=sponge.getLocation();
int age=sponge.getAge();
Bluestar.setBlock(loc,Material.AIR,sponge.getPlayer());
loc.getBlock().setType(Material.AIR);
boolean iswater=sponge.getIswater();
boolean islava=sponge.getIslava();
if (age>1)
Expand Down Expand Up @@ -75,12 +75,14 @@ private void decide(Location loc,int age,String player,boolean iswater,boolean i
{
if (loc.getBlock().getType()==Material.WATER&&iswater)
{
Bluestar.setBlock(loc,Material.END_STONE,player);
Bluestar.getMainManager().CoreLogRemoval(player,loc,Material.WATER,loc.getBlock().getBlockData());
loc.getBlock().setType(Material.END_STONE);
nextSponges.add(new SuperSponge(age-1,loc,player,islava,true));
}
if (loc.getBlock().getType()==Material.LAVA&&islava)
{
Bluestar.setBlock(loc,Material.OBSIDIAN,player);
Bluestar.getMainManager().CoreLogRemoval(player,loc,Material.LAVA,loc.getBlock().getBlockData());
loc.getBlock().setType(Material.OBSIDIAN);
nextSponges.add(new SuperSponge(age-1,loc,player,true,iswater));
}
}
Expand Down

0 comments on commit cb9d2fa

Please sign in to comment.