fixed something with event priority
also Changed some classnames for clarity
This commit is contained in:
1 parent
885b649dcc
commit
16ca190ee5
5 files changed
+24
-24
No files matched your search
@@ -3,7 +3,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.mcsmp</groupId>
|
||||
<artifactId>ParamnesticCure</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<version>1.0.1</version>
|
||||
<packaging>jar</packaging>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
@@ -31,7 +31,7 @@
|
||||
<dependency>
|
||||
<groupId>me.prunt.restrictedcreative</groupId>
|
||||
<artifactId>RestrictedCreativeAPI</artifactId>
|
||||
<version>2.4.7</version>
|
||||
<version>2.4.8</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
||||
@@ -27,8 +27,8 @@ import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import com.mcsmp.block.BlockTracker;
|
||||
import com.mcsmp.commands.CommandTracker;
|
||||
import com.mcsmp.block.BlockListener;
|
||||
import com.mcsmp.commands.CommandListener;
|
||||
import com.mcsmp.database.SqlManager;
|
||||
|
||||
import net.coreprotect.CoreProtect;
|
||||
@@ -52,7 +52,8 @@ public class ParamnesticCure extends JavaPlugin {
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
//sets so that any external methods that need to log messages wont get any errors
|
||||
|
||||
//sets instance.
|
||||
instance = this;
|
||||
|
||||
|
||||
@@ -66,9 +67,9 @@ public class ParamnesticCure extends JavaPlugin {
|
||||
|
||||
this.saveDefaultConfig();
|
||||
PluginManager pluginManager = this.getServer().getPluginManager();
|
||||
pluginManager.registerEvents(new CommandTracker(this), this);
|
||||
pluginManager.registerEvents(new BlockTracker(),this);
|
||||
pluginManager.registerEvents(new WorldTracker(),this);
|
||||
pluginManager.registerEvents(new CommandListener(this), this);
|
||||
pluginManager.registerEvents(new BlockListener(),this);
|
||||
pluginManager.registerEvents(new WorldListener(),this);
|
||||
|
||||
|
||||
log = getLogger();
|
||||
@@ -110,8 +111,6 @@ public class ParamnesticCure extends JavaPlugin {
|
||||
|
||||
createDB();
|
||||
isDebug = getConfig().getBoolean("Plugin_settings.debug");
|
||||
//sets instance.
|
||||
instance = this;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -159,7 +158,7 @@ public class ParamnesticCure extends JavaPlugin {
|
||||
List<World> worldlist = getServer().getWorlds();
|
||||
|
||||
for(World world : worldlist) {
|
||||
WorldTracker.addWorldToDB(world);
|
||||
WorldListener.addWorldToDB(world);
|
||||
}
|
||||
}
|
||||
/**
|
||||
|
||||
+2
-2
@@ -20,14 +20,14 @@ import org.bukkit.event.world.WorldInitEvent;
|
||||
* @author Thorin
|
||||
*
|
||||
*/
|
||||
public class WorldTracker implements Listener {
|
||||
public class WorldListener implements Listener {
|
||||
/**
|
||||
* If a world get created, its name needs to get stored in the database. TODO I should also add something that tracks if the world was renamed
|
||||
* @param event
|
||||
*/
|
||||
@EventHandler
|
||||
public void worldInit(WorldInitEvent event) {
|
||||
WorldTracker.addWorldToDB(event.getWorld());
|
||||
WorldListener.addWorldToDB(event.getWorld());
|
||||
}
|
||||
/**
|
||||
* Adds the world to the worlds table, which will assign it an id
|
||||
+8
-7
@@ -16,12 +16,13 @@ import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.block.data.Bisected;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
|
||||
import com.mcsmp.ParamnesticCure;
|
||||
import com.mcsmp.WorldTracker;
|
||||
import com.mcsmp.WorldListener;
|
||||
|
||||
import me.prunt.restrictedcreative.RestrictedCreativeAPI;
|
||||
import net.coreprotect.CoreProtectAPI;
|
||||
@@ -32,7 +33,7 @@ import net.coreprotect.CoreProtectAPI.ParseResult;
|
||||
* @author Frostalf
|
||||
* @author Thorin
|
||||
*/
|
||||
public class BlockTracker implements Listener {
|
||||
public class BlockListener implements Listener {
|
||||
|
||||
private static ParamnesticCure plugin = ParamnesticCure.getInstance();
|
||||
private static CoreProtectAPI coreprotect = plugin.getCoreProtect();
|
||||
@@ -41,14 +42,14 @@ public class BlockTracker implements Listener {
|
||||
/**
|
||||
* @param event BlockBreakEvent
|
||||
*/
|
||||
@EventHandler
|
||||
@EventHandler(ignoreCancelled = true,priority = EventPriority.MONITOR)
|
||||
public void onBlockBreak(BlockBreakEvent event) {
|
||||
generalBlockEventTrigger(event.getBlock(),true);
|
||||
}
|
||||
/**
|
||||
* @param event BlockPlaceEvent
|
||||
*/
|
||||
@EventHandler
|
||||
@EventHandler(ignoreCancelled = true,priority = EventPriority.MONITOR)
|
||||
public void onBlockPlace(BlockPlaceEvent event) {
|
||||
generalBlockEventTrigger(event.getBlock(),false);
|
||||
}
|
||||
@@ -78,7 +79,7 @@ public class BlockTracker implements Listener {
|
||||
|
||||
|
||||
if(!isCreative) return;
|
||||
BlockTracker.updateCreativeID(block,isCreative);
|
||||
BlockListener.updateCreativeID(block,isCreative);
|
||||
|
||||
|
||||
/*
|
||||
@@ -92,7 +93,7 @@ public class BlockTracker implements Listener {
|
||||
else
|
||||
loc = loc.add(0,-1,0);
|
||||
|
||||
BlockTracker.updateCreativeID(loc.getBlock(),isCreative);
|
||||
BlockListener.updateCreativeID(loc.getBlock(),isCreative);
|
||||
}
|
||||
}
|
||||
},waitPeriod);
|
||||
@@ -148,7 +149,7 @@ public class BlockTracker implements Listener {
|
||||
);
|
||||
|
||||
statement.setInt( 1, time);
|
||||
statement.setInt( 2, WorldTracker.getWorldId( block.getWorld().getName()) );
|
||||
statement.setInt( 2, WorldListener.getWorldId( block.getWorld().getName()) );
|
||||
statement.setInt( 3, block.getX());
|
||||
statement.setInt( 4, block.getY());
|
||||
statement.setInt( 5, block.getZ());
|
||||
+4
-4
@@ -22,7 +22,7 @@ import org.bukkit.event.server.ServerCommandEvent;
|
||||
|
||||
import com.mcsmp.MessageManager;
|
||||
import com.mcsmp.ParamnesticCure;
|
||||
import com.mcsmp.block.BlockTracker;
|
||||
import com.mcsmp.block.BlockListener;
|
||||
import com.mcsmp.block.RestoreManager;
|
||||
import com.mcsmp.block.RollbackManager;
|
||||
|
||||
@@ -31,7 +31,7 @@ import com.mcsmp.block.RollbackManager;
|
||||
* @author Frostalf
|
||||
* @author Thorin
|
||||
*/
|
||||
public class CommandTracker implements Listener {
|
||||
public class CommandListener implements Listener {
|
||||
|
||||
|
||||
private static HashMap<String,String[]> storedCommands = new HashMap<String,String[]>();
|
||||
@@ -42,7 +42,7 @@ public class CommandTracker implements Listener {
|
||||
* Constructor class
|
||||
* @param plugin Instance of the plugin.
|
||||
*/
|
||||
public CommandTracker(ParamnesticCure plugin) {
|
||||
public CommandListener(ParamnesticCure plugin) {
|
||||
//
|
||||
configSektion = plugin.getConfig().getConfigurationSection("");
|
||||
}
|
||||
@@ -170,7 +170,7 @@ public class CommandTracker implements Listener {
|
||||
//don't look here, this is stupid
|
||||
String[] temp = {command[2]};
|
||||
int time = (new RollbackManager(temp,null,null)).getTime();
|
||||
BlockTracker.purgeDatabase(time);
|
||||
BlockListener.purgeDatabase(time);
|
||||
}
|
||||
List<String> helpAlias = configSektion.getStringList("blockLoggerCommands.help");
|
||||
if(helpAlias.contains(command[1]) && PermissionManager.hasHelp(playerOperator)) {
|
||||
Reference in new issue
Block a user