API changes for StargateCommand
This commit is contained in:
parent
4367e3a36a
commit
88b30b3579
2
README
2
README
@ -202,6 +202,8 @@ createConflict=Gate conflicts with existing gate
|
|||||||
=============
|
=============
|
||||||
Changes
|
Changes
|
||||||
=============
|
=============
|
||||||
|
[Version 0.7.6.1]
|
||||||
|
- API update to support StargateCommand
|
||||||
[Version 0.7.6]
|
[Version 0.7.6]
|
||||||
- Moved gate opening/closing to a Queue/Runnable system to resolve server lag issues with very large gates
|
- Moved gate opening/closing to a Queue/Runnable system to resolve server lag issues with very large gates
|
||||||
[Version 0.7.5.11]
|
[Version 0.7.5.11]
|
||||||
|
@ -61,7 +61,7 @@ public class Gate {
|
|||||||
private int destroyCost = -1;
|
private int destroyCost = -1;
|
||||||
private boolean toOwner = false;
|
private boolean toOwner = false;
|
||||||
|
|
||||||
private Gate(String filename, Character[][] layout, HashMap<Character, Integer> types, HashMap<Character, Integer> metadata) {
|
public Gate(String filename, Character[][] layout, HashMap<Character, Integer> types, HashMap<Character, Integer> metadata) {
|
||||||
this.filename = filename;
|
this.filename = filename;
|
||||||
this.layout = layout;
|
this.layout = layout;
|
||||||
this.metadata = metadata;
|
this.metadata = metadata;
|
||||||
@ -176,6 +176,14 @@ public class Gate {
|
|||||||
return layout;
|
return layout;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public HashMap<Character, Integer> getTypes() {
|
||||||
|
return types;
|
||||||
|
}
|
||||||
|
|
||||||
|
public HashMap<Character, Integer> getMetaData() {
|
||||||
|
return metadata;
|
||||||
|
}
|
||||||
|
|
||||||
public RelativeBlockVector[] getEntrances() {
|
public RelativeBlockVector[] getEntrances() {
|
||||||
return entrances;
|
return entrances;
|
||||||
}
|
}
|
||||||
@ -207,10 +215,18 @@ public class Gate {
|
|||||||
return portalBlockOpen;
|
return portalBlockOpen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setPortalBlockOpen(int type) {
|
||||||
|
portalBlockOpen = type;
|
||||||
|
}
|
||||||
|
|
||||||
public int getPortalBlockClosed() {
|
public int getPortalBlockClosed() {
|
||||||
return portalBlockClosed;
|
return portalBlockClosed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setPortalBlockClosed(int type) {
|
||||||
|
portalBlockClosed = type;
|
||||||
|
}
|
||||||
|
|
||||||
public int getUseCost() {
|
public int getUseCost() {
|
||||||
if (useCost < 0) return iConomyHandler.useCost;
|
if (useCost < 0) return iConomyHandler.useCost;
|
||||||
return useCost;
|
return useCost;
|
||||||
@ -281,7 +297,7 @@ public class Gate {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void registerGate(Gate gate) {
|
public static void registerGate(Gate gate) {
|
||||||
gates.put(gate.getFilename(), gate);
|
gates.put(gate.getFilename(), gate);
|
||||||
|
|
||||||
int blockID = gate.getControlBlock();
|
int blockID = gate.getControlBlock();
|
||||||
@ -293,7 +309,7 @@ public class Gate {
|
|||||||
controlBlocks.get(blockID).add(gate);
|
controlBlocks.get(blockID).add(gate);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Gate loadGate(File file) {
|
public static Gate loadGate(File file) {
|
||||||
Scanner scanner = null;
|
Scanner scanner = null;
|
||||||
boolean designing = false;
|
boolean designing = false;
|
||||||
ArrayList<ArrayList<Character>> design = new ArrayList<ArrayList<Character>>();
|
ArrayList<ArrayList<Character>> design = new ArrayList<ArrayList<Character>>();
|
||||||
|
@ -524,10 +524,6 @@ public class Portal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void activate(Player player) {
|
public void activate(Player player) {
|
||||||
StargateActivateEvent event = new StargateActivateEvent(this, player);
|
|
||||||
Stargate.server.getPluginManager().callEvent(event);
|
|
||||||
if (event.isCancelled()) return;
|
|
||||||
|
|
||||||
destinations.clear();
|
destinations.clear();
|
||||||
destination = "";
|
destination = "";
|
||||||
Stargate.activeList.add(this);
|
Stargate.activeList.add(this);
|
||||||
@ -554,6 +550,15 @@ public class Portal {
|
|||||||
if (Stargate.destMemory && !lastDest.isEmpty() && destinations.contains(lastDest)) {
|
if (Stargate.destMemory && !lastDest.isEmpty() && destinations.contains(lastDest)) {
|
||||||
destination = lastDest;
|
destination = lastDest;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StargateActivateEvent event = new StargateActivateEvent(this, player, destinations, destination);
|
||||||
|
Stargate.server.getPluginManager().callEvent(event);
|
||||||
|
if (event.isCancelled()) {
|
||||||
|
Stargate.activeList.remove(this);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
destination = event.getDestination();
|
||||||
|
destinations = event.getDestinations();
|
||||||
drawSign();
|
drawSign();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -263,6 +263,10 @@ public class Stargate extends JavaPlugin {
|
|||||||
return portalFolder;
|
return portalFolder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String getGateFolder() {
|
||||||
|
return gateFolder;
|
||||||
|
}
|
||||||
|
|
||||||
public static String getDefaultNetwork() {
|
public static String getDefaultNetwork() {
|
||||||
return defNetwork;
|
return defNetwork;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package net.TheDgtl.Stargate.event;
|
package net.TheDgtl.Stargate.event;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
|
|
||||||
@ -24,7 +26,9 @@ import net.TheDgtl.Stargate.Portal;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
public class StargateActivateEvent extends StargateEvent {
|
public class StargateActivateEvent extends StargateEvent {
|
||||||
Player player;
|
private Player player;
|
||||||
|
private ArrayList<String> destinations;
|
||||||
|
private String destination;
|
||||||
|
|
||||||
private static final HandlerList handlers = new HandlerList();
|
private static final HandlerList handlers = new HandlerList();
|
||||||
|
|
||||||
@ -35,13 +39,31 @@ public class StargateActivateEvent extends StargateEvent {
|
|||||||
public static HandlerList getHandlerList() {
|
public static HandlerList getHandlerList() {
|
||||||
return handlers;
|
return handlers;
|
||||||
}
|
}
|
||||||
public StargateActivateEvent(Portal portal, Player player) {
|
public StargateActivateEvent(Portal portal, Player player, ArrayList<String> destinations, String destination) {
|
||||||
super("StargatActivateEvent", portal);
|
super("StargatActivateEvent", portal);
|
||||||
|
|
||||||
this.player = player;
|
this.player = player;
|
||||||
|
this.destinations = destinations;
|
||||||
|
this.destination = destination;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Player getPlayer() {
|
public Player getPlayer() {
|
||||||
return player;
|
return player;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ArrayList<String> getDestinations() {
|
||||||
|
return destinations;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDestinations(ArrayList<String> destinations) {
|
||||||
|
this.destinations = destinations;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDestination() {
|
||||||
|
return destination;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDestination(String destination) {
|
||||||
|
this.destination = destination;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
name: Stargate
|
name: Stargate
|
||||||
main: net.TheDgtl.Stargate.Stargate
|
main: net.TheDgtl.Stargate.Stargate
|
||||||
version: 0.7.6.0
|
version: 0.7.6.1
|
||||||
description: Stargate mod for Bukkit
|
description: Stargate mod for Bukkit
|
||||||
author: Drakia
|
author: Drakia
|
||||||
website: http://www.thedgtl.net
|
website: http://www.thedgtl.net
|
||||||
|
Loading…
Reference in New Issue
Block a user