CoreProtect WE-Integration support
This commit is contained in:
parent
fcb1e92f90
commit
808b50fb61
6 changed files with 64 additions and 9 deletions
10
pom.xml
10
pom.xml
|
@ -9,6 +9,7 @@
|
|||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<plib.version>1.4-SNAPSHOT</plib.version>
|
||||
<bukkit.version>1.6.4-R1.0</bukkit.version>
|
||||
</properties>
|
||||
|
||||
<scm>
|
||||
|
@ -77,7 +78,7 @@
|
|||
<!-- http://dl.bukkit.org/ -->
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>bukkit</artifactId>
|
||||
<version>1.6.2-R0.1</version>
|
||||
<version>${bukkit.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<!-- http://dev.bukkit.org/server-mods/worldguard/ -->
|
||||
|
@ -121,6 +122,12 @@
|
|||
<artifactId>logblock</artifactId>
|
||||
<version>dev-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<!-- http://dev.bukkit.org/bukkit-plugins/coreprotect/ -->
|
||||
<groupId>net.coreprotect</groupId>
|
||||
<artifactId>coreprotect</artifactId>
|
||||
<version>2.0.8</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
@ -165,6 +172,7 @@
|
|||
<param>Multiverse-Inventories</param>
|
||||
<param>Vault</param>
|
||||
<param>LogBlock</param>
|
||||
<param>CoreProtect</param>
|
||||
</softdepend>
|
||||
<custom>
|
||||
<dev-url>http://dev.bukkit.org/server-mods/limited-creative/</dev-url>
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package de.jaschastarke.minecraft.limitedcreative;
|
||||
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import de.jaschastarke.bukkit.lib.CoreModule;
|
||||
import de.jaschastarke.bukkit.lib.commands.AliasHelpedCommand;
|
||||
|
@ -72,12 +73,18 @@ public class ModBlockStates extends CoreModule<LimitedCreative> {
|
|||
return;
|
||||
}
|
||||
super.onEnable();
|
||||
if (plugin.getServer().getPluginManager().isPluginEnabled("WorldEdit")) {
|
||||
new BukkitRunnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
if (plugin.getServer().getPluginManager().isPluginEnabled("WorldEdit"))
|
||||
LCEditSessionFactory.initFactory(this);
|
||||
LCEditSessionFactory.initFactory(ModBlockStates.this);
|
||||
} catch (Exception e) {
|
||||
getLog().warn(plugin.getLocale().trans("block_state.warning.worldedit_sessionfactory_failed", e.getMessage()));
|
||||
}
|
||||
}
|
||||
}.runTaskLater(plugin, 1L);
|
||||
}
|
||||
|
||||
plugin.getCommandHandler().registerCommand(command);
|
||||
plugin.getMainCommand().registerCommand(new AliasHelpedCommand<BlockStateCommand>(command, "blockstate", new String[]{"bs"}));
|
||||
|
|
|
@ -25,7 +25,8 @@ public class LCEditSessionFactory extends EditSessionFactory {
|
|||
|
||||
static enum EditSessionParent {
|
||||
WORLDEDIT,
|
||||
LOGBLOCK("de.jaschastarke.minecraft.limitedcreative.blockstate.worldedit.LCEditSession_LogBlock");
|
||||
LOGBLOCK("de.jaschastarke.minecraft.limitedcreative.blockstate.worldedit.LCEditSession_LogBlock"),
|
||||
COREPROTECT("de.jaschastarke.minecraft.limitedcreative.blockstate.worldedit.LCEditSession_CoreProtect");
|
||||
|
||||
private String cls = null;
|
||||
EditSessionParent() {
|
||||
|
@ -141,6 +142,10 @@ public class LCEditSessionFactory extends EditSessionFactory {
|
|||
if (mod.isDebug())
|
||||
mod.getLog().debug("Replacing LogBlocks WorldEdit-SessionFactory");
|
||||
WorldEdit.getInstance().setEditSessionFactory(new LCEditSessionFactory(mod, EditSessionParent.LOGBLOCK));
|
||||
} else if (currentEditSessionFactory.getClass().getName().equals("net.coreprotect.worldedit.CoreProtectEditSessionFactory")) {
|
||||
if (mod.isDebug())
|
||||
mod.getLog().debug("Replacing CoreProtects WorldEdit-SessionFactory");
|
||||
WorldEdit.getInstance().setEditSessionFactory(new LCEditSessionFactory(mod, EditSessionParent.COREPROTECT));
|
||||
} else {
|
||||
throw new Exception("WorldEdit-SessionFactory is hooked by an unknown another Plugin (" + currentEditSessionFactory.getClass().getName() + ").");
|
||||
}
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
package de.jaschastarke.minecraft.limitedcreative.blockstate.worldedit;
|
||||
|
||||
import net.coreprotect.CoreProtect;
|
||||
import net.coreprotect.worldedit.CoreProtectEditSession;
|
||||
|
||||
import com.sk89q.worldedit.LocalPlayer;
|
||||
import com.sk89q.worldedit.LocalWorld;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.bags.BlockBag;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
|
||||
public class LCEditSession_CoreProtect extends CoreProtectEditSession {
|
||||
private LCEditSessionFactory factory;
|
||||
private LocalPlayer player;
|
||||
|
||||
public LCEditSession_CoreProtect(LCEditSessionFactory factory, LocalWorld world, int maxBlocks, BlockBag blockBag, LocalPlayer player) {
|
||||
super(world, maxBlocks, blockBag, player, CoreProtect.getInstance());
|
||||
this.factory = factory;
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
public LCEditSession_CoreProtect(LCEditSessionFactory factory, LocalWorld world, int maxBlocks, LocalPlayer player) {
|
||||
super(world, maxBlocks, player, CoreProtect.getInstance());
|
||||
this.factory = factory;
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean rawSetBlock(Vector pt, BaseBlock block) {
|
||||
boolean success = super.rawSetBlock(pt, block);
|
||||
if (success)
|
||||
factory.onBlockEdit(player, pt, block);
|
||||
return success;
|
||||
}
|
||||
}
|
|
@ -69,7 +69,7 @@ blocked.break: You are not allowed to break this type of block
|
|||
blocked.region.piston: Moving {0} block out of creative area was blocked at {1}
|
||||
blocked.region.piston_in: Moving {0} block into creative area was blocked at {1}
|
||||
|
||||
block_state.warning.worldedit_sessionfactory_failed: Failed to hook into WorldEdit. WorldEdit-actions can''t be traced. Error:
|
||||
block_state.warning.worldedit_sessionfactory_failed: Failed to hook into WorldEdit. WorldEdit-actions can''t be traced. Error: {0}
|
||||
block_state.tool_info.seed: This {0}-Block is generated by the god who created this world
|
||||
block_state.tool_info.player: This {0}-Block was created by ''{1}'' in {2}-mode on {3}
|
||||
block_state.tool_info.edit: This {0}-Block was modified with WorldEdit by ''{1}'' on {3}
|
||||
|
|
|
@ -69,7 +69,7 @@ blocked.break: Du darfst diesen Block nicht zerst
|
|||
blocked.region.piston: Verschieben eines {0} Blocks aus einem GameMode-Bereich wurde bei {1} verhindet
|
||||
blocked.region.piston_in: Verschieben eines {0} Blocks in einen GameMode-Bereich wurde bei {1} verhindet
|
||||
|
||||
block_state.warning.worldedit_sessionfactory_failed: Fehler beim Einhängen in WorldEdit. WorldEdit-Aktionen können nicht nachvollzogen werden. Fehler:
|
||||
block_state.warning.worldedit_sessionfactory_failed: Fehler beim Einhängen in WorldEdit. WorldEdit-Aktionen können nicht nachvollzogen werden. Fehler: {0}
|
||||
block_state.tool_info.seed: Dieser {0}-Block wurde von dem Gott generiert der diese Welt erschuf
|
||||
block_state.tool_info.player: Dieser {0}-Block wurde am {3} von ''{1}'' im {2}-Modus gebaut
|
||||
block_state.tool_info.edit: Der {0}-Block wurde am {3} von ''{1}'' mit WorldEdit gesetzt
|
||||
|
|
Loading…
Reference in a new issue