mirror of
https://github.com/libraryaddict/LibsDisguises.git
synced 2024-12-15 15:28:36 +01:00
Changed TargetedDisguise to have its methods return disguises
This finishes the commits which allows you to now use a disguise builder while breaking tons of plugins using Lib's Disguises. In retrospect. I should make a DisguiseBuilder instead.
This commit is contained in:
parent
54d785b680
commit
3d44760b1b
@ -412,10 +412,6 @@ public abstract class Disguise {
|
|||||||
return velocitySent;
|
return velocitySent;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean stopDisguise() {
|
|
||||||
return removeDisguise();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes the disguise and undisguises the entity if its using this disguise.
|
* Removes the disguise and undisguises the entity if its using this disguise.
|
||||||
*
|
*
|
||||||
@ -715,4 +711,8 @@ public abstract class Disguise {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean stopDisguise() {
|
||||||
|
return removeDisguise();
|
||||||
|
}
|
||||||
}
|
}
|
@ -10,6 +10,7 @@ import me.libraryaddict.disguise.disguisetypes.watchers.SplashPotionWatcher;
|
|||||||
import org.bukkit.Art;
|
import org.bukkit.Art;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
public class MiscDisguise extends TargetedDisguise {
|
public class MiscDisguise extends TargetedDisguise {
|
||||||
@ -104,6 +105,14 @@ public class MiscDisguise extends TargetedDisguise {
|
|||||||
this(DisguiseType.getType(disguiseType), id, data);
|
this(DisguiseType.getType(disguiseType), id, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public PlayerDisguise addPlayer(Player player) {
|
||||||
|
return (PlayerDisguise) super.addPlayer(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
public MiscDisguise addPlayer(String playername) {
|
||||||
|
return (MiscDisguise) super.addPlayer(playername);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MiscDisguise clone() {
|
public MiscDisguise clone() {
|
||||||
MiscDisguise disguise = new MiscDisguise(getType(), getData());
|
MiscDisguise disguise = new MiscDisguise(getType(), getData());
|
||||||
@ -148,10 +157,24 @@ public class MiscDisguise extends TargetedDisguise {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MiscDisguise removePlayer(Player player) {
|
||||||
|
return (MiscDisguise) super.removePlayer(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
public MiscDisguise removePlayer(String playername) {
|
||||||
|
return (MiscDisguise) super.removePlayer(playername);
|
||||||
|
}
|
||||||
|
|
||||||
|
public MiscDisguise setDisguiseTarget(TargetType newTargetType) {
|
||||||
|
return (MiscDisguise) super.setDisguiseTarget(newTargetType);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MiscDisguise setEntity(Entity entity) {
|
public MiscDisguise setEntity(Entity entity) {
|
||||||
return (MiscDisguise) super.setEntity(entity);
|
return (MiscDisguise) super.setEntity(entity);
|
||||||
} public MiscDisguise setHearSelfDisguise(boolean hearSelfDisguise) {
|
}
|
||||||
|
|
||||||
|
public MiscDisguise setHearSelfDisguise(boolean hearSelfDisguise) {
|
||||||
return (MiscDisguise) super.setHearSelfDisguise(hearSelfDisguise);
|
return (MiscDisguise) super.setHearSelfDisguise(hearSelfDisguise);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -195,4 +218,12 @@ public class MiscDisguise extends TargetedDisguise {
|
|||||||
return (MiscDisguise) super.setWatcher(newWatcher);
|
return (MiscDisguise) super.setWatcher(newWatcher);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MiscDisguise silentlyAddPlayer(String playername) {
|
||||||
|
return (MiscDisguise) super.silentlyAddPlayer(playername);
|
||||||
|
}
|
||||||
|
|
||||||
|
public MiscDisguise silentlyRemovePlayer(String playername) {
|
||||||
|
return (MiscDisguise) super.silentlyRemovePlayer(playername);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -7,6 +7,7 @@ import me.libraryaddict.disguise.disguisetypes.watchers.ZombieWatcher;
|
|||||||
|
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class MobDisguise extends TargetedDisguise {
|
public class MobDisguise extends TargetedDisguise {
|
||||||
|
|
||||||
@ -48,6 +49,14 @@ public class MobDisguise extends TargetedDisguise {
|
|||||||
this.setReplaceSounds(replaceSounds);
|
this.setReplaceSounds(replaceSounds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public PlayerDisguise addPlayer(Player player) {
|
||||||
|
return (PlayerDisguise) super.addPlayer(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
public MobDisguise addPlayer(String playername) {
|
||||||
|
return (MobDisguise) super.addPlayer(playername);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MobDisguise clone() {
|
public MobDisguise clone() {
|
||||||
MobDisguise disguise = new MobDisguise(getType(), isAdult());
|
MobDisguise disguise = new MobDisguise(getType(), isAdult());
|
||||||
@ -82,6 +91,18 @@ public class MobDisguise extends TargetedDisguise {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MobDisguise removePlayer(Player player) {
|
||||||
|
return (MobDisguise) super.removePlayer(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
public MobDisguise removePlayer(String playername) {
|
||||||
|
return (MobDisguise) super.removePlayer(playername);
|
||||||
|
}
|
||||||
|
|
||||||
|
public MobDisguise setDisguiseTarget(TargetType newTargetType) {
|
||||||
|
return (MobDisguise) super.setDisguiseTarget(newTargetType);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MobDisguise setEntity(Entity entity) {
|
public MobDisguise setEntity(Entity entity) {
|
||||||
return (MobDisguise) super.setEntity(entity);
|
return (MobDisguise) super.setEntity(entity);
|
||||||
@ -109,9 +130,7 @@ public class MobDisguise extends TargetedDisguise {
|
|||||||
|
|
||||||
public MobDisguise setKeepDisguiseOnPlayerLogout(boolean keepDisguise) {
|
public MobDisguise setKeepDisguiseOnPlayerLogout(boolean keepDisguise) {
|
||||||
return (MobDisguise) super.setKeepDisguiseOnPlayerLogout(keepDisguise);
|
return (MobDisguise) super.setKeepDisguiseOnPlayerLogout(keepDisguise);
|
||||||
}
|
} public MobDisguise setModifyBoundingBox(boolean modifyBox) {
|
||||||
|
|
||||||
public MobDisguise setModifyBoundingBox(boolean modifyBox) {
|
|
||||||
return (MobDisguise) super.setModifyBoundingBox(modifyBox);
|
return (MobDisguise) super.setModifyBoundingBox(modifyBox);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -130,4 +149,12 @@ public class MobDisguise extends TargetedDisguise {
|
|||||||
public MobDisguise setWatcher(FlagWatcher newWatcher) {
|
public MobDisguise setWatcher(FlagWatcher newWatcher) {
|
||||||
return (MobDisguise) super.setWatcher(newWatcher);
|
return (MobDisguise) super.setWatcher(newWatcher);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MobDisguise silentlyAddPlayer(String playername) {
|
||||||
|
return (MobDisguise) super.silentlyAddPlayer(playername);
|
||||||
|
}
|
||||||
|
|
||||||
|
public MobDisguise silentlyRemovePlayer(String playername) {
|
||||||
|
return (MobDisguise) super.silentlyRemovePlayer(playername);
|
||||||
|
}
|
||||||
}
|
}
|
@ -4,6 +4,8 @@ import java.util.UUID;
|
|||||||
|
|
||||||
import org.apache.commons.lang.Validate;
|
import org.apache.commons.lang.Validate;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.comphenix.protocol.wrappers.WrappedGameProfile;
|
import com.comphenix.protocol.wrappers.WrappedGameProfile;
|
||||||
|
|
||||||
import me.libraryaddict.disguise.utilities.DisguiseUtilities;
|
import me.libraryaddict.disguise.utilities.DisguiseUtilities;
|
||||||
@ -36,6 +38,14 @@ public class PlayerDisguise extends TargetedDisguise {
|
|||||||
setSkin(skinToUse);
|
setSkin(skinToUse);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public PlayerDisguise addPlayer(Player player) {
|
||||||
|
return (PlayerDisguise) super.addPlayer(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
public PlayerDisguise addPlayer(String playername) {
|
||||||
|
return (PlayerDisguise) super.addPlayer(playername);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PlayerDisguise clone() {
|
public PlayerDisguise clone() {
|
||||||
PlayerDisguise disguise = new PlayerDisguise(getName());
|
PlayerDisguise disguise = new PlayerDisguise(getName());
|
||||||
@ -82,6 +92,18 @@ public class PlayerDisguise extends TargetedDisguise {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public PlayerDisguise removePlayer(Player player) {
|
||||||
|
return (PlayerDisguise) super.removePlayer(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
public PlayerDisguise removePlayer(String playername) {
|
||||||
|
return (PlayerDisguise) super.removePlayer(playername);
|
||||||
|
}
|
||||||
|
|
||||||
|
public PlayerDisguise setDisguiseTarget(TargetType newTargetType) {
|
||||||
|
return (PlayerDisguise) super.setDisguiseTarget(newTargetType);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PlayerDisguise setEntity(Entity entity) {
|
public PlayerDisguise setEntity(Entity entity) {
|
||||||
return (PlayerDisguise) super.setEntity(entity);
|
return (PlayerDisguise) super.setEntity(entity);
|
||||||
@ -184,4 +206,12 @@ public class PlayerDisguise extends TargetedDisguise {
|
|||||||
public PlayerDisguise setWatcher(FlagWatcher newWatcher) {
|
public PlayerDisguise setWatcher(FlagWatcher newWatcher) {
|
||||||
return (PlayerDisguise) super.setWatcher(newWatcher);
|
return (PlayerDisguise) super.setWatcher(newWatcher);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public PlayerDisguise silentlyAddPlayer(String playername) {
|
||||||
|
return (PlayerDisguise) super.silentlyAddPlayer(playername);
|
||||||
|
}
|
||||||
|
|
||||||
|
public PlayerDisguise silentlyRemovePlayer(String playername) {
|
||||||
|
return (PlayerDisguise) super.silentlyRemovePlayer(playername);
|
||||||
|
}
|
||||||
}
|
}
|
@ -17,11 +17,12 @@ public abstract class TargetedDisguise extends Disguise {
|
|||||||
private List<String> disguiseViewers = new ArrayList<String>();
|
private List<String> disguiseViewers = new ArrayList<String>();
|
||||||
private TargetType targetType = TargetType.SHOW_TO_EVERYONE_BUT_THESE_PLAYERS;
|
private TargetType targetType = TargetType.SHOW_TO_EVERYONE_BUT_THESE_PLAYERS;
|
||||||
|
|
||||||
public void addPlayer(Player player) {
|
public TargetedDisguise addPlayer(Player player) {
|
||||||
addPlayer(player.getName());
|
addPlayer(player.getName());
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addPlayer(String playername) {
|
public TargetedDisguise addPlayer(String playername) {
|
||||||
if (!disguiseViewers.contains(playername)) {
|
if (!disguiseViewers.contains(playername)) {
|
||||||
disguiseViewers.add(playername);
|
disguiseViewers.add(playername);
|
||||||
if (DisguiseAPI.isDisguiseInUse(this)) {
|
if (DisguiseAPI.isDisguiseInUse(this)) {
|
||||||
@ -29,6 +30,7 @@ public abstract class TargetedDisguise extends Disguise {
|
|||||||
DisguiseUtilities.refreshTracker(this, playername);
|
DisguiseUtilities.refreshTracker(this, playername);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canSee(Player player) {
|
public boolean canSee(Player player) {
|
||||||
@ -51,11 +53,12 @@ public abstract class TargetedDisguise extends Disguise {
|
|||||||
return Collections.unmodifiableList(disguiseViewers);
|
return Collections.unmodifiableList(disguiseViewers);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removePlayer(Player player) {
|
public TargetedDisguise removePlayer(Player player) {
|
||||||
removePlayer(player.getName());
|
removePlayer(player.getName());
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removePlayer(String playername) {
|
public TargetedDisguise removePlayer(String playername) {
|
||||||
if (disguiseViewers.contains(playername)) {
|
if (disguiseViewers.contains(playername)) {
|
||||||
disguiseViewers.remove(playername);
|
disguiseViewers.remove(playername);
|
||||||
if (DisguiseAPI.isDisguiseInUse(this)) {
|
if (DisguiseAPI.isDisguiseInUse(this)) {
|
||||||
@ -63,24 +66,28 @@ public abstract class TargetedDisguise extends Disguise {
|
|||||||
DisguiseUtilities.refreshTracker(this, playername);
|
DisguiseUtilities.refreshTracker(this, playername);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDisguiseTarget(TargetType newTargetType) {
|
public TargetedDisguise setDisguiseTarget(TargetType newTargetType) {
|
||||||
if (DisguiseUtilities.isDisguiseInUse(this)) {
|
if (DisguiseUtilities.isDisguiseInUse(this)) {
|
||||||
throw new RuntimeException("Cannot set the disguise target after the entity has been disguised");
|
throw new RuntimeException("Cannot set the disguise target after the entity has been disguised");
|
||||||
}
|
}
|
||||||
targetType = newTargetType;
|
targetType = newTargetType;
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void silentlyAddPlayer(String playername) {
|
public TargetedDisguise silentlyAddPlayer(String playername) {
|
||||||
if (!disguiseViewers.contains(playername)) {
|
if (!disguiseViewers.contains(playername)) {
|
||||||
disguiseViewers.add(playername);
|
disguiseViewers.add(playername);
|
||||||
}
|
}
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void silentlyRemovePlayer(String playername) {
|
public TargetedDisguise silentlyRemovePlayer(String playername) {
|
||||||
if (disguiseViewers.contains(playername)) {
|
if (disguiseViewers.contains(playername)) {
|
||||||
disguiseViewers.remove(playername);
|
disguiseViewers.remove(playername);
|
||||||
}
|
}
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user