formatting
This commit is contained in:
parent
f9a5fdbb74
commit
a85e749fc5
14 changed files with 35 additions and 36 deletions
|
@ -23,6 +23,7 @@ public class ArmorCommand extends Command {
|
|||
if (sender instanceof Player player) {
|
||||
ItemStack helmet = new ItemStack(Material.LEATHER_HELMET);
|
||||
LeatherArmorMeta helmetdata = (LeatherArmorMeta) helmet.getItemMeta();
|
||||
if (helmetdata == null) return;
|
||||
helmetdata.setDisplayName(net.md_5.bungee.api.ChatColor.of("#ff23ff") + "Angeles Helmet");
|
||||
helmetdata.setColor(org.bukkit.Color.fromRGB(2, 2, 58));
|
||||
helmetdata.setUnbreakable(true);
|
||||
|
@ -31,6 +32,7 @@ public class ArmorCommand extends Command {
|
|||
|
||||
ItemStack cp = new ItemStack(Material.LEATHER_CHESTPLATE);
|
||||
LeatherArmorMeta cpdata = (LeatherArmorMeta) cp.getItemMeta();
|
||||
if (cpdata == null) return;
|
||||
cpdata.setDisplayName(net.md_5.bungee.api.ChatColor.of("#ff23ff") + "Angeles Chestplate");
|
||||
cpdata.setColor(org.bukkit.Color.fromRGB(2, 2, 58));
|
||||
cpdata.setUnbreakable(true);
|
||||
|
@ -39,6 +41,7 @@ public class ArmorCommand extends Command {
|
|||
|
||||
ItemStack leg = new ItemStack(Material.LEATHER_LEGGINGS);
|
||||
LeatherArmorMeta legdata = (LeatherArmorMeta) leg.getItemMeta();
|
||||
if (legdata == null) return;
|
||||
legdata.setDisplayName(net.md_5.bungee.api.ChatColor.of("#ff23ff") + "Angeles Leggings");
|
||||
legdata.setColor(org.bukkit.Color.fromRGB(2, 2, 58));
|
||||
legdata.setUnbreakable(true);
|
||||
|
@ -47,6 +50,7 @@ public class ArmorCommand extends Command {
|
|||
|
||||
ItemStack boot = new ItemStack(Material.LEATHER_BOOTS);
|
||||
LeatherArmorMeta bootdata = (LeatherArmorMeta) boot.getItemMeta();
|
||||
if (bootdata == null) return;
|
||||
bootdata.setDisplayName(net.md_5.bungee.api.ChatColor.of("#ff23ff") + "Angeles Boots");
|
||||
bootdata.setColor(org.bukkit.Color.fromRGB(2, 2, 58));
|
||||
bootdata.setUnbreakable(true);
|
||||
|
|
|
@ -19,9 +19,8 @@ public class HologramCommand extends Command {
|
|||
String[] ar = new String[]{ChatColor.AQUA + "Hi", ChatColor.DARK_PURPLE + "What", ChatColor.GOLD + "Hello World"};
|
||||
Location location = player.getLocation();
|
||||
for (String line : ar) {
|
||||
ArmorStand stand = location.getWorld().spawn(location.subtract(0, 0.3, 0), ArmorStand.class, armorStand -> {
|
||||
armorStand.setVisible(false);
|
||||
});
|
||||
ArmorStand stand = location.getWorld().spawn(location.subtract(0, 0.3, 0), ArmorStand.class);
|
||||
stand.setVisible(false);
|
||||
stand.setGravity(false);
|
||||
stand.setInvulnerable(true);
|
||||
stand.setCustomNameVisible(true);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package me.night.nullvalkyrie.commands;
|
||||
|
||||
import me.night.nullvalkyrie.Main;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
@ -22,13 +23,13 @@ public class VanishCommand extends Command {
|
|||
if (vanished.contains(player.getUniqueId())) {
|
||||
vanished.remove(player.getUniqueId());
|
||||
for (Player target : Bukkit.getOnlinePlayers()) {
|
||||
target.showPlayer(player);
|
||||
target.showPlayer(Main.getPlugin(Main.class), player);
|
||||
}
|
||||
player.sendMessage(ChatColor.GREEN + "You are now seen by people");
|
||||
} else {
|
||||
vanished.add(player.getUniqueId());
|
||||
for (Player target : Bukkit.getOnlinePlayers()) {
|
||||
target.hidePlayer(player);
|
||||
target.hidePlayer(Main.getPlugin(Main.class), player);
|
||||
}
|
||||
player.sendMessage(ChatColor.GREEN + "You are now vanished");
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ public class CustomWeaponsDataManager {
|
|||
abi.put("Name", ability.getString("Name"));
|
||||
List<String> details = new ArrayList<>();
|
||||
if (ability.get("Details") != null)
|
||||
for (String s : (List<String>) ability.get("Details")) details.add(s);
|
||||
details.addAll((List<String>) ability.get("Details"));
|
||||
abi.put("Details", details);
|
||||
for (String a : properties.keySet()) prop.put(a, properties.get(a));
|
||||
lores.put("Ability", abi);
|
||||
|
@ -49,7 +49,7 @@ public class CustomWeaponsDataManager {
|
|||
for (String i : ing.keySet())
|
||||
ingredients.put(i, ing.getString(i));
|
||||
List<String> shapes = new ArrayList<>();
|
||||
if (recipe.get("Shapes") != null) for (String s : (List<String>) recipe.get("Shapes")) shapes.add(s);
|
||||
if (recipe.get("Shapes") != null) shapes.addAll((List<String>) recipe.get("Shapes"));
|
||||
recipes.put("Shape", shapes);
|
||||
recipes.put("Amount", recipe.getInteger("Amount"));
|
||||
recipes.put("Ingredients", ingredients);
|
||||
|
@ -83,7 +83,7 @@ public class CustomWeaponsDataManager {
|
|||
abi.put("Name", ability.getString("Name"));
|
||||
List<String> details = new ArrayList<>();
|
||||
if (ability.get("Details") != null)
|
||||
for (String s : (List<String>) ability.get("Details")) details.add(s);
|
||||
details.addAll((List<String>) ability.get("Details"));
|
||||
abi.put("Details", details);
|
||||
for (String a : properties.keySet()) prop.put(a, properties.get(a));
|
||||
lores.put("Ability", abi);
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package me.night.nullvalkyrie.database;
|
||||
|
||||
import com.mongodb.client.MongoCursor;
|
||||
import com.mongodb.client.model.Filters;
|
||||
import me.night.nullvalkyrie.entities.miners.CryptoMiner;
|
||||
import org.bson.Document;
|
||||
import org.bson.conversions.Bson;
|
||||
|
@ -32,23 +31,19 @@ public class MinerDataManager {
|
|||
}
|
||||
|
||||
public static long getLastClaim(long id) {
|
||||
try (MongoCursor<Document> cursor = DatabaseManager.getMinersDB().find(Filters.eq("ID", id)).cursor()) {
|
||||
while (cursor.hasNext()) {
|
||||
Document doc = cursor.next();
|
||||
for (String key : doc.keySet()) {
|
||||
if (key.equals("LastClaim")) return (long) doc.get(key);
|
||||
}
|
||||
Document doc = DatabaseManager.getMinersDB().find(new Document("ID", id)).first();
|
||||
if (doc != null) {
|
||||
for (String key : doc.keySet()) {
|
||||
if (key.equals("LastClaim")) return (long) doc.get(key);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static CryptoMiner getMiner(long id) {
|
||||
try (MongoCursor<Document> cursor = DatabaseManager.getMinersDB().find(Filters.eq("ID", id)).cursor()) {
|
||||
while (cursor.hasNext()) {
|
||||
Document doc = cursor.next();
|
||||
return new CryptoMiner(doc.getString("Name"), Material.matchMaterial(doc.getString("Material")), doc.getInteger("Level"), doc.getDouble("Rate"), doc.getLong("LastClaim"));
|
||||
}
|
||||
Document doc = DatabaseManager.getMinersDB().find(new Document("ID", id)).first();
|
||||
if (doc != null) {
|
||||
return new CryptoMiner(doc.getString("Name"), Material.matchMaterial(doc.getString("Material")), doc.getInteger("Level"), doc.getDouble("Rate"), doc.getLong("LastClaim"));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -9,7 +9,6 @@ import javax.security.auth.login.LoginException;
|
|||
|
||||
|
||||
public class DiscordClientManager {
|
||||
private JDA jda;
|
||||
|
||||
public DiscordClientManager() {
|
||||
register();
|
||||
|
@ -19,7 +18,7 @@ public class DiscordClientManager {
|
|||
JDABuilder builder = JDABuilder.createDefault(Main.env.get("DISCORD_TOKEN"));
|
||||
builder.setActivity(Activity.streaming("cath.exe", "https://www.youtube.com/watch?v=YSKDu1gKntY"));
|
||||
try {
|
||||
jda = builder.build();
|
||||
JDA jda = builder.build();
|
||||
} catch (LoginException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
|
|
@ -8,8 +8,8 @@ import org.bukkit.event.HandlerList;
|
|||
import org.jetbrains.annotations.NotNull;
|
||||
public class InteractHologramEvent extends Event implements Cancellable {
|
||||
private boolean isCancelled;
|
||||
public Player player;
|
||||
public ArmorStand hologram;
|
||||
public final Player player;
|
||||
public final ArmorStand hologram;
|
||||
private static final HandlerList HANDLERS = new HandlerList();
|
||||
public InteractHologramEvent(Player player, ArmorStand hologram) {
|
||||
this.player = player;
|
||||
|
|
|
@ -230,9 +230,8 @@ public class CustomItemEvents implements Listener {
|
|||
|
||||
@EventHandler
|
||||
public void onDamage(EntityDamageByEntityEvent e) {
|
||||
if (e.getEntity() instanceof Player) {
|
||||
Player player = (Player) e.getEntity();
|
||||
// if ((player.getHealth() - e.getDamage()) <= 0) {
|
||||
if (e.getEntity() instanceof Player player) {
|
||||
// if ((player.getHealth() - e.getDamage()) <= 0) {
|
||||
// e.setCancelled(true);
|
||||
// Location loc = player.getWorld().getBlockAt(-3, 23, -3).getLocation();
|
||||
// player.teleport(loc);
|
||||
|
@ -335,7 +334,7 @@ public class CustomItemEvents implements Listener {
|
|||
}
|
||||
}
|
||||
|
||||
ProtocolManager manager = ProtocolLibrary.getProtocolManager();
|
||||
final ProtocolManager manager = ProtocolLibrary.getProtocolManager();
|
||||
|
||||
public void sendBlockDamage(Player player, Block block) {
|
||||
Location location = block.getLocation();
|
||||
|
|
|
@ -18,7 +18,7 @@ import java.text.DecimalFormat;
|
|||
import java.util.*;
|
||||
|
||||
public class DamageEffectEvents implements Listener {
|
||||
public World world = Bukkit.getWorld("world");
|
||||
public final World world = Bukkit.getWorld("world");
|
||||
public final Map<Entity, Integer> indicators = new HashMap<>();
|
||||
private final DecimalFormat formatter = new DecimalFormat("#");
|
||||
|
||||
|
|
|
@ -15,8 +15,8 @@ import org.bukkit.event.weather.WeatherChangeEvent;
|
|||
import java.io.File;
|
||||
|
||||
public class ServerEvents implements Listener {
|
||||
public BossBar bossbar;
|
||||
public PacketInjector injector;
|
||||
public final BossBar bossbar;
|
||||
public final PacketInjector injector;
|
||||
public ServerEvents() {
|
||||
bossbar = Bukkit.createBossBar(ChatColor.GOLD + "Kuudra", BarColor.RED, BarStyle.SEGMENTED_12);
|
||||
this.injector = new PacketInjector();
|
||||
|
|
|
@ -21,7 +21,7 @@ import java.util.*;
|
|||
import static me.night.nullvalkyrie.database.CustomWeaponsDataManager.getWeapon;
|
||||
|
||||
public class CustomItemManager {
|
||||
public static HashMap<String, NamespacedKey> keys = new HashMap<>();
|
||||
public static final HashMap<String, NamespacedKey> keys = new HashMap<>();
|
||||
|
||||
public static ItemStack produceItem(String itemName) {
|
||||
HashMap<String, Object> weapon = getWeapon(itemName);
|
||||
|
|
|
@ -7,8 +7,8 @@ import org.bukkit.inventory.ItemStack;
|
|||
import java.util.HashMap;
|
||||
|
||||
public class Pickaxe {
|
||||
public ArrayListMultimap<Material, Material> multimap = ArrayListMultimap.create();
|
||||
public HashMap<Material, Long> phases = new HashMap<>();
|
||||
public final ArrayListMultimap<Material, Material> multimap = ArrayListMultimap.create();
|
||||
public final HashMap<Material, Long> phases = new HashMap<>();
|
||||
private final ItemStack itemStack;
|
||||
public Pickaxe(ItemStack item) {
|
||||
multimap.put(Material.STONE_PICKAXE, Material.IRON_ORE); //put some blocks and pickaxe to mine
|
||||
|
|
|
@ -21,6 +21,7 @@ public class InventoryListener implements Listener {
|
|||
player.sendMessage(ChatColor.RED + "又做兵 抵死");
|
||||
break;
|
||||
case 22:
|
||||
player.teleport(player.getWorld().getSpawnLocation());
|
||||
break;
|
||||
case 24:
|
||||
player.closeInventory();
|
||||
|
|
|
@ -6,6 +6,8 @@ import org.bukkit.Bukkit;
|
|||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scoreboard.*;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class NameTagManager {
|
||||
public void setNametags(Player player) {
|
||||
Scoreboard newScoreboard = Bukkit.getScoreboardManager().getNewScoreboard();
|
||||
|
@ -27,8 +29,7 @@ public class NameTagManager {
|
|||
public void newTag(Player player) {
|
||||
Rank rank = RankDataManager.getRank(player.getUniqueId());
|
||||
for (Player target : Bukkit.getOnlinePlayers()) {
|
||||
if (rank == null) target.getScoreboard().getTeam(Rank.ROOKIE.name()).addEntry(player.getName());
|
||||
else target.getScoreboard().getTeam(rank.name()).addEntry(player.getName());
|
||||
target.getScoreboard().getTeam(Objects.requireNonNullElse(rank, Rank.ROOKIE).name()).addEntry(player.getName());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue