Skip to content

Commit

Permalink
#102: Added DataReloadEvent
Browse files Browse the repository at this point in the history
  • Loading branch information
Sataniel98 committed Jul 28, 2016
1 parent a3590ff commit cbf49c5
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import io.github.dre2n.commons.util.messageutil.MessageUtil;
import io.github.dre2n.dungeonsxl.DungeonsXL;
import io.github.dre2n.dungeonsxl.config.DMessages;
import io.github.dre2n.dungeonsxl.event.DataReloadEvent;
import io.github.dre2n.dungeonsxl.player.DPermissions;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
Expand All @@ -46,7 +47,13 @@ public ReloadCommand() {

@Override
public void onExecute(String[] args, CommandSender sender) {
PluginManager plugins = Bukkit.getServer().getPluginManager();
PluginManager plugins = Bukkit.getPluginManager();

DataReloadEvent event = new DataReloadEvent();
plugins.callEvent(event);
if (event.isCancelled()) {
return;
}

int maps = DungeonsXL.MAPS.listFiles().length;
int dungeons = DungeonsXL.DUNGEONS.listFiles().length;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* Copyright (C) 2012-2016 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 io.github.dre2n.dungeonsxl.event;

import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;

/**
* @author Daniel Saukel
*/
public class DataReloadEvent extends Event implements Cancellable {

private static final HandlerList handlers = new HandlerList();
private boolean cancelled;

@Override
public HandlerList getHandlers() {
return handlers;
}

public static HandlerList getHandlerList() {
return handlers;
}

@Override
public boolean isCancelled() {
return cancelled;
}

@Override
public void setCancelled(boolean cancelled) {
this.cancelled = cancelled;
}

}

0 comments on commit cbf49c5

Please sign in to comment.