-
Notifications
You must be signed in to change notification settings - Fork 4
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
Bysokar
committed
Jun 24, 2017
1 parent
f926f39
commit c32f7f1
Showing
16 changed files
with
1,026 additions
and
819 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
20 changes: 20 additions & 0 deletions
20
com/draksterau/Regenerator/event/RegenerationActionEvent.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,20 @@ | ||
/* | ||
* 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 com.draksterau.Regenerator.event; | ||
|
||
import org.bukkit.Chunk; | ||
import org.bukkit.Location; | ||
|
||
/** | ||
* | ||
* @author draks | ||
*/ | ||
public class RegenerationActionEvent extends RegenerationEvent { | ||
|
||
public RegenerationActionEvent(Location location) { | ||
super(location); | ||
} | ||
} |
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,80 @@ | ||
/* | ||
* 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 com.draksterau.Regenerator.event; | ||
|
||
import java.util.ArrayList; | ||
import java.util.HashMap; | ||
import org.bukkit.Chunk; | ||
import org.bukkit.Location; | ||
import org.bukkit.World; | ||
import org.bukkit.block.Block; | ||
import org.bukkit.entity.Player; | ||
import org.bukkit.event.Event; | ||
import org.bukkit.event.HandlerList; | ||
import org.bukkit.plugin.java.JavaPlugin; | ||
|
||
/** | ||
* | ||
* @author draks | ||
*/ | ||
public class RegenerationEvent extends Event { | ||
|
||
private Location location; | ||
private boolean cancelled = false; | ||
private HashMap<String, JavaPlugin> reasons = new HashMap<>(); | ||
private static final HandlerList handlers = new HandlerList(); | ||
|
||
public static HandlerList getHandlerList() { | ||
return handlers; | ||
} | ||
|
||
public RegenerationEvent(Location location) { | ||
this.location = location; | ||
} | ||
|
||
@Override | ||
public HandlerList getHandlers() { | ||
return handlers; | ||
} | ||
|
||
public boolean isCancelled() { | ||
return this.cancelled; | ||
} | ||
|
||
public Chunk getChunk() { | ||
return location.getChunk(); | ||
} | ||
|
||
public Block getBlock() { | ||
return location.getBlock(); | ||
} | ||
|
||
public Location getLocation() { | ||
return this.location; | ||
} | ||
|
||
public World getWorld() { | ||
return location.getWorld(); | ||
} | ||
|
||
public void clearCancellations() { | ||
this.reasons.clear(); | ||
this.cancelled = false; | ||
} | ||
|
||
public HashMap<String, JavaPlugin> getCancelledReasons() { | ||
return this.reasons; | ||
} | ||
|
||
public void cancelWithReason(String reason, JavaPlugin yourPlugin) { | ||
if (!this.cancelled) this.cancelled = true; | ||
if (!this.reasons.keySet().contains(reason)) this.reasons.put(reason, yourPlugin); | ||
} | ||
|
||
} | ||
|
||
|
||
|
49 changes: 49 additions & 0 deletions
49
com/draksterau/Regenerator/event/RegenerationRequestEvent.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,49 @@ | ||
/* | ||
* 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 com.draksterau.Regenerator.event; | ||
|
||
import org.bukkit.Location; | ||
import org.bukkit.entity.Player; | ||
import org.bukkit.plugin.java.JavaPlugin; | ||
|
||
/** | ||
* | ||
* @author draks | ||
*/ | ||
public class RegenerationRequestEvent extends RegenerationEvent { | ||
|
||
private final Player requestor; | ||
private RequestTrigger trigger = RequestTrigger.Unknown; | ||
private boolean performImmediately = false; | ||
private JavaPlugin plugin; | ||
|
||
public RegenerationRequestEvent(Location location, Player player, RequestTrigger trigger, JavaPlugin requestingPlugin) { | ||
super(location); | ||
this.requestor = player; | ||
this.trigger = trigger; | ||
this.plugin = requestingPlugin; | ||
} | ||
|
||
public JavaPlugin getPluginRequestor() { | ||
return this.plugin; | ||
} | ||
|
||
public boolean isImmediate() { | ||
return this.performImmediately; | ||
} | ||
|
||
public void setIsImmediate(boolean val) { | ||
this.performImmediately = val; | ||
} | ||
|
||
public RequestTrigger getTrigger() { | ||
return this.trigger; | ||
} | ||
|
||
public Player getRequestor() { | ||
return this.requestor; | ||
} | ||
} |
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,18 @@ | ||
/* | ||
* 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 com.draksterau.Regenerator.event; | ||
|
||
/** | ||
* | ||
* @author draks | ||
*/ | ||
public enum RequestTrigger { | ||
Break, | ||
Place, | ||
Explosion, | ||
Command, | ||
Unknown; | ||
} |
Oops, something went wrong.