mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-12 06:07:27 +00:00
Profile Change Command Completed
This commit is contained in:
1 parent
10edf72ed9
commit
52aa1a75c1
5 files changed
+13
-12
No files matched your search
@@ -22,6 +22,7 @@ public class CommandProfile extends CommandBase {
|
||||
|
||||
public CommandProfile(){
|
||||
registerCommand(help);
|
||||
registerCommand(new CommandProfileChange());
|
||||
}
|
||||
|
||||
public void registerCommand(CommandProfileBase command){
|
||||
|
||||
@@ -123,11 +123,11 @@ public abstract class CommandProfileBase extends CommandBase{
|
||||
}
|
||||
|
||||
public String getSubCommandPermission(String subCommand){
|
||||
return "cnpc.kamkeel." + getCommandName().toLowerCase() + "." + subCommand.toLowerCase();
|
||||
return "profile.kamkeel." + getCommandName().toLowerCase() + "." + subCommand.toLowerCase();
|
||||
}
|
||||
|
||||
public String getSubUniversalPermission(){
|
||||
return "cnpc.kamkeel." + getCommandName().toLowerCase() + "*";
|
||||
return "profile.kamkeel." + getCommandName().toLowerCase() + "*";
|
||||
}
|
||||
|
||||
public boolean canSendCommand(ICommandSender sender, SubCommand command, String subCommand){
|
||||
|
||||
@@ -104,7 +104,7 @@ public class ProfileController {
|
||||
});
|
||||
}
|
||||
|
||||
public void changeSlot(EntityPlayer player, int slotNumber){
|
||||
public static void changeSlot(EntityPlayer player, int slotNumber){
|
||||
if(!activeProfiles.containsKey(player.getUniqueID()))
|
||||
return;
|
||||
|
||||
@@ -122,7 +122,7 @@ public class ProfileController {
|
||||
save(player, profile);
|
||||
}
|
||||
|
||||
public void saveSlotData(EntityPlayer player){
|
||||
public static void saveSlotData(EntityPlayer player){
|
||||
if(!activeProfiles.containsKey(player.getUniqueID()))
|
||||
return;
|
||||
|
||||
@@ -134,8 +134,9 @@ public class ProfileController {
|
||||
slot = profile.slots.get(profile.currentID);
|
||||
dataCompound = (NBTTagCompound) slot.getCompound().copy();
|
||||
} else {
|
||||
slot = new Slot(profile.currentID, "Slot 1");
|
||||
slot = new Slot(profile.currentID, "Slot " + profile.currentID);
|
||||
dataCompound = new NBTTagCompound();
|
||||
slot.setCompound(dataCompound);
|
||||
}
|
||||
|
||||
for(IProfileData profileData : profileTypes.values()){
|
||||
@@ -146,7 +147,7 @@ public class ProfileController {
|
||||
slot.setCompound(dataCompound);
|
||||
}
|
||||
|
||||
public void changePlayerSlot(EntityPlayer player, int id){
|
||||
public static void changePlayerSlot(EntityPlayer player, int id){
|
||||
if(!activeProfiles.containsKey(player.getUniqueID()))
|
||||
return;
|
||||
|
||||
@@ -158,19 +159,15 @@ public class ProfileController {
|
||||
slotCompound = (NBTTagCompound) slot.getCompound().copy();
|
||||
} else {
|
||||
slot = new Slot(id, "Slot " + id);
|
||||
slot.setCompound(new NBTTagCompound());
|
||||
slotCompound = new NBTTagCompound();
|
||||
slot.setCompound(slotCompound);
|
||||
}
|
||||
|
||||
slot.setLastLoaded(System.currentTimeMillis());
|
||||
profile.slots.put(id, slot);
|
||||
|
||||
for(IProfileData profileData : profileTypes.values()){
|
||||
if(slotCompound.hasKey(profileData.getTagName())){
|
||||
profileData.setNBT(player, slotCompound.getCompoundTag(profileData.getTagName()));
|
||||
} else {
|
||||
profileData.setNBT(player, new NBTTagCompound());
|
||||
}
|
||||
profileData.setNBT(player, slotCompound.getCompoundTag(profileData.getTagName()));
|
||||
profileData.save(player);
|
||||
}
|
||||
|
||||
|
||||
@@ -34,5 +34,6 @@ public class CNPCData implements IProfileData {
|
||||
else {
|
||||
customNPCData.setNBT(replace);
|
||||
}
|
||||
customNPCData.updateClient = true;
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,7 @@ import cpw.mods.fml.common.registry.EntityRegistry;
|
||||
import foxz.command.CommandNoppes;
|
||||
import kamkeel.addon.AddonManager;
|
||||
import kamkeel.command.CommandKamkeel;
|
||||
import kamkeel.command.profile.CommandProfile;
|
||||
import kamkeel.controllers.ProfileController;
|
||||
import kamkeel.controllers.data.CNPCData;
|
||||
import kamkeel.developer.Developer;
|
||||
@@ -260,6 +261,7 @@ public class CustomNpcs {
|
||||
public void serverstart(FMLServerStartingEvent event) {
|
||||
event.registerServerCommand(new CommandNoppes());
|
||||
event.registerServerCommand(new CommandKamkeel());
|
||||
event.registerServerCommand(new CommandProfile());
|
||||
}
|
||||
|
||||
private void registerNpc(Class<? extends Entity> cl, String name) {
|
||||
|
||||
Reference in new issue
Block a user