Forbid PlugMan

This commit is contained in:
Daniel Saukel 2016-12-03 13:04:31 +01:00
parent babe7acd80
commit 5c7b466623
10 changed files with 75 additions and 8 deletions

View File

@ -8,6 +8,6 @@
<parent>
<groupId>io.github.dre2n</groupId>
<artifactId>dungeonsxl</artifactId>
<version>0.15.1</version>
<version>0.15.2</version>
</parent>
</project>

View File

@ -8,7 +8,7 @@
<parent>
<groupId>io.github.dre2n</groupId>
<artifactId>dungeonsxl</artifactId>
<version>0.15.1</version>
<version>0.15.2</version>
</parent>
<build>
<resources>

View File

@ -50,6 +50,7 @@ import io.github.dre2n.dungeonsxl.task.SecureModeTask;
import io.github.dre2n.dungeonsxl.task.UpdateTask;
import io.github.dre2n.dungeonsxl.task.WorldUnloadTask;
import io.github.dre2n.dungeonsxl.trigger.TriggerTypes;
import io.github.dre2n.dungeonsxl.util.NoReload;
import io.github.dre2n.dungeonsxl.world.DWorlds;
import java.io.File;
import java.util.List;
@ -159,6 +160,8 @@ public class DungeonsXL extends BRPlugin {
if (mainConfig.isSecureModeEnabled()) {
startSecureModeTask(mainConfig.getSecureModeCheckInterval());
}
new NoReload(this);
}
@Override

View File

@ -0,0 +1,64 @@
/*
* Copyright (C) 2016 Daniel Saukel
*
* 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 io.github.dre2n.dungeonsxl.util;
import org.bukkit.ChatColor;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.server.ServerCommandEvent;
import org.bukkit.plugin.Plugin;
/**
* NoReload 1.0
*
* @author Daniel Saukel
*/
public class NoReload implements Listener {
Plugin plugin;
/**
* @param plugin
* the plugin that integrates NoReload
*/
public NoReload(Plugin plugin) {
this.plugin = plugin;
plugin.getServer().getPluginManager().registerEvents(this, plugin);
}
@EventHandler
public void onPlayerCommand(PlayerCommandPreprocessEvent event) {
String pl = plugin.getDescription().getName().toUpperCase();
String cmd = event.getMessage().toUpperCase();
if (cmd.contains("PLUGMAN") && cmd.contains(pl)) {
event.setCancelled(true);
event.getPlayer().sendMessage(ChatColor.RED + "The plugin " + pl + " does not support insecure loading! Restart your server instead.");
}
}
@EventHandler
void onConsoleCommand(ServerCommandEvent event) {
String pl = plugin.getDescription().getName().toUpperCase();
String cmd = event.getCommand().toUpperCase();
if (cmd.contains("PLUGMAN") && cmd.contains(pl)) {
event.setCancelled(true);
event.getSender().sendMessage(ChatColor.RED + "The plugin " + pl + " does not support insecure loading! Restart your server instead.");
}
}
}

View File

@ -8,7 +8,7 @@
<parent>
<groupId>io.github.dre2n</groupId>
<artifactId>dungeonsxl</artifactId>
<version>0.15.1</version>
<version>0.15.2</version>
</parent>
<build>
<plugins>

View File

@ -8,7 +8,7 @@
<parent>
<groupId>io.github.dre2n</groupId>
<artifactId>dungeonsxl</artifactId>
<version>0.15.1</version>
<version>0.15.2</version>
</parent>
<build>
<plugins>

View File

@ -8,7 +8,7 @@
<parent>
<groupId>io.github.dre2n</groupId>
<artifactId>dungeonsxl</artifactId>
<version>0.15.1</version>
<version>0.15.2</version>
</parent>
<build>
<plugins>

View File

@ -8,7 +8,7 @@
<parent>
<groupId>io.github.dre2n</groupId>
<artifactId>dungeonsxl</artifactId>
<version>0.15.1</version>
<version>0.15.2</version>
</parent>
<build>
<plugins>

View File

@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>io.github.dre2n</groupId>
<artifactId>dungeonsxl</artifactId>
<version>0.15.1</version>
<version>0.15.2</version>
<packaging>pom</packaging>
<name>DungeonsXL</name>
<url>https://dre2n.github.io</url>

View File

@ -8,7 +8,7 @@
<parent>
<groupId>io.github.dre2n</groupId>
<artifactId>dungeonsxl</artifactId>
<version>0.15.1</version>
<version>0.15.2</version>
</parent>
<build>
<finalName>dungeonsxl-${project.version}${buildNo}</finalName>