Fixed player script enabled button not working right on servers. Added more player events and a getDimension() method to ScriptPlayer. Set player scripts to be off by default.

This commit is contained in:
luisc committed 2021-10-15 09:17:31 -05:00
1 parent 047552d9e5
commit a9bce4a3e3
9 files changed
+178 -44

No files matched your search

@@ -14,9 +14,6 @@ import java.util.ArrayList;
import java.util.List;
public interface IItemStack {
/**
* @return The minecraft name for this item
*/
public String getName();
/**
@@ -114,6 +111,11 @@ public interface IItemStack {
* @return Returns whether or not this item is a block
*/
public boolean isBlock();
public INbt getNbt();
public INbt getItemNbt();
/**
* No support is given for this method. Dont use if you dont know what you are doing.
* @return Minecraft ItemStack
@@ -50,6 +50,11 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
public void setPosition(double x, double y, double z){
NoppesUtilPlayer.teleportPlayer(player, x, y, z, player.dimension);
}
public int getDimension(){
return player.dimension;
}
public boolean hasFinishedQuest(int id){
PlayerQuestData data = PlayerDataController.instance.getPlayerData(player).questData;
@@ -89,6 +89,23 @@ public class PlayerEvent extends CustomNPCsEvent {
}
}
public static class RespawnEvent extends PlayerEvent {
public RespawnEvent(IPlayer player) {
super(player);
}
}
public static class ChangedDimension extends PlayerEvent {
public final int fromDim;
public final int toDim;
public ChangedDimension(IPlayer player, int fromDim, int toDim){
super(player);
this.fromDim = fromDim;
this.toDim = toDim;
}
}
public static class TimerEvent extends PlayerEvent {
public final int id;
@@ -113,6 +130,27 @@ public class PlayerEvent extends CustomNPCsEvent {
}
}
@Cancelable
public static class LightningEvent extends PlayerEvent {
public LightningEvent(IPlayer player) {
super(player);
}
}
@Cancelable
public static class SoundEvent extends PlayerEvent {
public final String name;
public final float pitch;
public final float volume;
public SoundEvent(ScriptPlayer player, String name, float pitch, float volume) {
super(player);
this.name = name;
this.pitch = pitch;
this.volume = volume;
}
}
public static class FallEvent extends PlayerEvent {
public final float distance;