Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

+ Prevent Hardcore/Vampirism features inside of Towny Arena Plots. #4

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ Key:
! Change
- Removal

Version 1.0.2
+ Prevent Hardcore/Vampirism features inside of Towny Arena Plots.

Version 1.0.1
= Fix error spam seen when used with new mcMMO builds (possible 2.* related.)
= Fix use of deprecated Towny API call, switched new TownyAPI.
Expand Down
7 changes: 1 addition & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,4 @@ mcMMO is currently developed by a team of individuals from all over the world.

mcMMO uses Maven 3 to manage dependencies, packaging, and shading of necessary classes; Maven 3 is required to compile mcMMO.

The typical command used to build mcMMO is: `mvn clean package install`

Required Libraries:
* Bukkit
* mcMMO
* Towny
The typical command used to build mcMMO is: `mvn clean package install`
Binary file removed lib/Towny.jar
Binary file not shown.
40 changes: 25 additions & 15 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.mcmmo</groupId>
<artifactId>mcMMO-Towny</artifactId>
<version>1.0.1</version>
<version>1.0.2</version>
<name>mcMMO-Towny</name>
<url>https://github.com/mcMMO-Dev/mcMMO-Towny</url>
<issueManagement>
Expand All @@ -24,27 +24,37 @@
</resource>
</resources>
</build>
<repositories>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>glaremasters repo</id>
<url>https://repo.glaremasters.me/repository/towny/</url>
</repository>
<repository>
<id>mcmmo-repo</id>
<url>https://nexus.neetgames.com/repository/maven-public</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.14.4-R0.1-SNAPSHOT</version>
<scope>system</scope>
<systemPath>${project.basedir}\lib\bukkit.jar</systemPath>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.gmail.nossr50.mcMMO</groupId>
<artifactId>mcMMO</artifactId>
<version>2.1.107</version>
<scope>system</scope>
<systemPath>${project.basedir}\lib\mcMMO.jar</systemPath>
<groupId>com.palmergames.bukkit.towny</groupId>
<artifactId>Towny</artifactId>
<version>0.98.3.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.palmergames</groupId>
<artifactId>Towny</artifactId>
<version>0.94.0.8</version>
<scope>system</scope>
<systemPath>${project.basedir}\lib\Towny.jar</systemPath>
<groupId>com.gmail.nossr50.mcMMO</groupId>
<artifactId>mcMMO</artifactId>
<version>2.1.209</version>
</dependency>
</dependencies>
<properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@
import org.bukkit.event.Listener;

import com.gmail.nossr50.events.experience.McMMOPlayerXpGainEvent;
import com.gmail.nossr50.events.hardcore.McMMOPlayerDeathPenaltyEvent;
import com.gmail.nossr50.events.hardcore.McMMOPlayerStatLossEvent;
import com.gmail.nossr50.events.hardcore.McMMOPlayerVampirismEvent;
import com.palmergames.bukkit.towny.TownyAPI;
import com.palmergames.bukkit.towny.object.TownBlock;
import com.palmergames.bukkit.towny.object.TownBlockType;

import org.mcmmo.mcmmotowny.config.Config;

public class ExperienceListener implements Listener {
Expand Down Expand Up @@ -36,4 +42,25 @@ private boolean isAffectedSkill(String skillName) {
private boolean isAffectedReason(String xpGainReason) {
return Config.getInstance().getAffectedXpGainReasons().contains(xpGainReason);
}

@EventHandler
public void onHardcoreDeath(McMMOPlayerDeathPenaltyEvent event) {
TownBlock townBlock = TownyAPI.getInstance().getTownBlock(event.getPlayer().getLocation());
if (townBlock != null && townBlock.getType().equals(TownBlockType.ARENA))
event.setCancelled(true);
}

@EventHandler
public void onStatLoss(McMMOPlayerStatLossEvent event) {
TownBlock townBlock = TownyAPI.getInstance().getTownBlock(event.getPlayer().getLocation());
if (townBlock != null && townBlock.getType().equals(TownBlockType.ARENA))
event.setCancelled(true);
}

@EventHandler
public void onVampirism(McMMOPlayerVampirismEvent event) {
TownBlock townBlock = TownyAPI.getInstance().getTownBlock(event.getPlayer().getLocation());
if (townBlock != null && townBlock.getType().equals(TownBlockType.ARENA))
event.setCancelled(true);
}
}
2 changes: 1 addition & 1 deletion src/main/java/org/mcmmo/mcmmotowny/mcMMOTowny.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public void onEnable() {
}

if (!isTownyEnabled()) {
this.getLogger().warning("mcMMO-Towny requires Towny to run, please download Towny. http://palmergames.com/towny/");
this.getLogger().warning("mcMMO-Towny requires Towny to run, please download Towny. https://townyadvanced.github.io");
getServer().getPluginManager().disablePlugin(this);
return;
}
Expand Down