Developper API - corentingosselin/ProdigyNightclubWiki GitHub Wiki
There is no maven right now, it's coming !
You plugin.yml
name: Test
version: 1.0-SNAPSHOT
main: com.example.test
depend: [ProdigyNightclub]
or:
name: Test
version: 1.0-SNAPSHOT
main: com.example.test
softdepend: [ProdigyNightclub]
You can use the api like example below:
package fr.cocoraid.test;
import fr.prodigynightclub.api.IProdigyNightclub;
import fr.prodigynightclub.api.ProdigyNightclubAPI;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.Vector;
public class Test extends JavaPlugin implements Listener, IProdigyNightclub {
private static Test instance;
private ProdigyNightclubAPI api;
@Override
public void onEnable() {
this.api = getProdigyNightclubAPI();
if(api == null) Bukkit.getConsoleSender().sendMessage("ProdigyNightclub not found...");
}
@Override
public void onDisable() {
}
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (sender instanceof Player) {
Player player = (Player) sender;
String nightclub = api.getNightclubAPI().getNightclubs()[0];
Vector dir = player.getLocation().getDirection();
// then instant target
api.getProjectorAPI().instantTarget(nightclub,0, dir.getX(),dir.getY(),dir.getZ());
player.sendMessage("done");
}
return true;
}
@Override
public ProdigyNightclubAPI getProdigyNightclubAPI() {
Plugin prodigyNightclub = Bukkit.getPluginManager().getPlugin("ProdigyNightclub");
if(prodigyNightclub == null) return null;
return ((IProdigyNightclub) prodigyNightclub).getProdigyNightclubAPI();
}
}
package fr.prodigynightclub.api;
import java.util.List;
public interface NightclubAPI {
String[] getNightclubs();
List<String> getNightclubList();
}
package fr.prodigynightclub.api;
import fr.cocoraid.prodigynightclub.nightclub.projector.Projector;
import javax.annotation.Nullable;
import java.util.List;
import java.util.Set;
public interface ProjectorAPI {
enum LaserType {
GUARDIAN,
DRAGON,
PARTICLE
}
void turn(String nightclub, int projectorID, boolean on);
void toggle(String nightclub, int projectorID);
void instantTarget(String nightclub, int projectorID, double xRotation, double yRotation, double zRotation);
void target(String nightclub, int projectorID, double xRotation, double yRotation, double zRotation, int time, @Nullable ProjectorReachTargetCallBack callback);
void instantTarget(String nightclub, String projectorGroup, double xRotation, double yRotation, double zRotation);
void target(String nightclub, String projectorGroup, double xRotation, double yRotation, double zRotation, int time, @Nullable ProjectorReachTargetCallBack callback);
void instantTarget(String nightclub, int[] projectors, double xRotation, double yRotation, double zRotation);
void target(String nightclub, int[] projectors, double xRotation, double yRotation, double zRotation, int time, @Nullable ProjectorReachTargetCallBack callback);
void setDistance(String nightclub, int projectorID, int distance);
void setLaserType(String nightclub, int projectorID, LaserType laserType);
void startRotation(String nightclub, String rotation, int projectorID);
void startRotation(String nightclub, String rotation, String projectorGroup);
void startRotation(String nightclub, String rotation, int[] projectors);
void stopRotation(String nightclub, int[] projectors);
void stopRotation(String nightclub, int projectorID);
void stopRotation(String nightclub, String projectorGroup);
Set<String> getRotations(String nightclub);
int[] getProjectors(String nightclub);
double[] getProjectorLocation(String nightclub, int projectorID);
}
package fr.prodigynightclub.api;
import java.util.UUID;
public interface TicketAPI {
void giveTicket(String event, UUID uuid);
boolean purchaseTicket(String event, UUID uuid);
void removeTicket(String event, UUID uuid, boolean refund);
}