mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-17 21:35:10 +00:00
Quest Profile Options
This commit is contained in:
1 parent
2141c5c4ca
commit
40154f9c53
14 files changed
+454
-60
No files matched your search
@@ -0,0 +1,88 @@
|
||||
package noppes.npcs.controllers.data;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.api.handler.data.IProfileOptions;
|
||||
import noppes.npcs.constants.EnumProfileSync;
|
||||
|
||||
public class ProfileOptions implements IProfileOptions {
|
||||
public boolean enableOptions = false;
|
||||
|
||||
public EnumProfileSync cooldownControl = EnumProfileSync.Individual;
|
||||
public EnumProfileSync completeControl = EnumProfileSync.Individual;
|
||||
|
||||
public void readFromNBT(NBTTagCompound compound)
|
||||
{
|
||||
// Party Management
|
||||
enableOptions = compound.getBoolean("EnableProfiles");
|
||||
if(enableOptions){
|
||||
cooldownControl = EnumProfileSync.values()[compound.getInteger("CooldownControl")];
|
||||
completeControl = EnumProfileSync.values()[compound.getInteger("CompleteControl")];
|
||||
}
|
||||
else {
|
||||
if(compound.hasKey("CooldownControl")){
|
||||
compound.removeTag("CooldownControl");
|
||||
}
|
||||
if(compound.hasKey("CompleteControl")){
|
||||
compound.removeTag("CompleteControl");
|
||||
}
|
||||
|
||||
cooldownControl = EnumProfileSync.Individual;
|
||||
completeControl = EnumProfileSync.Individual;
|
||||
}
|
||||
}
|
||||
public NBTTagCompound writeToNBT()
|
||||
{
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
compound.setBoolean("EnableProfiles", enableOptions);
|
||||
if(enableOptions){
|
||||
compound.setInteger("CooldownControl", cooldownControl.ordinal());
|
||||
compound.setInteger("CompleteControl", completeControl.ordinal());
|
||||
}
|
||||
else {
|
||||
if(compound.hasKey("CooldownControl")){
|
||||
compound.removeTag("CooldownControl");
|
||||
}
|
||||
if(compound.hasKey("CompleteControl")){
|
||||
compound.removeTag("CompleteControl");
|
||||
}
|
||||
}
|
||||
|
||||
return compound;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasProfileOptions() {
|
||||
return enableOptions;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setProfileOptions(boolean enable) {
|
||||
this.enableOptions = enable;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCooldownControl(int profileType) {
|
||||
if (profileType < 0 || profileType >= EnumProfileSync.values().length) {
|
||||
return;
|
||||
}
|
||||
this.cooldownControl = EnumProfileSync.values()[profileType];
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCooldownControl(){
|
||||
return this.cooldownControl.ordinal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCompleteControl(int profileType) {
|
||||
if (profileType < 0 || profileType >= EnumProfileSync.values().length) {
|
||||
return;
|
||||
}
|
||||
this.completeControl = EnumProfileSync.values()[profileType];
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCompleteControl(){
|
||||
return this.completeControl.ordinal();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user