changed namespace to com.massivecraft
This commit is contained in:
parent
60603892c6
commit
8aefae5679
@ -1,4 +1,4 @@
|
||||
package org.mcteam.factions;
|
||||
package com.massivecraft.factions;
|
||||
|
||||
import java.io.*;
|
||||
import java.lang.reflect.Type;
|
||||
@ -11,14 +11,15 @@ import java.util.Map.Entry;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.mcteam.factions.gson.JsonArray;
|
||||
import org.mcteam.factions.gson.JsonElement;
|
||||
import org.mcteam.factions.gson.JsonObject;
|
||||
import org.mcteam.factions.gson.JsonParser;
|
||||
import org.mcteam.factions.gson.reflect.TypeToken;
|
||||
import org.mcteam.factions.util.AsciiCompass;
|
||||
import org.mcteam.factions.util.DiscUtil;
|
||||
import org.mcteam.factions.util.TextUtil;
|
||||
|
||||
import com.massivecraft.factions.gson.JsonArray;
|
||||
import com.massivecraft.factions.gson.JsonElement;
|
||||
import com.massivecraft.factions.gson.JsonObject;
|
||||
import com.massivecraft.factions.gson.JsonParser;
|
||||
import com.massivecraft.factions.gson.reflect.TypeToken;
|
||||
import com.massivecraft.factions.util.AsciiCompass;
|
||||
import com.massivecraft.factions.util.DiscUtil;
|
||||
import com.massivecraft.factions.util.TextUtil;
|
||||
|
||||
|
||||
public class Board {
|
@ -1,10 +1,11 @@
|
||||
package org.mcteam.factions;
|
||||
package com.massivecraft.factions;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.entity.CreatureType;
|
||||
import org.mcteam.factions.util.DiscUtil;
|
||||
|
||||
import com.massivecraft.factions.util.DiscUtil;
|
||||
|
||||
|
||||
public class Conf {
|
@ -1,11 +1,12 @@
|
||||
package org.mcteam.factions;
|
||||
package com.massivecraft.factions;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.mcteam.factions.util.MiscUtil;
|
||||
|
||||
import com.massivecraft.factions.util.MiscUtil;
|
||||
|
||||
public class FLocation {
|
||||
|
@ -1,4 +1,4 @@
|
||||
package org.mcteam.factions;
|
||||
package com.massivecraft.factions;
|
||||
|
||||
import java.io.*;
|
||||
import java.lang.reflect.Type;
|
||||
@ -8,10 +8,11 @@ import java.util.Map.Entry;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.mcteam.factions.gson.reflect.TypeToken;
|
||||
import org.mcteam.factions.struct.Relation;
|
||||
import org.mcteam.factions.struct.Role;
|
||||
import org.mcteam.factions.util.DiscUtil;
|
||||
|
||||
import com.massivecraft.factions.gson.reflect.TypeToken;
|
||||
import com.massivecraft.factions.struct.Relation;
|
||||
import com.massivecraft.factions.struct.Role;
|
||||
import com.massivecraft.factions.util.DiscUtil;
|
||||
|
||||
|
||||
/**
|
@ -1,4 +1,4 @@
|
||||
package org.mcteam.factions;
|
||||
package com.massivecraft.factions;
|
||||
|
||||
import java.io.*;
|
||||
import java.lang.reflect.Type;
|
||||
@ -9,10 +9,11 @@ import java.util.logging.Level;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.mcteam.factions.gson.reflect.TypeToken;
|
||||
import org.mcteam.factions.struct.Relation;
|
||||
import org.mcteam.factions.struct.Role;
|
||||
import org.mcteam.factions.util.*;
|
||||
|
||||
import com.massivecraft.factions.gson.reflect.TypeToken;
|
||||
import com.massivecraft.factions.struct.Relation;
|
||||
import com.massivecraft.factions.struct.Role;
|
||||
import com.massivecraft.factions.util.*;
|
||||
|
||||
|
||||
public class Faction {
|
@ -1,4 +1,4 @@
|
||||
package org.mcteam.factions;
|
||||
package com.massivecraft.factions;
|
||||
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.ArrayList;
|
||||
@ -19,14 +19,14 @@ import org.bukkit.event.player.PlayerChatEvent;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.mcteam.factions.commands.*;
|
||||
import org.mcteam.factions.gson.Gson;
|
||||
import org.mcteam.factions.gson.GsonBuilder;
|
||||
import org.mcteam.factions.listeners.FactionsBlockListener;
|
||||
import org.mcteam.factions.listeners.FactionsEntityListener;
|
||||
import org.mcteam.factions.listeners.FactionsPlayerListener;
|
||||
|
||||
|
||||
import com.massivecraft.factions.commands.*;
|
||||
import com.massivecraft.factions.gson.Gson;
|
||||
import com.massivecraft.factions.gson.GsonBuilder;
|
||||
import com.massivecraft.factions.listeners.FactionsBlockListener;
|
||||
import com.massivecraft.factions.listeners.FactionsEntityListener;
|
||||
import com.massivecraft.factions.listeners.FactionsPlayerListener;
|
||||
import com.nijiko.permissions.PermissionHandler;
|
||||
import com.nijikokun.bukkit.Permissions.Permissions;
|
||||
|
@ -1,17 +1,18 @@
|
||||
package org.mcteam.factions;
|
||||
package com.massivecraft.factions;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.mcteam.factions.gson.JsonDeserializationContext;
|
||||
import org.mcteam.factions.gson.JsonDeserializer;
|
||||
import org.mcteam.factions.gson.JsonElement;
|
||||
import org.mcteam.factions.gson.JsonObject;
|
||||
import org.mcteam.factions.gson.JsonParseException;
|
||||
import org.mcteam.factions.gson.JsonSerializationContext;
|
||||
import org.mcteam.factions.gson.JsonSerializer;
|
||||
|
||||
import com.massivecraft.factions.gson.JsonDeserializationContext;
|
||||
import com.massivecraft.factions.gson.JsonDeserializer;
|
||||
import com.massivecraft.factions.gson.JsonElement;
|
||||
import com.massivecraft.factions.gson.JsonObject;
|
||||
import com.massivecraft.factions.gson.JsonParseException;
|
||||
import com.massivecraft.factions.gson.JsonSerializationContext;
|
||||
import com.massivecraft.factions.gson.JsonSerializer;
|
||||
|
||||
|
||||
public class MyLocationTypeAdapter implements JsonDeserializer<Location>, JsonSerializer<Location> {
|
@ -1,4 +1,4 @@
|
||||
package org.mcteam.factions;
|
||||
package com.massivecraft.factions;
|
||||
|
||||
public class SaveTask implements Runnable {
|
||||
|
@ -1,16 +1,17 @@
|
||||
package org.mcteam.factions.commands;
|
||||
package com.massivecraft.factions.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.mcteam.factions.Conf;
|
||||
import org.mcteam.factions.FPlayer;
|
||||
import org.mcteam.factions.Faction;
|
||||
import org.mcteam.factions.Factions;
|
||||
import org.mcteam.factions.struct.Role;
|
||||
import org.mcteam.factions.util.TextUtil;
|
||||
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.Factions;
|
||||
import com.massivecraft.factions.struct.Role;
|
||||
import com.massivecraft.factions.util.TextUtil;
|
||||
|
||||
|
||||
public class FBaseCommand {
|
@ -1,9 +1,9 @@
|
||||
package org.mcteam.factions.commands;
|
||||
package com.massivecraft.factions.commands;
|
||||
|
||||
import org.mcteam.factions.Conf;
|
||||
import org.mcteam.factions.FPlayer;
|
||||
import org.mcteam.factions.Faction;
|
||||
import org.mcteam.factions.struct.Role;
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.struct.Role;
|
||||
|
||||
public class FCommandAdmin extends FBaseCommand {
|
||||
|
@ -1,9 +1,9 @@
|
||||
package org.mcteam.factions.commands;
|
||||
package com.massivecraft.factions.commands;
|
||||
|
||||
import org.mcteam.factions.Conf;
|
||||
import org.mcteam.factions.FLocation;
|
||||
import org.mcteam.factions.Faction;
|
||||
import org.mcteam.factions.struct.Role;
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.FLocation;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.struct.Role;
|
||||
|
||||
public class FCommandAutoClaim extends FBaseCommand {
|
||||
|
@ -1,10 +1,11 @@
|
||||
package org.mcteam.factions.commands;
|
||||
package com.massivecraft.factions.commands;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.mcteam.factions.Board;
|
||||
import org.mcteam.factions.FLocation;
|
||||
import org.mcteam.factions.Faction;
|
||||
import org.mcteam.factions.Factions;
|
||||
|
||||
import com.massivecraft.factions.Board;
|
||||
import com.massivecraft.factions.FLocation;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.Factions;
|
||||
|
||||
public class FCommandAutoSafeclaim extends FBaseCommand {
|
||||
|
@ -1,10 +1,11 @@
|
||||
package org.mcteam.factions.commands;
|
||||
package com.massivecraft.factions.commands;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.mcteam.factions.Board;
|
||||
import org.mcteam.factions.FLocation;
|
||||
import org.mcteam.factions.Faction;
|
||||
import org.mcteam.factions.Factions;
|
||||
|
||||
import com.massivecraft.factions.Board;
|
||||
import com.massivecraft.factions.FLocation;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.Factions;
|
||||
|
||||
public class FCommandAutoWarclaim extends FBaseCommand {
|
||||
|
@ -1,8 +1,9 @@
|
||||
package org.mcteam.factions.commands;
|
||||
package com.massivecraft.factions.commands;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.mcteam.factions.Conf;
|
||||
import org.mcteam.factions.Factions;
|
||||
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.Factions;
|
||||
|
||||
|
||||
public class FCommandBypass extends FBaseCommand {
|
@ -1,4 +1,4 @@
|
||||
package org.mcteam.factions.commands;
|
||||
package com.massivecraft.factions.commands;
|
||||
|
||||
public class FCommandChat extends FBaseCommand {
|
||||
|
@ -1,4 +1,4 @@
|
||||
package org.mcteam.factions.commands;
|
||||
package com.massivecraft.factions.commands;
|
||||
|
||||
public class FCommandClaim extends FBaseCommand {
|
||||
|
@ -1,13 +1,14 @@
|
||||
package org.mcteam.factions.commands;
|
||||
package com.massivecraft.factions.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.mcteam.factions.Conf;
|
||||
import org.mcteam.factions.FPlayer;
|
||||
import org.mcteam.factions.Faction;
|
||||
import org.mcteam.factions.Factions;
|
||||
import org.mcteam.factions.struct.Role;
|
||||
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.Factions;
|
||||
import com.massivecraft.factions.struct.Role;
|
||||
|
||||
|
||||
public class FCommandCreate extends FBaseCommand {
|
@ -1,9 +1,9 @@
|
||||
package org.mcteam.factions.commands;
|
||||
package com.massivecraft.factions.commands;
|
||||
|
||||
import org.mcteam.factions.Conf;
|
||||
import org.mcteam.factions.FPlayer;
|
||||
import org.mcteam.factions.Faction;
|
||||
import org.mcteam.factions.struct.Role;
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.struct.Role;
|
||||
|
||||
public class FCommandDeinvite extends FBaseCommand {
|
||||
|
@ -1,9 +1,9 @@
|
||||
package org.mcteam.factions.commands;
|
||||
package com.massivecraft.factions.commands;
|
||||
|
||||
import org.mcteam.factions.Conf;
|
||||
import org.mcteam.factions.FPlayer;
|
||||
import org.mcteam.factions.struct.Role;
|
||||
import org.mcteam.factions.util.TextUtil;
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.struct.Role;
|
||||
import com.massivecraft.factions.util.TextUtil;
|
||||
|
||||
public class FCommandDescription extends FBaseCommand {
|
||||
|
@ -1,8 +1,9 @@
|
||||
package org.mcteam.factions.commands;
|
||||
package com.massivecraft.factions.commands;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.mcteam.factions.Faction;
|
||||
import org.mcteam.factions.Factions;
|
||||
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.Factions;
|
||||
|
||||
public class FCommandDisband extends FBaseCommand {
|
||||
|
@ -1,10 +1,11 @@
|
||||
package org.mcteam.factions.commands;
|
||||
package com.massivecraft.factions.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.mcteam.factions.Conf;
|
||||
import org.mcteam.factions.util.TextUtil;
|
||||
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.util.TextUtil;
|
||||
|
||||
|
||||
public class FCommandHelp extends FBaseCommand {
|
@ -1,15 +1,16 @@
|
||||
package org.mcteam.factions.commands;
|
||||
package com.massivecraft.factions.commands;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.mcteam.factions.Board;
|
||||
import org.mcteam.factions.Conf;
|
||||
import org.mcteam.factions.Faction;
|
||||
import org.mcteam.factions.FLocation;
|
||||
import org.mcteam.factions.FPlayer;
|
||||
import org.mcteam.factions.struct.Relation;
|
||||
import org.mcteam.factions.struct.Role;
|
||||
|
||||
import com.massivecraft.factions.Board;
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.FLocation;
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.struct.Relation;
|
||||
import com.massivecraft.factions.struct.Role;
|
||||
|
||||
public class FCommandHome extends FBaseCommand {
|
||||
|
||||
@ -48,7 +49,7 @@ public class FCommandHome extends FBaseCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Conf.homesTeleportAllowedFromDifferentWorld && player.getWorld().getId() != myFaction.getHome().getWorld().getId()) {
|
||||
if (!Conf.homesTeleportAllowedFromDifferentWorld && player.getWorld().getUID() != myFaction.getHome().getWorld().getUID()) {
|
||||
me.sendMessage("You cannot teleport to your faction home while in a different world.");
|
||||
return;
|
||||
}
|
@ -1,9 +1,9 @@
|
||||
package org.mcteam.factions.commands;
|
||||
package com.massivecraft.factions.commands;
|
||||
|
||||
import org.mcteam.factions.Conf;
|
||||
import org.mcteam.factions.FPlayer;
|
||||
import org.mcteam.factions.Faction;
|
||||
import org.mcteam.factions.struct.Role;
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.struct.Role;
|
||||
|
||||
public class FCommandInvite extends FBaseCommand {
|
||||
|
@ -1,7 +1,7 @@
|
||||
package org.mcteam.factions.commands;
|
||||
package com.massivecraft.factions.commands;
|
||||
|
||||
import org.mcteam.factions.Conf;
|
||||
import org.mcteam.factions.Faction;
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.Faction;
|
||||
|
||||
public class FCommandJoin extends FBaseCommand {
|
||||
|
@ -1,9 +1,9 @@
|
||||
package org.mcteam.factions.commands;
|
||||
package com.massivecraft.factions.commands;
|
||||
|
||||
import org.mcteam.factions.Conf;
|
||||
import org.mcteam.factions.FPlayer;
|
||||
import org.mcteam.factions.Faction;
|
||||
import org.mcteam.factions.Factions;
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.Factions;
|
||||
|
||||
public class FCommandKick extends FBaseCommand {
|
||||
|
@ -1,4 +1,4 @@
|
||||
package org.mcteam.factions.commands;
|
||||
package com.massivecraft.factions.commands;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
@ -1,13 +1,14 @@
|
||||
package org.mcteam.factions.commands;
|
||||
package com.massivecraft.factions.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.mcteam.factions.Conf;
|
||||
import org.mcteam.factions.Faction;
|
||||
import org.mcteam.factions.util.TextUtil;
|
||||
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.util.TextUtil;
|
||||
|
||||
|
||||
public class FCommandList extends FBaseCommand {
|
@ -1,7 +1,8 @@
|
||||
package org.mcteam.factions.commands;
|
||||
package com.massivecraft.factions.commands;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.mcteam.factions.Factions;
|
||||
|
||||
import com.massivecraft.factions.Factions;
|
||||
|
||||
public class FCommandLock extends FBaseCommand {
|
||||
|
@ -1,8 +1,9 @@
|
||||
package org.mcteam.factions.commands;
|
||||
package com.massivecraft.factions.commands;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.mcteam.factions.Board;
|
||||
import org.mcteam.factions.FLocation;
|
||||
|
||||
import com.massivecraft.factions.Board;
|
||||
import com.massivecraft.factions.FLocation;
|
||||
|
||||
|
||||
public class FCommandMap extends FBaseCommand {
|
@ -1,9 +1,9 @@
|
||||
package org.mcteam.factions.commands;
|
||||
package com.massivecraft.factions.commands;
|
||||
|
||||
import org.mcteam.factions.Conf;
|
||||
import org.mcteam.factions.FPlayer;
|
||||
import org.mcteam.factions.Faction;
|
||||
import org.mcteam.factions.struct.Role;
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.struct.Role;
|
||||
|
||||
public class FCommandMod extends FBaseCommand {
|
||||
|
@ -1,8 +1,8 @@
|
||||
package org.mcteam.factions.commands;
|
||||
package com.massivecraft.factions.commands;
|
||||
|
||||
import org.mcteam.factions.Conf;
|
||||
import org.mcteam.factions.Faction;
|
||||
import org.mcteam.factions.struct.Role;
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.struct.Role;
|
||||
|
||||
public class FCommandOpen extends FBaseCommand {
|
||||
|
@ -1,6 +1,6 @@
|
||||
package org.mcteam.factions.commands;
|
||||
package com.massivecraft.factions.commands;
|
||||
|
||||
import org.mcteam.factions.struct.Relation;
|
||||
import com.massivecraft.factions.struct.Relation;
|
||||
|
||||
public class FCommandRelationAlly extends FRelationCommand {
|
||||
|
@ -1,6 +1,6 @@
|
||||
package org.mcteam.factions.commands;
|
||||
package com.massivecraft.factions.commands;
|
||||
|
||||
import org.mcteam.factions.struct.Relation;
|
||||
import com.massivecraft.factions.struct.Relation;
|
||||
|
||||
public class FCommandRelationEnemy extends FRelationCommand {
|
||||
|
@ -1,6 +1,6 @@
|
||||
package org.mcteam.factions.commands;
|
||||
package com.massivecraft.factions.commands;
|
||||
|
||||
import org.mcteam.factions.struct.Relation;
|
||||
import com.massivecraft.factions.struct.Relation;
|
||||
|
||||
public class FCommandRelationNeutral extends FRelationCommand {
|
||||
|
@ -1,11 +1,12 @@
|
||||
package org.mcteam.factions.commands;
|
||||
package com.massivecraft.factions.commands;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.mcteam.factions.Board;
|
||||
import org.mcteam.factions.Conf;
|
||||
import org.mcteam.factions.FPlayer;
|
||||
import org.mcteam.factions.Faction;
|
||||
import org.mcteam.factions.Factions;
|
||||
|
||||
import com.massivecraft.factions.Board;
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.Factions;
|
||||
|
||||
public class FCommandReload extends FBaseCommand {
|
||||
|
@ -1,10 +1,11 @@
|
||||
package org.mcteam.factions.commands;
|
||||
package com.massivecraft.factions.commands;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.mcteam.factions.Board;
|
||||
import org.mcteam.factions.FLocation;
|
||||
import org.mcteam.factions.Faction;
|
||||
import org.mcteam.factions.Factions;
|
||||
|
||||
import com.massivecraft.factions.Board;
|
||||
import com.massivecraft.factions.FLocation;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.Factions;
|
||||
|
||||
public class FCommandSafeclaim extends FBaseCommand {
|
||||
|
@ -1,9 +1,10 @@
|
||||
package org.mcteam.factions.commands;
|
||||
package com.massivecraft.factions.commands;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.mcteam.factions.Board;
|
||||
import org.mcteam.factions.Faction;
|
||||
import org.mcteam.factions.Factions;
|
||||
|
||||
import com.massivecraft.factions.Board;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.Factions;
|
||||
|
||||
public class FCommandSafeunclaimall extends FBaseCommand {
|
||||
|
@ -1,7 +1,8 @@
|
||||
package org.mcteam.factions.commands;
|
||||
package com.massivecraft.factions.commands;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.mcteam.factions.Factions;
|
||||
|
||||
import com.massivecraft.factions.Factions;
|
||||
|
||||
public class FCommandSaveAll extends FBaseCommand {
|
||||
|
@ -1,8 +1,8 @@
|
||||
package org.mcteam.factions.commands;
|
||||
package com.massivecraft.factions.commands;
|
||||
|
||||
import org.mcteam.factions.Conf;
|
||||
import org.mcteam.factions.Faction;
|
||||
import org.mcteam.factions.struct.Role;
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.struct.Role;
|
||||
|
||||
public class FCommandSethome extends FBaseCommand {
|
||||
|
@ -1,14 +1,15 @@
|
||||
package org.mcteam.factions.commands;
|
||||
package com.massivecraft.factions.commands;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.mcteam.factions.Conf;
|
||||
import org.mcteam.factions.FPlayer;
|
||||
import org.mcteam.factions.Faction;
|
||||
import org.mcteam.factions.struct.Role;
|
||||
import org.mcteam.factions.util.TextUtil;
|
||||
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.struct.Role;
|
||||
import com.massivecraft.factions.util.TextUtil;
|
||||
|
||||
|
||||
public class FCommandShow extends FBaseCommand {
|
@ -1,11 +1,11 @@
|
||||
package org.mcteam.factions.commands;
|
||||
package com.massivecraft.factions.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.mcteam.factions.Conf;
|
||||
import org.mcteam.factions.Faction;
|
||||
import org.mcteam.factions.struct.Role;
|
||||
import org.mcteam.factions.util.TextUtil;
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.struct.Role;
|
||||
import com.massivecraft.factions.util.TextUtil;
|
||||
|
||||
|
||||
public class FCommandTag extends FBaseCommand {
|
@ -1,9 +1,9 @@
|
||||
package org.mcteam.factions.commands;
|
||||
package com.massivecraft.factions.commands;
|
||||
|
||||
import org.mcteam.factions.Conf;
|
||||
import org.mcteam.factions.FPlayer;
|
||||
import org.mcteam.factions.Faction;
|
||||
import org.mcteam.factions.util.TextUtil;
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.util.TextUtil;
|
||||
|
||||
public class FCommandTitle extends FBaseCommand {
|
||||
|
@ -1,11 +1,11 @@
|
||||
package org.mcteam.factions.commands;
|
||||
package com.massivecraft.factions.commands;
|
||||
|
||||
import org.mcteam.factions.Board;
|
||||
import org.mcteam.factions.Conf;
|
||||
import org.mcteam.factions.FLocation;
|
||||
import org.mcteam.factions.Faction;
|
||||
import org.mcteam.factions.Factions;
|
||||
import org.mcteam.factions.struct.Role;
|
||||
import com.massivecraft.factions.Board;
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.FLocation;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.Factions;
|
||||
import com.massivecraft.factions.struct.Role;
|
||||
|
||||
public class FCommandUnclaim extends FBaseCommand {
|
||||
|
@ -1,9 +1,9 @@
|
||||
package org.mcteam.factions.commands;
|
||||
package com.massivecraft.factions.commands;
|
||||
|
||||
import org.mcteam.factions.Board;
|
||||
import org.mcteam.factions.Conf;
|
||||
import org.mcteam.factions.Faction;
|
||||
import org.mcteam.factions.struct.Role;
|
||||
import com.massivecraft.factions.Board;
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.struct.Role;
|
||||
|
||||
public class FCommandUnclaimall extends FBaseCommand {
|
||||
|
@ -1,7 +1,8 @@
|
||||
package org.mcteam.factions.commands;
|
||||
package com.massivecraft.factions.commands;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.mcteam.factions.Factions;
|
||||
|
||||
import com.massivecraft.factions.Factions;
|
||||
|
||||
|
||||
public class FCommandVersion extends FBaseCommand {
|
@ -1,10 +1,11 @@
|
||||
package org.mcteam.factions.commands;
|
||||
package com.massivecraft.factions.commands;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.mcteam.factions.Board;
|
||||
import org.mcteam.factions.FLocation;
|
||||
import org.mcteam.factions.Faction;
|
||||
import org.mcteam.factions.Factions;
|
||||
|
||||
import com.massivecraft.factions.Board;
|
||||
import com.massivecraft.factions.FLocation;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.Factions;
|
||||
|
||||
public class FCommandWarclaim extends FBaseCommand {
|
||||
|
@ -1,9 +1,10 @@
|
||||
package org.mcteam.factions.commands;
|
||||
package com.massivecraft.factions.commands;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.mcteam.factions.Board;
|
||||
import org.mcteam.factions.Faction;
|
||||
import org.mcteam.factions.Factions;
|
||||
|
||||
import com.massivecraft.factions.Board;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.Factions;
|
||||
|
||||
public class FCommandWarunclaimall extends FBaseCommand {
|
||||
|
@ -1,8 +1,9 @@
|
||||
package org.mcteam.factions.commands;
|
||||
package com.massivecraft.factions.commands;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.mcteam.factions.Conf;
|
||||
import org.mcteam.factions.Factions;
|
||||
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.Factions;
|
||||
|
||||
public class FCommandWorldNoClaim extends FBaseCommand {
|
||||
|
@ -1,8 +1,9 @@
|
||||
package org.mcteam.factions.commands;
|
||||
package com.massivecraft.factions.commands;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.mcteam.factions.Conf;
|
||||
import org.mcteam.factions.Factions;
|
||||
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.Factions;
|
||||
|
||||
public class FCommandWorldNoPowerLoss extends FBaseCommand {
|
||||
|
@ -1,11 +1,12 @@
|
||||
package org.mcteam.factions.commands;
|
||||
package com.massivecraft.factions.commands;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.mcteam.factions.Conf;
|
||||
import org.mcteam.factions.Faction;
|
||||
import org.mcteam.factions.Factions;
|
||||
import org.mcteam.factions.struct.Relation;
|
||||
import org.mcteam.factions.struct.Role;
|
||||
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.Factions;
|
||||
import com.massivecraft.factions.struct.Relation;
|
||||
import com.massivecraft.factions.struct.Role;
|
||||
|
||||
|
||||
public class FRelationCommand extends FBaseCommand {
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.mcteam.factions.gson;
|
||||
package com.massivecraft.factions.gson;
|
||||
|
||||
/**
|
||||
* Strategy for excluding anonymous and local classes.
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.mcteam.factions.gson;
|
||||
package com.massivecraft.factions.gson;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.Map;
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.mcteam.factions.gson;
|
||||
package com.massivecraft.factions.gson;
|
||||
|
||||
/**
|
||||
* Defines generic cache interface.
|
@ -14,9 +14,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.mcteam.factions.gson;
|
||||
package com.massivecraft.factions.gson;
|
||||
|
||||
import org.mcteam.factions.gson.internal.$Gson$Preconditions;
|
||||
import com.massivecraft.factions.gson.internal.$Gson$Preconditions;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.Type;
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.mcteam.factions.gson;
|
||||
package com.massivecraft.factions.gson;
|
||||
|
||||
/**
|
||||
* Exception class to indicate a circular reference error.
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.mcteam.factions.gson;
|
||||
package com.massivecraft.factions.gson;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.Type;
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.mcteam.factions.gson;
|
||||
package com.massivecraft.factions.gson;
|
||||
|
||||
|
||||
import java.lang.reflect.Constructor;
|
@ -14,9 +14,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.mcteam.factions.gson;
|
||||
package com.massivecraft.factions.gson;
|
||||
|
||||
import com.massivecraft.factions.gson.internal.$Gson$Types;
|
||||
|
||||
import org.mcteam.factions.gson.internal.$Gson$Types;
|
||||
import java.lang.reflect.ParameterizedType;
|
||||
import java.lang.reflect.Type;
|
||||
import java.math.BigDecimal;
|
@ -14,9 +14,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.mcteam.factions.gson;
|
||||
package com.massivecraft.factions.gson;
|
||||
|
||||
import org.mcteam.factions.gson.internal.$Gson$Preconditions;
|
||||
import com.massivecraft.factions.gson.internal.$Gson$Preconditions;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -14,9 +14,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.mcteam.factions.gson;
|
||||
package com.massivecraft.factions.gson;
|
||||
|
||||
import org.mcteam.factions.gson.internal.$Gson$Preconditions;
|
||||
import com.massivecraft.factions.gson.internal.$Gson$Preconditions;
|
||||
|
||||
import java.util.Collection;
|
||||
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.mcteam.factions.gson;
|
||||
package com.massivecraft.factions.gson;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.mcteam.factions.gson;
|
||||
package com.massivecraft.factions.gson;
|
||||
|
||||
/**
|
||||
* A strategy (or policy) definition that is used to decide whether or not a field or top-level
|
@ -14,9 +14,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.mcteam.factions.gson;
|
||||
package com.massivecraft.factions.gson;
|
||||
|
||||
import org.mcteam.factions.gson.annotations.Expose;
|
||||
import com.massivecraft.factions.gson.annotations.Expose;
|
||||
|
||||
/**
|
||||
* Excludes fields that do not have the {@link Expose} annotation
|
@ -14,9 +14,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.mcteam.factions.gson;
|
||||
package com.massivecraft.factions.gson;
|
||||
|
||||
import org.mcteam.factions.gson.annotations.Expose;
|
||||
import com.massivecraft.factions.gson.annotations.Expose;
|
||||
|
||||
/**
|
||||
* Excludes fields that do not have the {@link Expose} annotation
|
@ -14,10 +14,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.mcteam.factions.gson;
|
||||
package com.massivecraft.factions.gson;
|
||||
|
||||
import org.mcteam.factions.gson.internal.$Gson$Preconditions;
|
||||
import org.mcteam.factions.gson.internal.$Gson$Types;
|
||||
import com.massivecraft.factions.gson.internal.$Gson$Preconditions;
|
||||
import com.massivecraft.factions.gson.internal.$Gson$Types;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.Field;
|
||||
@ -38,7 +38,7 @@ import java.util.Collections;
|
||||
*/
|
||||
public final class FieldAttributes {
|
||||
private static final String MAX_CACHE_PROPERTY_NAME =
|
||||
"org.mcteam.factions.gson.annotation_cache_size_hint";
|
||||
"com.google.gson.annotation_cache_size_hint";
|
||||
|
||||
private static final Cache<Pair<Class<?>, String>, Collection<Annotation>> ANNOTATION_CACHE =
|
||||
new LruCache<Pair<Class<?>,String>, Collection<Annotation>>(getMaxCacheSize());
|
@ -14,12 +14,12 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.mcteam.factions.gson;
|
||||
package com.massivecraft.factions.gson;
|
||||
|
||||
/**
|
||||
* An enumeration that defines a few standard naming conventions for JSON field names.
|
||||
* This enumeration should be used in conjunction with {@link org.mcteam.factions.gson.GsonBuilder}
|
||||
* to configure a {@link org.mcteam.factions.gson.Gson} instance to properly translate Java field
|
||||
* This enumeration should be used in conjunction with {@link com.massivecraft.factions.gson.GsonBuilder}
|
||||
* to configure a {@link com.massivecraft.factions.gson.Gson} instance to properly translate Java field
|
||||
* names into the desired JSON field names.
|
||||
*
|
||||
* @author Inderjeet Singh
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.mcteam.factions.gson;
|
||||
package com.massivecraft.factions.gson;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.mcteam.factions.gson;
|
||||
package com.massivecraft.factions.gson;
|
||||
|
||||
/**
|
||||
* The new mechanism for providing custom field naming in Gson. This allows the client code
|
@ -14,9 +14,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.mcteam.factions.gson;
|
||||
package com.massivecraft.factions.gson;
|
||||
|
||||
import org.mcteam.factions.gson.internal.$Gson$Preconditions;
|
||||
import com.massivecraft.factions.gson.internal.$Gson$Preconditions;
|
||||
|
||||
/**
|
||||
* Adapts the old FieldNamingStrategy to the new {@link FieldNamingStrategy2}
|
@ -14,12 +14,13 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.mcteam.factions.gson;
|
||||
package com.massivecraft.factions.gson;
|
||||
|
||||
import com.massivecraft.factions.gson.stream.JsonReader;
|
||||
import com.massivecraft.factions.gson.stream.JsonToken;
|
||||
import com.massivecraft.factions.gson.stream.JsonWriter;
|
||||
import com.massivecraft.factions.gson.stream.MalformedJsonException;
|
||||
|
||||
import org.mcteam.factions.gson.stream.JsonReader;
|
||||
import org.mcteam.factions.gson.stream.JsonToken;
|
||||
import org.mcteam.factions.gson.stream.JsonWriter;
|
||||
import org.mcteam.factions.gson.stream.MalformedJsonException;
|
||||
import java.io.IOException;
|
||||
import java.io.Reader;
|
||||
import java.io.StringReader;
|
||||
@ -68,7 +69,7 @@ import java.util.Map;
|
||||
* <p>See the <a href="https://sites.google.com/site/gson/gson-user-guide">Gson User Guide</a>
|
||||
* for a more complete set of examples.</p>
|
||||
*
|
||||
* @see org.mcteam.factions.gson.reflect.TypeToken
|
||||
* @see com.massivecraft.factions.gson.reflect.TypeToken
|
||||
*
|
||||
* @author Inderjeet Singh
|
||||
* @author Joel Leitch
|
||||
@ -130,10 +131,10 @@ public final class Gson {
|
||||
* ignores the millisecond portion of the date during serialization. You can change
|
||||
* this by invoking {@link GsonBuilder#setDateFormat(int)} or
|
||||
* {@link GsonBuilder#setDateFormat(String)}. </li>
|
||||
* <li>By default, Gson ignores the {@link org.mcteam.factions.gson.annotations.Expose} annotation.
|
||||
* <li>By default, Gson ignores the {@link com.massivecraft.factions.gson.annotations.Expose} annotation.
|
||||
* You can enable Gson to serialize/deserialize only those fields marked with this annotation
|
||||
* through {@link GsonBuilder#excludeFieldsWithoutExposeAnnotation()}. </li>
|
||||
* <li>By default, Gson ignores the {@link org.mcteam.factions.gson.annotations.Since} annotation. You
|
||||
* <li>By default, Gson ignores the {@link com.massivecraft.factions.gson.annotations.Since} annotation. You
|
||||
* can enable Gson to use this annotation through {@link GsonBuilder#setVersion(double)}.</li>
|
||||
* <li>The default field naming policy for the output Json is same as in Java. So, a Java class
|
||||
* field <code>versionNumber</code> will be output as <code>"versionNumber@quot;</code> in
|
||||
@ -205,7 +206,7 @@ public final class Gson {
|
||||
*
|
||||
* @param src the object for which JSON representation is to be created
|
||||
* @param typeOfSrc The specific genericized type of src. You can obtain
|
||||
* this type by using the {@link org.mcteam.factions.gson.reflect.TypeToken} class. For example,
|
||||
* this type by using the {@link com.massivecraft.factions.gson.reflect.TypeToken} class. For example,
|
||||
* to get the type for {@code Collection<Foo>}, you should use:
|
||||
* <pre>
|
||||
* Type typeOfSrc = new TypeToken<Collection<Foo>>(){}.getType();
|
||||
@ -248,7 +249,7 @@ public final class Gson {
|
||||
*
|
||||
* @param src the object for which JSON representation is to be created
|
||||
* @param typeOfSrc The specific genericized type of src. You can obtain
|
||||
* this type by using the {@link org.mcteam.factions.gson.reflect.TypeToken} class. For example,
|
||||
* this type by using the {@link com.massivecraft.factions.gson.reflect.TypeToken} class. For example,
|
||||
* to get the type for {@code Collection<Foo>}, you should use:
|
||||
* <pre>
|
||||
* Type typeOfSrc = new TypeToken<Collection<Foo>>(){}.getType();
|
||||
@ -290,7 +291,7 @@ public final class Gson {
|
||||
*
|
||||
* @param src the object for which JSON representation is to be created
|
||||
* @param typeOfSrc The specific genericized type of src. You can obtain
|
||||
* this type by using the {@link org.mcteam.factions.gson.reflect.TypeToken} class. For example,
|
||||
* this type by using the {@link com.massivecraft.factions.gson.reflect.TypeToken} class. For example,
|
||||
* to get the type for {@code Collection<Foo>}, you should use:
|
||||
* <pre>
|
||||
* Type typeOfSrc = new TypeToken<Collection<Foo>>(){}.getType();
|
||||
@ -399,7 +400,7 @@ public final class Gson {
|
||||
* @param <T> the type of the desired object
|
||||
* @param json the string from which the object is to be deserialized
|
||||
* @param typeOfT The specific genericized type of src. You can obtain this type by using the
|
||||
* {@link org.mcteam.factions.gson.reflect.TypeToken} class. For example, to get the type for
|
||||
* {@link com.massivecraft.factions.gson.reflect.TypeToken} class. For example, to get the type for
|
||||
* {@code Collection<Foo>}, you should use:
|
||||
* <pre>
|
||||
* Type typeOfT = new TypeToken<Collection<Foo>>(){}.getType();
|
||||
@ -452,7 +453,7 @@ public final class Gson {
|
||||
* @param <T> the type of the desired object
|
||||
* @param json the reader producing Json from which the object is to be deserialized
|
||||
* @param typeOfT The specific genericized type of src. You can obtain this type by using the
|
||||
* {@link org.mcteam.factions.gson.reflect.TypeToken} class. For example, to get the type for
|
||||
* {@link com.massivecraft.factions.gson.reflect.TypeToken} class. For example, to get the type for
|
||||
* {@code Collection<Foo>}, you should use:
|
||||
* <pre>
|
||||
* Type typeOfT = new TypeToken<Collection<Foo>>(){}.getType();
|
||||
@ -531,7 +532,7 @@ public final class Gson {
|
||||
* @param json the root of the parse tree of {@link JsonElement}s from which the object is to
|
||||
* be deserialized
|
||||
* @param typeOfT The specific genericized type of src. You can obtain this type by using the
|
||||
* {@link org.mcteam.factions.gson.reflect.TypeToken} class. For example, to get the type for
|
||||
* {@link com.massivecraft.factions.gson.reflect.TypeToken} class. For example, to get the type for
|
||||
* {@code Collection<Foo>}, you should use:
|
||||
* <pre>
|
||||
* Type typeOfT = new TypeToken<Collection<Foo>>(){}.getType();
|
@ -14,10 +14,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.mcteam.factions.gson;
|
||||
package com.massivecraft.factions.gson;
|
||||
|
||||
import org.mcteam.factions.gson.DefaultTypeAdapters.DefaultDateTypeAdapter;
|
||||
import org.mcteam.factions.gson.internal.$Gson$Preconditions;
|
||||
import com.massivecraft.factions.gson.DefaultTypeAdapters.DefaultDateTypeAdapter;
|
||||
import com.massivecraft.factions.gson.internal.$Gson$Preconditions;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.sql.Timestamp;
|
||||
@ -174,7 +174,7 @@ public final class GsonBuilder {
|
||||
|
||||
/**
|
||||
* Configures Gson to exclude all fields from consideration for serialization or deserialization
|
||||
* that do not have the {@link org.mcteam.factions.gson.annotations.Expose} annotation.
|
||||
* that do not have the {@link com.massivecraft.factions.gson.annotations.Expose} annotation.
|
||||
*
|
||||
* @return a reference to this {@code GsonBuilder} object to fulfill the "Builder" pattern
|
||||
*/
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.mcteam.factions.gson;
|
||||
package com.massivecraft.factions.gson;
|
||||
|
||||
import java.lang.reflect.Modifier;
|
||||
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.mcteam.factions.gson;
|
||||
package com.massivecraft.factions.gson;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.mcteam.factions.gson;
|
||||
package com.massivecraft.factions.gson;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.Type;
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.mcteam.factions.gson;
|
||||
package com.massivecraft.factions.gson;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
@ -14,9 +14,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.mcteam.factions.gson;
|
||||
package com.massivecraft.factions.gson;
|
||||
|
||||
import org.mcteam.factions.gson.internal.$Gson$Types;
|
||||
import com.massivecraft.factions.gson.internal.$Gson$Types;
|
||||
|
||||
import java.lang.reflect.Array;
|
||||
import java.lang.reflect.Type;
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.mcteam.factions.gson;
|
||||
package com.massivecraft.factions.gson;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
|
@ -1,89 +1,89 @@
|
||||
/*
|
||||
* Copyright (C) 2008 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.mcteam.factions.gson;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
|
||||
/**
|
||||
* implementation of a deserialization context for Gson
|
||||
*
|
||||
* @author Inderjeet Singh
|
||||
*/
|
||||
final class JsonDeserializationContextDefault implements JsonDeserializationContext {
|
||||
|
||||
private final ObjectNavigator objectNavigator;
|
||||
private final FieldNamingStrategy2 fieldNamingPolicy;
|
||||
private final ParameterizedTypeHandlerMap<JsonDeserializer<?>> deserializers;
|
||||
private final MappedObjectConstructor objectConstructor;
|
||||
|
||||
JsonDeserializationContextDefault(ObjectNavigator objectNavigator,
|
||||
FieldNamingStrategy2 fieldNamingPolicy,
|
||||
ParameterizedTypeHandlerMap<JsonDeserializer<?>> deserializers,
|
||||
MappedObjectConstructor objectConstructor) {
|
||||
this.objectNavigator = objectNavigator;
|
||||
this.fieldNamingPolicy = fieldNamingPolicy;
|
||||
this.deserializers = deserializers;
|
||||
this.objectConstructor = objectConstructor;
|
||||
}
|
||||
|
||||
ObjectConstructor getObjectConstructor() {
|
||||
return objectConstructor;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T> T deserialize(JsonElement json, Type typeOfT) throws JsonParseException {
|
||||
if (json == null || json.isJsonNull()) {
|
||||
return null;
|
||||
} else if (json.isJsonArray()) {
|
||||
return (T) fromJsonArray(typeOfT, json.getAsJsonArray(), this);
|
||||
} else if (json.isJsonObject()) {
|
||||
return (T) fromJsonObject(typeOfT, json.getAsJsonObject(), this);
|
||||
} else if (json.isJsonPrimitive()) {
|
||||
return (T) fromJsonPrimitive(typeOfT, json.getAsJsonPrimitive(), this);
|
||||
} else {
|
||||
throw new JsonParseException("Failed parsing JSON source: " + json + " to Json");
|
||||
}
|
||||
}
|
||||
|
||||
private <T> T fromJsonArray(Type arrayType, JsonArray jsonArray,
|
||||
JsonDeserializationContext context) throws JsonParseException {
|
||||
JsonArrayDeserializationVisitor<T> visitor = new JsonArrayDeserializationVisitor<T>(
|
||||
jsonArray, arrayType, objectNavigator, fieldNamingPolicy,
|
||||
objectConstructor, deserializers, context);
|
||||
objectNavigator.accept(new ObjectTypePair(null, arrayType, true), visitor);
|
||||
return visitor.getTarget();
|
||||
}
|
||||
|
||||
private <T> T fromJsonObject(Type typeOfT, JsonObject jsonObject,
|
||||
JsonDeserializationContext context) throws JsonParseException {
|
||||
JsonObjectDeserializationVisitor<T> visitor = new JsonObjectDeserializationVisitor<T>(
|
||||
jsonObject, typeOfT, objectNavigator, fieldNamingPolicy,
|
||||
objectConstructor, deserializers, context);
|
||||
objectNavigator.accept(new ObjectTypePair(null, typeOfT, true), visitor);
|
||||
return visitor.getTarget();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private <T> T fromJsonPrimitive(Type typeOfT, JsonPrimitive json,
|
||||
JsonDeserializationContext context) throws JsonParseException {
|
||||
JsonObjectDeserializationVisitor<T> visitor = new JsonObjectDeserializationVisitor<T>(
|
||||
json, typeOfT, objectNavigator, fieldNamingPolicy, objectConstructor, deserializers, context);
|
||||
objectNavigator.accept(new ObjectTypePair(json.getAsObject(), typeOfT, true), visitor);
|
||||
Object target = visitor.getTarget();
|
||||
return (T) target;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (C) 2008 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.massivecraft.factions.gson;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
|
||||
/**
|
||||
* implementation of a deserialization context for Gson
|
||||
*
|
||||
* @author Inderjeet Singh
|
||||
*/
|
||||
final class JsonDeserializationContextDefault implements JsonDeserializationContext {
|
||||
|
||||
private final ObjectNavigator objectNavigator;
|
||||
private final FieldNamingStrategy2 fieldNamingPolicy;
|
||||
private final ParameterizedTypeHandlerMap<JsonDeserializer<?>> deserializers;
|
||||
private final MappedObjectConstructor objectConstructor;
|
||||
|
||||
JsonDeserializationContextDefault(ObjectNavigator objectNavigator,
|
||||
FieldNamingStrategy2 fieldNamingPolicy,
|
||||
ParameterizedTypeHandlerMap<JsonDeserializer<?>> deserializers,
|
||||
MappedObjectConstructor objectConstructor) {
|
||||
this.objectNavigator = objectNavigator;
|
||||
this.fieldNamingPolicy = fieldNamingPolicy;
|
||||
this.deserializers = deserializers;
|
||||
this.objectConstructor = objectConstructor;
|
||||
}
|
||||
|
||||
ObjectConstructor getObjectConstructor() {
|
||||
return objectConstructor;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T> T deserialize(JsonElement json, Type typeOfT) throws JsonParseException {
|
||||
if (json == null || json.isJsonNull()) {
|
||||
return null;
|
||||
} else if (json.isJsonArray()) {
|
||||
return (T) fromJsonArray(typeOfT, json.getAsJsonArray(), this);
|
||||
} else if (json.isJsonObject()) {
|
||||
return (T) fromJsonObject(typeOfT, json.getAsJsonObject(), this);
|
||||
} else if (json.isJsonPrimitive()) {
|
||||
return (T) fromJsonPrimitive(typeOfT, json.getAsJsonPrimitive(), this);
|
||||
} else {
|
||||
throw new JsonParseException("Failed parsing JSON source: " + json + " to Json");
|
||||
}
|
||||
}
|
||||
|
||||
private <T> T fromJsonArray(Type arrayType, JsonArray jsonArray,
|
||||
JsonDeserializationContext context) throws JsonParseException {
|
||||
JsonArrayDeserializationVisitor<T> visitor = new JsonArrayDeserializationVisitor<T>(
|
||||
jsonArray, arrayType, objectNavigator, fieldNamingPolicy,
|
||||
objectConstructor, deserializers, context);
|
||||
objectNavigator.accept(new ObjectTypePair(null, arrayType, true), visitor);
|
||||
return visitor.getTarget();
|
||||
}
|
||||
|
||||
private <T> T fromJsonObject(Type typeOfT, JsonObject jsonObject,
|
||||
JsonDeserializationContext context) throws JsonParseException {
|
||||
JsonObjectDeserializationVisitor<T> visitor = new JsonObjectDeserializationVisitor<T>(
|
||||
jsonObject, typeOfT, objectNavigator, fieldNamingPolicy,
|
||||
objectConstructor, deserializers, context);
|
||||
objectNavigator.accept(new ObjectTypePair(null, typeOfT, true), visitor);
|
||||
return visitor.getTarget();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private <T> T fromJsonPrimitive(Type typeOfT, JsonPrimitive json,
|
||||
JsonDeserializationContext context) throws JsonParseException {
|
||||
JsonObjectDeserializationVisitor<T> visitor = new JsonObjectDeserializationVisitor<T>(
|
||||
json, typeOfT, objectNavigator, fieldNamingPolicy, objectConstructor, deserializers, context);
|
||||
objectNavigator.accept(new ObjectTypePair(json.getAsObject(), typeOfT, true), visitor);
|
||||
Object target = visitor.getTarget();
|
||||
return (T) target;
|
||||
}
|
||||
}
|
@ -14,9 +14,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.mcteam.factions.gson;
|
||||
package com.massivecraft.factions.gson;
|
||||
|
||||
import org.mcteam.factions.gson.internal.$Gson$Preconditions;
|
||||
import com.massivecraft.factions.gson.internal.$Gson$Preconditions;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.mcteam.factions.gson;
|
||||
package com.massivecraft.factions.gson;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
|
@ -14,9 +14,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.mcteam.factions.gson;
|
||||
package com.massivecraft.factions.gson;
|
||||
|
||||
import org.mcteam.factions.gson.internal.$Gson$Preconditions;
|
||||
import com.massivecraft.factions.gson.internal.$Gson$Preconditions;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.mcteam.factions.gson;
|
||||
package com.massivecraft.factions.gson;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
@ -1,47 +1,47 @@
|
||||
/*
|
||||
* Copyright (C) 2008 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.mcteam.factions.gson;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Definition of a visitor for a JsonElement tree.
|
||||
*
|
||||
* @author Inderjeet Singh
|
||||
*/
|
||||
interface JsonElementVisitor {
|
||||
void visitPrimitive(JsonPrimitive primitive) throws IOException;
|
||||
void visitNull() throws IOException;
|
||||
|
||||
void startArray(JsonArray array) throws IOException;
|
||||
void visitArrayMember(JsonArray parent, JsonPrimitive member, boolean isFirst) throws IOException;
|
||||
void visitArrayMember(JsonArray parent, JsonArray member, boolean isFirst) throws IOException;
|
||||
void visitArrayMember(JsonArray parent, JsonObject member, boolean isFirst) throws IOException;
|
||||
void visitNullArrayMember(JsonArray parent, boolean isFirst) throws IOException;
|
||||
void endArray(JsonArray array) throws IOException;
|
||||
|
||||
void startObject(JsonObject object) throws IOException;
|
||||
void visitObjectMember(JsonObject parent, String memberName, JsonPrimitive member,
|
||||
boolean isFirst) throws IOException;
|
||||
void visitObjectMember(JsonObject parent, String memberName, JsonArray member,
|
||||
boolean isFirst) throws IOException;
|
||||
void visitObjectMember(JsonObject parent, String memberName, JsonObject member,
|
||||
boolean isFirst) throws IOException;
|
||||
void visitNullObjectMember(JsonObject parent, String memberName,
|
||||
boolean isFirst) throws IOException;
|
||||
void endObject(JsonObject object) throws IOException;
|
||||
/*
|
||||
* Copyright (C) 2008 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.massivecraft.factions.gson;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Definition of a visitor for a JsonElement tree.
|
||||
*
|
||||
* @author Inderjeet Singh
|
||||
*/
|
||||
interface JsonElementVisitor {
|
||||
void visitPrimitive(JsonPrimitive primitive) throws IOException;
|
||||
void visitNull() throws IOException;
|
||||
|
||||
void startArray(JsonArray array) throws IOException;
|
||||
void visitArrayMember(JsonArray parent, JsonPrimitive member, boolean isFirst) throws IOException;
|
||||
void visitArrayMember(JsonArray parent, JsonArray member, boolean isFirst) throws IOException;
|
||||
void visitArrayMember(JsonArray parent, JsonObject member, boolean isFirst) throws IOException;
|
||||
void visitNullArrayMember(JsonArray parent, boolean isFirst) throws IOException;
|
||||
void endArray(JsonArray array) throws IOException;
|
||||
|
||||
void startObject(JsonObject object) throws IOException;
|
||||
void visitObjectMember(JsonObject parent, String memberName, JsonPrimitive member,
|
||||
boolean isFirst) throws IOException;
|
||||
void visitObjectMember(JsonObject parent, String memberName, JsonArray member,
|
||||
boolean isFirst) throws IOException;
|
||||
void visitObjectMember(JsonObject parent, String memberName, JsonObject member,
|
||||
boolean isFirst) throws IOException;
|
||||
void visitNullObjectMember(JsonObject parent, String memberName,
|
||||
boolean isFirst) throws IOException;
|
||||
void endObject(JsonObject object) throws IOException;
|
||||
}
|
@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.mcteam.factions.gson;
|
||||
package com.massivecraft.factions.gson;
|
||||
|
||||
/**
|
||||
* This exception is raised when Gson was unable to read an input stream
|
@ -1,72 +1,72 @@
|
||||
/*
|
||||
* Copyright (C) 2008 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.mcteam.factions.gson;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* A class representing a Json {@code null} value.
|
||||
*
|
||||
* @author Inderjeet Singh
|
||||
* @author Joel Leitch
|
||||
* @since 1.2
|
||||
*/
|
||||
public final class JsonNull extends JsonElement {
|
||||
private static final JsonNull INSTANCE = new JsonNull();
|
||||
|
||||
/**
|
||||
* Creates a new JsonNull object.
|
||||
*/
|
||||
public JsonNull() {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void toString(Appendable sb, Escaper escaper) throws IOException {
|
||||
sb.append("null");
|
||||
}
|
||||
|
||||
/**
|
||||
* All instances of JsonNull have the same hash code since they are indistinguishable
|
||||
*/
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return JsonNull.class.hashCode();
|
||||
}
|
||||
|
||||
/**
|
||||
* All instances of JsonNull are the same
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
return this == other || other instanceof JsonNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creation method used to return an instance of a {@link JsonNull}. To reduce the memory
|
||||
* footprint, a single object has been created for this class; therefore the same instance is
|
||||
* being returned for each invocation of this method. This method is kept private since we
|
||||
* prefer the users to use {@link JsonNull#JsonNull()} which is similar to how other JsonElements
|
||||
* are created. Note that all instances of JsonNull return true for {@link #equals(Object)}
|
||||
* when compared to each other.
|
||||
*
|
||||
* @return a instance of a {@link JsonNull}
|
||||
*/
|
||||
static JsonNull createJsonNull() {
|
||||
return INSTANCE;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (C) 2008 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.massivecraft.factions.gson;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* A class representing a Json {@code null} value.
|
||||
*
|
||||
* @author Inderjeet Singh
|
||||
* @author Joel Leitch
|
||||
* @since 1.2
|
||||
*/
|
||||
public final class JsonNull extends JsonElement {
|
||||
private static final JsonNull INSTANCE = new JsonNull();
|
||||
|
||||
/**
|
||||
* Creates a new JsonNull object.
|
||||
*/
|
||||
public JsonNull() {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void toString(Appendable sb, Escaper escaper) throws IOException {
|
||||
sb.append("null");
|
||||
}
|
||||
|
||||
/**
|
||||
* All instances of JsonNull have the same hash code since they are indistinguishable
|
||||
*/
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return JsonNull.class.hashCode();
|
||||
}
|
||||
|
||||
/**
|
||||
* All instances of JsonNull are the same
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
return this == other || other instanceof JsonNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creation method used to return an instance of a {@link JsonNull}. To reduce the memory
|
||||
* footprint, a single object has been created for this class; therefore the same instance is
|
||||
* being returned for each invocation of this method. This method is kept private since we
|
||||
* prefer the users to use {@link JsonNull#JsonNull()} which is similar to how other JsonElements
|
||||
* are created. Note that all instances of JsonNull return true for {@link #equals(Object)}
|
||||
* when compared to each other.
|
||||
*
|
||||
* @return a instance of a {@link JsonNull}
|
||||
*/
|
||||
static JsonNull createJsonNull() {
|
||||
return INSTANCE;
|
||||
}
|
||||
}
|
@ -14,9 +14,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.mcteam.factions.gson;
|
||||
package com.massivecraft.factions.gson;
|
||||
|
||||
import org.mcteam.factions.gson.internal.$Gson$Preconditions;
|
||||
import com.massivecraft.factions.gson.internal.$Gson$Preconditions;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.LinkedHashMap;
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.mcteam.factions.gson;
|
||||
package com.massivecraft.factions.gson;
|
||||
|
||||
|
||||
import java.lang.reflect.Type;
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.mcteam.factions.gson;
|
||||
package com.massivecraft.factions.gson;
|
||||
|
||||
/**
|
||||
* This exception is raised if there is a serious issue that occurs during parsing of a Json
|
@ -1,97 +1,98 @@
|
||||
/*
|
||||
* Copyright (C) 2009 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.mcteam.factions.gson;
|
||||
|
||||
import org.mcteam.factions.gson.stream.JsonReader;
|
||||
import org.mcteam.factions.gson.stream.JsonToken;
|
||||
import org.mcteam.factions.gson.stream.MalformedJsonException;
|
||||
import java.io.EOFException;
|
||||
import java.io.IOException;
|
||||
import java.io.Reader;
|
||||
import java.io.StringReader;
|
||||
|
||||
/**
|
||||
* A parser to parse Json into a parse tree of {@link JsonElement}s
|
||||
*
|
||||
* @author Inderjeet Singh
|
||||
* @author Joel Leitch
|
||||
* @since 1.3
|
||||
*/
|
||||
public final class JsonParser {
|
||||
|
||||
/**
|
||||
* Parses the specified JSON string into a parse tree
|
||||
*
|
||||
* @param json JSON text
|
||||
* @return a parse tree of {@link JsonElement}s corresponding to the specified JSON
|
||||
* @throws JsonParseException if the specified text is not valid JSON
|
||||
* @since 1.3
|
||||
*/
|
||||
public JsonElement parse(String json) throws JsonSyntaxException {
|
||||
return parse(new StringReader(json));
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the specified JSON string into a parse tree
|
||||
*
|
||||
* @param json JSON text
|
||||
* @return a parse tree of {@link JsonElement}s corresponding to the specified JSON
|
||||
* @throws JsonParseException if the specified text is not valid JSON
|
||||
* @since 1.3
|
||||
*/
|
||||
public JsonElement parse(Reader json) throws JsonIOException, JsonSyntaxException {
|
||||
try {
|
||||
JsonReader jsonReader = new JsonReader(json);
|
||||
JsonElement element = parse(jsonReader);
|
||||
if (!element.isJsonNull() && jsonReader.peek() != JsonToken.END_DOCUMENT) {
|
||||
throw new JsonSyntaxException("Did not consume the entire document.");
|
||||
}
|
||||
return element;
|
||||
} catch (MalformedJsonException e) {
|
||||
throw new JsonSyntaxException(e);
|
||||
} catch (IOException e) {
|
||||
throw new JsonIOException(e);
|
||||
} catch (NumberFormatException e) {
|
||||
throw new JsonSyntaxException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the next value from the JSON stream as a parse tree.
|
||||
*
|
||||
* @throws JsonParseException if there is an IOException or if the specified
|
||||
* text is not valid JSON
|
||||
* @since 1.6
|
||||
*/
|
||||
public JsonElement parse(JsonReader json) throws JsonIOException, JsonSyntaxException {
|
||||
boolean lenient = json.isLenient();
|
||||
json.setLenient(true);
|
||||
try {
|
||||
return Streams.parse(json);
|
||||
} catch (StackOverflowError e) {
|
||||
throw new JsonParseException("Failed parsing JSON source: " + json + " to Json", e);
|
||||
} catch (OutOfMemoryError e) {
|
||||
throw new JsonParseException("Failed parsing JSON source: " + json + " to Json", e);
|
||||
} catch (JsonParseException e) {
|
||||
if (e.getCause() instanceof EOFException) {
|
||||
return JsonNull.createJsonNull();
|
||||
}
|
||||
throw e;
|
||||
} finally {
|
||||
json.setLenient(lenient);
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (C) 2009 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.massivecraft.factions.gson;
|
||||
|
||||
import com.massivecraft.factions.gson.stream.JsonReader;
|
||||
import com.massivecraft.factions.gson.stream.JsonToken;
|
||||
import com.massivecraft.factions.gson.stream.MalformedJsonException;
|
||||
|
||||
import java.io.EOFException;
|
||||
import java.io.IOException;
|
||||
import java.io.Reader;
|
||||
import java.io.StringReader;
|
||||
|
||||
/**
|
||||
* A parser to parse Json into a parse tree of {@link JsonElement}s
|
||||
*
|
||||
* @author Inderjeet Singh
|
||||
* @author Joel Leitch
|
||||
* @since 1.3
|
||||
*/
|
||||
public final class JsonParser {
|
||||
|
||||
/**
|
||||
* Parses the specified JSON string into a parse tree
|
||||
*
|
||||
* @param json JSON text
|
||||
* @return a parse tree of {@link JsonElement}s corresponding to the specified JSON
|
||||
* @throws JsonParseException if the specified text is not valid JSON
|
||||
* @since 1.3
|
||||
*/
|
||||
public JsonElement parse(String json) throws JsonSyntaxException {
|
||||
return parse(new StringReader(json));
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the specified JSON string into a parse tree
|
||||
*
|
||||
* @param json JSON text
|
||||
* @return a parse tree of {@link JsonElement}s corresponding to the specified JSON
|
||||
* @throws JsonParseException if the specified text is not valid JSON
|
||||
* @since 1.3
|
||||
*/
|
||||
public JsonElement parse(Reader json) throws JsonIOException, JsonSyntaxException {
|
||||
try {
|
||||
JsonReader jsonReader = new JsonReader(json);
|
||||
JsonElement element = parse(jsonReader);
|
||||
if (!element.isJsonNull() && jsonReader.peek() != JsonToken.END_DOCUMENT) {
|
||||
throw new JsonSyntaxException("Did not consume the entire document.");
|
||||
}
|
||||
return element;
|
||||
} catch (MalformedJsonException e) {
|
||||
throw new JsonSyntaxException(e);
|
||||
} catch (IOException e) {
|
||||
throw new JsonIOException(e);
|
||||
} catch (NumberFormatException e) {
|
||||
throw new JsonSyntaxException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the next value from the JSON stream as a parse tree.
|
||||
*
|
||||
* @throws JsonParseException if there is an IOException or if the specified
|
||||
* text is not valid JSON
|
||||
* @since 1.6
|
||||
*/
|
||||
public JsonElement parse(JsonReader json) throws JsonIOException, JsonSyntaxException {
|
||||
boolean lenient = json.isLenient();
|
||||
json.setLenient(true);
|
||||
try {
|
||||
return Streams.parse(json);
|
||||
} catch (StackOverflowError e) {
|
||||
throw new JsonParseException("Failed parsing JSON source: " + json + " to Json", e);
|
||||
} catch (OutOfMemoryError e) {
|
||||
throw new JsonParseException("Failed parsing JSON source: " + json + " to Json", e);
|
||||
} catch (JsonParseException e) {
|
||||
if (e.getCause() instanceof EOFException) {
|
||||
return JsonNull.createJsonNull();
|
||||
}
|
||||
throw e;
|
||||
} finally {
|
||||
json.setLenient(lenient);
|
||||
}
|
||||
}
|
||||
}
|
@ -14,9 +14,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.mcteam.factions.gson;
|
||||
package com.massivecraft.factions.gson;
|
||||
|
||||
import org.mcteam.factions.gson.internal.$Gson$Preconditions;
|
||||
import com.massivecraft.factions.gson.internal.$Gson$Preconditions;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.mcteam.factions.gson;
|
||||
package com.massivecraft.factions.gson;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
|
@ -1,65 +1,65 @@
|
||||
/*
|
||||
* Copyright (C) 2008 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.mcteam.factions.gson;
|
||||
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
|
||||
/**
|
||||
* An implementation of serialization context for Gson.
|
||||
*
|
||||
* @author Inderjeet Singh
|
||||
*/
|
||||
final class JsonSerializationContextDefault implements JsonSerializationContext {
|
||||
|
||||
private final ObjectNavigator objectNavigator;
|
||||
private final FieldNamingStrategy2 fieldNamingPolicy;
|
||||
private final ParameterizedTypeHandlerMap<JsonSerializer<?>> serializers;
|
||||
private final boolean serializeNulls;
|
||||
private final MemoryRefStack ancestors;
|
||||
|
||||
JsonSerializationContextDefault(ObjectNavigator objectNavigator,
|
||||
FieldNamingStrategy2 fieldNamingPolicy, boolean serializeNulls,
|
||||
ParameterizedTypeHandlerMap<JsonSerializer<?>> serializers) {
|
||||
this.objectNavigator = objectNavigator;
|
||||
this.fieldNamingPolicy = fieldNamingPolicy;
|
||||
this.serializeNulls = serializeNulls;
|
||||
this.serializers = serializers;
|
||||
this.ancestors = new MemoryRefStack();
|
||||
}
|
||||
|
||||
public JsonElement serialize(Object src) {
|
||||
if (src == null) {
|
||||
return JsonNull.createJsonNull();
|
||||
}
|
||||
return serialize(src, src.getClass(), false);
|
||||
}
|
||||
|
||||
public JsonElement serialize(Object src, Type typeOfSrc) {
|
||||
return serialize(src, typeOfSrc, true);
|
||||
}
|
||||
|
||||
JsonElement serialize(Object src, Type typeOfSrc, boolean preserveType) {
|
||||
if (src == null) {
|
||||
return JsonNull.createJsonNull();
|
||||
}
|
||||
JsonSerializationVisitor visitor = new JsonSerializationVisitor(
|
||||
objectNavigator, fieldNamingPolicy, serializeNulls, serializers, this, ancestors);
|
||||
objectNavigator.accept(new ObjectTypePair(src, typeOfSrc, preserveType), visitor);
|
||||
return visitor.getJsonElement();
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (C) 2008 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.massivecraft.factions.gson;
|
||||
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
|
||||
/**
|
||||
* An implementation of serialization context for Gson.
|
||||
*
|
||||
* @author Inderjeet Singh
|
||||
*/
|
||||
final class JsonSerializationContextDefault implements JsonSerializationContext {
|
||||
|
||||
private final ObjectNavigator objectNavigator;
|
||||
private final FieldNamingStrategy2 fieldNamingPolicy;
|
||||
private final ParameterizedTypeHandlerMap<JsonSerializer<?>> serializers;
|
||||
private final boolean serializeNulls;
|
||||
private final MemoryRefStack ancestors;
|
||||
|
||||
JsonSerializationContextDefault(ObjectNavigator objectNavigator,
|
||||
FieldNamingStrategy2 fieldNamingPolicy, boolean serializeNulls,
|
||||
ParameterizedTypeHandlerMap<JsonSerializer<?>> serializers) {
|
||||
this.objectNavigator = objectNavigator;
|
||||
this.fieldNamingPolicy = fieldNamingPolicy;
|
||||
this.serializeNulls = serializeNulls;
|
||||
this.serializers = serializers;
|
||||
this.ancestors = new MemoryRefStack();
|
||||
}
|
||||
|
||||
public JsonElement serialize(Object src) {
|
||||
if (src == null) {
|
||||
return JsonNull.createJsonNull();
|
||||
}
|
||||
return serialize(src, src.getClass(), false);
|
||||
}
|
||||
|
||||
public JsonElement serialize(Object src, Type typeOfSrc) {
|
||||
return serialize(src, typeOfSrc, true);
|
||||
}
|
||||
|
||||
JsonElement serialize(Object src, Type typeOfSrc, boolean preserveType) {
|
||||
if (src == null) {
|
||||
return JsonNull.createJsonNull();
|
||||
}
|
||||
JsonSerializationVisitor visitor = new JsonSerializationVisitor(
|
||||
objectNavigator, fieldNamingPolicy, serializeNulls, serializers, this, ancestors);
|
||||
objectNavigator.accept(new ObjectTypePair(src, typeOfSrc, preserveType), visitor);
|
||||
return visitor.getJsonElement();
|
||||
}
|
||||
}
|
@ -14,10 +14,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.mcteam.factions.gson;
|
||||
package com.massivecraft.factions.gson;
|
||||
|
||||
import org.mcteam.factions.gson.internal.$Gson$Types;
|
||||
import org.mcteam.factions.gson.internal.$Gson$Preconditions;
|
||||
import com.massivecraft.factions.gson.internal.$Gson$Preconditions;
|
||||
import com.massivecraft.factions.gson.internal.$Gson$Types;
|
||||
|
||||
import java.lang.reflect.Array;
|
||||
import java.lang.reflect.Type;
|
@ -14,14 +14,14 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.mcteam.factions.gson;
|
||||
package com.massivecraft.factions.gson;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
|
||||
/**
|
||||
* Interface representing a custom serializer for Json. You should write a custom serializer, if
|
||||
* you are not happy with the default serialization done by Gson. You will also need to register
|
||||
* this serializer through {@link org.mcteam.factions.gson.GsonBuilder#registerTypeAdapter(Type, Object)}.
|
||||
* this serializer through {@link com.massivecraft.factions.gson.GsonBuilder#registerTypeAdapter(Type, Object)}.
|
||||
*
|
||||
* <p>Let us look at example where defining a serializer will be useful. The {@code Id} class
|
||||
* defined below has two fields: {@code clazz} and {@code value}.</p>
|
@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.mcteam.factions.gson;
|
||||
package com.massivecraft.factions.gson;
|
||||
|
||||
import java.io.EOFException;
|
||||
import java.io.IOException;
|
||||
@ -22,9 +22,9 @@ import java.io.StringReader;
|
||||
import java.util.Iterator;
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
import org.mcteam.factions.gson.stream.JsonReader;
|
||||
import org.mcteam.factions.gson.stream.JsonToken;
|
||||
import org.mcteam.factions.gson.stream.MalformedJsonException;
|
||||
import com.massivecraft.factions.gson.stream.JsonReader;
|
||||
import com.massivecraft.factions.gson.stream.JsonToken;
|
||||
import com.massivecraft.factions.gson.stream.MalformedJsonException;
|
||||
|
||||
/**
|
||||
* A streaming parser that allows reading of multiple {@link JsonElement}s from the specified reader
|
@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.mcteam.factions.gson;
|
||||
package com.massivecraft.factions.gson;
|
||||
|
||||
/**
|
||||
* This exception is raised when Gson attempts to read (or write) a malformed
|
@ -1,111 +1,111 @@
|
||||
/*
|
||||
* Copyright (C) 2008 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.mcteam.factions.gson;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* A navigator to navigate a tree of JsonElement nodes in Depth-first order
|
||||
*
|
||||
* @author Inderjeet Singh
|
||||
*/
|
||||
final class JsonTreeNavigator {
|
||||
private final JsonElementVisitor visitor;
|
||||
private final boolean visitNulls;
|
||||
|
||||
JsonTreeNavigator(JsonElementVisitor visitor, boolean visitNulls) {
|
||||
this.visitor = visitor;
|
||||
this.visitNulls = visitNulls;
|
||||
}
|
||||
|
||||
public void navigate(JsonElement element) throws IOException {
|
||||
if (element.isJsonNull()) {
|
||||
visitor.visitNull();
|
||||
} else if (element.isJsonArray()) {
|
||||
JsonArray array = element.getAsJsonArray();
|
||||
visitor.startArray(array);
|
||||
boolean isFirst = true;
|
||||
for (JsonElement child : array) {
|
||||
visitChild(array, child, isFirst);
|
||||
if (isFirst) {
|
||||
isFirst = false;
|
||||
}
|
||||
}
|
||||
visitor.endArray(array);
|
||||
} else if (element.isJsonObject()) {
|
||||
JsonObject object = element.getAsJsonObject();
|
||||
visitor.startObject(object);
|
||||
boolean isFirst = true;
|
||||
for (Map.Entry<String, JsonElement> member : object.entrySet()) {
|
||||
boolean visited = visitChild(object, member.getKey(), member.getValue(), isFirst);
|
||||
if (visited && isFirst) {
|
||||
isFirst = false;
|
||||
}
|
||||
}
|
||||
visitor.endObject(object);
|
||||
} else { // must be JsonPrimitive
|
||||
visitor.visitPrimitive(element.getAsJsonPrimitive());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the child was visited, false if it was skipped.
|
||||
*/
|
||||
private boolean visitChild(JsonObject parent, String childName, JsonElement child,
|
||||
boolean isFirst) throws IOException {
|
||||
if (child.isJsonNull()) {
|
||||
if (visitNulls) {
|
||||
visitor.visitNullObjectMember(parent, childName, isFirst);
|
||||
navigate(child.getAsJsonNull());
|
||||
} else { // Null value is being skipped.
|
||||
return false;
|
||||
}
|
||||
} else if (child.isJsonArray()) {
|
||||
JsonArray childAsArray = child.getAsJsonArray();
|
||||
visitor.visitObjectMember(parent, childName, childAsArray, isFirst);
|
||||
navigate(childAsArray);
|
||||
} else if (child.isJsonObject()) {
|
||||
JsonObject childAsObject = child.getAsJsonObject();
|
||||
visitor.visitObjectMember(parent, childName, childAsObject, isFirst);
|
||||
navigate(childAsObject);
|
||||
} else { // is a JsonPrimitive
|
||||
visitor.visitObjectMember(parent, childName, child.getAsJsonPrimitive(), isFirst);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the child was visited, false if it was skipped.
|
||||
*/
|
||||
private void visitChild(JsonArray parent, JsonElement child, boolean isFirst) throws IOException {
|
||||
if (child.isJsonNull()) {
|
||||
visitor.visitNullArrayMember(parent, isFirst);
|
||||
navigate(child);
|
||||
} else if (child.isJsonArray()) {
|
||||
JsonArray childAsArray = child.getAsJsonArray();
|
||||
visitor.visitArrayMember(parent, childAsArray, isFirst);
|
||||
navigate(childAsArray);
|
||||
} else if (child.isJsonObject()) {
|
||||
JsonObject childAsObject = child.getAsJsonObject();
|
||||
visitor.visitArrayMember(parent, childAsObject, isFirst);
|
||||
navigate(childAsObject);
|
||||
} else { // is a JsonPrimitive
|
||||
visitor.visitArrayMember(parent, child.getAsJsonPrimitive(), isFirst);
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (C) 2008 Google Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.massivecraft.factions.gson;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* A navigator to navigate a tree of JsonElement nodes in Depth-first order
|
||||
*
|
||||
* @author Inderjeet Singh
|
||||
*/
|
||||
final class JsonTreeNavigator {
|
||||
private final JsonElementVisitor visitor;
|
||||
private final boolean visitNulls;
|
||||
|
||||
JsonTreeNavigator(JsonElementVisitor visitor, boolean visitNulls) {
|
||||
this.visitor = visitor;
|
||||
this.visitNulls = visitNulls;
|
||||
}
|
||||
|
||||
public void navigate(JsonElement element) throws IOException {
|
||||
if (element.isJsonNull()) {
|
||||
visitor.visitNull();
|
||||
} else if (element.isJsonArray()) {
|
||||
JsonArray array = element.getAsJsonArray();
|
||||
visitor.startArray(array);
|
||||
boolean isFirst = true;
|
||||
for (JsonElement child : array) {
|
||||
visitChild(array, child, isFirst);
|
||||
if (isFirst) {
|
||||
isFirst = false;
|
||||
}
|
||||
}
|
||||
visitor.endArray(array);
|
||||
} else if (element.isJsonObject()) {
|
||||
JsonObject object = element.getAsJsonObject();
|
||||
visitor.startObject(object);
|
||||
boolean isFirst = true;
|
||||
for (Map.Entry<String, JsonElement> member : object.entrySet()) {
|
||||
boolean visited = visitChild(object, member.getKey(), member.getValue(), isFirst);
|
||||
if (visited && isFirst) {
|
||||
isFirst = false;
|
||||
}
|
||||
}
|
||||
visitor.endObject(object);
|
||||
} else { // must be JsonPrimitive
|
||||
visitor.visitPrimitive(element.getAsJsonPrimitive());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the child was visited, false if it was skipped.
|
||||
*/
|
||||
private boolean visitChild(JsonObject parent, String childName, JsonElement child,
|
||||
boolean isFirst) throws IOException {
|
||||
if (child.isJsonNull()) {
|
||||
if (visitNulls) {
|
||||
visitor.visitNullObjectMember(parent, childName, isFirst);
|
||||
navigate(child.getAsJsonNull());
|
||||
} else { // Null value is being skipped.
|
||||
return false;
|
||||
}
|
||||
} else if (child.isJsonArray()) {
|
||||
JsonArray childAsArray = child.getAsJsonArray();
|
||||
visitor.visitObjectMember(parent, childName, childAsArray, isFirst);
|
||||
navigate(childAsArray);
|
||||
} else if (child.isJsonObject()) {
|
||||
JsonObject childAsObject = child.getAsJsonObject();
|
||||
visitor.visitObjectMember(parent, childName, childAsObject, isFirst);
|
||||
navigate(childAsObject);
|
||||
} else { // is a JsonPrimitive
|
||||
visitor.visitObjectMember(parent, childName, child.getAsJsonPrimitive(), isFirst);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the child was visited, false if it was skipped.
|
||||
*/
|
||||
private void visitChild(JsonArray parent, JsonElement child, boolean isFirst) throws IOException {
|
||||
if (child.isJsonNull()) {
|
||||
visitor.visitNullArrayMember(parent, isFirst);
|
||||
navigate(child);
|
||||
} else if (child.isJsonArray()) {
|
||||
JsonArray childAsArray = child.getAsJsonArray();
|
||||
visitor.visitArrayMember(parent, childAsArray, isFirst);
|
||||
navigate(childAsArray);
|
||||
} else if (child.isJsonObject()) {
|
||||
JsonObject childAsObject = child.getAsJsonObject();
|
||||
visitor.visitArrayMember(parent, childAsObject, isFirst);
|
||||
navigate(childAsObject);
|
||||
} else { // is a JsonPrimitive
|
||||
visitor.visitArrayMember(parent, child.getAsJsonPrimitive(), isFirst);
|
||||
}
|
||||
}
|
||||
}
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.mcteam.factions.gson;
|
||||
package com.massivecraft.factions.gson;
|
||||
|
||||
/**
|
||||
* Defines the expected format for a {@code long} or {@code Long} type when its serialized.
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.mcteam.factions.gson;
|
||||
package com.massivecraft.factions.gson;
|
||||
|
||||
/**
|
||||
* A {@link FieldNamingStrategy2} that ensures the JSON field names consist of only
|
@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.mcteam.factions.gson;
|
||||
package com.massivecraft.factions.gson;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.Type;
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user