From 69786772f7b426eaebb7221d24aab9fc37171391 Mon Sep 17 00:00:00 2001 From: Jascha Starke Date: Fri, 2 Mar 2012 20:40:10 +0100 Subject: [PATCH 01/14] v1.2.0-alpha: - initial worldguard 5.5.2-snapshot --- lang/en_US.yml | 8 +- plugin.yml | 2 +- .../minecraft/limitedcreative/Core.java | 3 +- .../minecraft/limitedcreative/LCPlayer.java | 2 +- .../limitedcreative/regions/Flags.java | 12 +-- .../limitedcreative/regions/GameModeFlag.java | 80 ++++--------------- .../regions/RegionListener.java | 44 +++++----- .../worldguard/ApplicableRegions.java | 14 ++++ .../minecraft/worldguard/CCommand.java | 23 ++++-- .../minecraft/worldguard/CRegionManager.java | 13 ++- 10 files changed, 92 insertions(+), 109 deletions(-) diff --git a/lang/en_US.yml b/lang/en_US.yml index 6c95e07..9411b12 100644 --- a/lang/en_US.yml +++ b/lang/en_US.yml @@ -54,10 +54,10 @@ blocked: button: To interact with buttons is not allowed in creative mode lever: To interact with levers is not allowed in creative mode survival_flying: You should stay on ground, when leaving a creative-area - outside_creative: You can not place blocks outside of the creative-area - outside_creative_break: You can not destroy blocks outside of the creative-area - inside_survival: You can not place blocks inside of the survival-area - inside_survival_break: You can not destroy blocks inside of the survival-area + outside_place: You can not place blocks outside of the gamemode-area + outside_break: You can not destroy blocks outside of the gamemode-area + inside_place: You can not place blocks inside of the gamemode-area + inside_break: You can not destroy blocks inside of the gamemode-area use: You are not allowed to use this type of item place: You are not allowed to place this type of block break: You are not allowed to break this type of block diff --git a/plugin.yml b/plugin.yml index d20d5ba..e599b05 100644 --- a/plugin.yml +++ b/plugin.yml @@ -1,6 +1,6 @@ name: LimitedCreative main: de.jaschastarke.minecraft.limitedcreative.Core -version: 1.0 +version: 1.2.0-alpha softdepend: [WorldGuard, WorldEdit, MultiInv] dev-url: http://dev.bukkit.org/server-mods/limited-creative/ commands: diff --git a/src/de/jaschastarke/minecraft/limitedcreative/Core.java b/src/de/jaschastarke/minecraft/limitedcreative/Core.java index b3851e8..9dcc317 100644 --- a/src/de/jaschastarke/minecraft/limitedcreative/Core.java +++ b/src/de/jaschastarke/minecraft/limitedcreative/Core.java @@ -44,8 +44,9 @@ public class Core extends JavaPlugin { @Override public void onDisable() { plugin.getServer().getScheduler().cancelTasks(this); - try { + if (worldguard != null) worldguard.unload(); + try { Locale.unload(); } catch (NoClassDefFoundError e) {} // prevent unload issue diff --git a/src/de/jaschastarke/minecraft/limitedcreative/LCPlayer.java b/src/de/jaschastarke/minecraft/limitedcreative/LCPlayer.java index 7bc5310..52fdd89 100644 --- a/src/de/jaschastarke/minecraft/limitedcreative/LCPlayer.java +++ b/src/de/jaschastarke/minecraft/limitedcreative/LCPlayer.java @@ -100,7 +100,7 @@ public class LCPlayer { Players.getOptions().setRegionGameMode(getName(), gm); } - private GameMode getRegionGameMode() { + public GameMode getRegionGameMode() { if (!options.containsKey("region")) { options.put("region", Players.getOptions().getRegionGameMode(getName())); } diff --git a/src/de/jaschastarke/minecraft/limitedcreative/regions/Flags.java b/src/de/jaschastarke/minecraft/limitedcreative/regions/Flags.java index e921e01..1c20af6 100644 --- a/src/de/jaschastarke/minecraft/limitedcreative/regions/Flags.java +++ b/src/de/jaschastarke/minecraft/limitedcreative/regions/Flags.java @@ -4,21 +4,17 @@ import java.util.Arrays; import java.util.List; import com.sk89q.worldguard.protection.flags.Flag; -import com.sk89q.worldguard.protection.flags.RegionGroupFlag; +import com.sk89q.worldguard.protection.flags.RegionGroup; import com.sk89q.worldguard.protection.flags.StateFlag; public final class Flags { public static final StateFlag SPAWNDROPS = new StateFlag("spawndrops", true); - public static final StateFlag CREATIVE = new StateFlag("creative", false); - public static final RegionGroupFlag CREATIVE_GROUP = new RegionGroupFlag("creative-group", RegionGroupFlag.RegionGroup.MEMBERS); - static { - CREATIVE.setGroupFlag(CREATIVE_GROUP); - } + public static final GameModeFlag GAMEMODE = new GameModeFlag("gamemode", RegionGroup.MEMBERS); + public static List> getList() { return Arrays.asList(new Flag[]{ SPAWNDROPS, - CREATIVE, - CREATIVE_GROUP + GAMEMODE, }); } } diff --git a/src/de/jaschastarke/minecraft/limitedcreative/regions/GameModeFlag.java b/src/de/jaschastarke/minecraft/limitedcreative/regions/GameModeFlag.java index d53ced9..30a305f 100644 --- a/src/de/jaschastarke/minecraft/limitedcreative/regions/GameModeFlag.java +++ b/src/de/jaschastarke/minecraft/limitedcreative/regions/GameModeFlag.java @@ -6,89 +6,41 @@ import org.bukkit.command.CommandSender; import com.sk89q.worldguard.bukkit.WorldGuardPlugin; import com.sk89q.worldguard.protection.flags.Flag; import com.sk89q.worldguard.protection.flags.InvalidFlagFormat; -import com.sk89q.worldguard.protection.flags.RegionGroupFlag; +import com.sk89q.worldguard.protection.flags.RegionGroup; /** * Well, that was an interesting idea, but it doesn't work. */ -public class GameModeFlag extends Flag { - private State def; - private RegionGroupFlag groupFlag; - - public enum State { - CREATIVE, - SURVIVAL, - NONE; - - public GameMode getGameMode() { - return getBukkitGameMode(this); - } - public boolean equals (GameMode gm) { - return gm == this.getGameMode(); - } - public static GameMode getBukkitGameMode(State gm) { - switch (gm) { - case CREATIVE: - return GameMode.CREATIVE; - case SURVIVAL: - return GameMode.SURVIVAL; - default: - return null; - } - } - } - - public GameModeFlag(String name, State def) { - super(name); - this.def = def; - } - - public State getDefault() { - return def; - } - - public RegionGroupFlag getGroupFlag() { - return groupFlag; - } - - public void setGroupFlag(RegionGroupFlag groupFlag) { - this.groupFlag = groupFlag; +public class GameModeFlag extends Flag { + public GameModeFlag(String name, RegionGroup defaultGroup) { + super(name, defaultGroup); } @Override - public State parseInput(WorldGuardPlugin plugin, CommandSender sender, String input) throws InvalidFlagFormat { + public GameMode parseInput(WorldGuardPlugin plugin, CommandSender sender, String input) throws InvalidFlagFormat { input = input.trim(); if (input.equalsIgnoreCase("creative")) { - return State.CREATIVE; + return GameMode.CREATIVE; } else if (input.equalsIgnoreCase("survival")) { - return State.SURVIVAL; + return GameMode.SURVIVAL; } else if (input.equalsIgnoreCase("none")) { return null; } else { - throw new InvalidFlagFormat("Expected none/allow/deny but got '" + input + "'"); + throw new InvalidFlagFormat("Expected survival/creative/none but got '" + input + "'"); } } @Override - public State unmarshal(Object o) { - String input = o.toString(); - if (input.equalsIgnoreCase("creative")) { - return State.CREATIVE; - } else if (input.equalsIgnoreCase("survival")) { - return State.SURVIVAL; - } else { - return null; + public GameMode unmarshal(Object o) { + GameMode gm = null; + if (o != null) { + gm = GameMode.valueOf((String) o); } + return gm; } - + @Override - public Object marshal(State o) { - if (o == State.CREATIVE) { - return "allow"; - } else if (o == State.SURVIVAL) { - return "deny"; - } else { - return null; - } + public Object marshal(GameMode o) { + return o == null ? null : o.name(); } } diff --git a/src/de/jaschastarke/minecraft/limitedcreative/regions/RegionListener.java b/src/de/jaschastarke/minecraft/limitedcreative/regions/RegionListener.java index ae0dd72..a4e82f6 100644 --- a/src/de/jaschastarke/minecraft/limitedcreative/regions/RegionListener.java +++ b/src/de/jaschastarke/minecraft/limitedcreative/regions/RegionListener.java @@ -38,31 +38,31 @@ public class RegionListener implements Listener { private ApplicableRegions regionSet(Block block) { return rm.getRegionSet(block); } + @EventHandler public void onBlockBreak(BlockBreakEvent event) { if (event.isCancelled()) return; - + LCPlayer player = Players.get(event.getPlayer()); boolean diffrent_region = rm.isDiffrentRegion(event.getPlayer(), event.getBlock().getLocation()); - boolean creative_world = plugin.com.isCreative(event.getBlock().getWorld()); if (player.isRegionGameMode() && diffrent_region) { // do not break outside of "gamemod-change-region" when in the region - if (!rm.getRegionSet(event.getBlock()).allows(Flags.CREATIVE, event.getPlayer())) { - event.getPlayer().sendMessage(L("blocked.outside_creative_break")); + if (rm.getRegionSet(event.getBlock()).getFlag(Flags.GAMEMODE, event.getPlayer()) != player.getRegionGameMode()) { + event.getPlayer().sendMessage(L("blocked.outside_break")); event.setCancelled(true); } } else if (diffrent_region) { // do not break inside of "survial-region in creative world" when outside - if (rm.getRegionSet(event.getBlock()).allows(Flags.CREATIVE)) { - event.getPlayer().sendMessage(L("blocked.inside_survival_break")); + if (rm.getRegionSet(event.getBlock()).getFlag(Flags.GAMEMODE) != null) { + event.getPlayer().sendMessage(L("blocked.inside_break")); event.setCancelled(true); } } - if (!creative_world) { // in survival world - // prevent any drops for survival players in creative regions in survival worlds - if (event.getPlayer().getGameMode() != GameMode.CREATIVE && rm.getRegionSet(event.getBlock()).allows(Flags.CREATIVE)) { + if (!event.isCancelled()) { + // prevent any drops for survival players in creative regions + if (event.getPlayer().getGameMode() != GameMode.CREATIVE && rm.getRegionSet(event.getBlock()).getFlag(Flags.GAMEMODE) == GameMode.CREATIVE) { plugin.spawnblock.block(event.getBlock(), player); } } @@ -78,14 +78,14 @@ public class RegionListener implements Listener { if (player.isRegionGameMode() && diffrent_region) { // do not build outside of "gamemod-change-region" when in the region - if (!rm.getRegionSet(event.getBlock()).allows(Flags.CREATIVE, event.getPlayer())) { - event.getPlayer().sendMessage(L("blocked.outside_creative")); + if (rm.getRegionSet(event.getBlock()).getFlag(Flags.GAMEMODE, event.getPlayer()) != player.getRegionGameMode()) { + event.getPlayer().sendMessage(L("blocked.outside_place")); event.setCancelled(true); } } else if (diffrent_region) { // do not build inside of "survial-region in creative world" when outside - if (rm.getRegionSet(event.getBlock()).allows(Flags.CREATIVE)) { - event.getPlayer().sendMessage(L("blocked.inside_survival")); + if (rm.getRegionSet(event.getBlock()).getFlag(Flags.GAMEMODE) != null) { + event.getPlayer().sendMessage(L("blocked.inside_place")); event.setCancelled(true); } } @@ -93,17 +93,17 @@ public class RegionListener implements Listener { @EventHandler public void onPlayerChangedArea(PlayerNewLocationAreaEvent event) { - Players.get(event.getPlayer()).setRegionCreativeAllowed(event.getRegionSet().allows(Flags.CREATIVE, event.getPlayer()), event); + Players.get(event.getPlayer()).setRegionCreativeAllowed(event.getRegionSet().getFlag(Flags.GAMEMODE, event.getPlayer()) != null, event); } @EventHandler public void onPlayerSetArea(PlayerSetAreaEvent event) { - Players.get(event.getPlayer()).setRegionCreativeAllowed(event.getRegionSet().allows(Flags.CREATIVE, event.getPlayer()), event); + Players.get(event.getPlayer()).setRegionCreativeAllowed(event.getRegionSet().getFlag(Flags.GAMEMODE, event.getPlayer()) != null, event); } @EventHandler public void onPlayerUpdateArea(PlayerUpdateAreaEvent event) { - Players.get(event.getPlayer()).setRegionCreativeAllowed(event.getRegionSet().allows(Flags.CREATIVE, event.getPlayer()), event); + Players.get(event.getPlayer()).setRegionCreativeAllowed(event.getRegionSet().getFlag(Flags.GAMEMODE, event.getPlayer()) != null, event); } @EventHandler @@ -114,11 +114,11 @@ public class RegionListener implements Listener { Block source = event.getBlock().getRelative(event.getDirection()); Core.debug("PistonExtend "+source.getType()+" "+event.getDirection()); if (source.getType() != Material.AIR) { - if (regionSet(source).allows(Flags.CREATIVE)) { + if (regionSet(source).getFlag(Flags.GAMEMODE) == GameMode.CREATIVE) { for (int i = 1; i <= 12; i++) { Block dest = source.getRelative(event.getDirection(), i); Core.debug("dest "+i+": "+dest.getType()); - if (!regionSet(dest).allows(Flags.CREATIVE)) { + if (regionSet(dest).getFlag(Flags.GAMEMODE) != GameMode.CREATIVE) { plugin.logger.warning(L("blocked.piston", source.getRelative(event.getDirection(), i - 1).getType().toString(), Util.toString(source.getLocation()))); event.setCancelled(true); break; @@ -139,19 +139,19 @@ public class RegionListener implements Listener { Core.debug("PistonRetract "+source.getType()+" "+event.getDirection() + " " + event.isSticky()); if (event.isSticky() && source.getType() != Material.AIR) { Core.debug("dest "+dest.getType()); - if (regionSet(source).allows(Flags.CREATIVE)) { - if (!regionSet(dest).allows(Flags.CREATIVE)) { + if (regionSet(source).getFlag(Flags.GAMEMODE) == GameMode.CREATIVE) { + if (regionSet(dest).getFlag(Flags.GAMEMODE) != GameMode.CREATIVE) { plugin.logger.warning(L("blocked.piston", source.getType().toString(), Util.toString(source.getLocation()))); event.setCancelled(true); } - } else if (regionSet(dest).allows(Flags.CREATIVE)) { + } else if (regionSet(dest).getFlag(Flags.GAMEMODE) == GameMode.CREATIVE) { // source isn't creative plugin.logger.warning(L("blocked.piston_in", source.getType().toString(), Util.toString(source.getLocation()))); event.setCancelled(true); } } } - + @EventHandler public void onItemSpawn(ItemSpawnEvent event) { if (event.isCancelled()) diff --git a/src/de/jaschastarke/minecraft/worldguard/ApplicableRegions.java b/src/de/jaschastarke/minecraft/worldguard/ApplicableRegions.java index 5785926..80e563c 100644 --- a/src/de/jaschastarke/minecraft/worldguard/ApplicableRegions.java +++ b/src/de/jaschastarke/minecraft/worldguard/ApplicableRegions.java @@ -49,6 +49,20 @@ public class ApplicableRegions { contractRegionFlags(); return r; } + + public , V> V getFlag(T flag) { + extendRegionFlags(); + V r = regions.getFlag(flag); + contractRegionFlags(); + return r; + } + + public , V> V getFlag(T flag, Player player) { + extendRegionFlags(); + V r = regions.getFlag(flag, WorldGuardIntegration.wg.wrapPlayer(player)); + contractRegionFlags(); + return r; + } @SuppressWarnings("unchecked") private , V> void extendRegionFlags() { diff --git a/src/de/jaschastarke/minecraft/worldguard/CCommand.java b/src/de/jaschastarke/minecraft/worldguard/CCommand.java index 2fa2cec..e14ac81 100644 --- a/src/de/jaschastarke/minecraft/worldguard/CCommand.java +++ b/src/de/jaschastarke/minecraft/worldguard/CCommand.java @@ -19,6 +19,7 @@ package de.jaschastarke.minecraft.worldguard; import static de.jaschastarke.minecraft.utils.Locale.L; +import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.World; import org.bukkit.command.Command; @@ -136,8 +137,11 @@ public class CCommand implements CommandExecutor { hasPermission(sender, Perms.INFO); }*/ - String[] args = new String[]{"info", region.getWorld().getName(), region.getProtectedRegion().getId()}; - wg.onCommand(sender, wg.getCommand("region"), "region", args); + /* + * WorldEdits intercepting Servers privates commandMap via Reflections realy sucks! + * Just because they are to lazy to add all the lines commands to plugin.yml + */ + Bukkit.getServer().dispatchCommand(sender, "region info "+region.getWorld().getName()+ " "+region.getProtectedRegion().getId()); StringBuilder list = new StringBuilder(); for (FlagValue data : region.getFlags()) { @@ -157,15 +161,24 @@ public class CCommand implements CommandExecutor { return; } String flagName = args[2]; + String value = null; + Flag flag = FlagList.getFlag(flagName); + + if (args.length > 3 && args[3].equalsIgnoreCase("-g")) { + flag = flag.getRegionGroupFlag(); + if (args.length > 4) + value = Util.join(args, 4); + } else { + if (args.length > 3) + value = Util.join(args, 3); + } + if (flag == null) { sender.sendMessage(ChatColor.DARK_RED + L("command.worldguard.unknown_flag") + ": " + flagName); sender.sendMessage(ChatColor.DARK_RED + L("command.worldguard.available_flags") + ": " + FlagList.getStringListAvailableFlags(sender)); return; } - String value = null; - if (args.length > 3) - value = Util.join(args, 3); try { if (value != null) { diff --git a/src/de/jaschastarke/minecraft/worldguard/CRegionManager.java b/src/de/jaschastarke/minecraft/worldguard/CRegionManager.java index 568167d..38ffb9f 100644 --- a/src/de/jaschastarke/minecraft/worldguard/CRegionManager.java +++ b/src/de/jaschastarke/minecraft/worldguard/CRegionManager.java @@ -103,7 +103,12 @@ public class CRegionManager { ConfigurationSection fs = rs.contains("flags") ? rs.getConfigurationSection("flags") : rs.createSection("flags"); - fs.set(flag.getName(), flag.marshal((V) value)); + + Object o = null; + if (value != null) + o = flag.marshal((V) value); + + fs.set(flag.getName(), o); try { c.save(file); @@ -122,8 +127,10 @@ public class CRegionManager { ConfigurationSection fs = rs.getConfigurationSection("flags"); for (Map.Entry data : fs.getValues(false).entrySet()) { Flag flag = FlagList.getFlag(data.getKey()); - Object value = flag.unmarshal(data.getValue()); - list.add(new FlagValue(flag, value)); + if (flag != null) { // the flag doesn't exists anymore. just ignore it without error + Object value = flag.unmarshal(data.getValue()); + list.add(new FlagValue(flag, value)); + } } } } From 24d07152ab921d5b9ce45542eac4a1077150744c Mon Sep 17 00:00:00 2001 From: Jascha Starke Date: Sat, 3 Mar 2012 11:42:14 +0100 Subject: [PATCH 02/14] first maven step also: - fixed playermoveevent coarse-check --- .gitignore | 10 +++++-- pom.xml | 28 +++++++++++++++++++ .../minecraft/worldguard/CListener.java | 5 ++-- 3 files changed, 39 insertions(+), 4 deletions(-) create mode 100644 pom.xml diff --git a/.gitignore b/.gitignore index 1383453..7961ff4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,10 @@ +/bin + +# Eclipse stuff /.project /.classpath -/bin -/.settings \ No newline at end of file +/.settings +/.buildpath + +# maven +/target diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..35f40ed --- /dev/null +++ b/pom.xml @@ -0,0 +1,28 @@ + + 4.0.0 + LimitedCreative + LimitedCreative + LimitedCreative + 1.2.0-SNAPSHOT + https://github.com/possi/LimitedCreative + + scm:git:git://github.com/possi/LimitedCreative.git + scm:git:git@github.com:possi/LimitedCreative.git + https://github.com/possi/LimitedCreative/tree/master + + + + org.bukkit + bukkit + 1.2.3-R0.1-SNAPSHOT + + + com.sk89q + worldguard + 5.5.2-SNAPSHOT + + + + UTF-8 + + \ No newline at end of file diff --git a/src/de/jaschastarke/minecraft/worldguard/CListener.java b/src/de/jaschastarke/minecraft/worldguard/CListener.java index ca956a0..84a1cc6 100644 --- a/src/de/jaschastarke/minecraft/worldguard/CListener.java +++ b/src/de/jaschastarke/minecraft/worldguard/CListener.java @@ -42,10 +42,11 @@ public class CListener implements Listener { public void onPlayerMove(PlayerMoveEvent event) { if (event.isCancelled()) return; - //if (event.isCoarse()) { // next bukkit release will shortcut that + if (event.getFrom().getBlockX() != event.getTo().getBlockX() || event.getFrom().getBlockY() != event.getTo().getBlockY() - || event.getFrom().getBlockZ() != event.getTo().getBlockZ()) { // he really moved, and not just looked around + || event.getFrom().getBlockZ() != event.getTo().getBlockZ() + || !event.getFrom().getWorld().equals(event.getTo().getWorld())) { // he really moved, and not just looked around String current_hash = CPlayer.get(event.getPlayer()).getHash(); if (current_hash == null) { From 21f90d0deb3e42519fe88228b21fa897d6862d87 Mon Sep 17 00:00:00 2001 From: Jascha Starke Date: Sat, 3 Mar 2012 12:53:20 +0100 Subject: [PATCH 03/14] next maven step --- README.md | 23 +++++++++++++++++------ pom.xml | 29 +++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 5f1ed53..38717d8 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,22 @@ # Limited Creative http://dev.bukkit.org/server-mods/limited-creative/ -There is no automated building yet, so just use "Export..." -> "JAR file" in Eclipse +Required dependencies: +* [Bukkit](https://github.com/Bukkit/Bukkit) -Dependencies: +Maven Dependencies for optional integrations: +* [WorldGuard](https://github.com/sk89q/worldguard) +* [WorldEdit](https://github.com/sk89q/worldedit) +Non-Maven dependencies for optional integrations: +* [xAuth](http://dev.bukkit.org/server-mods/xauth/) +* [AuthMe](http://dev.bukkit.org/server-mods/authme-reloaded/) +* [Multiverse-Core](http://dev.bukkit.org/server-mods/multiverse-core/) -* [Craftbukkit](https://github.com/Bukkit/CraftBukkit) - * which implies [Bukkit](https://github.com/Bukkit/Bukkit) -* Optional: [WorldGuard](https://github.com/sk89q/worldguard) - * which depends on [WorldEdit](https://github.com/sk89q/worldedit) \ No newline at end of file +---- + +To use Maven packaging: +You need to add the non-maven dependencies: +* download the jars and then: +* $ mvn install:install-file -Dfile=AuthMe.jar -DgroupId=uk.org.whoami -DartifactId=authme -Dversion=2.6.2 -Dpackaging=jar +* $ mvn install:install-file -Dfile=Multiverse-Core.jar -DgroupId=com.onarandombox -DartifactId=multiverse-core -Dversion=2.3-AB -Dpackaging=jar +* $ mvn install:install-file -Dfile=xAuth.jar -DgroupId=com.cypherx -DartifactId=xauth -Dversion=3.1 -Dpackaging=jar \ No newline at end of file diff --git a/pom.xml b/pom.xml index 35f40ed..43b242f 100644 --- a/pom.xml +++ b/pom.xml @@ -10,6 +10,20 @@ scm:git:git@github.com:possi/LimitedCreative.git https://github.com/possi/LimitedCreative/tree/master + + ${basedir}/src + + + org.apache.maven.plugins + maven-compiler-plugin + 2.0.2 + + 1.7 + 1.5 + + + + org.bukkit @@ -21,6 +35,21 @@ worldguard 5.5.2-SNAPSHOT + + uk.org.whoami + authme + 2.6.2 + + + com.onarandombox + multiverse-core + 2.3-AB + + + com.cypherx + xauth + 3.1 + UTF-8 From f4db306a0f17953524c3b9c40c7a34bcc41b8eee Mon Sep 17 00:00:00 2001 From: Jascha Starke Date: Sat, 3 Mar 2012 12:55:46 +0100 Subject: [PATCH 04/14] readme markup --- README.md | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 38717d8..4194d80 100644 --- a/README.md +++ b/README.md @@ -1,22 +1,32 @@ # Limited Creative http://dev.bukkit.org/server-mods/limited-creative/ -Required dependencies: +Required dependencies +--------------------- + * [Bukkit](https://github.com/Bukkit/Bukkit) -Maven Dependencies for optional integrations: +Maven Dependencies for optional integrations +-------------------------------------------- + * [WorldGuard](https://github.com/sk89q/worldguard) * [WorldEdit](https://github.com/sk89q/worldedit) -Non-Maven dependencies for optional integrations: + +Non-Maven dependencies for optional integrations +------------------------------------------------ + * [xAuth](http://dev.bukkit.org/server-mods/xauth/) * [AuthMe](http://dev.bukkit.org/server-mods/authme-reloaded/) * [Multiverse-Core](http://dev.bukkit.org/server-mods/multiverse-core/) ---- -To use Maven packaging: +To use Maven packaging +---------------------- + You need to add the non-maven dependencies: -* download the jars and then: + +* download the jars and then... * $ mvn install:install-file -Dfile=AuthMe.jar -DgroupId=uk.org.whoami -DartifactId=authme -Dversion=2.6.2 -Dpackaging=jar * $ mvn install:install-file -Dfile=Multiverse-Core.jar -DgroupId=com.onarandombox -DartifactId=multiverse-core -Dversion=2.3-AB -Dpackaging=jar * $ mvn install:install-file -Dfile=xAuth.jar -DgroupId=com.cypherx -DartifactId=xauth -Dversion=3.1 -Dpackaging=jar \ No newline at end of file From 47cd386627deaa46a8d08cb6cb0fe876ff19620a Mon Sep 17 00:00:00 2001 From: Jascha Starke Date: Sat, 3 Mar 2012 15:35:33 +0100 Subject: [PATCH 05/14] hosting required jars --- README.md | 17 +++++------------ pom.xml | 17 +++++++++++++++++ 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 4194d80..a2127bf 100644 --- a/README.md +++ b/README.md @@ -6,15 +6,11 @@ Required dependencies * [Bukkit](https://github.com/Bukkit/Bukkit) -Maven Dependencies for optional integrations --------------------------------------------- +Dependencies for optional integrations +-------------------------------------- * [WorldGuard](https://github.com/sk89q/worldguard) * [WorldEdit](https://github.com/sk89q/worldedit) - -Non-Maven dependencies for optional integrations ------------------------------------------------- - * [xAuth](http://dev.bukkit.org/server-mods/xauth/) * [AuthMe](http://dev.bukkit.org/server-mods/authme-reloaded/) * [Multiverse-Core](http://dev.bukkit.org/server-mods/multiverse-core/) @@ -24,9 +20,6 @@ Non-Maven dependencies for optional integrations To use Maven packaging ---------------------- -You need to add the non-maven dependencies: - -* download the jars and then... -* $ mvn install:install-file -Dfile=AuthMe.jar -DgroupId=uk.org.whoami -DartifactId=authme -Dversion=2.6.2 -Dpackaging=jar -* $ mvn install:install-file -Dfile=Multiverse-Core.jar -DgroupId=com.onarandombox -DartifactId=multiverse-core -Dversion=2.3-AB -Dpackaging=jar -* $ mvn install:install-file -Dfile=xAuth.jar -DgroupId=com.cypherx -DartifactId=xauth -Dversion=3.1 -Dpackaging=jar \ No newline at end of file +For required development snapshots, that aren't found by maven, you have to clone the project and do: +$ mvn install +in the directory of the project \ No newline at end of file diff --git a/pom.xml b/pom.xml index 43b242f..d90c856 100644 --- a/pom.xml +++ b/pom.xml @@ -10,6 +10,23 @@ scm:git:git@github.com:possi/LimitedCreative.git https://github.com/possi/LimitedCreative/tree/master + + + + opt-dep + http://dl.dropbox.com/u/5023975/mvn-repo + + + + bukkit-repo + http://repo.bukkit.org/content/groups/public + + + + sk89q-mvn2 + http://mvn2.sk89q.com/repo + + ${basedir}/src From 3045d5b42c2fe2082fdd34ccd1564cede6476863 Mon Sep 17 00:00:00 2001 From: Jascha Starke Date: Tue, 6 Mar 2012 10:17:48 +0100 Subject: [PATCH 06/14] armor config fix --- .../minecraft/limitedcreative/Configuration.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/de/jaschastarke/minecraft/limitedcreative/Configuration.java b/src/de/jaschastarke/minecraft/limitedcreative/Configuration.java index fed84c3..82fc054 100644 --- a/src/de/jaschastarke/minecraft/limitedcreative/Configuration.java +++ b/src/de/jaschastarke/minecraft/limitedcreative/Configuration.java @@ -272,9 +272,11 @@ public class Configuration { if (sect.getBoolean("enabled")) { Map armor = new HashMap(); for (Map.Entry entry : sect.getValues(false).entrySet()) { - MaterialData md = parseMaterial((String) entry.getValue()); - if (md != null) - armor.put(entry.getKey(), md); + if (!entry.getKey().equals("enabled")) { + MaterialData md = parseMaterial((String) entry.getValue()); + if (md != null) + armor.put(entry.getKey(), md); + } } return armor; } From c354c19974cdb819c9f7ce448aedec0a7bb07f5a Mon Sep 17 00:00:00 2001 From: Jascha Starke Date: Tue, 6 Mar 2012 10:34:03 +0100 Subject: [PATCH 07/14] maven java version fix --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index d90c856..a5b04bc 100644 --- a/pom.xml +++ b/pom.xml @@ -35,7 +35,7 @@ maven-compiler-plugin 2.0.2 - 1.7 + 1.5 1.5 From 72715a40c4a50de83cdb10c11cf347d16c929ab0 Mon Sep 17 00:00:00 2001 From: Jascha Starke Date: Fri, 16 Mar 2012 16:37:43 +0100 Subject: [PATCH 08/14] v1.2.1-alpha: - muliverse unhandled worlds fix - publsh of armor config fix --- plugin.yml | 2 +- pom.xml | 30 ++++++++++++++++--- .../minecraft/integration/Communicator.java | 14 ++++++--- .../minecraft/integration/MultiVerse.java | 13 ++++---- 4 files changed, 42 insertions(+), 17 deletions(-) diff --git a/plugin.yml b/plugin.yml index e599b05..b0c1c3f 100644 --- a/plugin.yml +++ b/plugin.yml @@ -1,6 +1,6 @@ name: LimitedCreative main: de.jaschastarke.minecraft.limitedcreative.Core -version: 1.2.0-alpha +version: 1.2.1-alpha softdepend: [WorldGuard, WorldEdit, MultiInv] dev-url: http://dev.bukkit.org/server-mods/limited-creative/ commands: diff --git a/pom.xml b/pom.xml index a5b04bc..ff520fa 100644 --- a/pom.xml +++ b/pom.xml @@ -26,9 +26,31 @@ sk89q-mvn2 http://mvn2.sk89q.com/repo + + + onarandombox + http://repo.onarandombox.com/content/groups/public + ${basedir}/src + + + + . + true + ${basedir}/ + + plugin.yml + config.yml + + + + lang/ + ${basedir}/lang/ + + + org.apache.maven.plugins @@ -45,7 +67,7 @@ org.bukkit bukkit - 1.2.3-R0.1-SNAPSHOT + 1.2.3-R0.2-SNAPSHOT com.sk89q @@ -58,9 +80,9 @@ 2.6.2 - com.onarandombox - multiverse-core - 2.3-AB + com.onarandombox.multiversecore + Multiverse-Core + 2.4 com.cypherx diff --git a/src/de/jaschastarke/minecraft/integration/Communicator.java b/src/de/jaschastarke/minecraft/integration/Communicator.java index 111c473..283c085 100644 --- a/src/de/jaschastarke/minecraft/integration/Communicator.java +++ b/src/de/jaschastarke/minecraft/integration/Communicator.java @@ -40,15 +40,21 @@ public class Communicator extends AbstractCommunicator { public boolean isCreative(World world) { boolean creative = Bukkit.getServer().getDefaultGameMode() == GameMode.CREATIVE; - if (isPluginEnabled("Multiverse-Core")) - creative = MultiVerse.isCreative(world); + if (isMultiVerse()) { + GameMode tmp = MultiVerse.getGameMode(world); + if (tmp != null) + creative = tmp == GameMode.CREATIVE; + } Core.debug("com: "+world.getName()+": is creative: "+creative); return creative; } public GameMode getDefaultGameMode(World world) { GameMode def = Bukkit.getServer().getDefaultGameMode(); - if (isMultiVerse()) - def = MultiVerse.getGameMode(world); + if (isMultiVerse()) { + GameMode tmp = MultiVerse.getGameMode(world); + if (tmp != null) + def = tmp; + } Core.debug("com: "+world.getName()+": game mode: "+def); return def; } diff --git a/src/de/jaschastarke/minecraft/integration/MultiVerse.java b/src/de/jaschastarke/minecraft/integration/MultiVerse.java index e60185d..62875eb 100644 --- a/src/de/jaschastarke/minecraft/integration/MultiVerse.java +++ b/src/de/jaschastarke/minecraft/integration/MultiVerse.java @@ -22,19 +22,16 @@ import org.bukkit.GameMode; import org.bukkit.World; import com.onarandombox.MultiverseCore.MultiverseCore; +import com.onarandombox.MultiverseCore.api.MultiverseWorld; import de.jaschastarke.minecraft.limitedcreative.Core; public class MultiVerse implements CommunicationBridge { - - public static boolean isCreative(World world) { - boolean ic = getMV().getMVWorldManager().getMVWorld(world).getGameMode() == GameMode.CREATIVE; - Core.debug("Multiverse: "+world.getName()+": is creative: "+ic); - return ic; - } - public static GameMode getGameMode(World world) { - GameMode gm = getMV().getMVWorldManager().getMVWorld(world).getGameMode(); + MultiverseWorld mvWorld = getMV().getMVWorldManager().getMVWorld(world); + if (mvWorld == null) + return null; + GameMode gm = mvWorld.getGameMode(); Core.debug("Multiverse: "+world.getName()+": game mode: "+gm); return gm; } From eddb417d4a8ed9e111ee4194da46fa9f02d7923e Mon Sep 17 00:00:00 2001 From: Jascha Starke Date: Fri, 16 Mar 2012 17:35:21 +0100 Subject: [PATCH 09/14] still v1.2.1-alpha: - changed blacklist default, added exp bottle --- config.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/config.yml b/config.yml index d593bf5..800d01a 100644 --- a/config.yml +++ b/config.yml @@ -105,8 +105,10 @@ limit: # data-value, all items/blocks of this material are blocked. # You also may add the special block "*" (better add quotes to don't break yml) which prevents the usage of ANY # item/block. - # default: [] - use: [] + # default: [exp_bottle, bedrock] + use: + - EXP_BOTTLE + - bedrock # BreakBlackList # Prevents destroying of the given blocks in creative mode (and only in creative). From 0e305c3e34a446cd0eef8b5785ff18c4008e009c Mon Sep 17 00:00:00 2001 From: Jascha Starke Date: Fri, 16 Mar 2012 17:41:27 +0100 Subject: [PATCH 10/14] still v1.2.1-alpha: - jar filename --- pom.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index ff520fa..03f5c9a 100644 --- a/pom.xml +++ b/pom.xml @@ -1,6 +1,6 @@ 4.0.0 - LimitedCreative + de.jaschastarke LimitedCreative LimitedCreative 1.2.0-SNAPSHOT @@ -34,6 +34,7 @@ ${basedir}/src + ${project.artifactId} From ad2856bac89ee06c751707384f6946b5aa2c7e46 Mon Sep 17 00:00:00 2001 From: Jascha Starke Date: Fri, 23 Mar 2012 16:20:42 +0100 Subject: [PATCH 11/14] official xauth update --- pom.xml | 20 +++++++++---------- .../minecraft/integration/xAuth.java | 4 +++- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/pom.xml b/pom.xml index 03f5c9a..eb9cbf0 100644 --- a/pom.xml +++ b/pom.xml @@ -53,15 +53,15 @@ - - org.apache.maven.plugins - maven-compiler-plugin - 2.0.2 - - 1.5 - 1.5 - - + + org.apache.maven.plugins + maven-compiler-plugin + 2.0.2 + + 1.5 + 1.5 + + @@ -88,7 +88,7 @@ com.cypherx xauth - 3.1 + 2.0.3 diff --git a/src/de/jaschastarke/minecraft/integration/xAuth.java b/src/de/jaschastarke/minecraft/integration/xAuth.java index 90915db..774cb11 100644 --- a/src/de/jaschastarke/minecraft/integration/xAuth.java +++ b/src/de/jaschastarke/minecraft/integration/xAuth.java @@ -26,12 +26,14 @@ import de.jaschastarke.minecraft.limitedcreative.Core; public class xAuth implements CommunicationBridge { public static boolean isLoggedInNotGuest(Player player) { - xAuthPlayer xpl = getAuth().getPlayer(player.getName()); + xAuthPlayer xpl = getAuth().getPlyrMngr().getPlayer(player.getName()); boolean li = true; if (!xpl.isAuthenticated()) li = false; else if (xpl.isGuest()) li = false; + else if (!getAuth().getPlyrMngr().checkSession(xpl)) + li = false; Core.debug("xAuth: "+player.getName()+": logged in not guest: "+li); return li; } From bcacf3e8941bbcfd3b86b08a51cec1a54a90f812 Mon Sep 17 00:00:00 2001 From: Jascha Starke Date: Fri, 23 Mar 2012 16:58:06 +0100 Subject: [PATCH 12/14] v1.2.2-alpha: - functions renamed making sense - full use of "gamemode" flag, allows nesting of gamemode regions --- .../minecraft/limitedcreative/LCPlayer.java | 54 ++++++++++--------- .../regions/RegionListener.java | 14 ++--- 2 files changed, 35 insertions(+), 33 deletions(-) diff --git a/src/de/jaschastarke/minecraft/limitedcreative/LCPlayer.java b/src/de/jaschastarke/minecraft/limitedcreative/LCPlayer.java index 52fdd89..f9512df 100644 --- a/src/de/jaschastarke/minecraft/limitedcreative/LCPlayer.java +++ b/src/de/jaschastarke/minecraft/limitedcreative/LCPlayer.java @@ -62,8 +62,8 @@ public class LCPlayer { //name = player.getName(); //touch(); - if (!this.isRegionGameMode(player.getGameMode())) { - setPermanentGameMode(player.getGameMode()); + if (!this.isActiveRegionGameMode(player.getGameMode())) { + setInPermanentGameMode(player.getGameMode()); } } @@ -94,24 +94,24 @@ public class LCPlayer { }*/ private Map options = new HashMap(); - public void setRegionGameMode(final GameMode gm) { + public void storeActiveRegionGameMode(final GameMode gm) { options.remove("region"); Core.debug(getName()+": set region game mode: " + gm); Players.getOptions().setRegionGameMode(getName(), gm); } - public GameMode getRegionGameMode() { + public GameMode getActiveRegionGameMode() { if (!options.containsKey("region")) { options.put("region", Players.getOptions().getRegionGameMode(getName())); } Core.debug(getName()+": get region game mode: " + options.get("region")); return (GameMode) options.get("region"); } - public boolean isRegionGameMode(final GameMode gm) { - return gm.equals(getRegionGameMode()); + public boolean isActiveRegionGameMode(final GameMode gm) { + return gm.equals(getActiveRegionGameMode()); } - public boolean isRegionGameMode() { - return getRegionGameMode() != null; + public boolean isActiveRegionGameMode() { + return getActiveRegionGameMode() != null; } public boolean isOptionalRegionGameMode() { @@ -149,26 +149,29 @@ public class LCPlayer { Players.getOptions().setOptionalRegionGameMode(getName(), region, gm); } - public void setPermanentGameMode(GameMode temp) { + public void setInPermanentGameMode(GameMode temp) { Core.debug(getName()+": set permanent game mode: " + temp); if (temp != null) { if (temp.equals(plugin.com.getDefaultGameMode(getPlayer().getWorld()))) { temp = null; } else { - setRegionGameMode(null); + storeActiveRegionGameMode(null); } } _permanent_gamemode = temp; } - public boolean isPermanentGameMode(GameMode temp) { + public boolean isInPermanentGameMode() { + return isInPermanentGameMode(getPlayer().getGameMode()); + } + public boolean isInPermanentGameMode(GameMode temp) { Core.debug(getName()+": get permanent game mode: " + _permanent_gamemode); return temp.equals(_permanent_gamemode); } public boolean onSetGameMode(GameMode gm) { Core.debug(getName() + " going into " + gm); - if (isRegionGameMode()) { // change to the other gamemode as the area defines - if (!isRegionGameMode(gm)) { // only when we are not switching to the mode the region allows + if (isActiveRegionGameMode()) { // change to the other gamemode as the area defines + if (!isActiveRegionGameMode(gm)) { // only when we are not switching to the mode the region allows if (!plugin.config.getRegionOptional() && (!plugin.config.getPermissionsEnabled() || !hasPermission(Perms.REGIONS_BYPASS))) { getPlayer().sendMessage(ChatColor.RED + L("exception.region.not_optional", gm.toString().toLowerCase())); Core.debug("... denied"); @@ -179,10 +182,10 @@ public class LCPlayer { } else { // we are changing to the mode the region defines, thats not permanent setOptionalRegionGameMode(null); - setPermanentGameMode(null); + setInPermanentGameMode(null); } } else { - setPermanentGameMode(gm); // we are not in a region, so the mode change is permanent + setInPermanentGameMode(gm); // we are not in a region, so the mode change is permanent } /* @@ -389,17 +392,16 @@ public class LCPlayer { /* * Attention: "Creative" stands for "the other gamemode". So true may mean, "be survival in creative world". */ - public void setRegionCreativeAllowed(boolean rcreative, PlayerAreaEvent area_event) { - Core.debug(getName()+": changed region: "+rcreative+": " + area_event); + public void setRegionGameMode(GameMode region_gamemode, PlayerAreaEvent area_event) { + Core.debug(getName()+": changed region: "+region_gamemode+": " + area_event); PlayerMoveEvent event = null; if (area_event instanceof PlayerChangedAreaEvent) event = ((PlayerChangedAreaEvent) area_event).getMoveEvent(); GameMode CURRENT_GAMEMODE = getPlayer().getGameMode(); GameMode DEFAULT_GAMEMODE = plugin.com.getDefaultGameMode(event != null ? event.getTo().getWorld() : getPlayer().getWorld()); - GameMode TEMPORARY_GAMEMODE = DEFAULT_GAMEMODE == GameMode.SURVIVAL ? GameMode.CREATIVE : GameMode.SURVIVAL; // the opposite - if (rcreative && CURRENT_GAMEMODE != TEMPORARY_GAMEMODE && !this.isRegionGameMode(TEMPORARY_GAMEMODE)) { + if (region_gamemode != null && CURRENT_GAMEMODE != region_gamemode && !this.isActiveRegionGameMode(region_gamemode)) { Core.debug(getName()+": entering creative area"); // 1. the region allows "the other (temporary) gamemode" // 2. but the player is not in that mode @@ -409,33 +411,33 @@ public class LCPlayer { boolean isOptional = isOptionalRegionGameMode(area_event.getRegionHash(), CURRENT_GAMEMODE); if (isOptional || checkSwitchFlight(area_event)) { - setRegionGameMode(TEMPORARY_GAMEMODE); // have to be set, before setGameMode + storeActiveRegionGameMode(region_gamemode); // have to be set, before setGameMode if (!isOptional) { - getPlayer().setGameMode(TEMPORARY_GAMEMODE); + getPlayer().setGameMode(region_gamemode); } } - } else if (!rcreative && getPlayer().getGameMode() == TEMPORARY_GAMEMODE && !isPermanentGameMode(TEMPORARY_GAMEMODE)) { + } else if (region_gamemode == null && getPlayer().getGameMode() != DEFAULT_GAMEMODE && !isInPermanentGameMode(CURRENT_GAMEMODE)) { Core.debug(getName()+": leaving creative area"); // 1. the region doesn't allow "the other gamemode" // 2. but the player is in that mode // 3. and the player isn't global (permanent) in that mode // result: change him back to default mode if (checkSwitchFlight(area_event)) { - setRegionGameMode(null); + storeActiveRegionGameMode(null); if (event == null || event.getTo().getWorld() == event.getFrom().getWorld() || !plugin.com.isMultiVerse()) { // do not enforce the game mode change, on world teleport, as multiverse may cancel the event afterwards // the world-change game-mode change is done by multiworld getPlayer().setGameMode(DEFAULT_GAMEMODE); } } - } else if (!rcreative && this.isRegionGameMode(TEMPORARY_GAMEMODE)) { + } else if (region_gamemode == null && this.isActiveRegionGameMode()) { Core.debug(getName()+": leaving creative area (while already in default gamemode)"); // 1. the region doesn't allow "the other gamemode" // 2. but he thinks he is still allowed // 3. (because of else) we are not longer in that mode // result: advise him to not longer allowed to that region - setRegionGameMode(null); + storeActiveRegionGameMode(null); } /** At the moment, in permanent game mode, it ignores all regions else if (this.isRegionGameMode()) { @@ -501,7 +503,7 @@ public class LCPlayer { } public boolean isGameModeAllowed(GameMode gm) { - if (plugin.config.getRegionOptional() && isRegionGameMode()) { + if (plugin.config.getRegionOptional() && isActiveRegionGameMode()) { return true; } return false; diff --git a/src/de/jaschastarke/minecraft/limitedcreative/regions/RegionListener.java b/src/de/jaschastarke/minecraft/limitedcreative/regions/RegionListener.java index a4e82f6..7862940 100644 --- a/src/de/jaschastarke/minecraft/limitedcreative/regions/RegionListener.java +++ b/src/de/jaschastarke/minecraft/limitedcreative/regions/RegionListener.java @@ -47,9 +47,9 @@ public class RegionListener implements Listener { LCPlayer player = Players.get(event.getPlayer()); boolean diffrent_region = rm.isDiffrentRegion(event.getPlayer(), event.getBlock().getLocation()); - if (player.isRegionGameMode() && diffrent_region) { + if (player.isActiveRegionGameMode() && diffrent_region) { // do not break outside of "gamemod-change-region" when in the region - if (rm.getRegionSet(event.getBlock()).getFlag(Flags.GAMEMODE, event.getPlayer()) != player.getRegionGameMode()) { + if (rm.getRegionSet(event.getBlock()).getFlag(Flags.GAMEMODE, event.getPlayer()) != player.getActiveRegionGameMode()) { event.getPlayer().sendMessage(L("blocked.outside_break")); event.setCancelled(true); } @@ -76,9 +76,9 @@ public class RegionListener implements Listener { LCPlayer player = Players.get(event.getPlayer()); boolean diffrent_region = rm.isDiffrentRegion(event.getPlayer(), event.getBlock().getLocation()); - if (player.isRegionGameMode() && diffrent_region) { + if (player.isActiveRegionGameMode() && diffrent_region) { // do not build outside of "gamemod-change-region" when in the region - if (rm.getRegionSet(event.getBlock()).getFlag(Flags.GAMEMODE, event.getPlayer()) != player.getRegionGameMode()) { + if (rm.getRegionSet(event.getBlock()).getFlag(Flags.GAMEMODE, event.getPlayer()) != player.getActiveRegionGameMode()) { event.getPlayer().sendMessage(L("blocked.outside_place")); event.setCancelled(true); } @@ -93,17 +93,17 @@ public class RegionListener implements Listener { @EventHandler public void onPlayerChangedArea(PlayerNewLocationAreaEvent event) { - Players.get(event.getPlayer()).setRegionCreativeAllowed(event.getRegionSet().getFlag(Flags.GAMEMODE, event.getPlayer()) != null, event); + Players.get(event.getPlayer()).setRegionGameMode(event.getRegionSet().getFlag(Flags.GAMEMODE, event.getPlayer()), event); } @EventHandler public void onPlayerSetArea(PlayerSetAreaEvent event) { - Players.get(event.getPlayer()).setRegionCreativeAllowed(event.getRegionSet().getFlag(Flags.GAMEMODE, event.getPlayer()) != null, event); + Players.get(event.getPlayer()).setRegionGameMode(event.getRegionSet().getFlag(Flags.GAMEMODE, event.getPlayer()), event); } @EventHandler public void onPlayerUpdateArea(PlayerUpdateAreaEvent event) { - Players.get(event.getPlayer()).setRegionCreativeAllowed(event.getRegionSet().getFlag(Flags.GAMEMODE, event.getPlayer()) != null, event); + Players.get(event.getPlayer()).setRegionGameMode(event.getRegionSet().getFlag(Flags.GAMEMODE, event.getPlayer()), event); } @EventHandler From d448eb0f85c48322c22a44f115eba111f05cca17 Mon Sep 17 00:00:00 2001 From: Jascha Starke Date: Fri, 13 Apr 2012 18:53:31 +0200 Subject: [PATCH 13/14] v1.2.3-beta: - reverted xAuth session test - closing inventory on GM-Switch - fixed multiverse world teleport issue (by removing an not longer needed workaround) --- plugin.yml | 2 +- pom.xml | 4 ++-- src/de/jaschastarke/minecraft/integration/xAuth.java | 2 -- .../jaschastarke/minecraft/limitedcreative/LCPlayer.java | 7 ++----- 4 files changed, 5 insertions(+), 10 deletions(-) diff --git a/plugin.yml b/plugin.yml index b0c1c3f..958afac 100644 --- a/plugin.yml +++ b/plugin.yml @@ -1,6 +1,6 @@ name: LimitedCreative main: de.jaschastarke.minecraft.limitedcreative.Core -version: 1.2.1-alpha +version: 1.2.3-alpha softdepend: [WorldGuard, WorldEdit, MultiInv] dev-url: http://dev.bukkit.org/server-mods/limited-creative/ commands: diff --git a/pom.xml b/pom.xml index eb9cbf0..772a8f6 100644 --- a/pom.xml +++ b/pom.xml @@ -68,12 +68,12 @@ org.bukkit bukkit - 1.2.3-R0.2-SNAPSHOT + 1.2.5-R1.0 com.sk89q worldguard - 5.5.2-SNAPSHOT + 5.5.2 uk.org.whoami diff --git a/src/de/jaschastarke/minecraft/integration/xAuth.java b/src/de/jaschastarke/minecraft/integration/xAuth.java index 774cb11..05bc96c 100644 --- a/src/de/jaschastarke/minecraft/integration/xAuth.java +++ b/src/de/jaschastarke/minecraft/integration/xAuth.java @@ -32,8 +32,6 @@ public class xAuth implements CommunicationBridge { li = false; else if (xpl.isGuest()) li = false; - else if (!getAuth().getPlyrMngr().checkSession(xpl)) - li = false; Core.debug("xAuth: "+player.getName()+": logged in not guest: "+li); return li; } diff --git a/src/de/jaschastarke/minecraft/limitedcreative/LCPlayer.java b/src/de/jaschastarke/minecraft/limitedcreative/LCPlayer.java index f9512df..c13e12a 100644 --- a/src/de/jaschastarke/minecraft/limitedcreative/LCPlayer.java +++ b/src/de/jaschastarke/minecraft/limitedcreative/LCPlayer.java @@ -194,6 +194,7 @@ public class LCPlayer { if (plugin.config.getStoreEnabled()) { if (plugin.config.getPermissionToKeepInventory() && hasPermission(Perms.KEEPINVENTORY)) return true; + getPlayer().closeInventory(); if (gm != GameMode.CREATIVE || plugin.config.getStoreCreative()) getInv().save(); if (gm == GameMode.CREATIVE) { @@ -425,11 +426,7 @@ public class LCPlayer { // result: change him back to default mode if (checkSwitchFlight(area_event)) { storeActiveRegionGameMode(null); - if (event == null || event.getTo().getWorld() == event.getFrom().getWorld() || !plugin.com.isMultiVerse()) { - // do not enforce the game mode change, on world teleport, as multiverse may cancel the event afterwards - // the world-change game-mode change is done by multiworld - getPlayer().setGameMode(DEFAULT_GAMEMODE); - } + getPlayer().setGameMode(DEFAULT_GAMEMODE); } } else if (region_gamemode == null && this.isActiveRegionGameMode()) { Core.debug(getName()+": leaving creative area (while already in default gamemode)"); From daf13bcf1eafd72d16f22768b799c766ebdd5e33 Mon Sep 17 00:00:00 2001 From: Jascha Starke Date: Fri, 13 Apr 2012 18:58:41 +0200 Subject: [PATCH 14/14] alpha -> beta --- plugin.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.yml b/plugin.yml index 958afac..375f3b7 100644 --- a/plugin.yml +++ b/plugin.yml @@ -1,6 +1,6 @@ name: LimitedCreative main: de.jaschastarke.minecraft.limitedcreative.Core -version: 1.2.3-alpha +version: 1.2.3-beta softdepend: [WorldGuard, WorldEdit, MultiInv] dev-url: http://dev.bukkit.org/server-mods/limited-creative/ commands: