mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-20 09:59:42 +00:00
API Changes:
-Implemented interfaces for all jobs & roles. ScriptPlayer: -Added getData() function, which returns player data objects. IPlayerData: New class that holds all player data for modification. -Holds dialog, bank, quest, transport, faction, item giver, and mail data. -Also holds companion data, with functions has/set/getCompanion, and a getCompanionID function to differentiate companions.
This commit is contained in:
1 parent
587f63396f
commit
63a1525ee2
66 files changed
+1418
-207
No files matched your search
@@ -6,6 +6,7 @@
|
||||
package noppes.npcs.scripted;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -93,6 +94,10 @@ public class NpcAPI extends AbstractNpcAPI {
|
||||
return ServerCloneController.Instance;
|
||||
}
|
||||
|
||||
public ITransportHandler getLocations() {
|
||||
return TransportController.getInstance();
|
||||
}
|
||||
|
||||
public IEntity getIEntity(Entity entity) {
|
||||
if(entity == null)
|
||||
return null;
|
||||
@@ -121,6 +126,18 @@ public class NpcAPI extends AbstractNpcAPI {
|
||||
}
|
||||
}
|
||||
|
||||
public IEntity[] getLoadedEntities() {
|
||||
ArrayList<IEntity> list = new ArrayList<>();
|
||||
|
||||
for (IWorld world : worldCache.values()) {
|
||||
for (Object obj : world.getMCWorld().loadedEntityList) {
|
||||
list.add(NpcAPI.Instance().getIEntity((Entity) obj));
|
||||
}
|
||||
}
|
||||
|
||||
return list.toArray(new IEntity[0]);
|
||||
}
|
||||
|
||||
public IBlock getIBlock(World world, BlockPos pos) {
|
||||
return new ScriptBlock(world, world.getBlock(pos.getX(),pos.getY(),pos.getZ()), pos);
|
||||
}
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
package noppes.npcs.scripted;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.*;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
@@ -181,6 +178,15 @@ public class ScriptWorld implements IWorld {
|
||||
return world.countEntities(entity.getMCEntity().getClass());
|
||||
}
|
||||
|
||||
public IEntity[] getLoadedEntities() {
|
||||
ArrayList<IEntity> list = new ArrayList<>();
|
||||
for (Object obj : world.loadedEntityList) {
|
||||
list.add(NpcAPI.Instance().getIEntity((Entity) obj));
|
||||
}
|
||||
|
||||
return list.toArray(new IEntity[0]);
|
||||
}
|
||||
|
||||
public void setTileEntity(int x, int y, int z, ITileEntity tileEntity){
|
||||
world.setTileEntity(x,y,z,tileEntity.getMCTileEntity());
|
||||
}
|
||||
|
||||
@@ -44,6 +44,7 @@ import noppes.npcs.scripted.ScriptPixelmonPlayerData;
|
||||
import noppes.npcs.scripted.constants.EntityType;
|
||||
import noppes.npcs.scripted.gui.ScriptGui;
|
||||
import noppes.npcs.scripted.interfaces.IParticle;
|
||||
import noppes.npcs.scripted.interfaces.handler.IPlayerData;
|
||||
import noppes.npcs.scripted.interfaces.handler.data.IQuest;
|
||||
import noppes.npcs.scripted.interfaces.IBlock;
|
||||
import noppes.npcs.scripted.interfaces.IContainer;
|
||||
@@ -557,7 +558,7 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
|
||||
return player.isBlocking();
|
||||
}
|
||||
|
||||
private PlayerData getData() {
|
||||
public PlayerData getData() {
|
||||
if (this.data == null) {
|
||||
this.data = PlayerDataController.instance.getPlayerData(player);
|
||||
}
|
||||
@@ -566,7 +567,7 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
|
||||
}
|
||||
|
||||
public IQuest[] getActiveQuests() {
|
||||
PlayerQuestData data = this.getData().questData;
|
||||
PlayerQuestData data = (PlayerQuestData) this.getData().getQuestData();
|
||||
List<IQuest> quests = new ArrayList();
|
||||
Iterator var3 = data.activeQuests.keySet().iterator();
|
||||
|
||||
|
||||
@@ -55,6 +55,8 @@ public abstract class AbstractNpcAPI {
|
||||
|
||||
public abstract ICloneHandler getClones();
|
||||
|
||||
public abstract ITransportHandler getLocations();
|
||||
|
||||
public abstract ICustomNpc createNPC(World var1);
|
||||
|
||||
/**
|
||||
@@ -65,6 +67,8 @@ public abstract class AbstractNpcAPI {
|
||||
|
||||
public abstract IEntity getIEntity(Entity var1);
|
||||
|
||||
public abstract IEntity[] getLoadedEntities();
|
||||
|
||||
public abstract IBlock getIBlock(World var1, BlockPos var2);
|
||||
|
||||
public abstract IBlock getIBlock(World world, Block block, BlockPos pos);
|
||||
@@ -85,6 +89,8 @@ public abstract class AbstractNpcAPI {
|
||||
|
||||
public abstract IDamageSource getIDamageSource(DamageSource var1);
|
||||
|
||||
public abstract IDamageSource getIDamageSource(IEntity entity);
|
||||
|
||||
public abstract EventBus events();
|
||||
|
||||
public abstract File getGlobalDir();
|
||||
@@ -137,6 +143,8 @@ public abstract class AbstractNpcAPI {
|
||||
|
||||
public abstract INbt getINbt(NBTTagCompound nbtTagCompound);
|
||||
|
||||
public abstract INbt stringToNbt(String str);
|
||||
|
||||
public abstract IPlayer[] getAllServerPlayers();
|
||||
|
||||
public abstract IItemStack createItem(String id, int damage, int size);
|
||||
|
||||
@@ -98,6 +98,8 @@ public interface IWorld {
|
||||
*/
|
||||
int countEntities(IEntity entity);
|
||||
|
||||
IEntity[] getLoadedEntities();
|
||||
|
||||
/**
|
||||
* Sets the block's tile entity at the given position.
|
||||
*/
|
||||
|
||||
@@ -5,6 +5,7 @@ import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import noppes.npcs.scripted.entity.ScriptDBCPlayer;
|
||||
import noppes.npcs.scripted.interfaces.handler.IOverlayHandler;
|
||||
import noppes.npcs.scripted.interfaces.handler.IPlayerData;
|
||||
import noppes.npcs.scripted.interfaces.handler.data.IQuest;
|
||||
import noppes.npcs.scripted.interfaces.*;
|
||||
import noppes.npcs.scripted.interfaces.gui.ICustomGui;
|
||||
@@ -228,6 +229,8 @@ public interface IPlayer<T extends EntityPlayerMP> extends IEntityLivingBase<T>
|
||||
|
||||
boolean blocking();
|
||||
|
||||
public IPlayerData getData();
|
||||
|
||||
IQuest[] getActiveQuests();
|
||||
|
||||
IContainer getOpenContainer();
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
package noppes.npcs.scripted.interfaces.handler;
|
||||
|
||||
public interface IPlayerBankData {
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package noppes.npcs.scripted.interfaces.handler;
|
||||
import noppes.npcs.scripted.interfaces.entity.ICustomNpc;
|
||||
|
||||
public interface IPlayerData {
|
||||
|
||||
void setCompanion(ICustomNpc npc);
|
||||
|
||||
ICustomNpc getCompanion();
|
||||
|
||||
boolean hasCompanion();
|
||||
|
||||
int getCompanionID();
|
||||
|
||||
IPlayerDialogData getDialogData();
|
||||
|
||||
IPlayerBankData getBankData();
|
||||
|
||||
IPlayerQuestData getQuestData();
|
||||
|
||||
IPlayerTransportData getTransportData();
|
||||
|
||||
IPlayerFactionData getFactionData();
|
||||
|
||||
IPlayerItemGiverData getItemGiverData();
|
||||
|
||||
IPlayerMailData getMailData();
|
||||
|
||||
void save();
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package noppes.npcs.scripted.interfaces.handler;
|
||||
|
||||
public interface IPlayerDialogData {
|
||||
|
||||
boolean hasReadDialog(int id);
|
||||
|
||||
void readDialog(int id);
|
||||
|
||||
void unreadDialog(int id);
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package noppes.npcs.scripted.interfaces.handler;
|
||||
|
||||
public interface IPlayerFactionData {
|
||||
|
||||
int getPoints(int id);
|
||||
|
||||
void addPoints(int id, int points);
|
||||
|
||||
void setPoints(int id, int points);
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package noppes.npcs.scripted.interfaces.handler;
|
||||
|
||||
import noppes.npcs.scripted.interfaces.jobs.IJobItemGiver;
|
||||
|
||||
public interface IPlayerItemGiverData {
|
||||
|
||||
long getTime(IJobItemGiver jobItemGiver);
|
||||
|
||||
void setTime(IJobItemGiver jobItemGiver, long day);
|
||||
|
||||
boolean hasInteractedBefore(IJobItemGiver jobItemGiver);
|
||||
|
||||
IJobItemGiver[] getItemGivers();
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package noppes.npcs.scripted.interfaces.handler;
|
||||
|
||||
import noppes.npcs.scripted.interfaces.handler.data.IPlayerMail;
|
||||
|
||||
public interface IPlayerMailData {
|
||||
|
||||
boolean hasMail();
|
||||
|
||||
void addMail(IPlayerMail mail);
|
||||
|
||||
void removeMail(IPlayerMail mail);
|
||||
|
||||
boolean hasMail(IPlayerMail mail);
|
||||
|
||||
IPlayerMail[] getAllMail();
|
||||
|
||||
IPlayerMail[] getUnreadMail();
|
||||
|
||||
IPlayerMail[] getReadMail();
|
||||
|
||||
IPlayerMail[] getMailFrom(String sender);
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package noppes.npcs.scripted.interfaces.handler;
|
||||
|
||||
import noppes.npcs.scripted.interfaces.handler.data.IQuest;
|
||||
|
||||
public interface IPlayerQuestData {
|
||||
|
||||
IQuest getTrackedQuest();
|
||||
|
||||
void startQuest(int id);
|
||||
|
||||
void finishQuest(int id);
|
||||
|
||||
void stopQuest(int id);
|
||||
|
||||
void removeQuest(int id);
|
||||
|
||||
boolean hasFinishedQuest(int id);
|
||||
|
||||
public boolean hasActiveQuest(int id);
|
||||
|
||||
IQuest[] getActiveQuests();
|
||||
|
||||
IQuest[] getFinishedQuests();
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package noppes.npcs.scripted.interfaces.handler;
|
||||
|
||||
import noppes.npcs.scripted.interfaces.handler.data.ITransportLocation;
|
||||
|
||||
public interface IPlayerTransportData {
|
||||
|
||||
boolean hasTransport(int id);
|
||||
|
||||
void addTransport(int id);
|
||||
|
||||
void addTransport(ITransportLocation location);
|
||||
|
||||
ITransportLocation getTransport(int id);
|
||||
|
||||
ITransportLocation[] getTransports();
|
||||
|
||||
void removeTransport(int id);
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package noppes.npcs.scripted.interfaces.handler;
|
||||
|
||||
import noppes.npcs.scripted.interfaces.handler.data.ITransportCategory;
|
||||
|
||||
public interface ITransportHandler {
|
||||
|
||||
ITransportCategory[] categories();
|
||||
|
||||
void createCategory(String title);
|
||||
|
||||
ITransportCategory getCategory(String title);
|
||||
|
||||
void removeCategory(String title);
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package noppes.npcs.scripted.interfaces.handler.data;
|
||||
|
||||
import noppes.npcs.scripted.interfaces.item.IItemStack;
|
||||
|
||||
public interface IPlayerMail {
|
||||
|
||||
void setPageText(String[] pages);
|
||||
|
||||
String[] getPageText();
|
||||
|
||||
int getPageCount();
|
||||
|
||||
void setSender(String sender);
|
||||
|
||||
String getSender();
|
||||
|
||||
void setSubject(String subject);
|
||||
|
||||
String getSubject();
|
||||
|
||||
long getTimePast();
|
||||
|
||||
long getTimeSent();
|
||||
|
||||
boolean hasQuest();
|
||||
|
||||
IQuest getQuest();
|
||||
|
||||
IItemStack[] getItems();
|
||||
|
||||
void setItems(IItemStack[] items);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package noppes.npcs.scripted.interfaces.handler.data;
|
||||
|
||||
public interface ITransportCategory {
|
||||
|
||||
int getId();
|
||||
|
||||
void setTitle(String title);
|
||||
|
||||
String getTitle();
|
||||
|
||||
void addLocation(String name);
|
||||
|
||||
ITransportLocation getLocation(String name);
|
||||
|
||||
void removeLocation(String name);
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package noppes.npcs.scripted.interfaces.handler.data;
|
||||
|
||||
public interface ITransportLocation {
|
||||
|
||||
int getId();
|
||||
|
||||
void setName(String name);
|
||||
|
||||
String getName();
|
||||
|
||||
void setDimension(int dimension);
|
||||
|
||||
int getDimension();
|
||||
|
||||
void setType(int type);
|
||||
|
||||
int getType();
|
||||
|
||||
void setPosition(int x, int y, int z);
|
||||
|
||||
double getX();
|
||||
|
||||
double getY();
|
||||
|
||||
double getZ();
|
||||
|
||||
void save();
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package noppes.npcs.scripted.interfaces.jobs;
|
||||
|
||||
import noppes.npcs.roles.JobInterface;
|
||||
import noppes.npcs.scripted.interfaces.entity.ICustomNpc;
|
||||
|
||||
public interface IJob {
|
||||
|
||||
int getType();
|
||||
|
||||
JobInterface getJobInterface();
|
||||
|
||||
ICustomNpc getNpc();
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package noppes.npcs.scripted.interfaces.jobs;
|
||||
|
||||
public interface IJobBard extends IJob {
|
||||
|
||||
String getSong();
|
||||
|
||||
void setSong(String song);
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package noppes.npcs.scripted.interfaces.jobs;
|
||||
|
||||
public interface IJobConversation extends IJob {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package noppes.npcs.scripted.interfaces.jobs;
|
||||
|
||||
import noppes.npcs.scripted.interfaces.entity.ICustomNpc;
|
||||
|
||||
public interface IJobFollower extends IJob {
|
||||
|
||||
String getFollowingName();
|
||||
|
||||
void setFollowingName(String name);
|
||||
|
||||
ICustomNpc getFollowingNpc();
|
||||
|
||||
boolean isFollowing();
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package noppes.npcs.scripted.interfaces.jobs;
|
||||
|
||||
public interface IJobGuard extends IJob {
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package noppes.npcs.scripted.interfaces.jobs;
|
||||
|
||||
import noppes.npcs.scripted.interfaces.entity.IEntityLivingBase;
|
||||
|
||||
public interface IJobHealer extends IJob {
|
||||
|
||||
void heal(IEntityLivingBase entity, float amount);
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package noppes.npcs.scripted.interfaces.jobs;
|
||||
|
||||
import noppes.npcs.scripted.interfaces.entity.IPlayer;
|
||||
import noppes.npcs.scripted.interfaces.handler.data.IAvailability;
|
||||
import noppes.npcs.scripted.interfaces.item.IItemStack;
|
||||
|
||||
public interface IJobItemGiver extends IJob {
|
||||
|
||||
void setCooldown(int cooldown);
|
||||
|
||||
void setCooldownType(int type);
|
||||
|
||||
int getCooldownType();
|
||||
|
||||
void setGivingMethod(int method);
|
||||
|
||||
int getGivingMethod();
|
||||
|
||||
void setLines(String[] lines);
|
||||
|
||||
String[] getLines();
|
||||
|
||||
void setAvailability(IAvailability availability);
|
||||
|
||||
IAvailability getAvailability();
|
||||
|
||||
void setItem(int slot, IItemStack item);
|
||||
|
||||
IItemStack[] getItems();
|
||||
|
||||
boolean giveItems(IPlayer player);
|
||||
|
||||
boolean canPlayerInteract(IPlayer player);
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package noppes.npcs.scripted.interfaces.jobs;
|
||||
|
||||
public interface IJobPuppet extends IJob {
|
||||
|
||||
int getRotationX(int part);
|
||||
|
||||
int getRotationY(int part);
|
||||
|
||||
int getRotationZ(int part);
|
||||
|
||||
void setRotationX(int part, int rotation);
|
||||
|
||||
void setRotationY(int part, int rotation);
|
||||
|
||||
void setRotationZ(int part, int rotation);
|
||||
|
||||
boolean isEnabled(int part);
|
||||
|
||||
void setEnabled(int part, boolean bo);
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package noppes.npcs.scripted.interfaces.jobs;
|
||||
|
||||
import noppes.npcs.scripted.interfaces.entity.IEntityLivingBase;
|
||||
|
||||
public interface IJobSpawner extends IJob {
|
||||
|
||||
IEntityLivingBase spawnEntity(int number);
|
||||
|
||||
void removeAllSpawned();
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package noppes.npcs.scripted.interfaces.roles;
|
||||
|
||||
public interface IRole {
|
||||
|
||||
int getType();
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package noppes.npcs.scripted.interfaces.roles;
|
||||
|
||||
public interface IRoleBank extends IRole {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package noppes.npcs.scripted.interfaces.roles;
|
||||
|
||||
import noppes.npcs.scripted.interfaces.entity.IPlayer;
|
||||
|
||||
public interface IRoleFollower extends IRole {
|
||||
|
||||
/**
|
||||
* @since 1.7.10c
|
||||
* @param player Player who is set as the owner. If null given everything resets
|
||||
*/
|
||||
void setOwner(IPlayer player);
|
||||
|
||||
/**
|
||||
* @since 1.7.10c
|
||||
* @return Returns the followers owner. Returns null if he has no owner or the owner is offline
|
||||
*/
|
||||
IPlayer getOwner();
|
||||
|
||||
/**
|
||||
* @since 1.7.10c
|
||||
* @return Returns whether or not the follower has an owner
|
||||
*/
|
||||
boolean hasOwner();
|
||||
|
||||
boolean isFollowing();
|
||||
|
||||
void setIsFollowing(boolean following);
|
||||
|
||||
/**
|
||||
* @since 1.7.10c
|
||||
* @return Returns days left
|
||||
*/
|
||||
int getDaysLeft();
|
||||
|
||||
/**
|
||||
* @since 1.7.10c
|
||||
* @param days The days you want to add to the days remaining
|
||||
*/
|
||||
void addDaysLeft(int days);
|
||||
|
||||
/**
|
||||
* @since 1.7.10c
|
||||
* @return Returns whether or not the follower is set to infinite days
|
||||
*/
|
||||
boolean getInfiniteDays();
|
||||
|
||||
/**
|
||||
* @since 1.7.10c
|
||||
* @param infinite Sets whether the days hired are infinite
|
||||
*/
|
||||
void setInfiniteDays(boolean infinite);
|
||||
|
||||
/**
|
||||
* @since 1.7.10c
|
||||
* @return Return whether the gui is disabled
|
||||
*/
|
||||
boolean getGuiDisabled();
|
||||
|
||||
/**
|
||||
* @since 1.7.10c
|
||||
* @param disabled Set the gui to be disabled or not
|
||||
*/
|
||||
void setGuiDisabled(boolean disabled);
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package noppes.npcs.scripted.interfaces.roles;
|
||||
|
||||
public interface IRoleMailman extends IRole {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
package noppes.npcs.scripted.interfaces.roles;
|
||||
|
||||
import noppes.npcs.scripted.interfaces.entity.IPlayer;
|
||||
import noppes.npcs.scripted.interfaces.item.IItemStack;
|
||||
|
||||
public interface IRoleTrader extends IRole {
|
||||
|
||||
/**
|
||||
* @param slot Slot number 0-17
|
||||
* @param currency Currency item
|
||||
* @param currency2 Currency item number two
|
||||
* @param sold Item to be sold by this npc
|
||||
*/
|
||||
void setSellOption(int slot, IItemStack currency, IItemStack currency2, IItemStack sold);
|
||||
|
||||
/**
|
||||
* @param slot Slot number 0-17
|
||||
* @param currency Currency item
|
||||
* @param sold Item to be sold by this npc
|
||||
*/
|
||||
void setSellOption(int slot, IItemStack currency, IItemStack sold);
|
||||
|
||||
/**
|
||||
* @param slot
|
||||
* @return The item being sold in this slot.
|
||||
*/
|
||||
IItemStack getSellOption(int slot);
|
||||
|
||||
/**
|
||||
* @param slot
|
||||
* @return a ScriptItemStack array of size 2 which contains the currency of this trade
|
||||
*/
|
||||
IItemStack[] getCurrency(int slot);
|
||||
|
||||
/**
|
||||
* @param slot Slot number 0-17
|
||||
*/
|
||||
void removeSellOption(int slot);
|
||||
|
||||
/**
|
||||
* @param name The trader Linked Market name
|
||||
*/
|
||||
void setMarket(String name);
|
||||
|
||||
/**
|
||||
* @return Get the currently set Linked Market name
|
||||
*/
|
||||
String getMarket();
|
||||
|
||||
/**
|
||||
* @param slot
|
||||
* @return the number of times an item has been sold on that slot
|
||||
*/
|
||||
int getPurchaseNum(int slot);
|
||||
|
||||
/**
|
||||
* @param slot
|
||||
* @param player
|
||||
* @return the number of times this player has purchased from this trader
|
||||
*/
|
||||
int getPurchaseNum(int slot, IPlayer player);
|
||||
|
||||
/**
|
||||
* Sets the purchase count of all slots to 0
|
||||
*/
|
||||
void resetPurchaseNum();
|
||||
|
||||
/**
|
||||
* sets the purchase num for that slot to 0
|
||||
* @param slot
|
||||
*/
|
||||
void resetPurchaseNum(int slot);
|
||||
|
||||
/**
|
||||
* sets the purchase num for that slot and player to 0
|
||||
* @param slot
|
||||
* @param player
|
||||
*/
|
||||
void resetPurchaseNum(int slot, IPlayer player);
|
||||
|
||||
/**
|
||||
* @param slot
|
||||
* @return if this slot is enabled
|
||||
*/
|
||||
boolean isSlotEnabled(int slot);
|
||||
|
||||
/**
|
||||
* @param slot
|
||||
* @param player
|
||||
* @return if this slot is enabled for this player
|
||||
*/
|
||||
boolean isSlotEnabled(int slot, IPlayer player);
|
||||
|
||||
/**
|
||||
* prevent an item from being sold on that slot
|
||||
* @param slot
|
||||
*/
|
||||
void disableSlot(int slot);
|
||||
|
||||
/**
|
||||
* disables the slot for this player
|
||||
* @param slot
|
||||
* @param player
|
||||
*/
|
||||
void disableSlot(int slot, IPlayer player);
|
||||
|
||||
/**
|
||||
* allow an item to be sold on that slot
|
||||
* @param slot
|
||||
*/
|
||||
void enableSlot(int slot);
|
||||
|
||||
/**
|
||||
* enables the slot for this player
|
||||
* @param slot
|
||||
* @param player
|
||||
*/
|
||||
void enableSlot(int slot, IPlayer player);
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package noppes.npcs.scripted.interfaces.roles;
|
||||
|
||||
public interface IRoleTransporter extends IRole {
|
||||
|
||||
}
|
||||
@@ -3,8 +3,9 @@ package noppes.npcs.scripted.roles;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.roles.JobBard;
|
||||
import noppes.npcs.scripted.constants.JobType;
|
||||
import noppes.npcs.scripted.interfaces.jobs.IJobBard;
|
||||
|
||||
public class ScriptJobBard extends ScriptJobInterface{
|
||||
public class ScriptJobBard extends ScriptJobInterface implements IJobBard {
|
||||
private JobBard job;
|
||||
public ScriptJobBard(EntityNPCInterface npc){
|
||||
super(npc);
|
||||
|
||||
@@ -3,8 +3,9 @@ package noppes.npcs.scripted.roles;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.roles.JobConversation;
|
||||
import noppes.npcs.scripted.constants.JobType;
|
||||
import noppes.npcs.scripted.interfaces.jobs.IJobConversation;
|
||||
|
||||
public class ScriptJobConversation extends ScriptJobInterface{
|
||||
public class ScriptJobConversation extends ScriptJobInterface implements IJobConversation {
|
||||
private JobConversation job;
|
||||
public ScriptJobConversation(EntityNPCInterface npc){
|
||||
super(npc);
|
||||
|
||||
@@ -4,8 +4,9 @@ import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.roles.JobFollower;
|
||||
import noppes.npcs.scripted.constants.JobType;
|
||||
import noppes.npcs.scripted.interfaces.entity.ICustomNpc;
|
||||
import noppes.npcs.scripted.interfaces.jobs.IJobFollower;
|
||||
|
||||
public class ScriptJobFollower extends ScriptJobInterface{
|
||||
public class ScriptJobFollower extends ScriptJobInterface implements IJobFollower {
|
||||
private JobFollower job;
|
||||
public ScriptJobFollower(EntityNPCInterface npc){
|
||||
super(npc);
|
||||
@@ -20,7 +21,7 @@ public class ScriptJobFollower extends ScriptJobInterface{
|
||||
job.name = name;
|
||||
}
|
||||
|
||||
public ICustomNpc getFollowingNpc(){
|
||||
public ICustomNpc getFollowingNpc() {
|
||||
if(!isFollowing())
|
||||
return null;
|
||||
return job.following.script.dummyNpc;
|
||||
|
||||
@@ -3,8 +3,9 @@ package noppes.npcs.scripted.roles;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.roles.JobGuard;
|
||||
import noppes.npcs.scripted.constants.JobType;
|
||||
import noppes.npcs.scripted.interfaces.jobs.IJobGuard;
|
||||
|
||||
public class ScriptJobGuard extends ScriptJobInterface{
|
||||
public class ScriptJobGuard extends ScriptJobInterface implements IJobGuard {
|
||||
private JobGuard job;
|
||||
public ScriptJobGuard(EntityNPCInterface npc){
|
||||
super(npc);
|
||||
|
||||
@@ -4,8 +4,9 @@ import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.roles.JobHealer;
|
||||
import noppes.npcs.scripted.constants.JobType;
|
||||
import noppes.npcs.scripted.interfaces.entity.IEntityLivingBase;
|
||||
import noppes.npcs.scripted.interfaces.jobs.IJobHealer;
|
||||
|
||||
public class ScriptJobHealer extends ScriptJobInterface{
|
||||
public class ScriptJobHealer extends ScriptJobInterface implements IJobHealer {
|
||||
private JobHealer job;
|
||||
public ScriptJobHealer(EntityNPCInterface npc){
|
||||
super(npc);
|
||||
|
||||
@@ -1,13 +1,24 @@
|
||||
package noppes.npcs.scripted.roles;
|
||||
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.roles.JobInterface;
|
||||
import noppes.npcs.scripted.NpcAPI;
|
||||
import noppes.npcs.scripted.constants.JobType;
|
||||
import noppes.npcs.scripted.interfaces.entity.ICustomNpc;
|
||||
import noppes.npcs.scripted.interfaces.jobs.IJob;
|
||||
|
||||
public class ScriptJobInterface {
|
||||
protected EntityNPCInterface npc;
|
||||
public class ScriptJobInterface implements IJob {
|
||||
public final EntityNPCInterface npc;
|
||||
public final JobInterface jobInterface;
|
||||
|
||||
public ScriptJobInterface(JobInterface jobInterface) {
|
||||
this.npc = null;
|
||||
this.jobInterface = jobInterface;
|
||||
}
|
||||
|
||||
public ScriptJobInterface(EntityNPCInterface npc){
|
||||
this.npc = npc;
|
||||
this.jobInterface = npc.jobInterface;
|
||||
}
|
||||
/**
|
||||
* @see noppes.npcs.scripted.constants.JobType
|
||||
@@ -16,4 +27,13 @@ public class ScriptJobInterface {
|
||||
public int getType(){
|
||||
return JobType.UNKNOWN;
|
||||
}
|
||||
|
||||
public JobInterface getJobInterface() {
|
||||
return jobInterface;
|
||||
}
|
||||
|
||||
public ICustomNpc getNpc() {
|
||||
return (ICustomNpc) NpcAPI.Instance().getIEntity(npc);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,11 +1,29 @@
|
||||
package noppes.npcs.scripted.roles;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import noppes.npcs.controllers.data.Availability;
|
||||
import noppes.npcs.controllers.data.PlayerItemGiverData;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.roles.JobItemGiver;
|
||||
import noppes.npcs.scripted.NpcAPI;
|
||||
import noppes.npcs.scripted.constants.JobType;
|
||||
import noppes.npcs.scripted.interfaces.entity.IPlayer;
|
||||
import noppes.npcs.scripted.interfaces.handler.data.IAvailability;
|
||||
import noppes.npcs.scripted.interfaces.item.IItemStack;
|
||||
import noppes.npcs.scripted.interfaces.jobs.IJobItemGiver;
|
||||
|
||||
public class ScriptJobItemGiver extends ScriptJobInterface{
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
public class ScriptJobItemGiver extends ScriptJobInterface implements IJobItemGiver {
|
||||
private JobItemGiver job;
|
||||
|
||||
public ScriptJobItemGiver(JobItemGiver job) {
|
||||
super(job);
|
||||
this.job = job;
|
||||
}
|
||||
|
||||
public ScriptJobItemGiver(EntityNPCInterface npc){
|
||||
super(npc);
|
||||
this.job = (JobItemGiver) npc.jobInterface;
|
||||
@@ -15,5 +33,81 @@ public class ScriptJobItemGiver extends ScriptJobInterface{
|
||||
public int getType(){
|
||||
return JobType.ITEMGIVER;
|
||||
}
|
||||
|
||||
|
||||
public void setCooldown(int cooldown) {
|
||||
if (cooldown < 0)
|
||||
cooldown = 0;
|
||||
|
||||
job.cooldown = cooldown;
|
||||
}
|
||||
|
||||
public void setCooldownType(int type) {
|
||||
if (type < 0) {
|
||||
type = 0;
|
||||
} else if (type > 2) {
|
||||
type = 2;
|
||||
}
|
||||
job.cooldownType = type;
|
||||
}
|
||||
|
||||
public int getCooldownType() {
|
||||
return job.cooldownType;
|
||||
}
|
||||
|
||||
public void setGivingMethod(int method) {
|
||||
if (method < 0) {
|
||||
method = 0;
|
||||
} else if (method > 4) {
|
||||
method = 4;
|
||||
}
|
||||
job.givingMethod = method;
|
||||
}
|
||||
|
||||
public int getGivingMethod() {
|
||||
return job.givingMethod;
|
||||
}
|
||||
|
||||
public void setLines(String[] lines) {
|
||||
job.lines = new ArrayList<>(Arrays.asList(lines));
|
||||
}
|
||||
|
||||
public String[] getLines() {
|
||||
return job.lines.toArray(new String[0]);
|
||||
}
|
||||
|
||||
public void setAvailability(IAvailability availability) {
|
||||
job.availability = (Availability) availability;
|
||||
}
|
||||
|
||||
public IAvailability getAvailability() {
|
||||
return job.availability;
|
||||
}
|
||||
|
||||
public void setItem(int slot, IItemStack item) {
|
||||
if (slot < 0) {
|
||||
slot = 0;
|
||||
} else if (slot > 8) {
|
||||
slot = 8;
|
||||
}
|
||||
|
||||
job.inventory.items.put(slot, item.getMCItemStack());
|
||||
}
|
||||
|
||||
public IItemStack[] getItems() {
|
||||
ArrayList<IItemStack> items = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < job.inventory.getSizeInventory(); i++) {
|
||||
items.add(NpcAPI.Instance().getIItemStack(job.inventory.getStackInSlot(i)));
|
||||
}
|
||||
|
||||
return items.toArray(new IItemStack[0]);
|
||||
}
|
||||
|
||||
public boolean giveItems(IPlayer player) {
|
||||
return job.giveItems((EntityPlayer) player.getMCEntity());
|
||||
}
|
||||
|
||||
public boolean canPlayerInteract(IPlayer player) {
|
||||
return job.canPlayerInteract((PlayerItemGiverData) player.getData().getItemGiverData());
|
||||
}
|
||||
}
|
||||
@@ -3,8 +3,9 @@ package noppes.npcs.scripted.roles;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.roles.JobPuppet;
|
||||
import noppes.npcs.scripted.constants.JobType;
|
||||
import noppes.npcs.scripted.interfaces.jobs.IJobPuppet;
|
||||
|
||||
public class ScriptJobPuppet extends ScriptJobInterface{
|
||||
public class ScriptJobPuppet extends ScriptJobInterface implements IJobPuppet {
|
||||
private JobPuppet job;
|
||||
public ScriptJobPuppet(EntityNPCInterface npc){
|
||||
super(npc);
|
||||
@@ -100,7 +101,7 @@ public class ScriptJobPuppet extends ScriptJobInterface{
|
||||
|
||||
/**
|
||||
* @since 1.7.10c
|
||||
* @param type Body part (0:head, 1:body, 2:leftarm, 3:rightarm, 4:leftleg, 5:rightleg)
|
||||
* @param part Body part (0:head, 1:body, 2:leftarm, 3:rightarm, 4:leftleg, 5:rightleg)
|
||||
* @param rotation Rotation the of the body part
|
||||
*/
|
||||
public void setRotationY(int part, int rotation){
|
||||
|
||||
@@ -8,8 +8,9 @@ import noppes.npcs.roles.JobSpawner;
|
||||
import noppes.npcs.scripted.NpcAPI;
|
||||
import noppes.npcs.scripted.constants.JobType;
|
||||
import noppes.npcs.scripted.interfaces.entity.IEntityLivingBase;
|
||||
import noppes.npcs.scripted.interfaces.jobs.IJobSpawner;
|
||||
|
||||
public class ScriptJobSpawner extends ScriptJobInterface{
|
||||
public class ScriptJobSpawner extends ScriptJobInterface implements IJobSpawner {
|
||||
private JobSpawner job;
|
||||
public ScriptJobSpawner(EntityNPCInterface npc){
|
||||
super(npc);
|
||||
|
||||
@@ -2,8 +2,9 @@ package noppes.npcs.scripted.roles;
|
||||
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.scripted.constants.RoleType;
|
||||
import noppes.npcs.scripted.interfaces.roles.IRoleBank;
|
||||
|
||||
public class ScriptRoleBank extends ScriptRoleInterface{
|
||||
public class ScriptRoleBank extends ScriptRoleInterface implements IRoleBank {
|
||||
|
||||
public ScriptRoleBank(EntityNPCInterface npc) {
|
||||
super(npc);
|
||||
|
||||
@@ -6,18 +6,15 @@ import noppes.npcs.roles.RoleFollower;
|
||||
import noppes.npcs.scripted.NpcAPI;
|
||||
import noppes.npcs.scripted.constants.RoleType;
|
||||
import noppes.npcs.scripted.interfaces.entity.IPlayer;
|
||||
import noppes.npcs.scripted.interfaces.roles.IRoleFollower;
|
||||
|
||||
public class ScriptRoleFollower extends ScriptRoleInterface{
|
||||
public class ScriptRoleFollower extends ScriptRoleInterface implements IRoleFollower {
|
||||
private RoleFollower role;
|
||||
public ScriptRoleFollower(EntityNPCInterface npc) {
|
||||
super(npc);
|
||||
role = (RoleFollower) npc.roleInterface;
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 1.7.10c
|
||||
* @param player Player who is set as the owner. If null given everything resets
|
||||
*/
|
||||
|
||||
public void setOwner(IPlayer player){
|
||||
if(player == null || player.getMCEntity() == null){
|
||||
role.setOwner(null);
|
||||
@@ -26,22 +23,14 @@ public class ScriptRoleFollower extends ScriptRoleInterface{
|
||||
EntityPlayer mcplayer = (EntityPlayer) player.getMCEntity();
|
||||
role.setOwner(mcplayer);
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 1.7.10c
|
||||
* @return Returns the followers owner. Returns null if he has no owner or the owner is offline
|
||||
*/
|
||||
|
||||
public IPlayer getOwner(){
|
||||
if(role.owner == null)
|
||||
return null;
|
||||
|
||||
return (IPlayer) NpcAPI.Instance().getIEntity(role.owner);
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 1.7.10c
|
||||
* @return Returns whether or not the follower has an owner
|
||||
*/
|
||||
|
||||
public boolean hasOwner(){
|
||||
return role.owner != null;
|
||||
}
|
||||
@@ -53,51 +42,27 @@ public class ScriptRoleFollower extends ScriptRoleInterface{
|
||||
public void setIsFollowing(boolean following) {
|
||||
if (role.owner != null && role.getDaysLeft() > 0) role.isFollowing = following;
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 1.7.10c
|
||||
* @return Returns days left
|
||||
*/
|
||||
|
||||
public int getDaysLeft(){
|
||||
return role.getDaysLeft();
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 1.7.10c
|
||||
* @param days The days you want to add to the days remaining
|
||||
*/
|
||||
|
||||
public void addDaysLeft(int days){
|
||||
role.addDays(days);
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 1.7.10c
|
||||
* @return Returns whether or not the follower is set to infinite days
|
||||
*/
|
||||
|
||||
public boolean getInfiniteDays(){
|
||||
return role.infiniteDays;
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 1.7.10c
|
||||
* @param infinite Sets whether the days hired are infinite
|
||||
*/
|
||||
|
||||
public void setInfiniteDays(boolean infinite){
|
||||
role.infiniteDays = infinite;
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 1.7.10c
|
||||
* @return Return whether the gui is disabled
|
||||
*/
|
||||
|
||||
public boolean getGuiDisabled(){
|
||||
return role.disableGui;
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 1.7.10c
|
||||
* @param disabled Set the gui to be disabled or not
|
||||
*/
|
||||
|
||||
public void setGuiDisabled(boolean disabled){
|
||||
role.disableGui = disabled;
|
||||
}
|
||||
|
||||
@@ -1,13 +1,17 @@
|
||||
package noppes.npcs.scripted.roles;
|
||||
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.roles.RoleInterface;
|
||||
import noppes.npcs.scripted.constants.RoleType;
|
||||
import noppes.npcs.scripted.interfaces.roles.IRole;
|
||||
|
||||
public class ScriptRoleInterface {
|
||||
protected EntityNPCInterface npc;
|
||||
public class ScriptRoleInterface implements IRole {
|
||||
public final EntityNPCInterface npc;
|
||||
public final RoleInterface role;
|
||||
|
||||
public ScriptRoleInterface(EntityNPCInterface npc){
|
||||
this.npc = npc;
|
||||
this.role = npc.roleInterface;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,8 +2,9 @@ package noppes.npcs.scripted.roles;
|
||||
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.scripted.constants.RoleType;
|
||||
import noppes.npcs.scripted.interfaces.roles.IRoleMailman;
|
||||
|
||||
public class ScriptRoleMailman extends ScriptRoleInterface{
|
||||
public class ScriptRoleMailman extends ScriptRoleInterface implements IRoleMailman {
|
||||
|
||||
public ScriptRoleMailman(EntityNPCInterface npc) {
|
||||
super(npc);
|
||||
|
||||
@@ -8,20 +8,15 @@ import noppes.npcs.scripted.NpcAPI;
|
||||
import noppes.npcs.scripted.interfaces.item.IItemStack;
|
||||
import noppes.npcs.scripted.constants.RoleType;
|
||||
import noppes.npcs.scripted.interfaces.entity.IPlayer;
|
||||
import noppes.npcs.scripted.interfaces.roles.IRoleTrader;
|
||||
|
||||
public class ScriptRoleTrader extends ScriptRoleInterface{
|
||||
public class ScriptRoleTrader extends ScriptRoleInterface implements IRoleTrader {
|
||||
private RoleTrader role;
|
||||
public ScriptRoleTrader(EntityNPCInterface npc) {
|
||||
super(npc);
|
||||
role = (RoleTrader) npc.roleInterface;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param slot Slot number 0-17
|
||||
* @param currency Currency item
|
||||
* @param currency2 Currency item number two
|
||||
* @param sold Item to be sold by this npc
|
||||
*/
|
||||
|
||||
public void setSellOption(int slot, IItemStack currency, IItemStack currency2, IItemStack sold){
|
||||
if(sold == null || slot >= 18 || slot < 0)
|
||||
return;
|
||||
@@ -40,29 +35,16 @@ public class ScriptRoleTrader extends ScriptRoleInterface{
|
||||
role.inventorySold.items.put(slot, sold.getMCItemStack());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param slot Slot number 0-17
|
||||
* @param currency Currency item
|
||||
* @param sold Item to be sold by this npc
|
||||
*/
|
||||
public void setSellOption(int slot, IItemStack currency, IItemStack sold){
|
||||
setSellOption(slot, currency, null, sold);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param slot
|
||||
* @return The item being sold in this slot.
|
||||
*/
|
||||
|
||||
public IItemStack getSellOption(int slot) {
|
||||
if (slot >= 18 || slot < 0) return null;
|
||||
if (role.inventorySold.items.get(slot) == null) return null;
|
||||
return NpcAPI.Instance().getIItemStack(role.inventoryCurrency.items.get(slot));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param slot
|
||||
* @return a ScriptItemStack array of size 2 which contains the currency of this trade
|
||||
*/
|
||||
|
||||
public IItemStack[] getCurrency(int slot) {
|
||||
if (slot >= 18 || slot < 0) return null;
|
||||
IItemStack[] currency = new IItemStack[2];
|
||||
@@ -75,127 +57,72 @@ public class ScriptRoleTrader extends ScriptRoleInterface{
|
||||
return currency;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param slot Slot number 0-17
|
||||
*/
|
||||
|
||||
public void removeSellOption(int slot){
|
||||
if(slot >= 18 || slot < 0) return;
|
||||
role.inventoryCurrency.items.remove(slot);
|
||||
role.inventoryCurrency.items.remove(slot + 18);
|
||||
role.inventorySold.items.remove(slot);
|
||||
}
|
||||
/**
|
||||
* @param name The trader Linked Market name
|
||||
*/
|
||||
|
||||
public void setMarket(String name){
|
||||
role.marketName = name;
|
||||
Market.load(role, name);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Get the currently set Linked Market name
|
||||
*/
|
||||
|
||||
public String getMarket(){
|
||||
return role.marketName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param slot
|
||||
* @return the number of times an item has been sold on that slot
|
||||
*/
|
||||
|
||||
public int getPurchaseNum(int slot) {
|
||||
if(slot >= 18 || slot < 0) return -1;
|
||||
return role.purchases[slot];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param slot
|
||||
* @param player
|
||||
* @return the number of times this player has purchased from this trader
|
||||
*/
|
||||
|
||||
public int getPurchaseNum(int slot, IPlayer player) {
|
||||
if(slot >= 18 || slot < 0) return -1;
|
||||
return role.getArrayByName(player.getDisplayName(), role.playerPurchases)[slot];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the purchase count of all slots to 0
|
||||
*/
|
||||
|
||||
public void resetPurchaseNum() {
|
||||
for (int i = 0; i < role.purchases.length; ++i) role.purchases[i] = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* sets the purchase num for that slot to 0
|
||||
* @param slot
|
||||
*/
|
||||
|
||||
public void resetPurchaseNum(int slot) {
|
||||
if(slot >= 18 || slot < 0) return;
|
||||
role.purchases[slot] = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* sets the purchase num for that slot and player to 0
|
||||
* @param slot
|
||||
* @param player
|
||||
*/
|
||||
|
||||
public void resetPurchaseNum(int slot, IPlayer player) {
|
||||
if(slot >= 18 || slot < 0) return;
|
||||
role.getArrayByName(player.getDisplayName(), role.playerPurchases)[slot] = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param slot
|
||||
* @return if this slot is enabled
|
||||
*/
|
||||
|
||||
public boolean isSlotEnabled(int slot) {
|
||||
if(slot >= 18 || slot < 0) return false;
|
||||
return role.disableSlot[slot] > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param slot
|
||||
* @param player
|
||||
* @return if this slot is enabled for this player
|
||||
*/
|
||||
|
||||
public boolean isSlotEnabled(int slot, IPlayer player) {
|
||||
if(slot >= 18 || slot < 0) return false;
|
||||
return role.isSlotEnabled(slot, (EntityPlayer)player.getMCEntity());
|
||||
}
|
||||
|
||||
/**
|
||||
* prevent an item from being sold on that slot
|
||||
* @param slot
|
||||
*/
|
||||
|
||||
public void disableSlot(int slot) {
|
||||
if(slot >= 18 || slot < 0) return;
|
||||
role.disableSlot[slot] = 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* disables the slot for this player
|
||||
* @param slot
|
||||
* @param player
|
||||
*/
|
||||
|
||||
public void disableSlot(int slot, IPlayer player) {
|
||||
if(slot >= 18 || slot < 0) return;
|
||||
role.getArrayByName(player.getDisplayName(), role.playerDisableSlot)[slot] = 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* allow an item to be sold on that slot
|
||||
* @param slot
|
||||
*/
|
||||
|
||||
public void enableSlot(int slot) {
|
||||
if(slot >= 18 || slot < 0) return;
|
||||
role.disableSlot[slot] = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* enables the slot for this player
|
||||
* @param slot
|
||||
* @param player
|
||||
*/
|
||||
|
||||
public void enableSlot(int slot, IPlayer player) {
|
||||
if(slot >= 18 || slot < 0) return;
|
||||
role.getArrayByName(player.getDisplayName(), role.playerDisableSlot)[slot] = 0;
|
||||
|
||||
@@ -2,8 +2,9 @@ package noppes.npcs.scripted.roles;
|
||||
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
import noppes.npcs.scripted.constants.RoleType;
|
||||
import noppes.npcs.scripted.interfaces.roles.IRoleTransporter;
|
||||
|
||||
public class ScriptRoleTransporter extends ScriptRoleInterface{
|
||||
public class ScriptRoleTransporter extends ScriptRoleInterface implements IRoleTransporter {
|
||||
|
||||
public ScriptRoleTransporter(EntityNPCInterface npc) {
|
||||
super(npc);
|
||||
|
||||
Reference in new issue
Block a user