Skip to content

Commit

Permalink
null
Browse files Browse the repository at this point in the history
  • Loading branch information
nullaqua committed Feb 10, 2022
1 parent dcb24bc commit 3b2689a
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 13 deletions.
2 changes: 1 addition & 1 deletion 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>2.0.1</version>
<version>2.0.2</version>
<packaging>jar</packaging>

<name>BluestarGame</name>
Expand Down
21 changes: 14 additions & 7 deletions src/main/java/me/lanzhi/bluestargame/Type/superSponge.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ public final class superSponge implements ConfigurationSerializable {
private final Location location;
private final Player player;

public superSponge(Map<String, Object> map) {
public superSponge(Map<String, Object> map)
{
this.age = ((Integer) map.get("age")).intValue();
this.location = ((Location) map.get("location"));
this.player = Bukkit.getPlayer((String) map.get("player"));
Expand All @@ -33,8 +34,10 @@ public superSponge(int age, Location loc, Player player) {
this.player = player;
}

public static NBTItem getSuperSponge() {
if (superSponge == null) {
public static NBTItem getSuperSponge()
{
if (superSponge == null)
{
superSponge = new NBTItem(new ItemStack(Material.END_STONE));
superSponge.setBoolean("BluestarGameSponge", Boolean.valueOf(true));
NBTCompound display = superSponge.addCompound("display");
Expand All @@ -48,23 +51,27 @@ public static NBTItem getSuperSponge() {
}

@Override
public Map<String, Object> serialize() {
public Map<String, Object> serialize()
{
Map<String, Object> map = new HashMap();
map.put("age", Integer.valueOf(this.age));
map.put("location", this.location);
map.put("player", this.player.getName());
return map;
}

public int getAge() {
public int getAge()
{
return this.age;
}

public Location getLocation() {
public Location getLocation()
{
return this.location;
}

public Player getPlayer() {
public Player getPlayer()
{
return this.player;
}
}
Expand Down
27 changes: 24 additions & 3 deletions src/main/java/me/lanzhi/bluestargame/commands/maincommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import java.util.List;
import me.lanzhi.bluestargame.BluestarGame;
import me.lanzhi.bluestargame.Ctrls.CTRL;
import me.lanzhi.bluestargame.Type.superSponge;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.command.Command;
Expand All @@ -14,6 +15,8 @@
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;

import static me.lanzhi.bluestargame.BluestarGame.config;

public class maincommand implements CommandExecutor, TabExecutor
{
@Override
Expand Down Expand Up @@ -237,9 +240,9 @@ public boolean onCommand(CommandSender sender, Command command, String label, St
sender.sendMessage(ChatColor.RED + "错误,范围应在1-32之间!");
return false;
}
BluestarGame.config.getConfig().set("spongeR", Integer.valueOf(r));
BluestarGame.config.saveConfig();
BluestarGame.config.reloadConfig();
config.getConfig().set("spongeR", Integer.valueOf(r));
config.saveConfig();
config.reloadConfig();
sender.sendMessage(ChatColor.GREEN + "设置成功");
return true;
}
Expand All @@ -264,6 +267,24 @@ public boolean onCommand(CommandSender sender, Command command, String label, St
player.getLocation().getWorld().createExplosion(player.getLocation(), r, true, true);
return true;
}
if (args[0].equals("newsponge")&&sender.hasPermission("bluestargame.lanzhi"))
{
List<superSponge> sponges = (List<superSponge>)config.getConfig().getList("superSponges");
int r = 0;
try
{
r = Integer.valueOf(args[1]).intValue();
}
catch (NumberFormatException e)
{
sender.sendMessage(ChatColor.RED + "错误!");
return false;
}
Location locc=((Player)(sender)).getLocation();
Location loc=new Location(locc.getWorld(),locc.getBlockX(),locc.getBlockY(),locc.getBlockZ());
sponges.add(new superSponge(r,loc,(Player)sender));
return true;
}
sender.sendMessage(ChatColor.RED + "格式错误!");
return false;
}
Expand Down
8 changes: 6 additions & 2 deletions src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@ commands:
- bsgamelist
- bsglist
permissions:
bluestargame.use:
default: op
bluestargame.*:
children:
bluestargame.use:
default: op
bluestargame.lanzhi:
default: false
depend:
- BluestarAPI
- NBTAPI

0 comments on commit 3b2689a

Please sign in to comment.