Skip to content
Merged

1.18 #10

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@

<groupId>parallelmc</groupId>
<artifactId>parallelutils</artifactId>
<version>1.9.0</version>
<version>1.10.0</version>
<packaging>jar</packaging>

<name>Parallelutils</name>

<properties>
<java.version>16</java.version>
<maven.compiler.source>16</maven.compiler.source>
<maven.compiler.target>16</maven.compiler.target>
<java.version>17</java.version>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
Expand Down Expand Up @@ -109,8 +109,14 @@
</dependency>
<dependency>
<groupId>io.papermc.paper</groupId>
<artifactId>paper</artifactId>
<version>1.17.1-R0.1-SNAPSHOT</version>
<artifactId>paper-server</artifactId>
<version>1.18-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.papermc.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.18-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<!--<dependency>
Expand All @@ -128,7 +134,7 @@
<dependency>
<groupId>net.dv8tion</groupId>
<artifactId>JDA</artifactId>
<version>4.3.0_277</version>
<version>4.4.0_350</version>
<scope>compile</scope>
</dependency>

Expand Down Expand Up @@ -158,7 +164,7 @@
<dependency>
<groupId>com.sk89q.worldguard</groupId>
<artifactId>worldguard-bukkit</artifactId>
<version>7.0.5</version>
<version>7.0.6</version>
<scope>provided</scope>
</dependency>

Expand All @@ -175,5 +181,6 @@
<artifactId>mysql-connector-java</artifactId>
<version>8.0.26</version>
</dependency>

</dependencies>
</project>
2 changes: 1 addition & 1 deletion src/main/java/parallelmc/parallelutils/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

public class Constants {

public static final Version VERSION = new Version(1, 9, 0);
public static final Version VERSION = new Version(1, 10, 0);
public static final String PLUGIN_NAME = "ParallelUtils";
public static final String DEFAULT_WORLD = "world";
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.command.*;
import org.bukkit.craftbukkit.v1_17_R1.command.ServerCommandSender;
import org.bukkit.craftbukkit.v1_18_R1.command.ServerCommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import net.minecraft.nbt.NBTTagCompound;
import org.bukkit.Material;
import org.bukkit.craftbukkit.v1_17_R1.inventory.CraftItemStack;
import org.bukkit.craftbukkit.v1_18_R1.inventory.CraftItemStack;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.PlayerDeathEvent;
Expand Down Expand Up @@ -31,21 +31,21 @@ public void onPlayerDeath(PlayerDeathEvent event) {
// TODO: Try to change this code to use item.getItemMeta().getPersistentDataContainer()
net.minecraft.world.item.ItemStack nmsItem = CraftItemStack.asNMSCopy(item); // does this even work lol
// Grabs the NMS items compound and checks if it's null
NBTTagCompound compound = (nmsItem.hasTag()) ? nmsItem.getTag() : new NBTTagCompound();
NBTTagCompound compound = (nmsItem.r()) ? nmsItem.s() : new NBTTagCompound();

if (compound == null) continue;

if (compound.hasKey("CustomHat")) {
if (compound.e("CustomHat")) {
preventedDrops.add(item);
}
} else if (item.getType() == Material.PLAYER_HEAD) {
net.minecraft.world.item.ItemStack nmsItem = CraftItemStack.asNMSCopy(item); // does this even work lol
// Grabs the NMS items compound and checks if it's null
NBTTagCompound compound = (nmsItem.hasTag()) ? nmsItem.getTag() : new NBTTagCompound();
NBTTagCompound compound = (nmsItem.r()) ? nmsItem.s() : new NBTTagCompound();

if (compound == null) continue;

if (compound.hasKey("CustomTrophy")) {
if (compound.e("CustomTrophy")) {
preventedDrops.add(item);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Particle;
import org.bukkit.craftbukkit.v1_17_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_17_R1.entity.CraftZombie;
import org.bukkit.craftbukkit.v1_18_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_18_R1.entity.CraftZombie;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginManager;
import org.bukkit.scheduler.BukkitTask;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.craftbukkit.v1_17_R1.entity.CraftZombie;
import org.bukkit.craftbukkit.v1_18_R1.entity.CraftZombie;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.inventory.ItemFlag;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.craftbukkit.v1_17_R1.entity.CraftZombie;
import org.bukkit.craftbukkit.v1_18_R1.entity.CraftZombie;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.inventory.ItemFlag;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import org.bukkit.World;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.craftbukkit.v1_17_R1.CraftServer;
import org.bukkit.craftbukkit.v1_17_R1.CraftWorld;
import org.bukkit.craftbukkit.v1_18_R1.CraftServer;
import org.bukkit.craftbukkit.v1_18_R1.CraftWorld;
import org.bukkit.entity.Player;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import net.minecraft.world.entity.Entity;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_17_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_18_R1.entity.CraftEntity;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import parallelmc.parallelutils.Parallelutils;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ public class CustomEntityHelper {
*/
public static void clearGoals(EntityInsentient entity) {

Map goalC = (Map) getPrivateField("c", PathfinderGoalSelector.class, entity.bP);
Map goalC = (Map) getPrivateField("c", PathfinderGoalSelector.class, entity.bR);
goalC.clear();
Set goalD = (Set) getPrivateField("d", PathfinderGoalSelector.class, entity.bP);
Set goalD = (Set) getPrivateField("d", PathfinderGoalSelector.class, entity.bR);
goalD.clear();
Map targetC = (Map) getPrivateField("c", PathfinderGoalSelector.class, entity.bQ);
Map targetC = (Map) getPrivateField("c", PathfinderGoalSelector.class, entity.bS);
targetC.clear();
Set targetD = (Set) getPrivateField("d", PathfinderGoalSelector.class, entity.bQ);
Set targetD = (Set) getPrivateField("d", PathfinderGoalSelector.class, entity.bS);
targetD.clear();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
import net.minecraft.world.entity.monster.EntityZombie;
import net.minecraft.world.level.World;
import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_17_R1.CraftServer;
import org.bukkit.craftbukkit.v1_17_R1.CraftWorld;
import org.bukkit.craftbukkit.v1_17_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_17_R1.entity.CraftZombie;
import org.bukkit.craftbukkit.v1_18_R1.CraftServer;
import org.bukkit.craftbukkit.v1_18_R1.CraftWorld;
import org.bukkit.craftbukkit.v1_18_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_18_R1.entity.CraftZombie;
import org.bukkit.event.entity.CreatureSpawnEvent;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitTask;
Expand All @@ -26,27 +26,27 @@
public class EntityFireWisp extends EntityZombie {
public EntityFireWisp(EntityTypes<? extends EntityZombie> entitytypes, World world) {
super(entitytypes, world);
initPathfinder();
u();
}

public EntityFireWisp(World world) {
super(world);
initPathfinder();
u();
}

@Override
public void initPathfinder() {
public void u() {
initPathfinder(this);
}

public static void initPathfinder(EntityZombie zombie) {
//clearing Zombie goals
CustomEntityHelper.clearGoals(zombie);

zombie.bP.a(0, new PathfinderGoalMeleeAttack(zombie, 1.0, false));
zombie.bP.a(1, new PathfinderGoalRandomStroll(zombie, 1.0));
zombie.bR.a(0, new PathfinderGoalMeleeAttack(zombie, 1.0, false));
zombie.bR.a(1, new PathfinderGoalRandomStroll(zombie, 1.0));

zombie.bQ.a(0, new PathfinderGoalNearestAttackableTarget<>(zombie,
zombie.bS.a(0, new PathfinderGoalNearestAttackableTarget<>(zombie,
EntityPlayer.class, true));
}

Expand All @@ -55,13 +55,13 @@ public static EntityFireWisp spawn(JavaPlugin plugin, CraftServer server, CraftW
}

public static EntityFireWisp spawn(JavaPlugin plugin, CraftServer server, CraftWorld world, Location l,
SpawnReason reason, Location origin) {
SpawnReason reason, Location origin) {
EntityFireWisp wisp = new EntityFireWisp(world.getHandle());
CraftZombie zombie = (CraftZombie) CraftEntity.getEntity(server, wisp);

setup(plugin, zombie);
wisp.setPosition(l.getX(), l.getY(), l.getZ());
boolean spawned = world.getHandle().addEntity(wisp, CreatureSpawnEvent.SpawnReason.CUSTOM);
wisp.e(l.getX(), l.getY(), l.getZ());
boolean spawned = world.getHandle().addFreshEntity(wisp, CreatureSpawnEvent.SpawnReason.CUSTOM);

if (!spawned) {
Parallelutils.log(Level.INFO, "Unable to spawn entity");
Expand All @@ -87,4 +87,9 @@ public static EntityZombie setup(JavaPlugin plugin, CraftZombie mob) {

return wisp;
}

@Override
public boolean d_() {
return super.d_();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
import net.minecraft.world.entity.monster.EntityZombie;
import net.minecraft.world.level.World;
import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_17_R1.CraftServer;
import org.bukkit.craftbukkit.v1_17_R1.CraftWorld;
import org.bukkit.craftbukkit.v1_17_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_17_R1.entity.CraftZombie;
import org.bukkit.craftbukkit.v1_18_R1.CraftServer;
import org.bukkit.craftbukkit.v1_18_R1.CraftWorld;
import org.bukkit.craftbukkit.v1_18_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_18_R1.entity.CraftZombie;
import org.bukkit.event.entity.CreatureSpawnEvent;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitTask;
Expand All @@ -26,27 +26,27 @@
public class EntityWisp extends EntityZombie {
public EntityWisp(EntityTypes<? extends EntityZombie> entitytypes, World world) {
super(entitytypes, world);
initPathfinder();
u();
}

public EntityWisp(World world) {
super(world);
initPathfinder();
u();
}

@Override
public void initPathfinder() {
public void u() {
initPathfinder(this);
}

public static void initPathfinder(EntityZombie zombie) {
//clearing Zombie goals
CustomEntityHelper.clearGoals(zombie);

zombie.bP.a(0, new PathfinderGoalMeleeAttack(zombie, 1.0, false));
zombie.bP.a(1, new PathfinderGoalRandomStroll(zombie, 1.0));
zombie.bR.a(0, new PathfinderGoalMeleeAttack(zombie, 1.0, false));
zombie.bR.a(1, new PathfinderGoalRandomStroll(zombie, 1.0));

zombie.bQ.a(0, new PathfinderGoalHurtByTarget(zombie));
zombie.bS.a(0, new PathfinderGoalHurtByTarget(zombie));
}

public static EntityWisp spawn(JavaPlugin plugin, CraftServer server, CraftWorld world, Location l) {
Expand All @@ -59,8 +59,8 @@ public static EntityWisp spawn(JavaPlugin plugin, CraftServer server, CraftWorld
CraftZombie zombie = (CraftZombie) CraftEntity.getEntity(server, wisp);

setup(plugin, zombie);
wisp.setPosition(l.getX(), l.getY(), l.getZ());
boolean spawned = world.getHandle().addEntity(wisp, CreatureSpawnEvent.SpawnReason.CUSTOM);
wisp.e(l.getX(), l.getY(), l.getZ());
boolean spawned = world.getHandle().addFreshEntity(wisp, CreatureSpawnEvent.SpawnReason.CUSTOM);

if (!spawned) {
Parallelutils.log(Level.INFO, "Unable to spawn entity");
Expand All @@ -86,4 +86,9 @@ public static EntityZombie setup(JavaPlugin plugin, CraftZombie mob) {

return wisp;
}

@Override
public boolean d_() {
return super.d_();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import org.bukkit.Bukkit;
import org.bukkit.Chunk;
import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_17_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_18_R1.entity.CraftEntity;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginManager;
import parallelmc.parallelutils.Constants;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_17_R1.entity.CraftLivingEntity;
import org.bukkit.craftbukkit.v1_17_R1.entity.CraftMob;
import org.bukkit.craftbukkit.v1_18_R1.entity.CraftLivingEntity;
import org.bukkit.craftbukkit.v1_18_R1.entity.CraftMob;
import org.bukkit.plugin.IllegalPluginAccessException;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.block.Block;
import org.bukkit.craftbukkit.v1_17_R1.CraftServer;
import org.bukkit.craftbukkit.v1_17_R1.CraftWorld;
import org.bukkit.craftbukkit.v1_18_R1.CraftServer;
import org.bukkit.craftbukkit.v1_18_R1.CraftWorld;
import org.bukkit.entity.Player;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
Expand Down Expand Up @@ -112,7 +112,7 @@ public void run() {
}

if (setUpEntity != null && data.hasLeash()) {
SpawnerRegistry.getInstance().addLeashedEntity(location, setUpEntity.getUniqueID().toString());
SpawnerRegistry.getInstance().addLeashedEntity(location, setUpEntity.cm().toString());
if (SpawnerRegistry.getInstance().getLeashTaskID(location) == null) {
BukkitTask task = new LeashTask(location).runTaskTimer(plugin, 0, 10);
SpawnerRegistry.getInstance().addLeashTaskID(location, task.getTaskId());
Expand Down
Loading