-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d165467
commit 2438149
Showing
7 changed files
with
101 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* To change this license header, choose License Headers in Project Properties. | ||
* To change this template file, choose Tools | Templates | ||
* and open the template in the editor. | ||
*/ | ||
package de.erethon.dungeonsxl.util; | ||
|
||
import com.griefcraft.lwc.LWC; | ||
import com.griefcraft.model.Protection; | ||
import org.bukkit.Bukkit; | ||
import org.bukkit.block.Block; | ||
|
||
/** | ||
* @author Daniel Saukel | ||
*/ | ||
public class LWCUtil { | ||
|
||
public static void removeProtection(Block block) { | ||
if (!isLWCLoaded()) { | ||
return; | ||
} | ||
Protection protection = LWC.getInstance().getProtectionCache().getProtection(block); | ||
if (protection != null) { | ||
protection.remove(); | ||
} | ||
} | ||
|
||
/** | ||
* @return | ||
* true if LWC is loaded | ||
*/ | ||
public static boolean isLWCLoaded() { | ||
return Bukkit.getPluginManager().getPlugin("LWC") != null; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
src/main/java/de/erethon/dungeonsxl/world/LWCIntegration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* Copyright (C) 2012-2018 Frank Baumann | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package de.erethon.dungeonsxl.world; | ||
|
||
import com.griefcraft.lwc.LWC; | ||
import com.griefcraft.scripting.JavaModule; | ||
import com.griefcraft.scripting.event.LWCProtectionRegisterEvent; | ||
import de.erethon.dungeonsxl.DungeonsXL; | ||
|
||
/** | ||
* @author Daniel Saukel | ||
*/ | ||
public class LWCIntegration extends JavaModule { | ||
|
||
DungeonsXL plugin; | ||
|
||
public LWCIntegration(DungeonsXL plugin) { | ||
this.plugin = plugin; | ||
LWC.getInstance().getModuleLoader().registerModule(plugin, this); | ||
} | ||
|
||
@Override | ||
public void onRegisterProtection(LWCProtectionRegisterEvent event) { | ||
DInstanceWorld instance = plugin.getDWorlds().getInstanceByWorld(event.getBlock().getWorld()); | ||
if (instance != null) { | ||
event.setCancelled(true); | ||
} | ||
} | ||
|
||
} |