Skip to content

Commit

Permalink
additional little improvements (remove some legacy code)
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Nov 30, 2021
1 parent 02fbd09 commit c099a78
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ public interface PacketHelper {

void setVision(Player player, EntityType entityType);

void showDemoScreen(Player player);
default void showDemoScreen(Player player) {
throw new UnsupportedOperationException();
}

void showBlockAction(Player player, Location location, int action, int state);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ public Particle(org.bukkit.Particle particle) {
this.particle = particle;
}

public void playFor(Player player, Location location, int count, Vector offset, double extra) {
player.spawnParticle(particle, location, count, offset.getX(), offset.getY(), offset.getZ(), extra);
}

public <T> void playFor(Player player, Location location, int count, Vector offset, double extra, T data) {
player.spawnParticle(particle, location, count, offset.getX(), offset.getY(), offset.getZ(), extra, data);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.denizenscript.denizen.objects;

import com.denizenscript.denizen.events.BukkitScriptEvent;
import com.denizenscript.denizen.nms.NMSVersion;
import com.denizenscript.denizen.nms.interfaces.AdvancementHelper;
import com.denizenscript.denizen.objects.properties.entity.EntityHealth;
import com.denizenscript.denizen.scripts.commands.player.DisguiseCommand;
Expand Down Expand Up @@ -3228,7 +3229,12 @@ else if (split.length > 1) {
// Shows the player the demo screen.
// -->
if (mechanism.matches("show_demo")) {
NMSHandler.getPacketHelper().showDemoScreen(getPlayerEntity());
if (NMSHandler.getVersion().isAtLeast(NMSVersion.v1_18)) {
getPlayerEntity().showDemoScreen();
}
else {
NMSHandler.getPacketHelper().showDemoScreen(getPlayerEntity());
}
}

// <--[mechanism]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public Handler() {
itemHelper = new ItemHelperImpl();
soundHelper = new SoundHelperImpl();
packetHelper = new PacketHelperImpl();
particleHelper = new ParticleHelperImpl();
particleHelper = new ParticleHelper();
playerHelper = new PlayerHelperImpl();
worldHelper = new WorldHelperImpl();
enchantmentHelper = new EnchantmentHelperImpl();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,11 +187,6 @@ else if (entityType == EntityType.ENDERMAN) {
((CraftWorld) player.getWorld()).getHandle(), true, player.getLocation(), false);
}

@Override
public void showDemoScreen(Player player) {
send(player, new ClientboundGameEventPacket(ClientboundGameEventPacket.DEMO_EVENT, 0f));
}

@Override
public void showBlockAction(Player player, Location location, int action, int state) {
BlockPos position = new BlockPos(location.getX(), location.getY(), location.getZ());
Expand Down

This file was deleted.

This file was deleted.

0 comments on commit c099a78

Please sign in to comment.