v1.3.01:
MC 1.3.1: - Adventure GameMode Inventory (optional) - Region Flag for Adventure Inventory
This commit is contained in:
parent
50f022e1fb
commit
585aa06fae
7 changed files with 48 additions and 18 deletions
|
@ -47,6 +47,11 @@ store:
|
|||
# By default the inventories are saved to "plugin/LimitedCreative/inventories".
|
||||
# default: "inventories"
|
||||
folder: "inventories"
|
||||
|
||||
# SeparateAdventureInventory
|
||||
# When true, your players get a separate inventory when switching to adventure gamemode (2). Otherwise
|
||||
# they have the default survival inventory while in adventure gamemode.
|
||||
adventure: false
|
||||
|
||||
limit:
|
||||
# LimitsEnabled
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
name: LimitedCreative
|
||||
main: de.jaschastarke.minecraft.limitedcreative.Core
|
||||
version: 1.2.5
|
||||
version: 1.3.0a
|
||||
softdepend: [WorldGuard, WorldEdit, MultiInv]
|
||||
dev-url: http://dev.bukkit.org/server-mods/limited-creative/
|
||||
commands:
|
||||
|
|
4
pom.xml
4
pom.xml
|
@ -3,7 +3,7 @@
|
|||
<groupId>de.jaschastarke</groupId>
|
||||
<artifactId>LimitedCreative</artifactId>
|
||||
<name>LimitedCreative</name>
|
||||
<version>1.2.5</version>
|
||||
<version>1.3.0a</version>
|
||||
<url>https://github.com/possi/LimitedCreative</url>
|
||||
<scm>
|
||||
<connection>scm:git:git://github.com/possi/LimitedCreative.git</connection>
|
||||
|
@ -68,7 +68,7 @@
|
|||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>bukkit</artifactId>
|
||||
<version>1.2.5-R4.0</version>
|
||||
<version>1.3.1-R0.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sk89q</groupId>
|
||||
|
|
|
@ -43,6 +43,7 @@ public class Configuration {
|
|||
public enum Option {
|
||||
STORECREATIVE("store.creative", true),
|
||||
CREATIVEARMOR("store.armor.enabled", true),
|
||||
ADVENTUREINV("store.adventure", false),
|
||||
REGION_OPTIONAL("region.optional", true),
|
||||
REGION_REMEMBER("region.remember", true),
|
||||
BLOCKPICKUP("limit.pickup", true),
|
||||
|
@ -127,6 +128,9 @@ public class Configuration {
|
|||
public String getInventoryFolder() {
|
||||
return c.getString("store.folder", "inventories");
|
||||
}
|
||||
public boolean getAdventureInv() {
|
||||
return this.getBoolean(Option.ADVENTUREINV);
|
||||
}
|
||||
public boolean getBlockPickupInCreative() {
|
||||
return this.getBoolean(Option.BLOCKPICKUP);
|
||||
}
|
||||
|
|
|
@ -35,10 +35,11 @@ public class Inventory {
|
|||
|
||||
public enum Target {
|
||||
SURVIVAL,
|
||||
CREATIVE;
|
||||
CREATIVE,
|
||||
ADVENTURE;
|
||||
|
||||
public static Target getTarget(GameMode gm) {
|
||||
return gm == GameMode.CREATIVE ? Target.CREATIVE : Target.SURVIVAL;
|
||||
return Target.valueOf(gm.name());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -60,6 +61,10 @@ public class Inventory {
|
|||
Core.debug(getPlayer().getName()+": store inventory: "+getPlayer().getGameMode());
|
||||
storage.store(this, Target.getTarget(getPlayer().getGameMode()));
|
||||
}
|
||||
public void save(GameMode gm) {
|
||||
Core.debug(getPlayer().getName()+": store inventory: "+gm);
|
||||
storage.store(this, Target.getTarget(gm));
|
||||
}
|
||||
|
||||
public void load() {
|
||||
load(getPlayer().getGameMode());
|
||||
|
|
|
@ -195,20 +195,34 @@ public class LCPlayer {
|
|||
if (plugin.config.getPermissionToKeepInventory() && hasPermission(Perms.KEEPINVENTORY))
|
||||
return true;
|
||||
getPlayer().closeInventory();
|
||||
if (gm != GameMode.CREATIVE || plugin.config.getStoreCreative())
|
||||
getInv().save();
|
||||
if (gm == GameMode.CREATIVE) {
|
||||
if (plugin.config.getStoreCreative() && getInv().isStored(GameMode.CREATIVE)) {
|
||||
getInv().load(GameMode.CREATIVE);
|
||||
} else {
|
||||
getInv().clear();
|
||||
}
|
||||
setCreativeArmor();
|
||||
} else if (gm == GameMode.SURVIVAL) {
|
||||
if (getInv().isStored(GameMode.SURVIVAL))
|
||||
getInv().load(GameMode.SURVIVAL);
|
||||
}
|
||||
|
||||
GameMode cgm = getPlayer().getGameMode();
|
||||
if (gm == GameMode.ADVENTURE && !plugin.config.getAdventureInv())
|
||||
gm = GameMode.SURVIVAL;
|
||||
if (cgm == GameMode.ADVENTURE && !plugin.config.getAdventureInv())
|
||||
cgm = GameMode.SURVIVAL;
|
||||
|
||||
if (gm != cgm) {
|
||||
if (gm != GameMode.CREATIVE || plugin.config.getStoreCreative()) {
|
||||
getInv().save(cgm);
|
||||
}
|
||||
if (gm == GameMode.CREATIVE) {
|
||||
if (plugin.config.getStoreCreative() && getInv().isStored(GameMode.CREATIVE)) {
|
||||
getInv().load(GameMode.CREATIVE);
|
||||
} else {
|
||||
getInv().clear();
|
||||
}
|
||||
setCreativeArmor();
|
||||
} else if (gm == GameMode.SURVIVAL) {
|
||||
if (getInv().isStored(GameMode.SURVIVAL))
|
||||
getInv().load(GameMode.SURVIVAL);
|
||||
} else if (gm == GameMode.ADVENTURE) {
|
||||
if (getInv().isStored(GameMode.ADVENTURE))
|
||||
getInv().load(GameMode.ADVENTURE);
|
||||
else
|
||||
getInv().clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -23,6 +23,8 @@ public class GameModeFlag extends Flag<GameMode> {
|
|||
return GameMode.CREATIVE;
|
||||
} else if (input.equalsIgnoreCase("survival")) {
|
||||
return GameMode.SURVIVAL;
|
||||
} else if (input.equalsIgnoreCase("adventure")) {
|
||||
return GameMode.ADVENTURE;
|
||||
} else if (input.equalsIgnoreCase("none")) {
|
||||
return null;
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue