mirror of
https://github.com/devLukaDev/PureKitPvP.git
synced 2026-11-05 01:00:08 -05:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
65517a300d | ||
|
|
1d7cbc1422 | ||
|
|
adf60eb533 | ||
|
|
1ddfe08162 | ||
|
|
19338dcdcd | ||
|
|
4c9bb79652 |
No files matched your search
+5
-49
@@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>me.lifelessnerd.purekitpvp</groupId>
|
||||
<artifactId>PureKitPvP</artifactId>
|
||||
<version>1.3</version>
|
||||
<version>1.4</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>PureKitPvP</name>
|
||||
@@ -24,8 +24,8 @@
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<configuration>
|
||||
<source>16</source>
|
||||
<target>16</target>
|
||||
<source>17</source>
|
||||
<target>17</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
@@ -44,45 +44,12 @@
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<!-- <plugin>-->
|
||||
<!-- <groupId>net.md-5</groupId>-->
|
||||
<!-- <artifactId>specialsource-maven-plugin</artifactId>-->
|
||||
<!-- <version>1.2.2</version>-->
|
||||
<!-- <executions>-->
|
||||
<!-- <execution>-->
|
||||
<!-- <phase>package</phase>-->
|
||||
<!-- <goals>-->
|
||||
<!-- <goal>remap</goal>-->
|
||||
<!-- </goals>-->
|
||||
<!-- <id>remap-obf</id>-->
|
||||
<!-- <configuration>-->
|
||||
<!-- <srgIn>org.spigotmc:minecraft-server:1.20.2-R0.1-SNAPSHOT:txt:maps-mojang</srgIn>-->
|
||||
<!-- <reverse>true</reverse>-->
|
||||
<!-- <remappedDependencies>org.spigotmc:spigot:1.20.2-R0.1-SNAPSHOT:jar:remapped-mojang</remappedDependencies>-->
|
||||
<!-- <remappedArtifactAttached>true</remappedArtifactAttached>-->
|
||||
<!-- <remappedClassifierName>remapped-obf</remappedClassifierName>-->
|
||||
<!-- </configuration>-->
|
||||
<!-- </execution>-->
|
||||
<!-- <execution>-->
|
||||
<!-- <phase>package</phase>-->
|
||||
<!-- <goals>-->
|
||||
<!-- <goal>remap</goal>-->
|
||||
<!-- </goals>-->
|
||||
<!-- <id>remap-spigot</id>-->
|
||||
<!-- <configuration>-->
|
||||
<!-- <inputFile>${project.build.directory}/${project.artifactId}-${project.version}-remapped-obf.jar</inputFile>-->
|
||||
<!-- <srgIn>org.spigotmc:minecraft-server:1.20.2-R0.1-SNAPSHOT:csrg:maps-spigot</srgIn>-->
|
||||
<!-- <remappedDependencies>org.spigotmc:spigot:1.20.2-R0.1-SNAPSHOT:jar:remapped-obf</remappedDependencies>-->
|
||||
<!-- </configuration>-->
|
||||
<!-- </execution>-->
|
||||
<!-- </executions>-->
|
||||
<!-- </plugin>-->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>3.3.0</version>
|
||||
<configuration>
|
||||
<outputDirectory>F:\Minecraft\Servers\MC 1.20.4 Server\plugins</outputDirectory>
|
||||
<outputDirectory>/run/media/luka/250GB SATA SSD/Minecraft/Servers/1.21.11/plugins/</outputDirectory>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
@@ -103,10 +70,6 @@
|
||||
<id>sonatype</id>
|
||||
<url>https://oss.sonatype.org/content/groups/public/</url>
|
||||
</repository>
|
||||
<!-- <repository>-->
|
||||
<!-- <id>sk89q-repo</id>-->
|
||||
<!-- <url>https://maven.enginehub.org/repo/</url>-->
|
||||
<!-- </repository>-->
|
||||
<repository>
|
||||
<id>sonatype-snapshots</id>
|
||||
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
|
||||
@@ -118,21 +81,14 @@
|
||||
<dependency>
|
||||
<groupId>io.papermc.paper</groupId>
|
||||
<artifactId>paper-api</artifactId>
|
||||
<version>1.20.4-R0.1-SNAPSHOT</version>
|
||||
<version>1.21.1-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- https://github.com/CatCoderr/ProtocolSidebar -->
|
||||
<dependency>
|
||||
<groupId>me.catcoder</groupId>
|
||||
<artifactId>bukkit-sidebar</artifactId>
|
||||
<version>6.2.5-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/com.j256.ormlite/ormlite-jdbc -->
|
||||
<dependency>
|
||||
<groupId>com.j256.ormlite</groupId>
|
||||
<artifactId>ormlite-jdbc</artifactId>
|
||||
<version>6.1</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -38,7 +38,7 @@ public class InfoCommand extends Subcommand{
|
||||
|
||||
String message =
|
||||
"""
|
||||
&bPureKitPvP - version 1.3
|
||||
&bPureKitPvP - version 1.4
|
||||
&6Discord Support: &ohttps://discord.com/invite/8n65jSEkVf
|
||||
&6SpigotMC: &ohttps://bit.ly/PureKitPvPSpigotMC
|
||||
&6Github: &ohttps://github.com/LifelessNerd/PureKitPvP
|
||||
|
||||
@@ -7,7 +7,6 @@ import me.lifelessnerd.purekitpvp.combathandlers.killhandler.DeathHandler;
|
||||
import me.lifelessnerd.purekitpvp.database.KitDatabase;
|
||||
import me.lifelessnerd.purekitpvp.files.lang.LanguageConfig;
|
||||
import me.lifelessnerd.purekitpvp.globalevents.events.DoubleHealthListeners;
|
||||
import me.lifelessnerd.purekitpvp.scoreboards.SidebarScoreboard;
|
||||
import me.lifelessnerd.purekitpvp.cosmetics.cosmeticsCommand.CosmeticsCommand;
|
||||
import me.lifelessnerd.purekitpvp.cosmetics.cosmeticsCommand.CosmeticsGUIListener;
|
||||
import me.lifelessnerd.purekitpvp.cosmetics.cosmeticsCommand.inventories.KillEffectInventory;
|
||||
@@ -94,8 +93,6 @@ public final class PureKitPvP extends JavaPlugin {
|
||||
LanguageConfig.save();
|
||||
LanguageConfig.loadLanguage();
|
||||
|
||||
SidebarScoreboard scoreboard = new SidebarScoreboard(this);
|
||||
|
||||
getCommand("getkit").setExecutor(new GetKit(this));
|
||||
getCommand("kit").setExecutor(new KitsGUI(this));
|
||||
getCommand("perk").setExecutor(new PerkCommand(this));
|
||||
|
||||
@@ -2,7 +2,6 @@ package me.lifelessnerd.purekitpvp;
|
||||
|
||||
import me.lifelessnerd.purekitpvp.files.*;
|
||||
import me.lifelessnerd.purekitpvp.files.lang.LanguageConfig;
|
||||
import me.lifelessnerd.purekitpvp.scoreboards.SidebarScoreboard;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.format.NamedTextColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@@ -73,8 +72,6 @@ public class ReloadPlugin extends Subcommand {
|
||||
plugin.saveConfig();
|
||||
plugin.saveDefaultConfig();
|
||||
|
||||
SidebarScoreboard scoreboard = new SidebarScoreboard(plugin); // Make new Scoreboard instance
|
||||
|
||||
sender.sendMessage(Component.text("Plugin configs were reloaded!"));
|
||||
sender.sendMessage(Component.text("Please note that settings relating to events are not reloaded." +
|
||||
"\nIf you have made such changes, a server reload/restart is required.").color(NamedTextColor.GRAY));
|
||||
|
||||
+1
-1
@@ -6,8 +6,8 @@ import org.bukkit.entity.EnderPearl;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.EntityDismountEvent;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.spigotmc.event.entity.EntityDismountEvent;
|
||||
|
||||
public class PearlListener implements Listener {
|
||||
|
||||
|
||||
+1
-1
@@ -103,7 +103,7 @@ public class DeathHandler implements Listener {
|
||||
player.setExp(0f);
|
||||
player.setLevel(0);
|
||||
player.setArrowsInBody(0);
|
||||
player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 5, 254)); //Kinda jank, works tho
|
||||
player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP_BOOST, 5, 254)); //Kinda jank, works tho
|
||||
player.setFireTicks(0);
|
||||
player.addPotionEffect(new PotionEffect(PotionEffectType.FIRE_RESISTANCE, 5, 1));
|
||||
player.addPotionEffect(new PotionEffect(PotionEffectType.SATURATION, 10 , 1));
|
||||
|
||||
+16
-14
@@ -33,7 +33,7 @@ public class OnPlayerSpawnMob implements Listener {
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void playerUseSpawnEgg(PlayerInteractEvent e){
|
||||
public void playerUseSpawnEgg(PlayerInteractEvent e) {
|
||||
|
||||
Player player = e.getPlayer();
|
||||
|
||||
@@ -41,26 +41,25 @@ public class OnPlayerSpawnMob implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(e.getAction() == Action.RIGHT_CLICK_BLOCK)) {
|
||||
if (!(e.getAction() == Action.RIGHT_CLICK_BLOCK)) {
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if (!(player.getInventory().getItemInMainHand().getType().toString().contains("_SPAWN_EGG"))){
|
||||
if (!(player.getInventory().getItemInMainHand().getType().toString().contains("_SPAWN_EGG"))) {
|
||||
return;
|
||||
}
|
||||
|
||||
EntityType entityTypeTBS;
|
||||
ItemStack item = player.getInventory().getItemInMainHand();
|
||||
boolean customMob = false;
|
||||
if (item.getItemMeta().getPersistentDataContainer().has(new NamespacedKey(plugin, "custom_mob_id"), PersistentDataType.STRING)){
|
||||
if (item.getItemMeta().getPersistentDataContainer().has(new NamespacedKey(plugin, "custom_mob_id"), PersistentDataType.STRING)) {
|
||||
// Custom Mob has been attempted to spawn
|
||||
String customMobId = item.getItemMeta().getPersistentDataContainer().get(new NamespacedKey(plugin, "custom_mob_id"), PersistentDataType.STRING);
|
||||
String mobType = MobSpawnConfig.get().getString(customMobId + ".type");
|
||||
entityTypeTBS = EntityType.valueOf(mobType);
|
||||
customMob = true;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
String[] entityToBeSpawnedList = item.getType().toString().split("_SPAWN_EGG");
|
||||
String entityToBeSpawned = entityToBeSpawnedList[0];
|
||||
|
||||
@@ -71,8 +70,8 @@ public class OnPlayerSpawnMob implements Listener {
|
||||
Location lookPlace = e.getInteractionPoint();
|
||||
Entity spawnedEntity = player.getWorld().spawnEntity(lookPlace, entityTypeTBS);
|
||||
|
||||
if (spawnedEntity instanceof Chicken){
|
||||
if (plugin.getConfig().getBoolean("chicken-prevention")){
|
||||
if (spawnedEntity instanceof Chicken) {
|
||||
if (plugin.getConfig().getBoolean("chicken-prevention")) {
|
||||
player.sendMessage(Component.text("ChickenPrevention prevented your chicken from spawning.").color(NamedTextColor.RED));
|
||||
return;
|
||||
}
|
||||
@@ -94,7 +93,7 @@ public class OnPlayerSpawnMob implements Listener {
|
||||
if (customMob) {
|
||||
String customModId = item.getItemMeta().getPersistentDataContainer().get(new NamespacedKey(plugin, "custom_mob_id"), PersistentDataType.STRING);
|
||||
// System.out.println(customModId);
|
||||
if (spawnedEntity instanceof Mob){
|
||||
if (spawnedEntity instanceof Mob) {
|
||||
ItemStack mainHand = MobSpawnConfig.get().getItemStack(customModId + ".mainhand");
|
||||
((Mob) spawnedEntity).getEquipment().setItemInMainHand(mainHand);
|
||||
ItemStack offHand = MobSpawnConfig.get().getItemStack(customModId + ".offhand");
|
||||
@@ -141,12 +140,13 @@ public class OnPlayerSpawnMob implements Listener {
|
||||
|
||||
|
||||
}
|
||||
|
||||
// Stolen from https://www.spigotmc.org/threads/how-do-i-get-the-nearest-player.506654/
|
||||
public static @Nullable Player getNearestPlayer(Player player) {
|
||||
World world = player.getWorld();
|
||||
Location location = player.getLocation();
|
||||
ArrayList<Player> playersInWorld = new ArrayList<>(world.getEntitiesByClass(Player.class));
|
||||
if(playersInWorld.size()==1) return null;
|
||||
if (playersInWorld.size() == 1) return null;
|
||||
playersInWorld.remove(player); //Removes player itself
|
||||
playersInWorld.sort(Comparator.comparingDouble(o -> o.getLocation().distanceSquared(location)));
|
||||
return playersInWorld.get(0);
|
||||
@@ -160,13 +160,13 @@ public class OnPlayerSpawnMob implements Listener {
|
||||
if (!(entity.getWorld().getName().equalsIgnoreCase(plugin.getConfig().getString("world")))) {
|
||||
return;
|
||||
}
|
||||
if(toBeCancelled){
|
||||
if (toBeCancelled) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void mobTargetEvent(EntityTargetEvent e){
|
||||
public void mobTargetEvent(EntityTargetEvent e) {
|
||||
|
||||
Entity entity = e.getEntity();
|
||||
Entity target = e.getTarget();
|
||||
@@ -180,9 +180,11 @@ public class OnPlayerSpawnMob implements Listener {
|
||||
String entityName = entity.getName();
|
||||
String playerName = entityName.split("'s")[0]; // Gets name of player who spawned it
|
||||
Player player = Bukkit.getPlayerExact(playerName); // TODOX: This is quite janky, requires testing: seems to work!
|
||||
Player closestPlayer = getNearestPlayer(player); // NPE has no effect it seems; target becomes null and zombie is fine with that
|
||||
((Monster) entity).setTarget(closestPlayer);
|
||||
if (player != null) {
|
||||
Player closestPlayer = getNearestPlayer(player); // NPE has no effect it seems; target becomes null and zombie is fine with that
|
||||
((Monster) entity).setTarget(closestPlayer);
|
||||
// System.out.println(entity + "'s target set to " + closestPlayer);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
+1
-1
@@ -51,7 +51,7 @@ public CosmeticsCommand(Plugin plugin) {
|
||||
// Kill cosmetics button
|
||||
ItemStack killEffectButton = new ItemStack(Material.DIAMOND_SWORD);
|
||||
ItemMeta killEffectButtonMeta = killEffectButton.getItemMeta();
|
||||
killEffectButtonMeta.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS);
|
||||
killEffectButtonMeta.addItemFlags(ItemFlag.HIDE_ADDITIONAL_TOOLTIP);
|
||||
killEffectButtonMeta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES);
|
||||
killEffectButtonMeta.displayName(Component.text("Kill Effect").color(TextColor.color(200, 152, 0)).decoration(TextDecoration.ITALIC, false));
|
||||
List<Component> loreList2 = new ArrayList<>();
|
||||
|
||||
+2
-2
@@ -41,7 +41,7 @@ public class KillEffectInventory implements Listener {
|
||||
for (String killEffect : lib.killEffects.keySet()) {
|
||||
ItemStack effectItem = new ItemStack(lib.killEffects.get(killEffect), 1);
|
||||
ItemMeta itemMeta = effectItem.getItemMeta();
|
||||
itemMeta.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS);
|
||||
itemMeta.addItemFlags(ItemFlag.HIDE_ADDITIONAL_TOOLTIP);
|
||||
itemMeta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES);
|
||||
itemMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
|
||||
Component displayName = Component.text(MyStringUtils.cosmeticIdToItemName(killEffect));
|
||||
@@ -59,7 +59,7 @@ public class KillEffectInventory implements Listener {
|
||||
if (configValue.equalsIgnoreCase(killEffect)){
|
||||
displayName = displayName.color(NamedTextColor.GREEN).decoration(TextDecoration.ITALIC, false);
|
||||
displayName = displayName.decoration(TextDecoration.BOLD, true);
|
||||
itemMeta.addEnchant(Enchantment.DAMAGE_ALL, 1, true);
|
||||
itemMeta.addEnchant(Enchantment.SHARPNESS, 1, true);
|
||||
} else {
|
||||
displayName = displayName.color(NamedTextColor.RED).decoration(TextDecoration.ITALIC, false);;
|
||||
}
|
||||
|
||||
+2
-2
@@ -40,7 +40,7 @@ public class KillMessageInventory implements Listener {
|
||||
for (String messageEffect : lib.messageEffects.keySet()) {
|
||||
ItemStack effectItem = new ItemStack(lib.messageEffects.get(messageEffect), 1);
|
||||
ItemMeta itemMeta = effectItem.getItemMeta();
|
||||
itemMeta.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS);
|
||||
itemMeta.addItemFlags(ItemFlag.HIDE_ADDITIONAL_TOOLTIP);
|
||||
itemMeta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES);
|
||||
itemMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
|
||||
Component displayName = Component.text(MyStringUtils.cosmeticIdToItemName(messageEffect));
|
||||
@@ -58,7 +58,7 @@ public class KillMessageInventory implements Listener {
|
||||
if (configValue.equalsIgnoreCase(messageEffect)){
|
||||
displayName = displayName.color(NamedTextColor.GREEN).decoration(TextDecoration.ITALIC, false);
|
||||
displayName = displayName.decoration(TextDecoration.BOLD, true);
|
||||
itemMeta.addEnchant(Enchantment.DAMAGE_ALL, 1, true);
|
||||
itemMeta.addEnchant(Enchantment.SHARPNESS, 1, true);
|
||||
} else {
|
||||
displayName = displayName.color(NamedTextColor.RED).decoration(TextDecoration.ITALIC, false);;
|
||||
}
|
||||
|
||||
+2
-2
@@ -40,7 +40,7 @@ public class ProjectileTrailInventory implements Listener {
|
||||
for (String projectileTrail : lib.trailEffects.keySet()) {
|
||||
ItemStack effectItem = new ItemStack(lib.trailEffects.get(projectileTrail), 1);
|
||||
ItemMeta itemMeta = effectItem.getItemMeta();
|
||||
itemMeta.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS);
|
||||
itemMeta.addItemFlags(ItemFlag.HIDE_ADDITIONAL_TOOLTIP);
|
||||
itemMeta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES);
|
||||
itemMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
|
||||
Component displayName = Component.text(MyStringUtils.cosmeticIdToItemName(projectileTrail));
|
||||
@@ -58,7 +58,7 @@ public class ProjectileTrailInventory implements Listener {
|
||||
if (configValue.equalsIgnoreCase(projectileTrail)){
|
||||
displayName = displayName.color(NamedTextColor.GREEN).decoration(TextDecoration.ITALIC, false);
|
||||
displayName = displayName.decoration(TextDecoration.BOLD, true);
|
||||
itemMeta.addEnchant(Enchantment.DAMAGE_ALL, 1, true);
|
||||
itemMeta.addEnchant(Enchantment.SHARPNESS, 1, true);
|
||||
} else {
|
||||
displayName = displayName.color(NamedTextColor.RED).decoration(TextDecoration.ITALIC, false);;
|
||||
}
|
||||
|
||||
+2
-2
@@ -81,7 +81,7 @@ public class KillEffect implements Listener {
|
||||
|
||||
public static void firework(Location location) {
|
||||
location = location.add(0,1.4,0);
|
||||
Firework fw = (Firework) location.getWorld().spawnEntity(location, EntityType.FIREWORK);
|
||||
Firework fw = (Firework) location.getWorld().spawnEntity(location, EntityType.FIREWORK_ROCKET);
|
||||
FireworkMeta fwm = fw.getFireworkMeta();
|
||||
fwm.addEffect(FireworkEffect.builder().withColor(Color.RED).withColor(Color.WHITE).flicker(true).build());
|
||||
fw.setMetadata("nodamage", new FixedMetadataValue(plugin, true));
|
||||
@@ -104,7 +104,7 @@ public class KillEffect implements Listener {
|
||||
for (float i = 0.5f; i < 1.8f; i += 0.1) {
|
||||
float rndFloat = rnd.nextFloat() / 10;
|
||||
location.getWorld().spawnParticle(
|
||||
Particle.BLOCK_CRACK,
|
||||
Particle.BLOCK,
|
||||
location.add(rndFloat,i,rndFloat),
|
||||
20,
|
||||
Material.REDSTONE_BLOCK.createBlockData()
|
||||
|
||||
+3
-3
@@ -106,16 +106,16 @@ public class ProjectileTrail implements Listener {
|
||||
location.getWorld().spawnParticle(Particle.END_ROD, location, plugin.getConfig().getInt("projectile-trail-count"), 0.1, 0.1, 0.1, 0.001, null, true);
|
||||
break;
|
||||
case "water_drip":
|
||||
location.getWorld().spawnParticle(Particle.DRIP_WATER, location, plugin.getConfig().getInt("projectile-trail-count"), 0.1, 0.1, 0.1, 0.001, null, true);
|
||||
location.getWorld().spawnParticle(Particle.DRIPPING_WATER, location, plugin.getConfig().getInt("projectile-trail-count"), 0.1, 0.1, 0.1, 0.001, null, true);
|
||||
break;
|
||||
case "heart":
|
||||
location.getWorld().spawnParticle(Particle.HEART, location, plugin.getConfig().getInt("projectile-trail-count"), 0.1, 0.1, 0.1, 0.001, null, true);
|
||||
break;
|
||||
case "firework":
|
||||
location.getWorld().spawnParticle(Particle.FIREWORKS_SPARK, location, plugin.getConfig().getInt("projectile-trail-count"), 0.1, 0.1, 0.1, 0.001, null, true);
|
||||
location.getWorld().spawnParticle(Particle.ELECTRIC_SPARK, location, plugin.getConfig().getInt("projectile-trail-count"), 0.1, 0.1, 0.1, 0.001, null, true);
|
||||
break;
|
||||
case "totem":
|
||||
location.getWorld().spawnParticle(Particle.TOTEM, location, plugin.getConfig().getInt("projectile-trail-count"), 0.1, 0.1, 0.1, 0.001, null, true);
|
||||
location.getWorld().spawnParticle(Particle.TOTEM_OF_UNDYING, location, plugin.getConfig().getInt("projectile-trail-count"), 0.1, 0.1, 0.1, 0.001, null, true);
|
||||
break;
|
||||
case "smoke":
|
||||
location.getWorld().spawnParticle(Particle.CAMPFIRE_COSY_SMOKE, location, plugin.getConfig().getInt("projectile-trail-count"), 0.1, 0.1, 0.1, 0.001, null, true);
|
||||
|
||||
@@ -186,6 +186,7 @@ public class LanguageConfig {
|
||||
defaults.put(LanguageKey.SCOREBOARD_GLOBAL_KILLS, " &dKills");
|
||||
defaults.put(LanguageKey.SCOREBOARD_GLOBAL_KD, " &dK/D Ratio");
|
||||
defaults.put(LanguageKey.SCOREBOARD_GLOBAL_LEVEL, "&dLevel");
|
||||
|
||||
defaults.put(LanguageKey.STATS_NO_STATS, "That player has no stats attached to them!");
|
||||
defaults.put(LanguageKey.STATS_TITLE, "%PLAYER% &bStatistics");
|
||||
defaults.put(LanguageKey.STATS_LEVEL_UP, "&6You leveled up to LEVEL %VALUE%!");
|
||||
|
||||
@@ -102,7 +102,7 @@ public class KitsGUI implements TabExecutor {
|
||||
|
||||
ItemStack itemStack = new ItemStack(Material.BARRIER);
|
||||
ItemMeta itemMeta = itemStack.getItemMeta();
|
||||
itemMeta.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS);
|
||||
itemMeta.addItemFlags(ItemFlag.HIDE_ADDITIONAL_TOOLTIP);
|
||||
itemMeta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES);
|
||||
|
||||
// Set gui item
|
||||
@@ -160,14 +160,14 @@ public class KitsGUI implements TabExecutor {
|
||||
String amount = String.valueOf(item.getAmount());
|
||||
lore.add(Component.text(amount + "x ", NamedTextColor.GRAY).decoration(TextDecoration.ITALIC, false).append(
|
||||
Component.text(MyStringUtils.itemCamelCase(item.getType().toString()), NamedTextColor.YELLOW)));
|
||||
lore.add(Component.text(" " + MyStringUtils.itemMetaToEffects(item.getItemMeta().toString()), NamedTextColor.GRAY));
|
||||
lore.add(Component.text(" " + MyStringUtils.potionMetaToEffects(item.getItemMeta()), NamedTextColor.GRAY));
|
||||
|
||||
} else if (item.getType().toString().equalsIgnoreCase("POTION")){
|
||||
//Do stuff with potions
|
||||
String amount = String.valueOf(item.getAmount());
|
||||
lore.add(Component.text(amount + "x ", NamedTextColor.GRAY).decoration(TextDecoration.ITALIC, false).append(
|
||||
Component.text(MyStringUtils.itemCamelCase(item.getType().toString()), NamedTextColor.YELLOW)));
|
||||
lore.add(Component.text(" " + MyStringUtils.itemMetaToEffects(item.getItemMeta().toString()), NamedTextColor.GRAY));
|
||||
lore.add(Component.text(" " + MyStringUtils.potionMetaToEffects(item.getItemMeta()), NamedTextColor.GRAY));
|
||||
|
||||
} else if (item.getType().toString().equalsIgnoreCase("PLAYER_HEAD")){
|
||||
|
||||
@@ -189,7 +189,7 @@ public class KitsGUI implements TabExecutor {
|
||||
Component.text(MyStringUtils.itemCamelCase(item.getType().toString()), NamedTextColor.YELLOW)));
|
||||
//If it has enchants, view them
|
||||
if (!(item.getEnchantments().isEmpty())){
|
||||
lore.add(Component.text(" " + MyStringUtils.mapStringToEnchantment(item.getEnchantments().toString()), NamedTextColor.GRAY));
|
||||
lore.add(Component.text(" " + MyStringUtils.mapEnchantmentsToString(item.getEnchantments()), NamedTextColor.GRAY));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-2
@@ -74,7 +74,7 @@ public class PerkGUIListener implements Listener {
|
||||
|
||||
ItemStack icon = new ItemStack(perkLib.perkIcons.get(perk));
|
||||
ItemMeta itemMeta = icon.getItemMeta();
|
||||
itemMeta.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS);
|
||||
itemMeta.addItemFlags(ItemFlag.HIDE_ADDITIONAL_TOOLTIP);
|
||||
itemMeta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES);
|
||||
itemMeta.displayName(Component.text(perk).color(TextColor.color(200, 0, 0)).decoration(TextDecoration.ITALIC, false));
|
||||
|
||||
@@ -82,7 +82,7 @@ public class PerkGUIListener implements Listener {
|
||||
for(String selectedPerkKey : PerkData.get().getConfigurationSection(player.getName()).getKeys(false)){
|
||||
String selectedPerk = PerkData.get().getString(player.getName() + "." + selectedPerkKey);
|
||||
if (perk.equals(selectedPerk)){
|
||||
itemMeta.addEnchant(Enchantment.DAMAGE_ALL, 1, true);
|
||||
itemMeta.addEnchant(Enchantment.SHARPNESS, 1, true);
|
||||
itemMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
|
||||
itemMeta.displayName(Component.text(perk).color(TextColor.color(50, 200, 0)).decoration(TextDecoration.BOLD, true).decoration(TextDecoration.ITALIC, false));
|
||||
}
|
||||
|
||||
+13
-11
@@ -6,6 +6,7 @@ import me.lifelessnerd.purekitpvp.files.PerkData;
|
||||
import me.lifelessnerd.purekitpvp.utils.ComponentUtils;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.attribute.Attribute;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.*;
|
||||
@@ -59,7 +60,7 @@ public class PerkFireHandler {
|
||||
break;
|
||||
case "BULLDOZER":
|
||||
|
||||
player.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 60, 1));
|
||||
player.addPotionEffect(new PotionEffect(PotionEffectType.STRENGTH, 60, 1));
|
||||
break;
|
||||
case "KNOWLEDGE":
|
||||
|
||||
@@ -71,7 +72,7 @@ public class PerkFireHandler {
|
||||
ItemMeta weaponMeta = weapon.getItemMeta();
|
||||
if (weaponMeta == null){continue;} // If weapon is hand TODO maybe - check if it is a weapon?
|
||||
if (weapon.getType() == Material.BOW){continue;} // meh
|
||||
int sharpnessLevel = weaponMeta.getEnchantLevel(Enchantment.DAMAGE_ALL);
|
||||
int sharpnessLevel = weaponMeta.getEnchantLevel(Enchantment.SHARPNESS);
|
||||
|
||||
double rnd = Math.random();
|
||||
if(rnd * 100 <= (100 - plugin.getConfig().getInt("notoriety-chance-decrease") * sharpnessLevel)) {
|
||||
@@ -83,8 +84,8 @@ public class PerkFireHandler {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
weaponMeta.removeEnchant(Enchantment.DAMAGE_ALL);
|
||||
weaponMeta.addEnchant(Enchantment.DAMAGE_ALL, sharpnessLevel + 1, true);
|
||||
weaponMeta.removeEnchant(Enchantment.SHARPNESS);
|
||||
weaponMeta.addEnchant(Enchantment.SHARPNESS, sharpnessLevel + 1, true);
|
||||
weapon.setItemMeta(weaponMeta);
|
||||
player.sendMessage(LanguageConfig.lang.get("PERKS_PERK_NOTORIETY_UPGRADE").
|
||||
replaceText(ComponentUtils.replaceConfig("%CHANCE%",
|
||||
@@ -109,7 +110,7 @@ public class PerkFireHandler {
|
||||
ItemMeta weaponMarksmanMeta = weaponMarksman.getItemMeta();
|
||||
if (weaponMarksman.getType() != Material.BOW){continue;}
|
||||
if (weaponMarksmanMeta == null){continue;} // If weapon is hand
|
||||
int powerLevel = weaponMarksmanMeta.getEnchantLevel(Enchantment.ARROW_DAMAGE);
|
||||
int powerLevel = weaponMarksmanMeta.getEnchantLevel(Enchantment.POWER);
|
||||
|
||||
double rnd2 = Math.random();
|
||||
if(rnd2 * 100 <= (100 - plugin.getConfig().getInt("notoriety-chance-decrease") * powerLevel)) {
|
||||
@@ -122,8 +123,8 @@ public class PerkFireHandler {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
weaponMarksmanMeta.removeEnchant(Enchantment.ARROW_DAMAGE);
|
||||
weaponMarksmanMeta.addEnchant(Enchantment.ARROW_DAMAGE, powerLevel + 1, true);
|
||||
weaponMarksmanMeta.removeEnchant(Enchantment.POWER);
|
||||
weaponMarksmanMeta.addEnchant(Enchantment.POWER, powerLevel + 1, true);
|
||||
weaponMarksman.setItemMeta(weaponMarksmanMeta);
|
||||
player.sendMessage(LanguageConfig.lang.get("PERKS_PERK_MARKSMAN_UPGRADE").
|
||||
replaceText(ComponentUtils.replaceConfig("%CHANCE%",
|
||||
@@ -218,11 +219,12 @@ public class PerkFireHandler {
|
||||
//Main logic
|
||||
double damageDealt = event.getDamage();
|
||||
double regen = damageDealt / 2;
|
||||
|
||||
if (player.getHealth() + regen <= 20){
|
||||
double maxHealth = player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue();
|
||||
// System.out.println(maxHealth);
|
||||
if (player.getHealth() + regen <= maxHealth){
|
||||
player.setHealth(player.getHealth() + regen);
|
||||
} else {
|
||||
player.setHealth(20);
|
||||
player.setHealth(maxHealth);
|
||||
}
|
||||
|
||||
player.playSound(player.getLocation(), Sound.ENTITY_PLAYER_BURP, 1,0);
|
||||
@@ -243,7 +245,7 @@ public class PerkFireHandler {
|
||||
switch(perk){
|
||||
case "SNOWMAN":
|
||||
if (event.getEntity() instanceof Snowball) {
|
||||
damaged.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 60, 0));
|
||||
damaged.addPotionEffect(new PotionEffect(PotionEffectType.SLOWNESS, 60, 0));
|
||||
}
|
||||
break;
|
||||
case "DISRUPTOR":
|
||||
|
||||
-244
@@ -1,244 +0,0 @@
|
||||
package me.lifelessnerd.purekitpvp.scoreboards;
|
||||
import me.catcoder.sidebar.ProtocolSidebar;
|
||||
import me.catcoder.sidebar.Sidebar;
|
||||
import me.catcoder.sidebar.pager.SidebarPager;
|
||||
import me.lifelessnerd.purekitpvp.files.lang.LanguageConfig;
|
||||
import me.lifelessnerd.purekitpvp.files.PlayerStatsConfig;
|
||||
import me.lifelessnerd.purekitpvp.utils.ComponentUtils;
|
||||
import me.lifelessnerd.purekitpvp.utils.DoubleUtils;
|
||||
import me.lifelessnerd.purekitpvp.utils.PlayerUtils;
|
||||
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.format.NamedTextColor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class SidebarScoreboard implements Listener {
|
||||
Plugin plugin;
|
||||
|
||||
|
||||
public SidebarScoreboard(Plugin plugin) {
|
||||
this.plugin = plugin;
|
||||
|
||||
|
||||
if (plugin.getConfig().getBoolean("scoreboard-enabled")){
|
||||
refreshLeaderboard();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void refreshLeaderboard() {
|
||||
Set<Player> players = PlayerUtils.getPlayersInWorld(plugin.getConfig().getString("world"));
|
||||
|
||||
List<String> enabled = plugin.getConfig().getStringList("enabled-slides");
|
||||
|
||||
ArrayList<Sidebar<Component>> enabledSidebars = new ArrayList<>();
|
||||
|
||||
Component titleComponent = LanguageConfig.lang.get("SCOREBOARD_MAIN_TITLE");
|
||||
|
||||
for (String panel : enabled) {
|
||||
|
||||
switch(panel){
|
||||
case "GlobalStats":
|
||||
Sidebar<Component> globalStatsSidebar = ProtocolSidebar.newAdventureSidebar(titleComponent, plugin);
|
||||
fillGlobalSidebar(globalStatsSidebar);
|
||||
enabledSidebars.add(globalStatsSidebar);
|
||||
break;
|
||||
case "PersonalStats":
|
||||
Sidebar<Component> personalStatsSidebar = ProtocolSidebar.newAdventureSidebar(titleComponent, plugin);
|
||||
fillPersonalSidebar(personalStatsSidebar);
|
||||
enabledSidebars.add(personalStatsSidebar);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
long period = plugin.getConfig().getInt("scoreboard-period") * 20L;
|
||||
SidebarPager<Component> pager = new SidebarPager<>(
|
||||
enabledSidebars, period, plugin);
|
||||
|
||||
// add page status line to all sidebars in pager
|
||||
pager.addPageLine((page, maxPage, sidebar) ->
|
||||
sidebar.addLine(Component.text("Page " + page + "/" + maxPage).color(NamedTextColor.GREEN)));
|
||||
|
||||
|
||||
for (Player player : players){
|
||||
pager.show(player);
|
||||
if (!(plugin.getConfig().getBoolean("scoreboard-enabled"))){
|
||||
pager.hide(player);
|
||||
}
|
||||
}
|
||||
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (plugin.getConfig().getBoolean("scoreboard-enabled")){
|
||||
refreshLeaderboard();
|
||||
}
|
||||
pager.destroy();
|
||||
}
|
||||
}.runTaskLater(plugin, period * 2);
|
||||
}
|
||||
|
||||
|
||||
private void fillGlobalSidebar(Sidebar<Component> sidebar) {
|
||||
|
||||
int places = plugin.getConfig().getInt("global-stats-place-amount");
|
||||
List<String> enabled = plugin.getConfig().getStringList("global-stats-components");
|
||||
|
||||
sidebar.addLine(LanguageConfig.lang.get("SCOREBOARD_GLOBAL_TITLE"));
|
||||
|
||||
for (String component : enabled){
|
||||
ArrayList<Component> createdLeaderboard = null;
|
||||
switch(component) {
|
||||
case "Killstreak":
|
||||
sidebar.addLine(LanguageConfig.lang.get("SCOREBOARD_GLOBAL_KILLSTREAK"));
|
||||
createdLeaderboard = createLeaderboard(".killstreak", places);
|
||||
|
||||
break;
|
||||
case "Level":
|
||||
sidebar.addLine(LanguageConfig.lang.get("SCOREBOARD_GLOBAL_LEVEL"));
|
||||
createdLeaderboard = createLeaderboard(".level", places);
|
||||
|
||||
break;
|
||||
case "Kills":
|
||||
sidebar.addLine(LanguageConfig.lang.get("SCOREBOARD_GLOBAL_KILLS"));
|
||||
createdLeaderboard = createLeaderboard(".kills", places);
|
||||
|
||||
break;
|
||||
case "KD":
|
||||
sidebar.addLine(LanguageConfig.lang.get("SCOREBOARD_GLOBAL_KD"));
|
||||
createdLeaderboard = createLeaderboard(".kdratio", places);
|
||||
|
||||
break;
|
||||
default:
|
||||
plugin.getLogger().warning("Global leaderboard components are wrongly defined! " +
|
||||
"If you do not want a global scoreboard, change this in the enabled-slides value.");
|
||||
createdLeaderboard = new ArrayList<>(); // This is empty; only happens when there are no/faulty values defined
|
||||
break;
|
||||
}
|
||||
|
||||
for (Component line : createdLeaderboard){
|
||||
sidebar.addUpdatableLine(
|
||||
(player) -> {
|
||||
return line;
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
sidebar.updateLinesPeriodically(0, 20);
|
||||
}
|
||||
|
||||
|
||||
private ArrayList<Component> createLeaderboard(String statKey, int places) {
|
||||
HashMap<String, Double> leaderboard = new HashMap<>();
|
||||
|
||||
Set<String> players = PlayerStatsConfig.get().getKeys(false);
|
||||
|
||||
for (String player : players){
|
||||
double statValue = PlayerStatsConfig.get().getDouble(player + statKey);
|
||||
leaderboard.put(player, statValue);
|
||||
}
|
||||
|
||||
ArrayList<Component> toBeReturned = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < places; i++) {
|
||||
double highestScore = 0;
|
||||
String highestPlayer = null;
|
||||
for (String player : leaderboard.keySet()) {
|
||||
if (leaderboard.get(player) > highestScore) {
|
||||
highestScore = leaderboard.get(player);
|
||||
highestPlayer = player;
|
||||
}
|
||||
}
|
||||
if (highestPlayer != null) {
|
||||
highestScore = DoubleUtils.round(highestScore, 2);
|
||||
if (highestScore % 1 == 0){
|
||||
int highestScoreInt = (int) highestScore;
|
||||
toBeReturned.add(Component.text(" " + highestPlayer + " - ", NamedTextColor.GRAY).append(Component.text(highestScoreInt, NamedTextColor.AQUA)));
|
||||
} else {
|
||||
toBeReturned.add(Component.text(" " + highestPlayer + " - ", NamedTextColor.GRAY).append(Component.text(highestScore, NamedTextColor.AQUA)));
|
||||
}
|
||||
leaderboard.remove(highestPlayer);
|
||||
}
|
||||
}
|
||||
|
||||
return toBeReturned;
|
||||
}
|
||||
|
||||
private void fillPersonalSidebar(Sidebar<Component> sidebar){
|
||||
|
||||
sidebar.addLine(LanguageConfig.lang.get("SCOREBOARD_PERSONAL_TITLE"));
|
||||
|
||||
List<String> enabled = plugin.getConfig().getStringList("personal-stats-components");
|
||||
|
||||
for (String component : enabled){
|
||||
switch(component){
|
||||
case "Killstreak":
|
||||
sidebar.addUpdatableLine(
|
||||
(player) -> LanguageConfig.lang.get("SCOREBOARD_PERSONAL_KILLSTREAK").
|
||||
replaceText(ComponentUtils.replaceConfig("%VALUE%",
|
||||
PlayerStatsConfig.get().getString(player.getName() + ".killstreak")))
|
||||
);
|
||||
break;
|
||||
case "Kills":
|
||||
sidebar.addUpdatableLine(
|
||||
(player) -> LanguageConfig.lang.get("SCOREBOARD_PERSONAL_KILLS").
|
||||
replaceText(ComponentUtils.replaceConfig("%VALUE%",
|
||||
PlayerStatsConfig.get().getString(player.getName() + ".kills")))
|
||||
);
|
||||
break;
|
||||
case "Deaths":
|
||||
sidebar.addUpdatableLine(
|
||||
(player) -> LanguageConfig.lang.get("SCOREBOARD_PERSONAL_DEATHS").
|
||||
replaceText(ComponentUtils.replaceConfig("%VALUE%",
|
||||
PlayerStatsConfig.get().getString(player.getName() + ".deaths")))
|
||||
);
|
||||
break;
|
||||
case "KD":
|
||||
sidebar.addUpdatableLine(
|
||||
(player) -> LanguageConfig.lang.get("SCOREBOARD_PERSONAL_KD").
|
||||
replaceText(ComponentUtils.replaceConfig("%VALUE%",
|
||||
String.valueOf(DoubleUtils.round(
|
||||
PlayerStatsConfig.get().getDouble(player.getName() + ".kdratio"), 2)
|
||||
)))
|
||||
);
|
||||
break;
|
||||
case "Level":
|
||||
sidebar.addUpdatableLine(
|
||||
(player) -> LanguageConfig.lang.get("SCOREBOARD_PERSONAL_LEVEL").
|
||||
replaceText(ComponentUtils.replaceConfig("%VALUE%",
|
||||
PlayerStatsConfig.get().getString(player.getName() + ".level")))
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
sidebar.updateLinesPeriodically(0, 20);
|
||||
}
|
||||
|
||||
private HashMap<String, Integer> orderLeaderboard(HashMap<String, Integer> unordered){
|
||||
HashMap<String, Integer> sortedMap = new HashMap<>();
|
||||
ArrayList<Integer> list = new ArrayList<>();
|
||||
for (Map.Entry<String, Integer> entry : unordered.entrySet()) {
|
||||
list.add(entry.getValue());
|
||||
}
|
||||
Collections.sort(list, new Comparator<Integer>() {
|
||||
public int compare(Integer int1, Integer int2) {
|
||||
return (int1).compareTo(int2);
|
||||
}
|
||||
});
|
||||
for (Integer integer : list) {
|
||||
for (Map.Entry<String, Integer> entry : unordered.entrySet()) {
|
||||
if (entry.getValue().equals(integer)) {
|
||||
sortedMap.put(entry.getKey(), integer);
|
||||
}
|
||||
}
|
||||
}
|
||||
return sortedMap;
|
||||
}
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
//package me.lifelessnerd.purekitpvp.scoreboards;
|
||||
//
|
||||
//
|
||||
//import me.lifelessnerd.purekitpvp.utils.ComponentUtils;
|
||||
//import me.lifelessnerd.purekitpvp.utils.PlayerUtils;
|
||||
//import net.kyori.adventure.text.Component;
|
||||
//import net.minecraft.network.protocol.game.ClientboundTabListPacket;
|
||||
//import net.minecraft.server.level.ServerPlayer;
|
||||
//import org.bukkit.Bukkit;
|
||||
//import org.bukkit.craftbukkit.v1_20_R2.entity.CraftPlayer;
|
||||
//import org.bukkit.entity.Player;
|
||||
//import org.bukkit.plugin.Plugin;
|
||||
//
|
||||
//import java.util.Set;
|
||||
//
|
||||
//
|
||||
//public class TabManager {
|
||||
//
|
||||
// private Plugin plugin;
|
||||
// private Component header = Component.text("");
|
||||
// private Component footer = Component.text("");
|
||||
//
|
||||
// public TabManager(Plugin plugin) {
|
||||
// this.plugin = plugin;
|
||||
// }
|
||||
// // CURRENTLY NOT IN USE
|
||||
// public void showTab(){
|
||||
// if(header == null && footer == null) return;
|
||||
//
|
||||
// Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, new Runnable() {
|
||||
//
|
||||
//
|
||||
// @Override
|
||||
// public void run() {
|
||||
//
|
||||
// // CURRENTLY NOT IN USE
|
||||
//
|
||||
// net.minecraft.network.chat.Component headerTBS = ComponentUtils.toMojangComponent(header);
|
||||
// net.minecraft.network.chat.Component footerTBS = ComponentUtils.toMojangComponent(footer);
|
||||
//
|
||||
// ClientboundTabListPacket packet = new ClientboundTabListPacket(headerTBS, footerTBS);
|
||||
//
|
||||
// Set<Player> inWorld = PlayerUtils.getPlayersInWorld(plugin.getConfig().getString("world"));
|
||||
// if (inWorld.size() != 0){
|
||||
// for (Player player : inWorld){
|
||||
// CraftPlayer cPlayer = (CraftPlayer) player; // frick nms
|
||||
// ServerPlayer serverPlayer = cPlayer.getHandle();
|
||||
// serverPlayer.connection.send(packet);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
// }
|
||||
// }, 10, plugin.getConfig().getLong("tab-refresh-period"));
|
||||
//
|
||||
// }
|
||||
// // CURRENTLY NOT IN USE
|
||||
// public void addHeader(Component header){
|
||||
// this.header = this.header.append(header).appendNewline();
|
||||
// }
|
||||
// public void addFooter(Component footer){
|
||||
// this.footer = this.footer.append(footer).appendNewline();
|
||||
// }
|
||||
//}
|
||||
@@ -2,14 +2,25 @@ package me.lifelessnerd.purekitpvp.utils;
|
||||
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.inventory.meta.PotionMeta;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionType;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class MyStringUtils {
|
||||
|
||||
public static String itemCamelCase(String string){
|
||||
public static String itemCamelCase(String string) {
|
||||
//Input: IRON_SWORD
|
||||
String[] split = string.split("_");
|
||||
StringBuilder processedSentence = new StringBuilder();
|
||||
for (String word : split){
|
||||
for (String word : split) {
|
||||
String processedWord = camelCaseWord(word);
|
||||
processedSentence.append(processedWord).append(" ");
|
||||
}
|
||||
@@ -18,15 +29,16 @@ public class MyStringUtils {
|
||||
//Output: Iron Sword
|
||||
}
|
||||
|
||||
public static String camelCaseWord(String string){
|
||||
public static String camelCaseWord(String string) {
|
||||
//Input: SAMPLE
|
||||
string = string.toLowerCase();
|
||||
return string.substring(0, 1).toUpperCase() + string.substring(1);
|
||||
//Output: Sample
|
||||
}
|
||||
|
||||
public static String mapStringToEnchantment(String string){
|
||||
|
||||
@Deprecated
|
||||
public static String mapStringToEnchantment(String string) {
|
||||
System.out.println(string);
|
||||
//{CraftEnchantment[minecraft:knockback]=11, CraftEnchantment[minecraft:fire_aspect]=2}
|
||||
StringBuilder result = new StringBuilder();
|
||||
|
||||
@@ -36,7 +48,7 @@ public class MyStringUtils {
|
||||
string = builder.toString();
|
||||
|
||||
String[] split = string.split(",");
|
||||
for(String substring : split){
|
||||
for (String substring : split) {
|
||||
substring = substring.trim();
|
||||
substring = substring.substring(16);
|
||||
String level = substring.split("=")[1];
|
||||
@@ -50,7 +62,58 @@ public class MyStringUtils {
|
||||
//Output: Knockback 11, Fire Aspect 2
|
||||
}
|
||||
|
||||
public static String itemMetaToEffects(String string){
|
||||
public static String mapEnchantmentsToString(Map<Enchantment, Integer> map) {
|
||||
if (map == null || map.isEmpty()) return "0";
|
||||
|
||||
return map.entrySet().stream()
|
||||
.map(e -> formatEnchantmentName(e.getKey()) + " " + romanize(e.getValue()))
|
||||
.collect(Collectors.joining(", "));
|
||||
}
|
||||
|
||||
private static String formatEnchantmentName(Enchantment enchantment) {
|
||||
String raw = enchantment.getKey().getKey(); // e.g. "sharpness", "blast_protection"
|
||||
return Arrays.stream(raw.split("_"))
|
||||
.map(word -> Character.toUpperCase(word.charAt(0)) + word.substring(1).toLowerCase())
|
||||
.collect(Collectors.joining(" "));
|
||||
}
|
||||
|
||||
public static String potionMetaToEffects(ItemMeta potionItemMeta) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
PotionMeta potionMeta = (PotionMeta) potionItemMeta;
|
||||
|
||||
// Add information about base effect
|
||||
if (potionMeta.getBasePotionType() == null) return "";
|
||||
if (!potionMeta.getBasePotionType().name().equals("WATER")) {
|
||||
for (PotionEffect potionEffect : potionMeta.getBasePotionType().getPotionEffects()) {
|
||||
String translationKey = potionEffect.getType().translationKey();
|
||||
String[] split = translationKey.split("\\.");
|
||||
sb.append(itemCamelCase(split[split.length - 1]));
|
||||
sb.append(romanize(potionEffect.getAmplifier() + 1));
|
||||
if (potionEffect.getDuration() > 1) sb.append(" (").append(potionEffect.getDuration()).append("s)");
|
||||
}
|
||||
}
|
||||
|
||||
List<PotionEffect> customEffects = potionMeta.getCustomEffects();
|
||||
if (!customEffects.isEmpty()) {
|
||||
// Add information about each custom effect
|
||||
if (!potionMeta.getBasePotionType().name().equals("WATER")) sb.append(", ");
|
||||
for (PotionEffect customEffect : customEffects) {
|
||||
String customEffectName = customEffect.getType().translationKey();
|
||||
String[] split = customEffectName.split("\\.");
|
||||
int amplifier = customEffect.getAmplifier() + 1;
|
||||
int duration = customEffect.getDuration();
|
||||
|
||||
sb.append(itemCamelCase(split[split.length - 1]));
|
||||
sb.append(romanize(amplifier));
|
||||
if (duration > 1) sb.append(" (").append(duration).append("s)");
|
||||
}
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static String itemMetaToEffects(String string) {
|
||||
|
||||
//I: POTION_META:meta-type=POTION, potion-type=minecraft:strong_healing)
|
||||
//OR
|
||||
@@ -58,30 +121,30 @@ public class MyStringUtils {
|
||||
|
||||
StringBuilder result = new StringBuilder("");
|
||||
|
||||
if (string.contains("custom-effects")){
|
||||
if (string.contains("custom-effects")) {
|
||||
|
||||
String[] split = string.split("custom-effects=");
|
||||
StringBuilder builder = new StringBuilder(split[1]);
|
||||
builder.deleteCharAt(0);
|
||||
builder.deleteCharAt(split[1].length() - 2 );
|
||||
builder.deleteCharAt(split[1].length() - 3 );
|
||||
builder.deleteCharAt(split[1].length() - 2);
|
||||
builder.deleteCharAt(split[1].length() - 3);
|
||||
String[] splitAgain = builder.toString().split(":");
|
||||
|
||||
result.append(itemCamelCase(splitAgain[0]));
|
||||
String meta = splitAgain[1];
|
||||
String[] splitOnceMore = meta.split("-");
|
||||
|
||||
StringBuilder time = new StringBuilder(splitOnceMore[0]);
|
||||
StringBuilder time = new StringBuilder(splitOnceMore[0]);
|
||||
time.deleteCharAt(splitOnceMore[0].length() - 1);
|
||||
int timeSec = Integer.parseInt(time.toString()) / 20;
|
||||
|
||||
|
||||
StringBuilder potency = new StringBuilder(splitOnceMore[1]);
|
||||
StringBuilder potency = new StringBuilder(splitOnceMore[1]);
|
||||
potency.deleteCharAt(0);
|
||||
int potencyInt = Integer.parseInt(potency.toString()) + 1;
|
||||
|
||||
StringBuilder lvlAndTime = new StringBuilder("");
|
||||
if (timeSec > 100000000){
|
||||
if (timeSec > 100000000) {
|
||||
lvlAndTime.append(potencyInt + " (Infinite)");
|
||||
} else {
|
||||
lvlAndTime.append(potencyInt + " (" + timeSec + "s)");
|
||||
@@ -96,11 +159,11 @@ public class MyStringUtils {
|
||||
StringBuilder effectB = new StringBuilder(split[1]);
|
||||
String effect = effectB.deleteCharAt(split[1].length() - 1).toString();
|
||||
|
||||
if (effect.contains("strong")){
|
||||
if (effect.contains("strong")) {
|
||||
String[] splitAgain = effect.split("strong_");
|
||||
result.append(itemCamelCase(splitAgain[1]));
|
||||
result.append("II ");
|
||||
} else if (effect.contains("long")){
|
||||
} else if (effect.contains("long")) {
|
||||
String[] splitAgain = effect.split("long_");
|
||||
result.append(itemCamelCase(splitAgain[1]));
|
||||
result.append("(Long) ");
|
||||
@@ -112,12 +175,12 @@ public class MyStringUtils {
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
public static String[] perkLoreDecoder(String string){
|
||||
public static String[] perkLoreDecoder(String string) {
|
||||
String[] output = string.split("\n");
|
||||
return output;
|
||||
}
|
||||
|
||||
public static String itemNameToCosmeticId(String input){
|
||||
public static String itemNameToCosmeticId(String input) {
|
||||
String processed = input.toLowerCase();
|
||||
processed = processed.replace(' ', '_');
|
||||
|
||||
@@ -125,16 +188,30 @@ public class MyStringUtils {
|
||||
}
|
||||
|
||||
// Opposite of function above
|
||||
public static String cosmeticIdToItemName(String input){
|
||||
public static String cosmeticIdToItemName(String input) {
|
||||
// Input: blood_explosion -> Blood Explosion
|
||||
return itemCamelCase(input).trim();
|
||||
}
|
||||
|
||||
public static String componentToString(Component singleLineComponent){
|
||||
public static String componentToString(Component singleLineComponent) {
|
||||
PlainTextComponentSerializer serializer = PlainTextComponentSerializer.plainText();
|
||||
String processed = serializer.serialize(singleLineComponent);
|
||||
processed = processed.substring(1, processed.length() - 1);
|
||||
return processed;
|
||||
}
|
||||
|
||||
public static String romanize(int input) {
|
||||
int[] values = {1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1};
|
||||
String[] symbols = {"M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I"};
|
||||
|
||||
StringBuilder result = new StringBuilder();
|
||||
for (int i = 0; i < values.length; i++) {
|
||||
while (input >= values[i]) {
|
||||
result.append(symbols[i]);
|
||||
input -= values[i];
|
||||
}
|
||||
}
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,14 +1,14 @@
|
||||
|
||||
![\[Banner\]](https://i.imgur.com/tl2TQuw.png)
|
||||
# PureKitPvP (1.2)
|
||||
# PureKitPvP (1.3.1)
|
||||
|
||||
PureKitPvP lets you create a kit pvp environment quickly, with your own custom kits. These kits work similar to the plugin PureKits, but since that plugin is abandoned, I decided to extend it with other features. A quick overview of all features:
|
||||
PureKitPvP lets you create a kit pvp environment quickly, with your own custom kits. A quick overview of all features:
|
||||
- Death Recaps
|
||||
- Kill Credit on void/environmental damage
|
||||
- Assist credit
|
||||
- Tracks Killstreaks, Kills, Deaths and a lot more stats
|
||||
- Level system based on kills, deaths and assists
|
||||
- Kits can be made in-game
|
||||
- Kits can be made in-game, layout customizable per player
|
||||
- Kits can have a kill item, an item that will be aquired on kill
|
||||
- Pick only one kit per minecraft life (reset after death)
|
||||
- Per kit permissions
|
||||
@@ -23,26 +23,30 @@ PureKitPvP lets you create a kit pvp environment quickly, with your own custom k
|
||||
- Quickly die when falling in the void
|
||||
- 14 Perks, with GUI selection
|
||||
- Cosmetics: Projectile Trails, Kill Effect, Kill/Death Message
|
||||
- Global PvP-related Events
|
||||
- Customizable language file: most player-visible messages can be changed
|
||||
|
||||
## Commands
|
||||
All commands can be seen in-game via _/purekitpvp help_.
|
||||
|
||||
### Admin commands
|
||||
* **/purekitpvp createkit \<kitName> \<displayColor> \<kitIcon> \<kitPermission> \<killItem>**
|
||||
* Create a kit with the contents of your inventory
|
||||
* \<kitIcon> / \<killItem> - _All material names within the autocomplete menu_
|
||||
* Use _air_ if you don't want a kill item
|
||||
|
||||
* **/purekitpvp deletekit\<kitName>**
|
||||
* Remove a kit
|
||||
All admin commands are preceded with /purekitpvp.
|
||||
* **/purekitpvp kit <create/delete/edit/setkillitem>**
|
||||
* **create** \<kitName> \<displayColor> \<kitIcon> \<kitPermission> \<killItem>
|
||||
* Create a kit with the contents of your inventory
|
||||
* \<kitIcon> / \<killItem> - _All material names within the autocomplete menu_
|
||||
* Use _air_ if you don't want a kill item
|
||||
* **delete** \<kitName>
|
||||
* Remove a kit
|
||||
* **edit** \<kitName>
|
||||
* Edit a kit's contents in a GUI
|
||||
* **setkillitem** \<kitName>
|
||||
* Set the killitem to the item in your hand
|
||||
|
||||
* **/purekitpvp resetkit**
|
||||
* Reset your kit (dying will also reset your kit)
|
||||
* **/purekitpvp resetkit**
|
||||
* Resets kit, if the executor has the sufficient permission.
|
||||
|
||||
* **/purekitpvp setkillitem \<kitName>**
|
||||
* Set the killitem to the item in your hand
|
||||
|
||||
* **/purekitpvp createloottable \<name> \<lore> \<displayName>**
|
||||
* **/purekitpvp createloottable** **\<name> \<lore> \<displayName>**
|
||||
* Create a loottable of the chest you are looking at
|
||||
* \<lore> - _The lore on the item chest that will be right clicked for the random items_
|
||||
* \<displayName> -_The displayname on the item chest that will be right clicked for the random items_
|
||||
@@ -55,35 +59,47 @@ All commands can be seen in-game via _/purekitpvp help_.
|
||||
* \<custom_mob> requires a custom mob name
|
||||
|
||||
* **/purekitpvp custommob \<create/set/delete>**
|
||||
* \<create> \<name> \<type>
|
||||
* **create** \<name> \<type>
|
||||
* Creates custom mob with a certain type, can be any entity (mobs are officially supported)
|
||||
* \<set \<name> \<mainhand/offhand/boots/leggings/chestplate/helmet/child>
|
||||
* **set** \<name> \<mainhand/offhand/boots/leggings/chestplate/helmet/child>
|
||||
* Sets a property of a mob to the item in hand, or with the child property; true or false must be specified
|
||||
* \<delete> \<name>
|
||||
* **delete** \<name>
|
||||
* Deletes a custom mob
|
||||
|
||||
* **/purekitpvp event \<start/stop/pause>**
|
||||
* **start** \<eventName>
|
||||
* You may only start one event at a time. Timer can be skipped to the end of the event timer.
|
||||
* **stop** \<eventName>
|
||||
* Stops current event.
|
||||
* **pause**
|
||||
* Pauses the global event loop timer. Events already active stay active. If you want the global event loop to stop, you may disable it in the config, or pause when no event is active to keep any events from triggering.
|
||||
|
||||
* **/purekitpvp getkitstats**
|
||||
* Outputs kit usage stats to see what kit is most popular (for balancing)
|
||||
|
||||
* **/purekitpvp \<help/info/reload>**
|
||||
* Self explanatory
|
||||
* Reload does not fully reload the config file; any settings pertaining to the event loop are not updated, because the event loop is continuous.
|
||||
|
||||
### Player commands
|
||||
* **/kit**
|
||||
* Show Kit GUI
|
||||
![\[IMG\]](https://i.imgur.com/JLFvel3.png)
|
||||
Kits can be customized per player; see video:
|
||||
Per Player Preferences feature showcase - https://youtu.be/wVQJzBPUlQU
|
||||
|
||||
|
||||
* **/perks**
|
||||
* Show Perk GUI, click on a slot to change the perk in that slot (see img2)
|
||||
* Show Perk GUI, click on a slot to change the perk in that slot (see image)
|
||||
![\[IMG\]](https://i.imgur.com/Yau99d1.png)
|
||||
![\[IMG\]](https://i.imgur.com/DB81qVL.png)
|
||||
* **/cosmetics**
|
||||
* Brings up cosmetics menu
|
||||
* In this menu, the kill effect, death/kill message and projectile trail can be changed
|
||||
|
||||
* **/getkit <kitName>**
|
||||
* **/getkit \<kitName>**
|
||||
* Get a kit directly
|
||||
|
||||
* **/stats <player>**
|
||||
* **/stats \<player>**
|
||||
* Show stats of any player
|
||||
|
||||

|
||||
@@ -93,14 +109,16 @@ All commands can be seen in-game via _/purekitpvp help_.
|
||||
* Enabling this improves accuracy of death messages
|
||||
|
||||
## Files
|
||||
There are several files, most are used internally to track stats and such. The config has some feature toggles that are explained there.
|
||||
I would recommend not editing the kits.yml unless you know how to check if your YAML is valid, because the file may reset when wrong YAML is parsed (don't ask me why).
|
||||
For the loottables.yml, follow the format that is provided in the example in the file. Write lore bare, and the displayname with single apostrophes (like so: '&6Lootchest').
|
||||
There are several files, most are used internally to track stats and such. The **config.yml** has some feature toggles that are explained there.
|
||||
I would recommend not editing the **kits.yml** unless you know how to check if your YAML is valid, because the file may reset when wrong YAML is parsed (don't ask me why).
|
||||
For the **loottables.yml**, follow the format that is provided in the example in the file. Write lore bare, and the displayname with single apostrophes (like so: '&6Lootchest').
|
||||
The **lang.yml** file has a plethora of language keys, each of which corresponds with a single or more instances of text in-game. Most text that is visible to a default player - that is a non-admin - is customizable. Item tooltips in GUI's, scoreboard text, all perk explanations et cetera. Be sure to follow the format of each key individually, since some are made for single-line text (such as a display name of an item), and others for multiple lines of lore (think perk explanations). Resetting a value is as easy as deleting it from the file and reloading: missing values are always added back in with their default values. Text that pertains to the kill messages is currently not customizable; the system is not made for this and I question whether the two systems can live side-by-side.
|
||||
If you have any questions please reach out via Discord (see #Support).
|
||||
|
||||
## How to create a kit
|
||||
*Also see the video that covers this topic below.*
|
||||
|
||||
Have all the items you want to be in your kit in your inventory, and type the command /purekitpvp createkit \<name> . A kit will be created with the arguments and automatically added to the kit menu (/kit). You either provide a kill item in the base command, or, if you want the kill item to be a special item (i.e. a golden head or a random loot chest), use the /purekitpvp getcustomitem command to get that item, and run the command /purekitpvp setkillitem \<kitName> while holding that item.
|
||||
Have all the items you want to be in your kit in your inventory, and type the command /purekitpvp kit create \<name> . A kit will be created with the arguments and automatically added to the kit menu (/kit). You either provide a kill item in the base command, or, if you want the kill item to be a special item (i.e. a golden head or a random loot chest), use the /purekitpvp getcustomitem command to get that item, and run the command /purekitpvp kit setkillitem \<kitName> while holding that item.
|
||||
The contents of the kit will be shown in a clean hoverbox when choosing the kit, which will categorize the first 3 items in your hotbar as weapons, the rest of the inventory as items, the armor as armor and the offhand as offhand. If the kit has no armor, it will tell you aswell. A piece of lore can be set in the kits.yml.
|
||||
Basic potions that can be found in the inventory are translated as well, although they do not show their potency and lenght, due to how these items work in spigot. Custom potions created with commands however do work perfectly and show potency and lenght, so I recommend to create your own potions with commands when working with them.
|
||||
|
||||
@@ -123,8 +141,11 @@ https://youtu.be/wZcZ4DcRfgU - Create Kits and Loot tables
|
||||
|
||||
https://youtu.be/tLelKptr6wA - Custom Mobs and how to use them
|
||||
|
||||
## Known issues
|
||||
https://youtu.be/wVQJzBPUlQU - Per Player Kit Preferences feature showcase
|
||||
|
||||
## Known issues & Support
|
||||
Issues can be found [here](https://github.com/LifelessNerd/PureKitPvP/issues).
|
||||
I am sure there will be issues, but finding all of them takes a lot of testing time. Please submit any problems!
|
||||
|
||||
If there are any problems, create a message on [Spigot](https://bit.ly/PureKitPvPSpigotMC), add them on GitHub, [here](https://github.com/LifelessNerd/PureKitPvP), or DM me on [Twitter](https://twitter.com/lukadevrij).
|
||||
If there are any problems, create a message on [Spigot](https://bit.ly/PureKitPvPSpigotMC), add them on GitHub, [here](https://github.com/LifelessNerd/PureKitPvP), or DM me on [Twitter](https://twitter.com/lukadevrij). For direct support you may also join the support [Discord server](https://discord.com/invite/8n65jSEkVf).
|
||||
|
||||
Reference in new issue
Block a user