Skip to content

Commit

Permalink
Final compatibility patches for hardcore mode on worlds.
Browse files Browse the repository at this point in the history
  • Loading branch information
creatorfromhell committed Mar 1, 2024
1 parent 494523e commit 6574951
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 8 deletions.
6 changes: 6 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@
<version>1.20.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<!-- <dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.8.8-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>-->
<dependency>
<groupId>com.github.lokka30</groupId>
<artifactId>MicroLib</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import org.bukkit.NamespacedKey;
import org.bukkit.World;
import org.bukkit.WorldCreator;
import org.bukkit.potion.PotionEffectType;

import java.util.ArrayList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ public class PotionEffectParameter extends ArgumentResolver<CommandSender, Strin

static {

System.out.println("Null Check: " + (PhantomWorlds.compatibility() == null));

POTION_EFFECTS.addAll(PhantomWorlds.compatibility().potionEffectSuggestions());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public static void onCommand(final CommandSender sender, Double x, Double y, Dou
//PhantomWorlds doesn't manage the spawn here so let Mojang deal with it.
try {
finalWorld.setSpawnLocation(new Location(finalWorld, finalX, finalY, finalZ, finalYaw, finalPitch));
} catch(NoSuchMethodError err) {
} catch(NoSuchMethodError ignore) {
//This is dumb that the setSpawn method in spigot uses integers... great design.
finalWorld.setSpawnLocation((int)finalX, (int)finalY, (int)finalZ);
// 1.8 doesn't let us set pitch and yaw ... yawn
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import me.lokka30.phantomworlds.PhantomWorlds;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.NamespacedKey;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerChangedWorldEvent;
Expand Down Expand Up @@ -67,7 +66,7 @@ public void onChangeWorld(PlayerChangedWorldEvent event) {
PhantomWorlds.instance().data.getConfig().isConfigurationSection(cfgPrevPath + ".effects")) {
for(final String effName : PhantomWorlds.instance().data.getConfig().getConfigurationSection(cfgPrevPath + ".effects").getKeys(false)) {

final PotionEffectType type = PotionEffectType.getByKey(NamespacedKey.fromString(effName));
final PotionEffectType type = PhantomWorlds.compatibility().findType(effName);
if(type != null) {
event.getPlayer().removePotionEffect(type);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public PlayerTeleportListener(PhantomWorlds plugin) {
}

@EventHandler
public void onPortal(PlayerTeleportEvent event) {
public void onTP(PlayerTeleportEvent event) {
if(event.getTo() == null || event.getTo().getWorld() == null || event.getFrom().getWorld() == null) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,6 @@ public void create() {
world.setKeepSpawnInMemory(keepSpawnInMemory);
world.setPVP(allowPvP);
world.setDifficulty(difficulty);

PhantomWorlds.compatibility().applyHardcore(world, hardcore);
}

public void save() {
Expand Down

0 comments on commit 6574951

Please sign in to comment.