- do not empty on first switch
- plugin.yml added
This commit is contained in:
parent
9cc0fb267d
commit
078fd69e08
3 changed files with 17 additions and 2 deletions
9
LimitedCreative/plugin.yml
Normal file
9
LimitedCreative/plugin.yml
Normal file
|
@ -0,0 +1,9 @@
|
|||
name: LimitedCreative
|
||||
main: de.jaschastarke.minecraft.limitedcreative.LimitedCreativeCore
|
||||
version: 0.1-alpha
|
||||
depend: [WorldGuard]
|
||||
commands:
|
||||
limitedcreative:
|
||||
description: Manually control the Creative-Features
|
||||
aliases: lc
|
||||
usage: /<command> load
|
|
@ -70,4 +70,9 @@ public class Inventory {
|
|||
new Armor(pinv).restore(yml.getConfigurationSection("armor"));
|
||||
new Items(pinv).restore(yml.getConfigurationSection("inv"));
|
||||
}
|
||||
|
||||
public boolean isStored(GameMode gm) {
|
||||
File f = new File(LimitedCreativeCore.plugin.getDataFolder(), getFileName(player, gm));
|
||||
return f.exists();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ public class PlayerCore {
|
|||
public void onSetCreative() {
|
||||
Inventory inv = new Inventory(player);
|
||||
inv.save();
|
||||
if (plugin.config.getStoreCreative()) {
|
||||
if (plugin.config.getStoreCreative() && inv.isStored(GameMode.CREATIVE)) {
|
||||
inv.load(GameMode.CREATIVE);
|
||||
} else {
|
||||
inv.clear();
|
||||
|
@ -26,6 +26,7 @@ public class PlayerCore {
|
|||
if (plugin.config.getStoreCreative()) {
|
||||
inv.save();
|
||||
}
|
||||
if (inv.isStored(GameMode.SURVIVAL))
|
||||
inv.load(GameMode.SURVIVAL);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue