Going for 1.5

Fixed missing strings
Fixed region interact
This commit is contained in:
Jascha Starke 2013-03-20 21:33:52 +01:00
parent 670908dc6a
commit 89318a3658
8 changed files with 33 additions and 19 deletions

View file

@ -77,26 +77,26 @@
<!-- http://dl.bukkit.org/ -->
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.4.7-R1.0</version>
<version>1.4.7-R0.1-SNAPSHOT</version>
</dependency>
<dependency>
<!-- http://dev.bukkit.org/server-mods/worldedit/ -->
<groupId>com.sk89q</groupId>
<artifactId>worldedit</artifactId>
<version>5.4.5</version>
<version>5.5.4</version>
<scope>compile</scope>
</dependency>
<dependency>
<!-- http://dev.bukkit.org/server-mods/worldguard/ -->
<groupId>com.sk89q</groupId>
<artifactId>worldguard</artifactId>
<version>5.6.6-SNAPSHOT</version>
<version>5.7.3</version>
</dependency>
<dependency>
<!-- http://dev.bukkit.org/server-mods/authme-reloaded/ -->
<groupId>uk.org.whoami</groupId>
<artifactId>authme</artifactId>
<version>2.7.7</version>
<version>2.7.12</version>
</dependency>
<dependency>
<!-- http://dev.bukkit.org/server-mods/multiverse-core/ -->

View file

@ -1,5 +1,7 @@
package de.jaschastarke.minecraft.limitedcreative;
import java.io.IOException;
import org.bukkit.event.Listener;
import de.jaschastarke.bukkit.lib.CoreModule;
@ -33,7 +35,7 @@ public class FeatureMetrics extends CoreModule<LimitedCreative> implements Liste
metric.unregister();
}
public void track(String event) {
public void track(String event) throws IOException {
if (metric == null)
throw new IllegalAccessError("The feature hasn't been enabled");
metric.trackEvent(event);

View file

@ -5,10 +5,17 @@ import de.jaschastarke.configuration.IConfigurationNode;
import de.jaschastarke.configuration.IConfigurationSubGroup;
import de.jaschastarke.configuration.InvalidValueException;
import de.jaschastarke.configuration.annotations.IsConfigurationNode;
import de.jaschastarke.maven.ArchiveDocComments;
import de.jaschastarke.minecraft.limitedcreative.ModCmdBlocker;
import de.jaschastarke.modularize.IModule;
import de.jaschastarke.modularize.ModuleEntry;
/**
* CommandBlocker-Feature
*
* http://dev.bukkit.org/server-mods/limited-creative/pages/features/command-blocker/
*/
@ArchiveDocComments
public class CmdBlockerConfig extends Configuration implements IConfigurationSubGroup {
protected ModCmdBlocker mod;
protected ModuleEntry<IModule> entry;

View file

@ -38,26 +38,26 @@ public class BlockListener extends Listener {
}
private void whenBlockBreak(Cancellable event, Block block, Player player) {
boolean diffrent_region = rm.isDiffrentRegion(player, block.getLocation());
boolean diffrent_region = getRM().isDiffrentRegion(player, block.getLocation());
PlayerMeta pdata = new PlayerMeta(player);
if (pdata.isActiveRegionGameMode() && diffrent_region) {
// do not break outside of "gamemod-change-region" when in the region
if (rm.getRegionSet(block).getFlag(Flags.GAMEMODE, player) != pdata.getActiveRegionGameMode()) {
if (getRM().getRegionSet(block).getFlag(Flags.GAMEMODE, player) != pdata.getActiveRegionGameMode()) {
player.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(block).getFlag(Flags.GAMEMODE) != null) {
if (getRM().getRegionSet(block).getFlag(Flags.GAMEMODE) != null) {
player.sendMessage(L("blocked.inside_break"));
event.setCancelled(true);
}
}
if (!event.isCancelled()) {
// prevent any drops for survival players in creative regions
if (player.getGameMode() != GameMode.CREATIVE && rm.getRegionSet(block).getFlag(Flags.GAMEMODE) == GameMode.CREATIVE) {
if (player.getGameMode() != GameMode.CREATIVE && getRM().getRegionSet(block).getFlag(Flags.GAMEMODE) == GameMode.CREATIVE) {
mod.getBlockSpawn().block(block, player);
}
}
@ -69,17 +69,17 @@ public class BlockListener extends Listener {
return;
PlayerMeta pdata = new PlayerMeta(event.getPlayer());
boolean diffrent_region = rm.isDiffrentRegion(event.getPlayer(), event.getBlock().getLocation());
boolean diffrent_region = getRM().isDiffrentRegion(event.getPlayer(), event.getBlock().getLocation());
if (pdata.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()) != pdata.getActiveRegionGameMode()) {
if (getRM().getRegionSet(event.getBlock()).getFlag(Flags.GAMEMODE, event.getPlayer()) != pdata.getActiveRegionGameMode()) {
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()).getFlag(Flags.GAMEMODE) != null) {
if (getRM().getRegionSet(event.getBlock()).getFlag(Flags.GAMEMODE) != null) {
event.getPlayer().sendMessage(L("blocked.inside_place"));
event.setCancelled(true);
}

View file

@ -13,11 +13,9 @@ import de.jaschastarke.minecraft.limitedcreative.regions.worldguard.CustomRegion
abstract public class Listener implements org.bukkit.event.Listener {
protected ModRegions mod;
protected CustomRegionManager rm;
public Listener(ModRegions mod) {
this.mod = mod;
rm = mod.getRegionManager();
}
/**
@ -31,10 +29,13 @@ abstract public class Listener implements org.bukkit.event.Listener {
}
protected ApplicableRegions regionSet(Location loc) {
return rm.getRegionSet(loc);
return getRM().getRegionSet(loc);
}
protected ApplicableRegions regionSet(Block block) {
return rm.getRegionSet(block);
return getRM().getRegionSet(block);
}
protected CustomRegionManager getRM() {
return mod.getRegionManager();
}
class PlayerMeta {

View file

@ -39,17 +39,17 @@ public class PlayerListener extends Listener {
block.getType() == Material.WORKBENCH || block.getType() == Material.ANVIL) {
PlayerMeta pmeta = new PlayerMeta(event.getPlayer());
boolean diffrent_region = rm.isDiffrentRegion(event.getPlayer(), block.getLocation());
boolean diffrent_region = getRM().isDiffrentRegion(event.getPlayer(), block.getLocation());
if (pmeta.isActiveRegionGameMode() && diffrent_region) {
// do not break outside of "gamemod-change-region" when in the region
if (rm.getRegionSet(block).getFlag(Flags.GAMEMODE, event.getPlayer()) != pmeta.getActiveRegionGameMode()) {
if (getRM().getRegionSet(block).getFlag(Flags.GAMEMODE, event.getPlayer()) != pmeta.getActiveRegionGameMode()) {
event.getPlayer().sendMessage(L("blocked.outside_interact"));
event.setCancelled(true);
}
} else if (diffrent_region) {
// do not break inside of "survial-region in creative world" when outside
if (rm.getRegionSet(block).getFlag(Flags.GAMEMODE) != null) {
if (getRM().getRegionSet(block).getFlag(Flags.GAMEMODE) != null) {
event.getPlayer().sendMessage(L("blocked.inside_interact"));
event.setCancelled(true);
}

View file

@ -7,6 +7,7 @@ import de.jaschastarke.configuration.IConfigurationNode;
import de.jaschastarke.configuration.IConfigurationSubGroup;
import de.jaschastarke.configuration.InvalidValueException;
import de.jaschastarke.configuration.annotations.IsConfigurationNode;
import de.jaschastarke.maven.ArchiveDocComments;
import de.jaschastarke.minecraft.limitedcreative.ModRegions;
import de.jaschastarke.minecraft.limitedcreative.limits.BlackList;
import de.jaschastarke.modularize.IModule;
@ -17,6 +18,7 @@ import de.jaschastarke.modularize.ModuleEntry;
*
* http://dev.bukkit.org/server-mods/limited-creative/pages/features/region/
*/
@ArchiveDocComments
public class RegionConfig extends Configuration implements IConfigurationSubGroup {
protected ModRegions mod;
protected ModuleEntry<IModule> entry;

View file

@ -30,8 +30,10 @@ blocked.chest: Access to chests is not allowed in creative mode
blocked.survival_flying: You should stay on ground, when leaving a creative-area
blocked.outside_place: You can not place blocks outside of the gamemode-area
blocked.outside_break: You can not destroy blocks outside of the gamemode-area
blocked.outside_interact: You can not interact with those blocks outside of the gamemode-area
blocked.inside_place: You can not place blocks inside of the gamemode-area
blocked.inside_break: You can not destroy blocks inside of the gamemode-area
blocked.inside_interact: You can not interact with those blocks inside of the gamemode-area
blocked.interact: You are not allowed to interact with this type of blocks
blocked.use: You are not allowed to use this type of item
blocked.place: You are not allowed to place this type of block