mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-07-20 14:24:44 +02:00
Nothing is implemented, but it can compile and "run" on sponge now.
This commit is contained in:
@ -33,6 +33,7 @@ import com.intellectualcrafters.plot.util.EventUtil;
|
||||
import com.intellectualcrafters.plot.util.InventoryUtil;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.PlayerManager;
|
||||
import com.intellectualcrafters.plot.util.SetupUtils;
|
||||
import com.intellectualcrafters.plot.util.TaskManager;
|
||||
import com.intellectualcrafters.plot.util.UUIDHandlerImplementation;
|
||||
import com.intellectualcrafters.plot.uuid.UUIDWrapper;
|
||||
@ -42,7 +43,6 @@ import com.plotsquared.bukkit.database.plotme.LikePlotMeConverter;
|
||||
import com.plotsquared.bukkit.database.plotme.PlotMeConnector_017;
|
||||
import com.plotsquared.bukkit.generator.BukkitGeneratorWrapper;
|
||||
import com.plotsquared.bukkit.generator.HybridGen;
|
||||
import com.plotsquared.bukkit.listeners.APlotListener;
|
||||
import com.plotsquared.bukkit.listeners.ChunkListener;
|
||||
import com.plotsquared.bukkit.listeners.ForceFieldListener;
|
||||
import com.plotsquared.bukkit.listeners.PlayerEvents;
|
||||
@ -57,7 +57,6 @@ import com.plotsquared.bukkit.listeners.worldedit.WESubscriber;
|
||||
import com.plotsquared.bukkit.titles.AbstractTitle;
|
||||
import com.plotsquared.bukkit.titles.DefaultTitle;
|
||||
import com.plotsquared.bukkit.util.BukkitHybridUtils;
|
||||
import com.plotsquared.bukkit.util.SetupUtils;
|
||||
import com.plotsquared.bukkit.util.bukkit.BukkitChunkManager;
|
||||
import com.plotsquared.bukkit.util.bukkit.BukkitEconHandler;
|
||||
import com.plotsquared.bukkit.util.bukkit.BukkitEventUtil;
|
||||
@ -78,6 +77,7 @@ import com.plotsquared.bukkit.util.bukkit.uuid.SQLUUIDHandler;
|
||||
import com.plotsquared.bukkit.uuid.DefaultUUIDWrapper;
|
||||
import com.plotsquared.bukkit.uuid.LowerOfflineUUIDWrapper;
|
||||
import com.plotsquared.bukkit.uuid.OfflineUUIDWrapper;
|
||||
import com.plotsquared.listener.APlotListener;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
|
||||
|
||||
|
@ -5,6 +5,8 @@ import com.intellectualcrafters.plot.generator.PlotGenerator;
|
||||
import com.intellectualcrafters.plot.object.PlotCluster;
|
||||
import com.intellectualcrafters.plot.object.PlotManager;
|
||||
import com.intellectualcrafters.plot.object.PlotWorld;
|
||||
import com.intellectualcrafters.plot.object.SetupObject;
|
||||
|
||||
import org.bukkit.generator.ChunkGenerator;
|
||||
|
||||
public class BukkitGeneratorWrapper extends PlotGenerator<ChunkGenerator> {
|
||||
@ -13,7 +15,7 @@ public class BukkitGeneratorWrapper extends PlotGenerator<ChunkGenerator> {
|
||||
|
||||
public BukkitGeneratorWrapper(String world, ChunkGenerator generator) {
|
||||
super(world, generator);
|
||||
full = generator != null;
|
||||
full = (generator instanceof BukkitPlotGenerator);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -76,5 +78,12 @@ public class BukkitGeneratorWrapper extends PlotGenerator<ChunkGenerator> {
|
||||
}
|
||||
return generator.getClass().getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processSetup(SetupObject object) {
|
||||
if (generator instanceof BukkitPlotGenerator) {
|
||||
((BukkitPlotGenerator) generator).processSetup(object);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,13 +0,0 @@
|
||||
package com.plotsquared.bukkit.listeners;
|
||||
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
|
||||
public abstract class APlotListener {
|
||||
|
||||
public static APlotListener manager;
|
||||
|
||||
public abstract boolean plotEntry(final PlotPlayer player, final Plot plot);
|
||||
|
||||
public abstract boolean plotExit(final PlotPlayer player, final Plot plot);
|
||||
}
|
@ -31,8 +31,9 @@ import com.intellectualcrafters.plot.util.*;
|
||||
import com.plotsquared.bukkit.events.PlayerEnterPlotEvent;
|
||||
import com.plotsquared.bukkit.events.PlayerLeavePlotEvent;
|
||||
import com.plotsquared.bukkit.object.BukkitPlayer;
|
||||
import com.plotsquared.bukkit.object.comment.CommentManager;
|
||||
import com.plotsquared.bukkit.titles.AbstractTitle;
|
||||
import com.plotsquared.listener.APlotListener;
|
||||
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@ -205,7 +206,7 @@ public class PlotListener extends APlotListener {
|
||||
replacements.put("%s", getName(plot.owner));
|
||||
String main = StringMan.replaceFromMap(C.TITLE_ENTERED_PLOT.s(), replacements);
|
||||
String sub = StringMan.replaceFromMap(C.TITLE_ENTERED_PLOT_SUB.s(), replacements);
|
||||
AbstractTitle.sendTitle(pp, main, sub, ChatColor.valueOf(C.TITLE_ENTERED_PLOT_COLOR.s()), ChatColor.valueOf(C.TITLE_ENTERED_PLOT_SUB_COLOR.s()));
|
||||
AbstractTitle.sendTitle(pp, main, sub);
|
||||
}
|
||||
}
|
||||
}, 20);
|
||||
|
@ -21,12 +21,12 @@ import java.util.UUID;
|
||||
public class BukkitPlayer implements PlotPlayer {
|
||||
|
||||
public final Player player;
|
||||
UUID uuid;
|
||||
String name;
|
||||
private UUID uuid;
|
||||
private String name;
|
||||
private int op = 0;
|
||||
private long last = 0;
|
||||
public HashSet<String> hasPerm = new HashSet<>();
|
||||
public HashSet<String> noPerm = new HashSet<>();
|
||||
private HashSet<String> hasPerm = new HashSet<>();
|
||||
private HashSet<String> noPerm = new HashSet<>();
|
||||
|
||||
private HashMap<String, Object> meta;
|
||||
|
||||
|
@ -1,79 +0,0 @@
|
||||
package com.plotsquared.bukkit.object.comment;
|
||||
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.config.Settings;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.object.RunnableVal;
|
||||
import com.intellectualcrafters.plot.object.comment.*;
|
||||
import com.intellectualcrafters.plot.util.TaskManager;
|
||||
import com.plotsquared.bukkit.titles.AbstractTitle;
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
|
||||
public class CommentManager {
|
||||
public static HashMap<String, CommentInbox> inboxes = new HashMap<>();
|
||||
|
||||
public static void sendTitle(final PlotPlayer player, final Plot plot) {
|
||||
if (!Settings.COMMENT_NOTIFICATIONS) {
|
||||
return;
|
||||
}
|
||||
if (!plot.isOwner(player.getUUID())) {
|
||||
return;
|
||||
}
|
||||
TaskManager.runTaskLaterAsync(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Collection<CommentInbox> boxes = CommentManager.inboxes.values();
|
||||
final AtomicInteger count = new AtomicInteger(0);
|
||||
final AtomicInteger size = new AtomicInteger(boxes.size());
|
||||
for (final CommentInbox inbox : inboxes.values()) {
|
||||
inbox.getComments(plot, new RunnableVal() {
|
||||
@Override
|
||||
public void run() {
|
||||
int total;
|
||||
if (value != null) {
|
||||
int num = 0;
|
||||
for (PlotComment comment : (ArrayList<PlotComment>) value) {
|
||||
if (comment.timestamp > getTimestamp(player, inbox.toString())) {
|
||||
num++;
|
||||
}
|
||||
}
|
||||
total = count.addAndGet(num);
|
||||
}
|
||||
else {
|
||||
total = count.get();
|
||||
}
|
||||
if (size.decrementAndGet() == 0 && total > 0) {
|
||||
AbstractTitle.sendTitle(player, "", C.INBOX_NOTIFICATION.s().replaceAll("%s", "" + total), ChatColor.GOLD, ChatColor.valueOf(C.TITLE_ENTERED_PLOT_SUB_COLOR.s()));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}, 20);
|
||||
}
|
||||
|
||||
public static long getTimestamp(PlotPlayer player, String inbox) {
|
||||
Object meta = player.getMeta("inbox:"+inbox);
|
||||
if (meta == null) {
|
||||
return player.getPreviousLogin();
|
||||
}
|
||||
return (Long) meta;
|
||||
}
|
||||
|
||||
public static void addInbox(CommentInbox inbox) {
|
||||
inboxes.put(inbox.toString().toLowerCase(), inbox);
|
||||
}
|
||||
|
||||
public static void registerDefaultInboxes() {
|
||||
addInbox(new InboxReport());
|
||||
addInbox(new InboxPublic());
|
||||
addInbox(new InboxOwner());
|
||||
}
|
||||
}
|
@ -6,11 +6,11 @@ import org.bukkit.ChatColor;
|
||||
public abstract class AbstractTitle {
|
||||
public static AbstractTitle TITLE_CLASS;
|
||||
|
||||
public static void sendTitle(PlotPlayer player, String head, String sub, ChatColor head_color, ChatColor sub_color) {
|
||||
public static void sendTitle(PlotPlayer player, String head, String sub) {
|
||||
if (TITLE_CLASS != null && !player.getAttribute("disabletitles")) {
|
||||
TITLE_CLASS.sendTitle(player, head, sub, head_color, sub_color, 1, 2, 1);
|
||||
TITLE_CLASS.sendTitle(player, head, sub, 1, 2, 1);
|
||||
}
|
||||
}
|
||||
|
||||
public abstract void sendTitle(PlotPlayer player, String head, String sub, ChatColor head_color, ChatColor sub_color, int in, int delay, int out);
|
||||
public abstract void sendTitle(PlotPlayer player, String head, String sub, int in, int delay, int out);
|
||||
}
|
||||
|
@ -6,15 +6,13 @@ import org.bukkit.ChatColor;
|
||||
|
||||
public class DefaultTitle extends AbstractTitle {
|
||||
@Override
|
||||
public void sendTitle(final PlotPlayer player, final String head, final String sub, final ChatColor head_color, final ChatColor sub_color, int in, int delay, int out) {
|
||||
public void sendTitle(final PlotPlayer player, final String head, final String sub, int in, int delay, int out) {
|
||||
try {
|
||||
final DefaultTitleManager title = new DefaultTitleManager(head, sub, in, delay, out);
|
||||
title.setTitleColor(head_color);
|
||||
title.setSubtitleColor(sub_color);
|
||||
title.send(((BukkitPlayer) player).player);
|
||||
} catch (final Throwable e) {
|
||||
AbstractTitle.TITLE_CLASS = new DefaultTitle_183();
|
||||
AbstractTitle.TITLE_CLASS.sendTitle(player, head, sub, head_color, sub_color, in, delay, out);
|
||||
AbstractTitle.TITLE_CLASS.sendTitle(player, head, sub, in, delay, out);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,15 +6,13 @@ import org.bukkit.ChatColor;
|
||||
|
||||
public class DefaultTitle_183 extends AbstractTitle {
|
||||
@Override
|
||||
public void sendTitle(final PlotPlayer player, final String head, final String sub, final ChatColor head_color, final ChatColor sub_color, int in, int delay, int out) {
|
||||
public void sendTitle(final PlotPlayer player, final String head, final String sub, int in, int delay, int out) {
|
||||
try {
|
||||
final DefaultTitleManager_183 title = new DefaultTitleManager_183(head, sub, in, delay, out);
|
||||
title.setTitleColor(head_color);
|
||||
title.setSubtitleColor(sub_color);
|
||||
title.send(((BukkitPlayer) player).player);
|
||||
} catch (final Throwable e) {
|
||||
AbstractTitle.TITLE_CLASS = new HackTitle();
|
||||
AbstractTitle.TITLE_CLASS.sendTitle(player, head, sub, head_color, sub_color, in, delay, out);
|
||||
AbstractTitle.TITLE_CLASS.sendTitle(player, head, sub, in, delay, out);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,11 +8,9 @@ import org.bukkit.ChatColor;
|
||||
|
||||
public class HackTitle extends AbstractTitle {
|
||||
@Override
|
||||
public void sendTitle(final PlotPlayer player, final String head, final String sub, final ChatColor head_color, final ChatColor sub_color, int in, int delay, int out) {
|
||||
public void sendTitle(final PlotPlayer player, final String head, final String sub, int in, int delay, int out) {
|
||||
try {
|
||||
final HackTitleManager title = new HackTitleManager(head, sub, in, delay, out);
|
||||
title.setTitleColor(head_color);
|
||||
title.setSubtitleColor(sub_color);
|
||||
title.send(((BukkitPlayer) player).player);
|
||||
} catch (final Throwable e) {
|
||||
PS.log("&cYour server version does not support titles!");
|
||||
|
@ -1,22 +0,0 @@
|
||||
package com.plotsquared.bukkit.util;
|
||||
|
||||
import com.intellectualcrafters.plot.object.PlotWorld;
|
||||
import com.intellectualcrafters.plot.object.SetupObject;
|
||||
import org.bukkit.generator.ChunkGenerator;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public abstract class SetupUtils {
|
||||
|
||||
public static SetupUtils manager;
|
||||
|
||||
public final static Map<String, SetupObject> setupMap = new HashMap<>();
|
||||
public static HashMap<String, ChunkGenerator> generators = new HashMap<>();
|
||||
|
||||
public abstract void updateGenerators();
|
||||
|
||||
public abstract String getGenerator(PlotWorld plotworld);
|
||||
|
||||
public abstract String setupWorld(final SetupObject object);
|
||||
}
|
@ -2,10 +2,13 @@ package com.plotsquared.bukkit.util.bukkit;
|
||||
|
||||
import com.intellectualcrafters.plot.PS;
|
||||
import com.intellectualcrafters.plot.config.ConfigurationNode;
|
||||
import com.intellectualcrafters.plot.generator.PlotGenerator;
|
||||
import com.intellectualcrafters.plot.object.PlotWorld;
|
||||
import com.intellectualcrafters.plot.object.SetupObject;
|
||||
import com.intellectualcrafters.plot.util.SetupUtils;
|
||||
import com.plotsquared.bukkit.generator.BukkitGeneratorWrapper;
|
||||
import com.plotsquared.bukkit.generator.BukkitPlotGenerator;
|
||||
import com.plotsquared.bukkit.util.SetupUtils;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.World.Environment;
|
||||
@ -32,7 +35,7 @@ public class BukkitSetupUtils extends SetupUtils {
|
||||
final String name = plugin.getDescription().getName();
|
||||
// final PlotGenerator pgen = (PlotGenerator) generator;
|
||||
// if (pgen.getPlotManager() instanceof SquarePlotManager) {
|
||||
SetupUtils.generators.put(name, generator);
|
||||
SetupUtils.generators.put(name, new BukkitGeneratorWrapper("CheckingPlotSquaredGenerator", generator));
|
||||
// }
|
||||
// }
|
||||
}
|
||||
@ -55,8 +58,8 @@ public class BukkitSetupUtils extends SetupUtils {
|
||||
if (object.setupGenerator != null && !object.setupGenerator.equals(object.plotManager)) {
|
||||
PS.get().config.set("worlds." + world + "." + "generator.init", object.setupGenerator);
|
||||
}
|
||||
ChunkGenerator gen = generators.get(object.setupGenerator);
|
||||
if (gen instanceof BukkitPlotGenerator) {
|
||||
PlotGenerator<ChunkGenerator> gen = (PlotGenerator<ChunkGenerator>) generators.get(object.setupGenerator);
|
||||
if (gen.generator instanceof BukkitPlotGenerator) {
|
||||
object.setupGenerator = null;
|
||||
}
|
||||
}
|
||||
@ -105,8 +108,8 @@ public class BukkitSetupUtils extends SetupUtils {
|
||||
if (!(generator instanceof BukkitPlotGenerator)) {
|
||||
return null;
|
||||
}
|
||||
for (Entry<String, ChunkGenerator> entry : generators.entrySet()) {
|
||||
if (entry.getValue().getClass().getName().equals(generator.getClass().getName())) {
|
||||
for (Entry<String, PlotGenerator<?>> entry : generators.entrySet()) {
|
||||
if (entry.getValue().generator.getClass().getName().equals(generator.getClass().getName())) {
|
||||
return entry.getKey();
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,10 @@
|
||||
package com.plotsquared.bukkit.util.bukkit;
|
||||
|
||||
import com.intellectualcrafters.plot.PS;
|
||||
import com.intellectualcrafters.plot.generator.PlotGenerator;
|
||||
import com.intellectualcrafters.plot.util.SetupUtils;
|
||||
import com.plotsquared.bukkit.generator.AugmentedPopulator;
|
||||
import com.plotsquared.bukkit.util.SetupUtils;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.generator.BlockPopulator;
|
||||
import org.bukkit.generator.ChunkGenerator;
|
||||
@ -22,7 +24,8 @@ public class SetGenCB {
|
||||
}
|
||||
String name = gen.getClass().getCanonicalName();
|
||||
boolean set = false;
|
||||
for (ChunkGenerator newGen : SetupUtils.generators.values()) {
|
||||
for (PlotGenerator<?> wrapper : SetupUtils.generators.values()) {
|
||||
ChunkGenerator newGen = (ChunkGenerator) wrapper.generator;
|
||||
if (newGen.getClass().getCanonicalName().equals(name)) {
|
||||
// set generator
|
||||
Field generator = world.getClass().getDeclaredField("generator");
|
||||
|
Reference in New Issue
Block a user